Add support for 8-bit and 24-bit shifts in the z80 assembler.
authorSergey Belyashov <sergey.belyashov@gmail.com>
Mon, 10 May 2021 12:36:08 +0000 (13:36 +0100)
committerNick Clifton <nickc@redhat.com>
Mon, 10 May 2021 12:36:08 +0000 (13:36 +0100)
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.

gas/ChangeLog
gas/config/tc-z80.c
gas/testsuite/gas/z80/z80_reloc.d
gas/testsuite/gas/z80/z80_reloc.s

index 5892659c9052982caf6fb0c15d8f84b9f33a7ad5..4b89aae25cc314062d13dadc45fff7866e2cbfac 100644 (file)
@@ -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.
index e9c664db63e5d49c89c3017cef3a70955e3e633d..b43a34f3dfb0d772dcd7a978c3101280500aea08 100644 (file)
@@ -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;
            }
        }
index 7a17617ebacf4e72f13fa13debad613820974b84..8ca3b52deddc4ffa15a93ff0b45100cff05e0acd 100644 (file)
@@ -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
index 52d0335365e0635ad39cc75bde47dc900b56517b..0b75c55bb186f973d4b22879202eebec3b91ecb0 100644 (file)
 .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