From: "H.J. Lu" <hjl.tools@gmail.com>
To: Alan Modra <amodra@gmail.com>, binutils@sourceware.org
Subject: Re: [binutils-gdb] LTO: Handle __real_SYM reference in IR
Date: Wed, 4 May 2022 17:02:38 -0700 [thread overview]
Message-ID: <CAMe9rOpjU3t5zT10nmOYvsyu2X7xpN1gwuDw_ebQBSPSo+drhA@mail.gmail.com> (raw)
In-Reply-To: <YnMPjeTHLqo+tdon@squeak.grove.modra.org>
[-- 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
parent reply other threads:[~2022-05-05 0:03 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <YnMPjeTHLqo+tdon@squeak.grove.modra.org>]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAMe9rOpjU3t5zT10nmOYvsyu2X7xpN1gwuDw_ebQBSPSo+drhA@mail.gmail.com \
--to=hjl.tools@gmail.com \
--cc=amodra@gmail.com \
--cc=binutils@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).