diff options
author | Daniel Jacobowitz <dan@debian.org> | 2006-11-03 00:58:10 +0000 |
---|---|---|
committer | Daniel Jacobowitz <dan@debian.org> | 2006-11-03 00:58:10 +0000 |
commit | 369354aef498f3dd03320779738e3155589ffa7d (patch) | |
tree | 14f4528768733e2a545d634f48d729795a89b6e7 /bfd/elf32-sh.c | |
parent | 8c085db1b09fc5554247198ca893fc23c046a95e (diff) | |
download | gdb-369354aef498f3dd03320779738e3155589ffa7d.tar.gz |
bfd/
* libbfd-in.h (_bfd_clear_contents): New prototype.
* reloc.c (_bfd_clear_contents): New.
* libbfd.h: Regenerated.
* elf32-arm.c (elf32_arm_final_link_relocate): Use
_bfd_clear_contents.
* elf32-d10v.c (elf32_d10v_relocate_section): Likewise.
* elf32-hppa.c (elf32_hppa_relocate_section): Likewise.
* elf32-i386.c (elf_i386_relocate_section): Likewise.
* elf32-ppc.c (ppc_elf_relocate_section): Likewise.
* elf32-s390.c (elf_s390_relocate_section): Likewise.
* elf32-sh.c (sh_elf_relocate_section): Likewise.
* elf32-xtensa.c (elf_xtensa_relocate_section): Likewise.
* elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
* elf64-s390.c (elf_s390_relocate_section): Likewise.
* elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise.
* elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Likewise.
* elfxx-ia64.c (elfNN_ia64_relocate_section): Set value to
zero for discarded symbols.
* elfxx-mips.c (mips_elf_calculate_relocation): Likewise.
ld/testsuite/
* ld-discard/zero-rel.d, ld-discard/zero-rel.s: New files.
Diffstat (limited to 'bfd/elf32-sh.c')
-rw-r--r-- | bfd/elf32-sh.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c index 85f3d8ff6d1..8e53056f332 100644 --- a/bfd/elf32-sh.c +++ b/bfd/elf32-sh.c @@ -3557,6 +3557,15 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, case R_SH_IMM_MEDHI16_PCREL: case R_SH_IMM_HI16_PCREL: #endif + /* r_symndx will be zero only for relocs against symbols + from removed linkonce sections, or sections discarded by + a linker script. */ + if (r_symndx == 0) + { + _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset); + continue; + } + if (info->shared && (h == NULL || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT |