public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: John David Anglin <dave.anglin@bell.net>
To: Alan Modra <amodra@gmail.com>, John David Anglin <dave@parisc-linux.org>
Cc: Binutils <binutils@sourceware.org>
Subject: Re: [PATCH] Fix segmentation fault in bfd/elf32-hppa.c
Date: Fri, 15 Dec 2023 16:13:50 -0500	[thread overview]
Message-ID: <95453075-9b1a-417d-a5cf-536bbb614fd6@bell.net> (raw)
In-Reply-To: <ZXj0ZTGUXZkMic0F@squeak.grove.modra.org>

After retesting, I committed the following change.  Hopefully, there aren't
other types that need handling.

Dave
---

Fix segmentation fault in bfd/elf32-hppa.c

2023-12-15  John David Anglin  <danglin@gcc.gnu.org>

     PR ld/31148

bfd/ChangeLog:

     * elf32-hppa.c (elf32_hppa_finish_dynamic_symbol): Output
     relative reloc only when eh->root.type is bfd_link_hash_defined
     or bfd_link_hash_defweak.

diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c
index 44129c80138..d64ca7528a0 100644
--- a/bfd/elf32-hppa.c
+++ b/bfd/elf32-hppa.c
@@ -4216,7 +4216,9 @@ elf32_hppa_finish_dynamic_symbol (bfd *output_bfd,
           file, we just want to emit a RELATIVE reloc.  The entry
           in the global offset table will already have been
           initialized in the relocate_section function.  */
-      if (!is_dyn)
+      if (!is_dyn
+          && (eh->root.type == bfd_link_hash_defined
+          || eh->root.type == bfd_link_hash_defweak))
          {
            rela.r_info = ELF32_R_INFO (0, R_PARISC_DIR32);
            rela.r_addend = (eh->root.u.def.value


      reply	other threads:[~2023-12-15 21:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-12 17:21 John David Anglin
2023-12-13  0:01 ` Alan Modra
2023-12-15 21:13   ` John David Anglin [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=95453075-9b1a-417d-a5cf-536bbb614fd6@bell.net \
    --to=dave.anglin@bell.net \
    --cc=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=dave@parisc-linux.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).