public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
* [binutils-gdb] Re: elf: Strip unreferenced weak undefined symbols
@ 2024-04-19  7:18 Alan Modra
  0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2024-04-19  7:18 UTC (permalink / raw)
  To: binutils-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=9cf3c87e166b2f3728ae5c50c501f64f385e349e

commit 9cf3c87e166b2f3728ae5c50c501f64f385e349e
Author: Alan Modra <amodra@gmail.com>
Date:   Fri Apr 19 16:35:30 2024 +0930

    Re: elf: Strip unreferenced weak undefined symbols
    
            PR ld/31652
            * elflink.c (_bfd_elf_link_output_relocs): Don't segfault
            on NULL rel_hash.

Diff:
---
 bfd/elflink.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/bfd/elflink.c b/bfd/elflink.c
index 4f72d1b2a90..6db6a9c0b47 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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-04-19  7:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-19  7:18 [binutils-gdb] Re: elf: Strip unreferenced weak undefined symbols Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).