aboutsummaryrefslogtreecommitdiff
path: root/gold/powerpc.cc
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2017-08-28 16:27:33 +0930
committerAlan Modra <amodra@gmail.com>2017-08-28 16:27:33 +0930
commit565ed01a4e0e3584f24580177822a5271b1c0c8b (patch)
treee9b966a4414efec1764b7157318faa9d0cd8435e /gold/powerpc.cc
parent41e52377486950e32a1bc121e4c42abc8561aee5 (diff)
downloadgdb-565ed01a4e0e3584f24580177822a5271b1c0c8b.zip
gdb-565ed01a4e0e3584f24580177822a5271b1c0c8b.tar.gz
gdb-565ed01a4e0e3584f24580177822a5271b1c0c8b.tar.bz2
[GOLD] Symbol flag for PowerPC64 localentry:0 tracking
This patch provides a flag for PowerPC64 ELFv2 use in class Symbol, and modifies Sized_target::resolve to return whether the symbol has been resolved. If not, normal processing continues. I use this for PowerPC64 ELFv2 to keep track of whether a symbol has any definition with non-zero localentry, in order to disable --plt-localentry for that symbol. PR 21847 * powerpc.cc (Target_powerpc::is_elfv2_localentry0): Test non_zero_localentry. (Target_powerpc::resolve): New function. (powerpc_info): Set has_resolve for 64-bit. * target.h (Sized_target::resolve): Return bool. * resolve.cc (Symbol_table::resolve): Continue with normal processing when target resolve returns false. * symtab.h (Symbol::non_zero_localentry, set_non_zero_localentry): New accessors. (Symbol::non_zero_localentry_): New flag bit. * symtab.cc (Symbol::init_fields): Init non_zero_localentry_.
Diffstat (limited to 'gold/powerpc.cc')
-rw-r--r--gold/powerpc.cc23
1 files changed, 20 insertions, 3 deletions
diff --git a/gold/powerpc.cc b/gold/powerpc.cc
index 6f610cb..c29850b 100644
--- a/gold/powerpc.cc
+++ b/gold/powerpc.cc
@@ -1026,7 +1026,8 @@ class Target_powerpc : public Sized_target<size, big_endian>
&& this->plt_localentry0()
&& gsym->type() == elfcpp::STT_FUNC
&& gsym->is_defined()
- && gsym->nonvis() >> 3 == 0);
+ && gsym->nonvis() >> 3 == 0
+ && !gsym->non_zero_localentry());
}
bool
@@ -1051,6 +1052,22 @@ class Target_powerpc : public Sized_target<size, big_endian>
return false;
}
+ // Remember any symbols seen with non-zero localentry, even those
+ // not providing a definition
+ bool
+ resolve(Symbol* to, const elfcpp::Sym<size, big_endian>& sym, Object*,
+ const char*)
+ {
+ if (size == 64)
+ {
+ unsigned char st_other = sym.get_st_other();
+ if ((st_other & elfcpp::STO_PPC64_LOCAL_MASK) != 0)
+ to->set_non_zero_localentry();
+ }
+ // We haven't resolved anything, continue normal processing.
+ return false;
+ }
+
int
abiversion() const
{ return this->processor_specific_flags() & elfcpp::EF_PPC64_ABI; }
@@ -1603,7 +1620,7 @@ Target::Target_info Target_powerpc<64, true>::powerpc_info =
true, // is_big_endian
elfcpp::EM_PPC64, // machine_code
false, // has_make_symbol
- false, // has_resolve
+ true, // has_resolve
false, // has_code_fill
true, // is_default_stack_executable
false, // can_icf_inline_merge_sections
@@ -1631,7 +1648,7 @@ Target::Target_info Target_powerpc<64, false>::powerpc_info =
false, // is_big_endian
elfcpp::EM_PPC64, // machine_code
false, // has_make_symbol
- false, // has_resolve
+ true, // has_resolve
false, // has_code_fill
true, // is_default_stack_executable
false, // can_icf_inline_merge_sections