diff options
author | Nelson Chu <nelson@rivosinc.com> | 2025-03-09 14:17:09 +0800 |
---|---|---|
committer | Nelson Chu <nelson@rivosinc.com> | 2025-03-09 14:18:06 +0800 |
commit | 512316811d47d689d75d25aa9d5b98bdafd64df6 (patch) | |
tree | c0864009d56bcc8bceebccf97f514f38c6f00105 | |
parent | cbc6950a6603e184ebc6671f2c252a56013b07c2 (diff) | |
download | binutils-512316811d47d689d75d25aa9d5b98bdafd64df6.zip binutils-512316811d47d689d75d25aa9d5b98bdafd64df6.tar.gz binutils-512316811d47d689d75d25aa9d5b98bdafd64df6.tar.bz2 |
RISC-V: PR32772, fixed segfault caused by the accidental removal of `h != NULL'
bfd/
PR 32772
* elfnn-riscv.c (riscv_elf_relocate_section): Fixed segfault caused by
the accidental removal of `h != NULL' when handling a call to an
undefined weak function.
-rw-r--r-- | bfd/elfnn-riscv.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/bfd/elfnn-riscv.c b/bfd/elfnn-riscv.c index bca3a58..06e9940 100644 --- a/bfd/elfnn-riscv.c +++ b/bfd/elfnn-riscv.c @@ -2783,7 +2783,7 @@ riscv_elf_relocate_section (bfd *output_bfd, case R_RISCV_CALL_PLT: /* Handle a call to an undefined weak function. This won't be relaxed, so we have to handle it here. */ - if (h->root.type == bfd_link_hash_undefweak && !via_plt) + if (h != NULL && h->root.type == bfd_link_hash_undefweak && !via_plt) { /* We can use x0 as the base register. */ bfd_vma insn = bfd_getl32 (contents + rel->r_offset + 4); |