x86-64: Force symbol dynamic if it isn't undefined weak
authorH.J. Lu <hjl.tools@gmail.com>
Mon, 24 Apr 2017 21:37:12 +0000 (14:37 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Mon, 24 Apr 2017 21:37:12 +0000 (14:37 -0700)
commit9e9821ddd80c0d0b3dda54d34cc8867f256d4583
tree0d36e2b7fc6b5eada69e538373a900317ef78279
parent0dc9a308a1ec9675bf6b33bae9e8b1faa0bad9ed
x86-64: Force symbol dynamic if it isn't undefined weak

Force symbol dynamic if it isn't undefined weak.  Generate relative
relocation for GOT reference against non-dynamic symbol in PIC to
avoid unnecessary dynamic symbols.

bfd/

* elf64-x86-64.c (elf_x86_64_link_hash_entry): Add
no_finish_dynamic_symbol.
(elf_x86_64_link_hash_newfunc): Set no_finish_dynamic_symbol to
0.
(elf_x86_64_allocate_dynrelocs): If a symbol isn't undefined
weak symbol, don't make it dynamic.
(elf_x86_64_relocate_section): If a symbol isn't dynamic in PIC,
set no_finish_dynamic_symbol and generate R_X86_64_RELATIVE
relocation for GOT reference.
(elf_x86_64_finish_dynamic_symbol): Abort if
no_finish_dynamic_symbol isn't 0.

ld/

* testsuite/ld-x86-64/no-plt.exp: Also check no-plt-1e.nd.
* testsuite/ld-x86-64/no-plt-1e.nd: New file.
bfd/ChangeLog
bfd/elf64-x86-64.c
ld/ChangeLog
ld/testsuite/ld-x86-64/no-plt-1e.nd [new file with mode: 0644]
ld/testsuite/ld-x86-64/no-plt.exp