public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@gmail.com>
To: binutils@sourceware.org
Subject: segv in coff_aarch64_addr32nb_reloc
Date: Fri, 27 Jan 2023 08:21:20 +1030	[thread overview]
Message-ID: <Y9L12EZ4fvTcwQj1@squeak.grove.modra.org> (raw)

	* coff-aarch64.c (coff_aarch64_addr32nb_reloc): When output_bfd
	is NULL (which it is for objdump -W) get the output bfd via the
	input section.

diff --git a/bfd/coff-aarch64.c b/bfd/coff-aarch64.c
index 12e242e18d0..659cd4f162d 100644
--- a/bfd/coff-aarch64.c
+++ b/bfd/coff-aarch64.c
@@ -189,9 +189,10 @@ coff_aarch64_addr32nb_reloc (bfd *abfd,
 		       + symbol->section->output_section->vma);
       bfd_vma addend = bfd_getl_signed_32 (data + reloc_entry->address);
       relocation += addend;
-      if (bfd_get_flavour (output_bfd) == bfd_target_coff_flavour
-	  && obj_pe (output_bfd))
-	relocation -= pe_data (output_bfd)->pe_opthdr.ImageBase;
+      bfd *obfd = input_section->output_section->owner;
+      if (bfd_get_flavour (obfd) == bfd_target_coff_flavour
+	  && obj_pe (obfd))
+	relocation -= pe_data (obfd)->pe_opthdr.ImageBase;
       else
 	{
 	  *error_message = "unsupported";

-- 
Alan Modra
Australia Development Lab, IBM

                 reply	other threads:[~2023-01-26 21:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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