arm-asm: Raise error if user tries to use PC for offset register of single data transfer

This commit is contained in:
Danny Milosavljevic 2021-01-12 15:51:07 +01:00
parent 007839597f
commit 757eccd1d2
No known key found for this signature in database
GPG key ID: E71A35542C30BAA5

View file

@ -1016,6 +1016,10 @@ static void asm_single_data_transfer_opcode(TCCState *s1, int token)
} }
parse_operand(s1, &ops[2]); parse_operand(s1, &ops[2]);
if (ops[2].type == OP_REG32) { if (ops[2].type == OP_REG32) {
if (ops[2].reg == 15) {
tcc_error("Using 'pc' for register offset in '%s' is not implemented by ARM", get_tok_str(token, NULL));
return;
}
if (tok == ',') { if (tok == ',') {
next(); next();
opcode |= asm_parse_optional_shift(s1, &nb_shift, &shift); opcode |= asm_parse_optional_shift(s1, &nb_shift, &shift);