[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug gold/25872] Gold doesn't properly support CET PLT
From: |
hjl.tools at gmail dot com |
Subject: |
[Bug gold/25872] Gold doesn't properly support CET PLT |
Date: |
Fri, 24 Apr 2020 18:30:53 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=25872
H.J. Lu <hjl.tools at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|ifuncmain7.c:47: error: |Gold doesn't properly
|relocation overflow: |support CET PLT
|reference to local symbol 5 |
|in ifuncmain7.o |
--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> ---
template<int size>
uint64_t
Output_data_plt_x86_64_ibt<size>::do_address_for_global(const Symbol* gsym)
{
uint64_t offset = this->aplt_offset_;
// Convert the PLT offset into an APLT offset.
unsigned int plt_offset = gsym->plt_offset();
if (gsym->type() == elfcpp::STT_GNU_IFUNC
&& gsym->can_use_relative_reloc(false))
offset += this->regular_count() * aplt_entry_size;
else
plt_offset -= plt_entry_size;
plt_offset = plt_offset / (plt_entry_size / aplt_entry_size);
return this->address() + offset + plt_offset;
}
checks STT_GNU_IFUNC. But do_address_for_local doesn't. Even with
diff --git a/gold/x86_64.cc b/gold/x86_64.cc
index 1442a009d7..284809c719 100644
--- a/gold/x86_64.cc
+++ b/gold/x86_64.cc
@@ -2288,7 +2288,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_
I got
/export/gnu/import/git/gitlab/x86-binutils/gold/../test-driver: line 107:
299279 Segmentation fault (core dumped) "$@" > $log_file 2>&1
FAIL: tls_shared_gnu2_test
--
You are receiving this mail because:
You are on the CC list for the bug.