Treat common symbol in executable as definition
authorH.J. Lu <hjl.tools@gmail.com>
Fri, 4 Mar 2016 14:37:34 +0000 (06:37 -0800)
committerH.J. Lu <hjl.tools@gmail.com>
Fri, 4 Mar 2016 14:37:54 +0000 (06:37 -0800)
commit07492f668d2173da7a2bda3707ff0985e0f460b6
tree5495148ee6fc8e585e00cca748ac0351995bf8d4
parent9411fd44aa4adfb0caeebd9e4355a3441d9bc104
Treat common symbol in executable as definition

Common symbol in executable is a definition, which overrides definition
from shared objects.  When linker sees a new definition from a shared
object, the new dynamic definition should be overridden by the previous
common symbol in executable.

bfd/

PR ld/19579
* elflink.c (_bfd_elf_merge_symbol): Treat common symbol in
executable as definition if the new definition comes from a
shared library.

ld/

PR ld/19579
* testsuite/ld-elf/pr19579a.c: New file.
* testsuite/ld-elf/pr19579b.c: Likewise.
* testsuite/ld-elf/shared.exp: Run PR ld/19579 test.
bfd/ChangeLog
bfd/elflink.c
ld/ChangeLog
ld/testsuite/ld-elf/pr19579a.c [new file with mode: 0644]
ld/testsuite/ld-elf/pr19579b.c [new file with mode: 0644]
ld/testsuite/ld-elf/shared.exp