[GOLD] Two GOT sections for PowerPC64
authorAlan Modra <amodra@gmail.com>
Fri, 8 Oct 2021 23:33:21 +0000 (10:03 +1030)
committerAlan Modra <amodra@gmail.com>
Thu, 14 Oct 2021 02:38:46 +0000 (13:08 +1030)
commitf19c3684a6db145f57048bff5485fec6e3dd0f76
treef9a488503e22d7ecae390a551b5bbadddd0ec52a
parenta19da04b3c3a01699aaf7a59b03f5f008355b23d
[GOLD] Two GOT sections for PowerPC64

Split .got into two piece, one with the header and entries for small
model got entries, the other with entries for medium/large model got
entries.  The idea is to better support mixed pcrel/non-pcrel code
where non-pcrel small-model .toc entries need to be within 32k of the
toc pointer.

* target.h (Target::tls_offset_for_local): Add got param.
(Target::tls_offset_for_global): Likewise.
(Target::do_tls_offset_for_local, do_tls_offset_for_global): Likewise.
* output.h (Output_data_got::Got_entry::write): Add got param.
* output.cc (Output_data_got::Got_entry::write): Likewise, pass to
tls_offset_for_local/global calls.
(Output_data_got::do_write): Adjust to suit.
* s390.cc (Target_s390::do_tls_offset_for_local): Likewise.
(Target_s390::do_tls_offset_for_global): Likewise.
* powerpc.cc (enum Got_type): Extend with small types, move from
class Target_powerpc.
(Target_powerpc::biggot_): New.
(Traget_powerpc::do_tls_offset_for_local, do_tls_offset_for_global,
got_size, got_section, got_base_offset): Handle biggot_.
(Target_powerpc::do_define_standard_symbols): Adjust.
(Target_powerpc::make_plt_section, do_finalize_sections): Likewise.
(Output_data_got_powerpc::Output_data_got_powerpc): Only make
64-bit header for small got section.
(Output_data_got_powerpc::g_o_t): Only return a result for small
got section.
(Output_data_got_powerpc::write): Only write small got section
header.
(Target_powerpc::Scan::local, global): Select small/big Got_type
and section to suit reloc.
(Target_powerpc::Relocate::relocate): Similarly.
(Sort_toc_sections): Rewrite.
gold/output.cc
gold/output.h
gold/powerpc.cc
gold/s390.cc
gold/target.h