aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2020-05-01 08:53:47 -0700
committerH.J. Lu <hjl.tools@gmail.com>2020-05-01 08:59:32 -0700
commite977e74712cf8df6ff44ead0a5c0ffd3cb9aa065 (patch)
treeda1f47d461095f7fcbe1fb48b8494b8f3dc95ee9
parent693196cba23b888d7014a3533b132b756e8d4e79 (diff)
downloadgdb-e977e74712cf8df6ff44ead0a5c0ffd3cb9aa065.zip
gdb-e977e74712cf8df6ff44ead0a5c0ffd3cb9aa065.tar.gz
gdb-e977e74712cf8df6ff44ead0a5c0ffd3cb9aa065.tar.bz2
gold: Handle local IFUNC symbol for APLT
Handle local IFUNC symbol for APLT like global IFUNC symbol. PR gold/25872 * x86_64.cc (Output_data_plt_x86_64_bnd::do_address_for_local): Handle local IFUNC symbol. (Output_data_plt_x86_64_ibt::do_address_for_local): Likewise.
-rw-r--r--gold/ChangeLog7
-rw-r--r--gold/x86_64.cc14
2 files changed, 19 insertions, 2 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog
index 4466f4d..cc62a3e 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,10 @@
+2020-05-01 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR gold/25872
+ * x86_64.cc (Output_data_plt_x86_64_bnd::do_address_for_local):
+ Handle local IFUNC symbol.
+ (Output_data_plt_x86_64_ibt::do_address_for_local): Likewise.
+
2020-03-19 Fangrui Song <maskray@google.com>
* options.h (General_options): Add --no-rosegment option.
diff --git a/gold/x86_64.cc b/gold/x86_64.cc
index 8b6027e..6219c8e 100644
--- a/gold/x86_64.cc
+++ b/gold/x86_64.cc
@@ -2086,7 +2086,12 @@ Output_data_plt_x86_64_bnd::do_address_for_local(const Relobj* object,
unsigned int r_sym)
{
// Convert the PLT offset into an APLT offset.
- unsigned int plt_offset = ((object->local_plt_offset(r_sym) - plt_entry_size)
+ const Sized_relobj_file<64, false>* sized_relobj =
+ static_cast<const Sized_relobj_file<64, false>*>(object);
+ const Symbol_value<64>* psymval = sized_relobj->local_symbol(r_sym);
+ unsigned int plt_offset = ((object->local_plt_offset(r_sym)
+ - (psymval->is_ifunc_symbol()
+ ? 0 : plt_entry_size))
/ (plt_entry_size / aplt_entry_size));
return (this->address()
+ this->aplt_offset_
@@ -2260,7 +2265,12 @@ Output_data_plt_x86_64_ibt<size>::do_address_for_local(const Relobj* object,
unsigned int r_sym)
{
// Convert the PLT offset into an APLT offset.
- unsigned int plt_offset = ((object->local_plt_offset(r_sym) - plt_entry_size)
+ const Sized_relobj_file<size, false>* sized_relobj =
+ static_cast<const Sized_relobj_file<size, false>*>(object);
+ const Symbol_value<size>* psymval = sized_relobj->local_symbol(r_sym);
+ unsigned int plt_offset = ((object->local_plt_offset(r_sym)
+ - (psymval->is_ifunc_symbol()
+ ? 0 : plt_entry_size))
/ (plt_entry_size / aplt_entry_size));
return (this->address()
+ this->aplt_offset_