summaryrefslogtreecommitdiff
path: root/bfd/elf32-sh.c
diff options
context:
space:
mode:
Diffstat (limited to 'bfd/elf32-sh.c')
-rw-r--r--bfd/elf32-sh.c9
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