aboutsummaryrefslogtreecommitdiff
path: root/bfd/coff-z80.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2022-06-08 13:26:27 +0930
committerAlan Modra <amodra@gmail.com>2022-06-08 16:37:16 +0930
commit24d34d81eacbce13854d99f390240e6ad63d38a6 (patch)
treed5a765a5978fc0e6115d5f86a8a2e81d24daeb25 /bfd/coff-z80.c
parentff50916f8bce08829e3da5cc7d43c431105204c7 (diff)
downloadgdb-24d34d81eacbce13854d99f390240e6ad63d38a6.zip
gdb-24d34d81eacbce13854d99f390240e6ad63d38a6.tar.gz
gdb-24d34d81eacbce13854d99f390240e6ad63d38a6.tar.bz2
coff-z80 reloc howto fixes
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.
Diffstat (limited to 'bfd/coff-z80.c')
-rw-r--r--bfd/coff-z80.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/bfd/coff-z80.c b/bfd/coff-z80.c
index 1fefee4..fd3c84a 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;