From 4cafd9ff8e8fc7d7154f39b4d36a9f0b9de53ca6 Mon Sep 17 00:00:00 2001 From: Daniel Jacobowitz Date: Fri, 3 Nov 2006 00:58:10 +0000 Subject: 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. --- bfd/elf32-hppa.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'bfd/elf32-hppa.c') diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c index db6e84212b..c448aac26f 100644 --- a/bfd/elf32-hppa.c +++ b/bfd/elf32-hppa.c @@ -3942,8 +3942,14 @@ elf32_hppa_relocate_section (bfd *output_bfd, /* 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 - || (input_section->flags & SEC_ALLOC) == 0) + if (r_symndx == 0) + { + _bfd_clear_contents (elf_hppa_howto_table + r_type, input_bfd, + contents + rela->r_offset); + break; + } + + if ((input_section->flags & SEC_ALLOC) == 0) break; /* The reloc types handled here and this conditional -- cgit v1.2.1