From: Sergey Belyashov Date: Mon, 10 May 2021 12:36:08 +0000 (+0100) Subject: Add support for 8-bit and 24-bit shifts in the z80 assembler. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e4b1ab2062e1d8458167534881248d5555bd82fa;p=binutils-gdb.git 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. --- diff --git a/gas/ChangeLog b/gas/ChangeLog index 5892659c905..4b89aae25cc 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,11 @@ +2021-05-10 Sergey Belyashov + + 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 * 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 e9c664db63e..b43a34f3dfb 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 7a17617ebac..8ca3b52dedd 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 52d0335365e..0b75c55bb18 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