diff options
author | Alan Modra <amodra@gmail.com> | 2021-08-25 21:58:51 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2021-09-18 08:20:11 +0930 |
commit | e4d49a0f908415edb7a7e718ef2008a96dd43f9b (patch) | |
tree | b23f491455f9e03d32f806cd26590414f4259b73 /gold/powerpc.cc | |
parent | 2cc9ed14fae1b288bbdbd9b102b2cbc9a29bf348 (diff) | |
download | gdb-e4d49a0f908415edb7a7e718ef2008a96dd43f9b.zip gdb-e4d49a0f908415edb7a7e718ef2008a96dd43f9b.tar.gz gdb-e4d49a0f908415edb7a7e718ef2008a96dd43f9b.tar.bz2 |
[GOLD] Got_entry::write addends
This takes care of writing out GOT entries with addends. The local
symbol case was already largely handled, except for passing the addend
to tls_offset_for_local which might need the addend in a
local_got_offset call. That's needed also in tls_offset_for_global.
I'm assuming here that GOT entries for function symbols won't ever
have addends, and in particular that a GOT entry referencing PLT call
stub code won't want an offset into the code.
PR 28192
* output.cc (Output_data_got::Got_entry::write): Include addend
in global symbol value. Pass addend to tls_offset_for_*.
* powerpc.cc (Target_powerpc::do_tls_offset_for_local): Handle addend.
(Target_powerpc::do_tls_offset_for_global): Likewise.
* s390.cc (Target_s390::do_tls_offset_for_local): Likewise.
(Target_s390::do_tls_offset_for_global): Likewise.
* target.h (Target::tls_offset_for_local): Add addend param.
(Target::tls_offset_for_global): Likewise.
(Target::do_tls_offset_for_local): Likewise.
(Target::do_tls_offset_for_global): Likewise.
Diffstat (limited to 'gold/powerpc.cc')
-rw-r--r-- | gold/powerpc.cc | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/gold/powerpc.cc b/gold/powerpc.cc index 11b9869..0b64059 100644 --- a/gold/powerpc.cc +++ b/gold/powerpc.cc @@ -825,12 +825,14 @@ class Target_powerpc : public Sized_target<size, big_endian> int64_t do_tls_offset_for_local(const Relobj* object, unsigned int symndx, - unsigned int got_indx) const; + unsigned int got_indx, + uint64_t addend) const; // Return the offset to use for the GOT_INDX'th got entry which is // for global tls symbol GSYM. int64_t - do_tls_offset_for_global(Symbol* gsym, unsigned int got_indx) const; + do_tls_offset_for_global(Symbol* gsym, unsigned int got_indx, + uint64_t addend) const; void do_function_location(Symbol_location*) const; @@ -12790,7 +12792,8 @@ int64_t Target_powerpc<size, big_endian>::do_tls_offset_for_local( const Relobj* object, unsigned int symndx, - unsigned int got_indx) const + unsigned int got_indx, + uint64_t addend) const { const Powerpc_relobj<size, big_endian>* ppc_object = static_cast<const Powerpc_relobj<size, big_endian>*>(object); @@ -12799,9 +12802,10 @@ Target_powerpc<size, big_endian>::do_tls_offset_for_local( for (Got_type got_type = GOT_TYPE_TLSGD; got_type <= GOT_TYPE_TPREL; got_type = Got_type(got_type + 1)) - if (ppc_object->local_has_got_offset(symndx, got_type)) + if (ppc_object->local_has_got_offset(symndx, got_type, addend)) { - unsigned int off = ppc_object->local_got_offset(symndx, got_type); + unsigned int off + = ppc_object->local_got_offset(symndx, got_type, addend); if (got_type == GOT_TYPE_TLSGD) off += size / 8; if (off == got_indx * (size / 8)) @@ -12822,16 +12826,17 @@ template<int size, bool big_endian> int64_t Target_powerpc<size, big_endian>::do_tls_offset_for_global( Symbol* gsym, - unsigned int got_indx) const + unsigned int got_indx, + uint64_t addend) const { if (gsym->type() == elfcpp::STT_TLS) { for (Got_type got_type = GOT_TYPE_TLSGD; got_type <= GOT_TYPE_TPREL; got_type = Got_type(got_type + 1)) - if (gsym->has_got_offset(got_type)) + if (gsym->has_got_offset(got_type, addend)) { - unsigned int off = gsym->got_offset(got_type); + unsigned int off = gsym->got_offset(got_type, addend); if (got_type == GOT_TYPE_TLSGD) off += size / 8; if (off == got_indx * (size / 8)) |