2009-06-25 Kai Tietz <kai.tietz@onevision.com>
[binutils.git] / gold / target.cc
blobb6844d0ac32b5a2aa97b1b53840b704096fcb5bc
1 // target.cc
3 // Copyright 2009 Free Software Foundation, Inc.
4 // Written by Doug Kwan <dougkwan@google.com>.
6 // This file is part of gold.
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.
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.
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.
23 #include "gold.h"
24 #include "target.h"
26 namespace gold
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().
34 bool
35 Target::do_is_local_label_name (const char* name) const
37 // Normal local symbols start with ``.L''.
38 if (name[0] == '.' && name[1] == 'L')
39 return true;
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;
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;
55 return false;
58 } // End namespace gold.