From: Alan Modra <amodra@gmail.com>
To: binutils@sourceware.org
Subject: mips_gprel_reloc segfault
Date: Fri, 3 Jun 2022 12:40:01 +0930 [thread overview]
Message-ID: <Ypl7iTo8+TZxs3q/@squeak.grove.modra.org> (raw)
Not just the undefined section has a NULL owner, the absolute section
has too. Which means we can't find output_bfd for __gp. Also, may as
well test directly for output_bfd == NULL.
* coff-mips.c (mips_gprel_reloc): Don't segfault on any of
bfd_is_const_section sections.
diff --git a/bfd/coff-mips.c b/bfd/coff-mips.c
index 9614d338abe..d4dc1bd3c19 100644
--- a/bfd/coff-mips.c
+++ b/bfd/coff-mips.c
@@ -593,11 +593,10 @@ mips_gprel_reloc (bfd *abfd ATTRIBUTE_UNUSED,
{
relocatable = false;
output_bfd = symbol->section->output_section->owner;
+ if (output_bfd == NULL)
+ return bfd_reloc_undefined;
}
- if (bfd_is_und_section (symbol->section) && ! relocatable)
- return bfd_reloc_undefined;
-
/* We have to figure out the gp value, so that we can adjust the
symbol value correctly. We look up the symbol _gp in the output
BFD. If we can't find it, we're stuck. We cache it in the ECOFF
--
Alan Modra
Australia Development Lab, IBM
next reply other threads:[~2022-06-03 3:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-03 3:10 Alan Modra [this message]
2022-06-03 3:47 ` Alan Modra
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=Ypl7iTo8+TZxs3q/@squeak.grove.modra.org \
--to=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).