From: Alan Modra <amodra@gmail.com>
To: binutils@sourceware.org
Subject: coff-z80 reloc howto fixes
Date: Wed, 8 Jun 2022 21:26:27 +0930 [thread overview]
Message-ID: <YqCOa///7kExVbuf@squeak.grove.modra.org> (raw)
Mostly cosmetic unless attempting to link coff-z80 into another output
format.
* coff-z80.c (howto_table <R_IMM24, R_WORD0, R_WORD1>): Correct size.
(extra_case): Use bfd_{get,put}_24 when applying R_IMM24.
diff --git a/bfd/coff-z80.c b/bfd/coff-z80.c
index 1fefee44b13..fd3c84a196e 100644
--- a/bfd/coff-z80.c
+++ b/bfd/coff-z80.c
@@ -60,7 +60,7 @@ static bfd_howto_type howto_table[] =
BFD_HOWTO (BFD_RELOC_24,
R_IMM24, /* type */
0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 5, /* size (0 = byte, 1 = short, 2 = long) */
24, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
@@ -195,7 +195,7 @@ static bfd_howto_type howto_table[] =
BFD_HOWTO (BFD_RELOC_Z80_WORD0,
R_WORD0, /* type */
0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
@@ -210,7 +210,7 @@ static bfd_howto_type howto_table[] =
BFD_HOWTO (BFD_RELOC_Z80_WORD1,
R_WORD1, /* type */
16, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
@@ -405,11 +405,9 @@ extra_case (bfd *in_abfd,
case R_IMM24:
if (reloc->howto->partial_inplace)
- val += (bfd_get_16 ( in_abfd, data+*src_ptr)
- + (bfd_get_8 ( in_abfd, data+*src_ptr+2) << 16))
- & reloc->howto->src_mask;
- bfd_put_16 (in_abfd, val, data + *dst_ptr);
- bfd_put_8 (in_abfd, val >> 16, data + *dst_ptr+2);
+ val += (bfd_get_24 (in_abfd, data + *src_ptr)
+ & reloc->howto->src_mask);
+ bfd_put_24 (in_abfd, val, data + *dst_ptr);
(*dst_ptr) += 3;
(*src_ptr) += 3;
break;
--
Alan Modra
Australia Development Lab, IBM
reply other threads:[~2022-06-08 11:56 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=YqCOa///7kExVbuf@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).