PR30217, dynamic relocations using local dynamic symbols
authorAlan Modra <amodra@gmail.com>
Wed, 15 Mar 2023 07:37:44 +0000 (18:07 +1030)
committerAlan Modra <amodra@gmail.com>
Thu, 16 Mar 2023 00:41:44 +0000 (11:11 +1030)
commit0961e631575b0a1eafccf32fbde56d456aef9169
tree7dac5a39d9bfdf8c3c68f7d0a1045aae40af8f83
parentd56e433a7914cdf1ad6db64f7b10506336a8def9
PR30217, dynamic relocations using local dynamic symbols

glibc's ld.so ignores local dynamic symbols.  It's been that way
forever.  We therefore can't use them on dynamic relocations.  Fixing
that problem uncovered another problem in sorting of dynamic relocs,
caused no doubt by copying make_iplt_section (where we don't want
reloc sorting by the generic gold function, we want iplt relocs last)
to make_lplt_section (where we do want sorting).

PR 30217
* powerpc.cc (branch_needs_plt_entry): New function.
(Target_powerpc::plt_off): Use it here..
(Target_powerpc::Scan::global): ..and here to correct PLT16 reloc
handling for forced-local global symbols.
(Output_data_plt_powerpc::add_entry): Rename "stash"
parameter "is_local".  Emit relative relocs for globals that
are forced local, and don't set_needs_dynsym_entry.
(Target_powerpc::make_lplt_section): Don't create a separate
reloc section, use rela_dyn.
(Target_powerpc::make_brlt_section): Likewise.
gold/powerpc.cc