From: Ian Lance Taylor Date: Fri, 12 Dec 2008 02:41:39 +0000 (+0000) Subject: PR 7091 X-Git-Tag: sid-snapshot-20090201~476 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c25081787282f9acff5b23cf4f0b110857f03286;p=external%2Fbinutils.git PR 7091 * target-reloc.h (Default_scan_relocatable_relocs): For each function, map r_type == 0 to RELOC_DISCARD. --- diff --git a/gold/ChangeLog b/gold/ChangeLog index 85482bb..28ba299 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,9 @@ +2008-12-11 Ian Lance Taylor + + PR 7091 + * target-reloc.h (Default_scan_relocatable_relocs): For each + function, map r_type == 0 to RELOC_DISCARD. + 2008-12-10 Cary Coutant * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement diff --git a/gold/target-reloc.h b/gold/target-reloc.h index 935d76b..3205e36 100644 --- a/gold/target-reloc.h +++ b/gold/target-reloc.h @@ -308,14 +308,24 @@ class Default_scan_relocatable_relocs // Return the strategy to use for a local symbol which is not a // section symbol, given the relocation type. inline Relocatable_relocs::Reloc_strategy - local_non_section_strategy(unsigned int, Relobj*) - { return Relocatable_relocs::RELOC_COPY; } + local_non_section_strategy(unsigned int r_type, Relobj*) + { + // We assume that relocation type 0 is NONE. Targets which are + // different must override. + if (r_type == 0) + return Relocatable_relocs::RELOC_DISCARD; + return Relocatable_relocs::RELOC_COPY; + } // Return the strategy to use for a local symbol which is a section // symbol, given the relocation type. inline Relocatable_relocs::Reloc_strategy local_section_strategy(unsigned int r_type, Relobj* object) { + // We assume that relocation type 0 is NONE. Targets which are + // different must override. + if (r_type == 0) + return Relocatable_relocs::RELOC_DISCARD; if (sh_type == elfcpp::SHT_RELA) return Relocatable_relocs::RELOC_ADJUST_FOR_SECTION_RELA; else @@ -342,8 +352,14 @@ class Default_scan_relocatable_relocs // Return the strategy to use for a global symbol, given the // relocation type, the object, and the symbol index. inline Relocatable_relocs::Reloc_strategy - global_strategy(unsigned int, Relobj*, unsigned int) - { return Relocatable_relocs::RELOC_COPY; } + global_strategy(unsigned int r_type, Relobj*, unsigned int) + { + // We assume that relocation type 0 is NONE. Targets which are + // different must override. + if (r_type == 0) + return Relocatable_relocs::RELOC_DISCARD; + return Relocatable_relocs::RELOC_COPY; + } }; // Scan relocs during a relocatable link. This is a default