[binutils-gdb/binutils-2_37-branch] [GOLD] Re: PowerPC64: Don't pretend to support multi-toc

Alan Modra amodra@sourceware.org
Thu Oct 21 11:36:27 GMT 2021


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=34bebf56c8d095f95bf21057ec33386696c71449

commit 34bebf56c8d095f95bf21057ec33386696c71449
Author: Alan Modra <amodra@gmail.com>
Date:   Thu Oct 14 17:01:06 2021 +1030

    [GOLD] Re: PowerPC64: Don't pretend to support multi-toc
    
    We can't get at section->address() until everything is laid out, so
    trying to generalise the offset calculation rather than using a value
    of 0x8000 (the old object->toc_base_offset()) was bound to fail.
    got->g_o_t() is a little better than a hard-coded 0x8000.
    
            * powerpc.cc (Target_powerpc::Scan::local, global): Don't use
            toc_pointer() here.
    
    (cherry picked from commit a1251fdcb58f99644c49b65d72507706f2d40200)

Diff:
---
 gold/powerpc.cc | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/gold/powerpc.cc b/gold/powerpc.cc
index d10b11e003b..4266268d639 100644
--- a/gold/powerpc.cc
+++ b/gold/powerpc.cc
@@ -8013,8 +8013,7 @@ Target_powerpc<size, big_endian>::Scan::local(
 	      break;
 
 	    Reloc_section* rela_dyn = target->rela_dyn_section(layout);
-	    Address got_off = (target->toc_pointer()
-			       - got->output_section()->address());
+	    Address got_off = got->g_o_t();
 	    rela_dyn->add_output_section_relative(got->output_section(),
 						  elfcpp::R_POWERPC_RELATIVE,
 						  output_section,
@@ -8740,8 +8739,7 @@ Target_powerpc<size, big_endian>::Scan::global(
 	      break;
 
 	    Reloc_section* rela_dyn = target->rela_dyn_section(layout);
-	    Address got_off = (target->toc_pointer()
-			       - got->output_section()->address());
+	    Address got_off = got->g_o_t();
 	    rela_dyn->add_output_section_relative(got->output_section(),
 						  elfcpp::R_POWERPC_RELATIVE,
 						  output_section,


More information about the Binutils-cvs mailing list