From: Alan Modra Date: Wed, 23 Sep 2020 13:24:01 +0000 (+0930) Subject: [GOLD] PowerPC64 __tls_get_addr_opt stub X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a993d270f8423a8b6faa2ce9d245073bed076bb0;p=binutils-gdb.git [GOLD] PowerPC64 __tls_get_addr_opt stub This stub doesn't have the r2 store at the beginning. * powerpc.cc (Target_powerpc::Relocate::relocate): Don't skip first insn of __tls_get_addr_opt stub. --- diff --git a/gold/ChangeLog b/gold/ChangeLog index 176b728606d..3cd441af656 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,8 @@ +2020-09-24 Alan Modra + + * powerpc.cc (Target_powerpc::Relocate::relocate): Don't skip + first insn of __tls_get_addr_opt stub. + 2020-08-24 Alan Modra * powerpc.cc (Target_powerpc): Add tprel_opt_ and accessors. diff --git a/gold/powerpc.cc b/gold/powerpc.cc index e35cbcf6c0b..1020fa42f99 100644 --- a/gold/powerpc.cc +++ b/gold/powerpc.cc @@ -10401,21 +10401,24 @@ Target_powerpc::Relocate::relocate( value += ent->tocoff_; if (size == 64 && ent->r2save_ - && r_type == elfcpp::R_PPC64_REL24_NOTOC) + && !(gsym != NULL + && target->is_tls_get_addr_opt(gsym))) { - if (!(target->power10_stubs() - && target->power10_stubs_auto())) - value += 4; - } - else if (size == 64 - && ent->r2save_ - && relnum < reloc_count - 1) - { - Reltype next_rela(preloc + reloc_size); - if (elfcpp::elf_r_type(next_rela.get_r_info()) - == elfcpp::R_PPC64_TOCSAVE - && next_rela.get_r_offset() == rela.get_r_offset() + 4) - value += 4; + if (r_type == elfcpp::R_PPC64_REL24_NOTOC) + { + if (!(target->power10_stubs() + && target->power10_stubs_auto())) + value += 4; + } + else if (relnum < reloc_count - 1) + { + Reltype next_rela(preloc + reloc_size); + if (elfcpp::elf_r_type(next_rela.get_r_info()) + == elfcpp::R_PPC64_TOCSAVE + && (next_rela.get_r_offset() + == rela.get_r_offset() + 4)) + value += 4; + } } localentry0 = ent->localentry0_; has_stub_value = true;