From f697178787b1200fcbea13f6504c108e7714c6bd Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Sun, 1 Jun 2014 22:01:44 +0930 Subject: Fix PowerPC64 ELFv2 icf_safe failures ELFv2 doesn't use .opd, so folding function code can't be allowed in safe mode if a function's address might be taken. * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer): Only ignore relocs on ELFv1. (Target_powerpc::global_reloc_may_be_function_pointer): Likewise. --- gold/ChangeLog | 6 ++++++ gold/powerpc.cc | 20 +++++++++++++++----- 2 files changed, 21 insertions(+), 5 deletions(-) (limited to 'gold') diff --git a/gold/ChangeLog b/gold/ChangeLog index 7b6fa81..b421ad9 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,9 @@ +2014-06-02 Alan Modra + + * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer): + Only ignore relocs on ELFv1. + (Target_powerpc::global_reloc_may_be_function_pointer): Likewise. + 2014-05-30 Cary Coutant * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option. diff --git a/gold/powerpc.cc b/gold/powerpc.cc index e59c319..1078017 100644 --- a/gold/powerpc.cc +++ b/gold/powerpc.cc @@ -947,7 +947,7 @@ class Target_powerpc : public Sized_target inline bool local_reloc_may_be_function_pointer(Symbol_table* , Layout* , Target_powerpc* , - Sized_relobj_file* , + Sized_relobj_file* relobj, unsigned int , Output_section* , const elfcpp::Rela& , @@ -958,8 +958,13 @@ class Target_powerpc : public Sized_target // may be folded and we'll still keep function addresses distinct. // That means no reloc is of concern here. if (size == 64) - return false; - // For 32-bit, conservatively assume anything but calls to + { + Powerpc_relobj* ppcobj = static_cast + *>(relobj); + if (ppcobj->abiversion() == 1) + return false; + } + // For 32-bit and ELFv2, conservatively assume anything but calls to // function code might be taking the address of the function. return !is_branch_reloc(r_type); } @@ -967,7 +972,7 @@ class Target_powerpc : public Sized_target inline bool global_reloc_may_be_function_pointer(Symbol_table* , Layout* , Target_powerpc* , - Sized_relobj_file* , + Sized_relobj_file* relobj, unsigned int , Output_section* , const elfcpp::Rela& , @@ -976,7 +981,12 @@ class Target_powerpc : public Sized_target { // As above. if (size == 64) - return false; + { + Powerpc_relobj* ppcobj = static_cast + *>(relobj); + if (ppcobj->abiversion() == 1) + return false; + } return !is_branch_reloc(r_type); } -- cgit v1.1