From bfdfa4cd8da8b878613e3ee98c8268f8aa72983c Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 12 Sep 2012 22:43:54 +0000 Subject: * target-reloc.h (scan_relocs): Call scan.local for relocs against symbols in discarded sections. Pass is_discarded param. * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local): Add is_discarded param. * powerpc (Target_powerpc::Scan::local): Likewise. Use is_discarded to flag opd entry as discarded. Don't emit dyn relocs on such entries. (Target_powerpc::Scan::global): Similarly detect and handle such opd entries. (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with opd_ent_. Update all uses. (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions. (Target_powerpc::relocate_section): Zero out discarded opd entry relocs. --- gold/i386.cc | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'gold/i386.cc') diff --git a/gold/i386.cc b/gold/i386.cc index 91611a1..47779d0 100644 --- a/gold/i386.cc +++ b/gold/i386.cc @@ -538,7 +538,8 @@ class Target_i386 : public Sized_target<32, false> unsigned int data_shndx, Output_section* output_section, const elfcpp::Rel<32, false>& reloc, unsigned int r_type, - const elfcpp::Sym<32, false>& lsym); + const elfcpp::Sym<32, false>& lsym, + bool is_discarded); inline void global(Symbol_table* symtab, Layout* layout, Target_i386* target, @@ -1702,15 +1703,19 @@ Target_i386::Scan::reloc_needs_plt_for_ifunc( inline void Target_i386::Scan::local(Symbol_table* symtab, - Layout* layout, - Target_i386* target, - Sized_relobj_file<32, false>* object, - unsigned int data_shndx, - Output_section* output_section, - const elfcpp::Rel<32, false>& reloc, - unsigned int r_type, - const elfcpp::Sym<32, false>& lsym) + Layout* layout, + Target_i386* target, + Sized_relobj_file<32, false>* object, + unsigned int data_shndx, + Output_section* output_section, + const elfcpp::Rel<32, false>& reloc, + unsigned int r_type, + const elfcpp::Sym<32, false>& lsym, + bool is_discarded) { + if (is_discarded) + return; + // A local STT_GNU_IFUNC symbol may require a PLT entry. if (lsym.get_st_type() == elfcpp::STT_GNU_IFUNC && this->reloc_needs_plt_for_ifunc(object, r_type)) -- cgit v1.1