* config/obj-elf.c (obj_elf_type): Add code to support a type of

gnu_unique_object.
        * doc/as.texinfo: Document new feature of .type directive.
        * NEWS: Mention support for gnu_unique_object symbol type.

        * common.h (STB_GNU_UNIQUE): Define.

        * NEWS: Mention the linker's support for symbols with a binding of
        STB_GNU_UNIQUE.

        * gas/elf/type.s: Add unique global symbol definition.
        * gas/elf/type.e: Add expected readelf output for global unique
        symbol.

        * elfcpp.h (enum STB): Add STB_GNU_UNIQUE.

        * readelf.c (get_symbol_binding): For Linux targeted files return
        UNIQUE for symbols with the STB_GNU_UNIQUE binding.
        * doc/binutils.texi: Document the meaning of the 'u' symbol
        binding in the output of nm and objdump --syms.

        * elf-bfd.h (struct elf_link_hash_entry): Add unique_global field.
        * elf.c (swap_out_syms): Set binding to STB_GNU_UNIQUE for symbols
        with the BSF_GNU_UNIQUE flag bit set.
        * elfcode.h (elf_slurp_symbol_table): Set the BSF_GNU_UNIQUE flag
        for symbols with STB_GNU_UNIQUE binding.
        * elflink.c (_bfd_elf_merge_symbol): Set unique_global for symbols
        with the STB_GNU_UNIQUE binding.
        (elf_link_add_object_symbols): Set the BSF_GNU_UNIQUE flag for
        symbols with STB_GNU_UNIQUE binding.  Set STB_GNU_UNIQUE for
        symbols with the unique_global field set.
        (elf_link_output_extsym): Set unique_global field for symbols with
        the STB_GNU_UNIQUE binding.
        * syms.c (struct bfd_symbol): Define BSF_GNU_UNIQUE flag bit.
        (bfd_print_symbol_vandf): Print a 'u' character for BSF_GNU_UNIQUE
        symbols.
        (bfd_decode_symclass): Return a 'u' character for BSF_GNU_UNIQUE
        symbols.
        * bfd-in2.h: Regenerate.
This commit is contained in:
Nick Clifton
2009-07-23 13:00:30 +00:00
parent 6ec8e7022b
commit 3e7a7d11f1
23 changed files with 167 additions and 18 deletions

View File

@@ -1,3 +1,10 @@
2009-07-23 Ulrich Drepper <drepper@redhat.com>
* readelf.c (get_symbol_binding): For Linux targeted files return
UNIQUE for symbols with the STB_GNU_UNIQUE binding.
* doc/binutils.texi: Document the meaning of the 'u' symbol
binding in the output of nm and objdump --syms.
2009-07-20 H.J. Lu <hongjiu.lu@intel.com>
* NEWS: Mention --insn-width.

View File

@@ -745,7 +745,13 @@ object file formats permit more efficient access to small data objects,
such as a global int variable as opposed to a large global array.
@item i
The symbol is in a section specific to the implementation of DLLs.
For PE format files this indicates that the symbol is in a section
specific to the implementation of DLLs. For ELF format files this
indicates that the symbol is an indirect function. This is a GNU
extension to the standard set of ELF symbol types. It indicates a
symbol which if referenced by a relocation does not evaluate to its
address, but instead must be invoked at runtime. The runtime
execution will then return the value to be used in the relocation.
@item N
The symbol is a debugging symbol.
@@ -768,6 +774,12 @@ The symbol is in the text (code) section.
@item U
The symbol is undefined.
@item u
The symbol is a unique global symbol. This is a GNU extension to the
standard set of ELF symbol bindings. For such a symbol the dynamic linker
will make sure that in the entire process there is just one symbol with
this name and type in use.
@item V
@itemx v
The symbol is a weak object. When a weak defined symbol is linked with
@@ -2142,11 +2154,16 @@ The flag characters are divided into 7 groups as follows:
@table @code
@item l
@itemx g
@itemx u
@itemx !
The symbol is local (l), global (g), neither (a space) or both (!). A
The symbol is a local (l), global (g), unique global (u), neither
global nor local (a space) or both global and local (!). A
symbol can be neither local or global for a variety of reasons, e.g.,
because it is used for debugging, but it is probably an indication of
a bug if it is ever both local and global.
a bug if it is ever both local and global. Unique global symbols are
a GNU extension to the standard set of ELF symbol bindings. For such
a symbol the dynamic linker will make sure that in the entire process
there is just one symbol with this name and type in use.
@item w
The symbol is weak (w) or strong (a space).

View File

@@ -6902,7 +6902,14 @@ get_symbol_binding (unsigned int binding)
snprintf (buff, sizeof (buff), _("<processor specific>: %d"),
binding);
else if (binding >= STB_LOOS && binding <= STB_HIOS)
snprintf (buff, sizeof (buff), _("<OS specific>: %d"), binding);
{
if (binding == STB_GNU_UNIQUE
&& (elf_header.e_ident[EI_OSABI] == ELFOSABI_LINUX
/* GNU/Linux is still using the default value 0. */
|| elf_header.e_ident[EI_OSABI] == ELFOSABI_NONE))
return "UNIQUE";
snprintf (buff, sizeof (buff), _("<OS specific>: %d"), binding);
}
else
snprintf (buff, sizeof (buff), _("<unknown>: %d"), binding);
return buff;