aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-09-23 22:54:01 +0930
committerAndreas K. Hüttel <dilfridge@gentoo.org>2020-10-21 00:54:29 +0300
commit03c0c3389bac50f35136b0ec5f314549943d828a (patch)
tree6f1a9c2ae67997579b7e9041ee57fdcfd494dcb6
parent[GOLD] Power10 stub selection (diff)
downloadbinutils-gdb-03c0c3389bac50f35136b0ec5f314549943d828a.tar.gz
binutils-gdb-03c0c3389bac50f35136b0ec5f314549943d828a.tar.bz2
binutils-gdb-03c0c3389bac50f35136b0ec5f314549943d828a.zip
[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. (cherry picked from commit a993d270f8423a8b6faa2ce9d245073bed076bb0) (cherry picked from commit dc9f426801780e98f6bb81e74d5bb10b663260ac)
-rw-r--r--gold/ChangeLog5
-rw-r--r--gold/powerpc.cc31
2 files changed, 22 insertions, 14 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog
index 5c891349c4..7734acec35 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,5 +1,10 @@
2020-09-24 Alan Modra <amodra@gmail.com>
+ * powerpc.cc (Target_powerpc::Relocate::relocate): Don't skip
+ first insn of __tls_get_addr_opt stub.
+
+2020-09-24 Alan Modra <amodra@gmail.com>
+
Apply from master
2020-07-27 Alan Modra <amodra@gmail.com>
* options.h (DEFINE_enum): Add optional_arg__ param, adjust
diff --git a/gold/powerpc.cc b/gold/powerpc.cc
index e35cbcf6c0..1020fa42f9 100644
--- a/gold/powerpc.cc
+++ b/gold/powerpc.cc
@@ -10401,21 +10401,24 @@ Target_powerpc<size, big_endian>::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<size>(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<size>(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;