[GOLD] PowerPC64 TOC indirect to TOC relative code editing
authorAlan Modra <amodra@gmail.com>
Tue, 10 Jan 2017 21:11:53 +0000 (07:41 +1030)
committerAlan Modra <amodra@gmail.com>
Tue, 10 Jan 2017 21:11:53 +0000 (07:41 +1030)
commit5edad15d7c1e6a2409102b3426b444d6ea98bdfc
treeeec37ed37396a95a50b5d8d9a7b8a8436c20a2f7
parentf129e49f4d07f4d36319ac757fdcf3a8ce7d605b
[GOLD] PowerPC64 TOC indirect to TOC relative code editing

Doesn't yet trim off the unused TOC entries.

* powerpc.cc (class Powerpc_copy_relocs): New.
(Powerpc_copy_relocs::emit): New function.
(Powerpc_relobj::relatoc_, toc_, no_toc_opt_): New variables.
(Powerpc_relobj::toc_shndx, set_no_toc_opt, no_toc_opt): New inlines.
(Powerpc_relobj::do_relocate_sections): New function.
(Powerpc_relobj::make_toc_relative): Likewise.
(Powerpc_relobj::do_find_special_sections): Stash away .rela.toc
and .toc too.
(ok_lo_toc_insn): Move earlier, and handle more insns.
(Target_powerpc::Scan::local): If optimizing toc accesses, set
no_toc_opt for entries we can't edit.  Check insn validity.
Emit "toc optimization is not supported" warning, downgraded
from error.
(Target_powerpc::Scan::global): Likewise.
(Target_powerpc::Relocate::relocate): Edit TOC indirect code
to TOC relative.  Don't emit "toc optimization is not supported"
error here.
gold/ChangeLog
gold/powerpc.cc