From cfe7a19169f54ce3a007f850b7adccbaec62d00a Mon Sep 17 00:00:00 2001 From: Sergey Belyashov Date: Tue, 11 May 2021 10:57:04 +0100 Subject: [PATCH] Report illegal Z80 load instructions. PR 27823 * config/tc-z80.c (emit_ld_r_m): Report an illegal load instruction. * testsuite/gas/z80/ill_ops.s: New test source file. * testsuite/gas/z80/ill_ops.d: New test driver. * testsuite/gas/z80/ill_ops.l: New test error output. --- gas/ChangeLog | 9 +++++++ gas/config/tc-z80.c | 2 ++ gas/testsuite/gas/z80/ill_ops.d | 3 +++ gas/testsuite/gas/z80/ill_ops.l | 39 ++++++++++++++++++++++++++++++ gas/testsuite/gas/z80/ill_ops.s | 42 +++++++++++++++++++++++++++++++++ 5 files changed, 95 insertions(+) create mode 100644 gas/testsuite/gas/z80/ill_ops.d create mode 100644 gas/testsuite/gas/z80/ill_ops.l create mode 100644 gas/testsuite/gas/z80/ill_ops.s diff --git a/gas/ChangeLog b/gas/ChangeLog index 4b89aae25cc..459da066846 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,12 @@ +2021-05-11 Sergey Belyashov + + PR 27823 + * config/tc-z80.c (emit_ld_r_m): Report an illegal load + instruction. + * testsuite/gas/z80/ill_ops.s: New test source file. + * testsuite/gas/z80/ill_ops.d: New test driver. + * testsuite/gas/z80/ill_ops.l: New test error output. + 2021-05-10 Sergey Belyashov PR 27415 diff --git a/gas/config/tc-z80.c b/gas/config/tc-z80.c index b43a34f3dfb..2146e675672 100644 --- a/gas/config/tc-z80.c +++ b/gas/config/tc-z80.c @@ -2391,6 +2391,8 @@ emit_ld_r_m (expressionS *dst, expressionS *src) *q = (ins_ok & INS_GBZ80) ? 0xFA : 0x3A; emit_word (src); } + else + ill_op (); } } diff --git a/gas/testsuite/gas/z80/ill_ops.d b/gas/testsuite/gas/z80/ill_ops.d new file mode 100644 index 00000000000..869debf58a1 --- /dev/null +++ b/gas/testsuite/gas/z80/ill_ops.d @@ -0,0 +1,3 @@ +#as: +#name: illegal operations +#error_output: ill_ops.l diff --git a/gas/testsuite/gas/z80/ill_ops.l b/gas/testsuite/gas/z80/ill_ops.l new file mode 100644 index 00000000000..8d8feb3e610 --- /dev/null +++ b/gas/testsuite/gas/z80/ill_ops.l @@ -0,0 +1,39 @@ +[^:]*: Assembler messages: +[^:]*:2: Error: illegal operand +[^:]*:3: Error: illegal operand +[^:]*:4: Error: illegal operand +[^:]*:5: Error: illegal operand +[^:]*:6: Error: illegal operand +[^:]*:7: Error: illegal operand +[^:]*:8: Error: illegal operand +[^:]*:9: Error: illegal operand +[^:]*:10: Error: illegal operand +[^:]*:11: Error: illegal operand +[^:]*:12: Error: illegal operand +[^:]*:13: Error: illegal operand +[^:]*:14: Error: illegal operand +[^:]*:15: Error: illegal operand +[^:]*:16: Error: illegal operand +[^:]*:17: Error: illegal operand +[^:]*:18: Error: illegal operand +[^:]*:19: Error: illegal operand +[^:]*:20: Error: illegal operand +[^:]*:21: Error: illegal operand +[^:]*:22: Error: illegal operand +[^:]*:23: Error: illegal operand +[^:]*:24: Error: illegal operand +[^:]*:25: Error: illegal operand +[^:]*:26: Error: illegal operand +[^:]*:27: Error: illegal operand +[^:]*:28: Error: illegal operand +[^:]*:29: Error: illegal operand +[^:]*:30: Error: illegal operand +[^:]*:31: Error: illegal operand +[^:]*:32: Error: illegal operand +[^:]*:33: Error: illegal operand +[^:]*:34: Error: illegal operand +[^:]*:35: Error: illegal operand +[^:]*:36: Error: illegal operand +[^:]*:37: Error: illegal operand +[^:]*:38: Error: illegal operand +[^:]*:39: Error: illegal operand diff --git a/gas/testsuite/gas/z80/ill_ops.s b/gas/testsuite/gas/z80/ill_ops.s new file mode 100644 index 00000000000..13e56376fb8 --- /dev/null +++ b/gas/testsuite/gas/z80/ill_ops.s @@ -0,0 +1,42 @@ +.text + ld b,(var) + ld c,(var) + ld d,(var) + ld e,(var) + ld h,(var) + ld l,(var) + ld (var),(var) + ld (var),b + ld (var),c + ld (var),d + ld (var),h + ld (var),l + ld (var),10 + ld 10,(var) + ld b,(bc) + ld c,(bc) + ld d,(bc) + ld e,(bc) + ld h,(bc) + ld l,(bc) + ld (bc),b + ld (bc),c + ld (bc),d + ld (bc),e + ld (bc),h + ld (bc),l + ld b,(de) + ld c,(de) + ld d,(de) + ld e,(de) + ld h,(de) + ld l,(de) + ld (de),b + ld (de),c + ld (de),d + ld (de),e + ld (de),h + ld (de),l +.bss +var: + .db 10 -- 2.30.2