public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@gmail.com>
To: binutils@sourceware.org
Subject: Re: mips_gprel_reloc segfault
Date: Fri, 3 Jun 2022 13:17:50 +0930	[thread overview]
Message-ID: <YpmEZpq65NpuRi0d@squeak.grove.modra.org> (raw)
In-Reply-To: <Ypl7iTo8+TZxs3q/@squeak.grove.modra.org>

Similarly for the elf mips support.

	* elf32-mips.c (mips_elf_final_gp): Don't segfault on symbols
	in any of the bfd_is_const_section sections.
	* elf64-mips.c (mips_elf64_final_gp): Likewise.
	* elfn32-mips.c (mips_elf_final_gp): Likewise.

diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c
index a4c88c6b089..8989011edc9 100644
--- a/bfd/elf32-mips.c
+++ b/bfd/elf32-mips.c
@@ -1720,8 +1720,7 @@ static bfd_reloc_status_type
 mips_elf_final_gp (bfd *output_bfd, asymbol *symbol, bool relocatable,
 		   char **error_message, bfd_vma *pgp)
 {
-  if (bfd_is_und_section (symbol->section)
-      && ! relocatable)
+  if (output_bfd == NULL)
     {
       *pgp = 0;
       return bfd_reloc_undefined;
diff --git a/bfd/elf64-mips.c b/bfd/elf64-mips.c
index 6fa9d44300c..7f6f7ef0053 100644
--- a/bfd/elf64-mips.c
+++ b/bfd/elf64-mips.c
@@ -3427,8 +3427,7 @@ static bfd_reloc_status_type
 mips_elf64_final_gp (bfd *output_bfd, asymbol *symbol, bool relocatable,
 		     char **error_message, bfd_vma *pgp)
 {
-  if (bfd_is_und_section (symbol->section)
-      && ! relocatable)
+  if (output_bfd == NULL)
     {
       *pgp = 0;
       return bfd_reloc_undefined;
diff --git a/bfd/elfn32-mips.c b/bfd/elfn32-mips.c
index 1ae51a4648c..07b753f0cc1 100644
--- a/bfd/elfn32-mips.c
+++ b/bfd/elfn32-mips.c
@@ -3254,8 +3254,7 @@ static bfd_reloc_status_type
 mips_elf_final_gp (bfd *output_bfd, asymbol *symbol, bool relocatable,
 		   char **error_message, bfd_vma *pgp)
 {
-  if (bfd_is_und_section (symbol->section)
-      && ! relocatable)
+  if (output_bfd == NULL)
     {
       *pgp = 0;
       return bfd_reloc_undefined;

-- 
Alan Modra
Australia Development Lab, IBM

      reply	other threads:[~2022-06-03  3:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-03  3:10 Alan Modra
2022-06-03  3:47 ` Alan Modra [this message]

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=YpmEZpq65NpuRi0d@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).