aboutsummaryrefslogtreecommitdiff
path: root/bfd/elfnn-riscv.c
diff options
context:
space:
mode:
Diffstat (limited to 'bfd/elfnn-riscv.c')
-rw-r--r--bfd/elfnn-riscv.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/bfd/elfnn-riscv.c b/bfd/elfnn-riscv.c
index 0a0ceb7..bb114e5 100644
--- a/bfd/elfnn-riscv.c
+++ b/bfd/elfnn-riscv.c
@@ -2059,7 +2059,9 @@ riscv_elf_relocate_section (bfd *output_bfd,
all relocs to update these addends. This is also ambiguous, as
we do allow offsets to be added to the target address, which are
not to be used to find the auipc address. */
- if ((ELF_ST_TYPE (sym->st_info) == STT_SECTION) && rel->r_addend)
+ if (((sym != NULL && (ELF_ST_TYPE (sym->st_info) == STT_SECTION))
+ || (h != NULL && h->type == STT_SECTION))
+ && rel->r_addend)
{
r = bfd_reloc_dangerous;
break;