aboutsummaryrefslogtreecommitdiff
path: root/gold/output.cc
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2021-08-25 21:58:51 +0930
committerAlan Modra <amodra@gmail.com>2021-09-18 08:20:11 +0930
commite4d49a0f908415edb7a7e718ef2008a96dd43f9b (patch)
treeb23f491455f9e03d32f806cd26590414f4259b73 /gold/output.cc
parent2cc9ed14fae1b288bbdbd9b102b2cbc9a29bf348 (diff)
downloadgdb-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/output.cc')
-rw-r--r--gold/output.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/gold/output.cc b/gold/output.cc
index c5f7eef..7ad8750 100644
--- a/gold/output.cc
+++ b/gold/output.cc
@@ -1412,10 +1412,17 @@ Output_data_got<got_size, big_endian>::Got_entry::write(
default:
gold_unreachable();
}
+ // If this is a GOT entry for a known value global symbol,
+ // then the value should include the addend. If the value
+ // is not known leave the value as zero; The GOT entry
+ // will be set by a dynamic relocation.
+ if (this->addend_ && gsym->final_value_is_known())
+ val += this->addend_;
if (this->use_plt_or_tls_offset_
&& gsym->type() == elfcpp::STT_TLS)
val += parameters->target().tls_offset_for_global(gsym,
- got_indx);
+ got_indx,
+ this->addend_);
}
}
break;
@@ -1444,7 +1451,8 @@ Output_data_got<got_size, big_endian>::Got_entry::write(
val = convert_types<Valtype, uint64_t>(lval);
if (this->use_plt_or_tls_offset_ && is_tls)
val += parameters->target().tls_offset_for_local(object, lsi,
- got_indx);
+ got_indx,
+ this->addend_);
}
}
break;