* Re: [binutils-gdb] LTO: Handle __real_SYM reference in IR
[not found] ` <YnMPjeTHLqo+tdon@squeak.grove.modra.org>
@ 2022-05-05 0:02 ` H.J. Lu
0 siblings, 0 replies; only message in thread
From: H.J. Lu @ 2022-05-05 0:02 UTC (permalink / raw)
To: Alan Modra, binutils
[-- Attachment #1: Type: text/plain, Size: 633 bytes --]
On Wed, May 4, 2022 at 4:43 PM Alan Modra <amodra@gmail.com> wrote:
>
> On Wed, May 04, 2022 at 11:27:56PM +0000, H.J. Lu via Binutils-cvs wrote:
> > --- a/bfd/linker.c
> > +++ b/bfd/linker.c
> > @@ -599,6 +599,7 @@ bfd_wrapped_link_hash_lookup (bfd *abfd,
> > n[1] = '\0';
> > strcat (n, l + sizeof REAL - 1);
> > h = bfd_link_hash_lookup (info->hash, n, create, true, follow);
> > + h->ref_real = 1;
> > free (n);
> > return h;
> > }
>
> Do you need "if (h != NULL)" here before setting ref_real? I suspect
> you do.
>
You are right. I am checking in this.
Thanks.
--
H.J.
[-- Attachment #2: 0001-bfd-Check-NULL-pointer-before-setting-ref_real.patch --]
[-- Type: text/x-patch, Size: 796 bytes --]
From 1accb102b68c2fdeaec487f44a18adb14f0c5b12 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Wed, 4 May 2022 17:00:15 -0700
Subject: [PATCH] bfd: Check NULL pointer before setting ref_real
PR ld/29086
* linker.c (bfd_wrapped_link_hash_lookup): Check NULL pointer
before setting ref_real.
---
bfd/linker.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/bfd/linker.c b/bfd/linker.c
index e9ebdbad040..0c2e3c10a67 100644
--- a/bfd/linker.c
+++ b/bfd/linker.c
@@ -599,7 +599,8 @@ bfd_wrapped_link_hash_lookup (bfd *abfd,
n[1] = '\0';
strcat (n, l + sizeof REAL - 1);
h = bfd_link_hash_lookup (info->hash, n, create, true, follow);
- h->ref_real = 1;
+ if (h != NULL)
+ h->ref_real = 1;
free (n);
return h;
}
--
2.35.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-05-05 0:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20220504232756.229053857379@sourceware.org>
[not found] ` <YnMPjeTHLqo+tdon@squeak.grove.modra.org>
2022-05-05 0:02 ` [binutils-gdb] LTO: Handle __real_SYM reference in IR H.J. Lu
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).