From 67b402fda4076a0bb6b73cd49014e9dc161606d3 Mon Sep 17 00:00:00 2001 From: Danny Milosavljevic Date: Sun, 27 Dec 2020 16:24:07 +0100 Subject: [PATCH] arm-asm: Raise an error if asm_binary_opcode is used with PC as operand --- arm-asm.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arm-asm.c b/arm-asm.c index 847a4f34..d6adc20d 100644 --- a/arm-asm.c +++ b/arm-asm.c @@ -217,11 +217,21 @@ static void asm_binary_opcode(TCCState *s1, int token) return; } + if (ops[0].reg == 15) { + tcc_error("'%s' does not support 'pc' as operand", get_tok_str(token, NULL)); + return; + } + if (ops[1].type != OP_REG32) { expect("(source operand) register"); return; } + if (ops[1].reg == 15) { + tcc_error("'%s' does not support 'pc' as operand", get_tok_str(token, NULL)); + return; + } + if (tok == ',') { next(); // skip ',' if (tok == TOK_ASM_ror) {