2009-06-05 Doug Kwan <dougkwan@google.com>
[deliverable/binutils-gdb.git] / gold / target.cc
CommitLineData
bb04269c
DK
1// target.cc
2
3// Copyright 2009 Free Software Foundation, Inc.
4// Written by Doug Kwan <dougkwan@google.com>.
5
6// This file is part of gold.
7
8// This program is free software; you can redistribute it and/or modify
9// it under the terms of the GNU General Public License as published by
10// the Free Software Foundation; either version 3 of the License, or
11// (at your option) any later version.
12
13// This program is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16// GNU General Public License for more details.
17
18// You should have received a copy of the GNU General Public License
19// along with this program; if not, write to the Free Software
20// Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
21// MA 02110-1301, USA.
22
23#include "gold.h"
24#include "target.h"
25
26namespace gold
27{
28
29// Return whether NAME is a local label name. This is used to implement the
30// --discard-locals options and can be overriden by children classes to
31// implement system-specific behaviour. The logic here is the same as that
32// in _bfd_elf_is_local_label_name().
33
34bool
35Target::do_is_local_label_name (const char* name) const
36{
37 // Normal local symbols start with ``.L''.
38 if (name[0] == '.' && name[1] == 'L')
39 return true;
40
41 // At least some SVR4 compilers (e.g., UnixWare 2.1 cc) generate
42 // DWARF debugging symbols starting with ``..''.
43 if (name[0] == '.' && name[1] == '.')
44 return true;
45
46 // gcc will sometimes generate symbols beginning with ``_.L_'' when
47 // emitting DWARF debugging output. I suspect this is actually a
48 // small bug in gcc (it calls ASM_OUTPUT_LABEL when it should call
49 // ASM_GENERATE_INTERNAL_LABEL, and this causes the leading
50 // underscore to be emitted on some ELF targets). For ease of use,
51 // we treat such symbols as local.
52 if (name[0] == '_' && name[1] == '.' && name[2] == 'L' && name[3] == '_')
53 return true;
54
55 return false;
56}
57
58} // End namespace gold.
This page took 0.025937 seconds and 4 git commands to generate.