From 6ec65f28db6b718b505e2ee5c34a274ba07397ae Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Tue, 28 Apr 2015 13:28:29 +0930 Subject: [PATCH] PowerPC gold assertion on missing global entry stub Global entry stubs are used on ELFv2 to provide addresses for functions not defined in a non-PIC executable but whose address is taken, in much the same way as PLT stub code is used on other targets to provide function addresses. We don't want to insert a global entry stub just because (bogus) debug info refers to the address of a non-local function, but we also don't want gold to die. * powerpc.cc (Target_powerpc::Relocate::relocate): Don't assert on missing global entry stub due to bogus debug info. --- gold/ChangeLog | 28 +++++++++++++++++----------- gold/powerpc.cc | 9 ++++++--- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/gold/ChangeLog b/gold/ChangeLog index 5c6b2af43fe..3f03b6bdab3 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,8 @@ +2015-04-28 Alan Modra + + * powerpc.cc (Target_powerpc::Relocate::relocate): Don't assert + on missing global entry stub due to bogus debug info. + 2015-04-27 Han Shen * options.h (--fix-cortex-a53-843419): Rename option. @@ -15,7 +20,8 @@ * testsuite/eh_test_a.cc: New test. * testsuite/eh_test_b.cc: New test. -2015-04-23 Sriraman Tallam +2015-04-23 Sriraman Tallam + * options.h (--weak-unresolved-symbols): New option. * symtab.cc (Symbol_table::sized_write_globals): Change symbol binding to weak with new option. @@ -42,16 +48,16 @@ 2015-04-16 Han Shen - * aarch64.cc (AArch64_insn_utilities): New utility class. - (AArch64_relobj::Mapping_symbol_position): New struct. - (AArch64_relobj::Mapping_symbol_info): New typedef. - (AArch64_relobj::do_count_local_symbols): New function overriding - parent's implementation. - (AArch64_relobj::mapping_symbol_info_): New member - (AArch64_relobj::scan_erratum_843419): New method. - (Target_aarch64::scan_erratum_843419_span): New method. - (Target_aarch64::is_erratum_843419_sequence): New method. - * options.h (fix_cortex_a53): New option. + * aarch64.cc (AArch64_insn_utilities): New utility class. + (AArch64_relobj::Mapping_symbol_position): New struct. + (AArch64_relobj::Mapping_symbol_info): New typedef. + (AArch64_relobj::do_count_local_symbols): New function overriding + parent's implementation. + (AArch64_relobj::mapping_symbol_info_): New member + (AArch64_relobj::scan_erratum_843419): New method. + (Target_aarch64::scan_erratum_843419_span): New method. + (Target_aarch64::is_erratum_843419_sequence): New method. + * options.h (fix_cortex_a53): New option. 2015-04-09 Cary Coutant diff --git a/gold/powerpc.cc b/gold/powerpc.cc index fddf3fadeb9..3d753b54f4e 100644 --- a/gold/powerpc.cc +++ b/gold/powerpc.cc @@ -6836,8 +6836,11 @@ Target_powerpc::Relocate::relocate( && !is_branch_reloc(r_type)) { unsigned int off = target->glink_section()->find_global_entry(gsym); - gold_assert(off != (unsigned int)-1); - value = target->glink_section()->global_entry_address() + off; + if (off != (unsigned int)-1) + { + value = target->glink_section()->global_entry_address() + off; + has_stub_value = true; + } } else { @@ -6859,8 +6862,8 @@ Target_powerpc::Relocate::relocate( rela.get_r_addend()); gold_assert(off != invalid_address); value = stub_table->stub_address() + off; + has_stub_value = true; } - has_stub_value = true; } if (r_type == elfcpp::R_POWERPC_GOT16 -- 2.30.2