aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2024-04-19 16:35:30 +0930
committerAlan Modra <amodra@gmail.com>2024-04-19 16:48:03 +0930
commit9cf3c87e166b2f3728ae5c50c501f64f385e349e (patch)
tree03d08e8144610c82a2b86d6a8ba6ee352e68899b /bfd
parenteebad48efeeee858be83d754a6b1326133e51d36 (diff)
downloadgdb-9cf3c87e166b2f3728ae5c50c501f64f385e349e.zip
gdb-9cf3c87e166b2f3728ae5c50c501f64f385e349e.tar.gz
gdb-9cf3c87e166b2f3728ae5c50c501f64f385e349e.tar.bz2
Re: elf: Strip unreferenced weak undefined symbols
PR ld/31652 * elflink.c (_bfd_elf_link_output_relocs): Don't segfault on NULL rel_hash.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/elflink.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 4f72d1b..6db6a9c 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -2985,12 +2985,13 @@ _bfd_elf_link_output_relocs (bfd *output_bfd,
* bed->s->int_rels_per_ext_rel);
while (irela < irelaend)
{
- if (*rel_hash)
+ if (rel_hash && *rel_hash)
(*rel_hash)->has_reloc = 1;
(*swap_out) (output_bfd, irela, erel);
irela += bed->s->int_rels_per_ext_rel;
erel += input_rel_hdr->sh_entsize;
- rel_hash++;
+ if (rel_hash)
+ rel_hash++;
}
/* Bump the counter, so that we know where to add the next set of