public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@gmail.com>
To: binutils@sourceware.org
Subject: riscv64-pei uninitialised data writing relocs
Date: Thu, 25 Jan 2024 10:08:40 +1030	[thread overview]
Message-ID: <ZbGfgJ8PBNvw3e67@squeak.grove.modra.org> (raw)

Without this patch the r_offset field of struct external_reloc is
uninitialised when using objcopy.

Please note that riscv64-pei is only useful for obcopy, objump, nm and
the other tools in the binutils directory.  gas and ld are not
supported.

	* coff/riscv64.h (SWAP_IN_RELOC_OFFSET): Define.
	(SWAP_OUT_RELOC_OFFSET): Define.

diff --git a/include/coff/riscv64.h b/include/coff/riscv64.h
index 1a1d6f37c7d..dfff497bc1b 100644
--- a/include/coff/riscv64.h
+++ b/include/coff/riscv64.h
@@ -60,5 +60,7 @@ struct external_reloc
 
 #define RELOC struct external_reloc
 #define RELSZ 14
+#define SWAP_IN_RELOC_OFFSET	H_GET_32
+#define SWAP_OUT_RELOC_OFFSET	H_PUT_32
 
 #endif /* COFF_RISCV64_H */

-- 
Alan Modra
Australia Development Lab, IBM

                 reply	other threads:[~2024-01-24 23:38 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=ZbGfgJ8PBNvw3e67@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).