aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorSergey Belyashov <sergey.belyashov@gmail.com>2021-05-10 13:36:08 +0100
committerNick Clifton <nickc@redhat.com>2021-05-10 13:36:08 +0100
commite4b1ab2062e1d8458167534881248d5555bd82fa (patch)
tree3e32531db72d589a06a13dd618518ad345f28e33 /gas
parent749c700282097cf679ff019a9674d7c762f48619 (diff)
downloadgdb-e4b1ab2062e1d8458167534881248d5555bd82fa.zip
gdb-e4b1ab2062e1d8458167534881248d5555bd82fa.tar.gz
gdb-e4b1ab2062e1d8458167534881248d5555bd82fa.tar.bz2
Add support for 8-bit and 24-bit shifts in the z80 assembler.
PR 27415 * config/tc-z80.c (emit_data_val): Add support for 8-bit and 24-bit shifts. * testsuite/gas/z80/z80_reloc.a: Update tests. * testsuite/gas/z80/z80_reloc.d: Update expected disassembly.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog8
-rw-r--r--gas/config/tc-z80.c17
-rw-r--r--gas/testsuite/gas/z80/z80_reloc.d5
-rw-r--r--gas/testsuite/gas/z80/z80_reloc.s7
4 files changed, 35 insertions, 2 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 5892659..4b89aae 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,11 @@
+2021-05-10 Sergey Belyashov <sergey.belyashov@gmail.com>
+
+ PR 27415
+ * config/tc-z80.c (emit_data_val): Add support for 8-bit and
+ 24-bit shifts.
+ * testsuite/gas/z80/z80_reloc.a: Update tests.
+ * testsuite/gas/z80/z80_reloc.d: Update expected disassembly.
+
2021-05-08 Mike Frysinger <vapier@gentoo.org>
* doc/Makefile.am (html-local, as/index.html): New targets.
diff --git a/gas/config/tc-z80.c b/gas/config/tc-z80.c
index e9c664d..b43a34f 100644
--- a/gas/config/tc-z80.c
+++ b/gas/config/tc-z80.c
@@ -1177,6 +1177,23 @@ emit_data_val (expressionS * val, int size)
{
case 0: r_type = BFD_RELOC_Z80_WORD0; break;
case 16: r_type = BFD_RELOC_Z80_WORD1; break;
+ case 8:
+ case 24: /* add two byte fixups */
+ val->X_op = O_symbol;
+ val->X_op_symbol = NULL;
+ val->X_add_number = 0;
+ if (shift == 8)
+ {
+ fix_new_exp (frag_now, p++ - frag_now->fr_literal, 1, val, false,
+ BFD_RELOC_Z80_BYTE1);
+ /* prepare to next byte */
+ r_type = BFD_RELOC_Z80_BYTE2;
+ }
+ else
+ r_type = BFD_RELOC_Z80_BYTE3; /* high byte will be 0 */
+ size = 1;
+ simplify = false;
+ break;
default: simplify = false;
}
}
diff --git a/gas/testsuite/gas/z80/z80_reloc.d b/gas/testsuite/gas/z80/z80_reloc.d
index 7a17617..8ca3b52 100644
--- a/gas/testsuite/gas/z80/z80_reloc.d
+++ b/gas/testsuite/gas/z80/z80_reloc.d
@@ -24,4 +24,9 @@ OFFSET[ ]+TYPE[ ]+VALUE\s*
0000002a[ ]+r_byte1[ ]+data16
0000002b[ ]+r_word0[ ]+data32
0000002d[ ]+r_word1[ ]+data32
+0000002f[ ]+r_byte3[ ]+data32
+00000031[ ]+r_byte1[ ]+data24
+00000032[ ]+r_byte2[ ]+data24
+00000033[ ]+r_byte1[ ]+data32
+00000034[ ]+r_byte2[ ]+data32
#pass
diff --git a/gas/testsuite/gas/z80/z80_reloc.s b/gas/testsuite/gas/z80/z80_reloc.s
index 52d0335..0b75c55 100644
--- a/gas/testsuite/gas/z80/z80_reloc.s
+++ b/gas/testsuite/gas/z80/z80_reloc.s
@@ -25,10 +25,13 @@
.L_label:
.db data8
.dw data16
- .d24 data24
- .d32 data32
+ .d24 data24
+ .d32 data32
.db data16 & 0xff
.db data16 >> 8
.dw data32 & 0xffff
.dw data32 >> 16
+ .dw data32 >> 24
+ .dw data24 >> 8
+ .dw data32 >> 8
.end