Rearrange PLT reloc output on powerpc
authorAlan Modra <amodra@gmail.com>
Sun, 8 Apr 2018 23:51:59 +0000 (09:21 +0930)
committerAlan Modra <amodra@gmail.com>
Mon, 9 Apr 2018 07:32:19 +0000 (17:02 +0930)
commit49c09209d06885dc8350042ce77e442bfbb5bf27
tree8acffc57915285f2c28394f16c3bfa1a7bf075f6
parent08be322439408ac02cff2ac9b5eca4f7243a0277
Rearrange PLT reloc output on powerpc

The current scheme where we output PLT relocs for global symbols in
finish_dynamic_symbol, and PLT relocs for local symbols when
outputting stubs does not work if PLT entries are to be used for
inline PLT sequences against non-dynamic globals or local symbols.

bfd/
* elf64-ppc.c (ppc_build_one_stub): Move output of PLT relocs
for local symbols to..
(write_plt_relocs_for_local_syms): ..here.  New function.
(ppc64_elf_finish_dynamic_symbol): Move output of PLT relocs for
global symbols to..
(build_global_entry_stubs_and_plt): ..here.  Rename from
build_global_entry_stubs.
(ppc64_elf_build_stubs): Always call build_global_entry_stubs_and_plt.
Call write_plt_relocs_for_local_syms.
* elf32-ppc.c (get_sym_h): New function.
(ppc_elf_relax_section): Use get_sym_h.
(ppc_elf_relocate_section): Move output of PLT relocs and glink
stubs for local symbols to..
(ppc_finish_symbols): ..here.  New function.
(ppc_elf_finish_dynamic_symbol): Move output of PLT relocs for
global syms to..
(write_global_sym_plt): ..here.  New function.
* elf32-ppc.h (ppc_elf_modify_segment_map): Delete attribute.
(ppc_finish_symbols): Declare.
ld/
* ppc32elf.em (ppc_finish): Call ppc_finish_symbols.
bfd/ChangeLog
bfd/elf32-ppc.c
bfd/elf32-ppc.h
bfd/elf64-ppc.c
ld/ChangeLog
ld/emultempl/ppc32elf.em