Properly merge hidden versioned symbol
authorH.J. Lu <hjl.tools@gmail.com>
Fri, 7 Aug 2015 12:04:21 +0000 (05:04 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Fri, 7 Aug 2015 12:04:35 +0000 (05:04 -0700)
commit6e33951edcbed1fd803beabcde2af3b252b92164
treec7a0d6fc3c3d61e67ddbfa8a7afd8b76c619b735
parent060967202b8def804d9afccad343d2eaef8a81cf
Properly merge hidden versioned symbol

The hidden versioned symbol can only be merged with the versioned
symbol with the same symbol version.  _bfd_elf_merge_symbol should
check the symbol version before merging the new hidden versioned
symbol with the existing symbol.  _bfd_elf_link_hash_copy_indirect can't
copy any references to the hidden versioned symbol.   We need to
bind a symbol locally when linking executable if it is locally defined,
hidden versioned, not referenced by shared library and not exported.

bfd/

PR ld/18720
* elflink.c (_bfd_elf_merge_symbol): Add a parameter to indicate
if the new symbol matches the existing one.  The new hidden
versioned symbol matches the existing symbol if they have the
same symbol version. Update the existing symbol only if they
match.
(_bfd_elf_add_default_symbol): Update call to
_bfd_elf_merge_symbol.
(_bfd_elf_link_assign_sym_version): Don't set the hidden field
here.
(elf_link_add_object_symbols): Override a definition only if the
new symbol matches the existing one.
(_bfd_elf_link_hash_copy_indirect): Don't copy any references to
the hidden versioned symbol.
(elf_link_output_extsym): Bind a symbol locally when linking
executable if it is locally defined, hidden versioned, not
referenced by shared library and not exported.  Turn on
VERSYM_HIDDEN only if the hidden vesioned symbol is defined
locally.

ld/testsuite/

PR ld/18720
* ld-elf/indirect.exp: Run tests for PR ld/18720.
* ld-elf/pr18720.out: New file.
* ld-elf/pr18720a.c: Likewise.
* ld-elf/pr18720b.c: Likewise.
* ld-elf/pr18720c.c: Likewise.
bfd/ChangeLog
bfd/elflink.c
ld/testsuite/ChangeLog
ld/testsuite/ld-elf/indirect.exp
ld/testsuite/ld-elf/pr18720.out [new file with mode: 0644]
ld/testsuite/ld-elf/pr18720a.c [new file with mode: 0644]
ld/testsuite/ld-elf/pr18720b.c [new file with mode: 0644]
ld/testsuite/ld-elf/pr18720c.c [new file with mode: 0644]
This page took 0.026698 seconds and 4 git commands to generate.