mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-02-17 17:19:35 +08:00
Display warning for invalid RIP-relative addressing
This commit is contained in:
parent
3f9fc2a3a7
commit
f4e7a636a8
@ -2264,6 +2264,17 @@ static void gencode(struct out_data *data, insn *ins)
|
||||
rfield, rflags, ins, eat, &errmsg))
|
||||
nasm_nonfatal("%s", errmsg);
|
||||
|
||||
/* If RIP-relative, indexreg and scale must not be present:
|
||||
* [basereg + indexreg*scale + displacement]
|
||||
* https://bugzilla.nasm.us/show_bug.cgi?id=3392797
|
||||
*/
|
||||
if (bits == 64 && (opy->eaflags & EAF_REL) &&
|
||||
((opy->indexreg != -1) || (opy->scale != -1))) {
|
||||
nasm_warn(WARN_OTHER | ERR_PASS2,
|
||||
"invalid addressing mode: RIP-relative address "
|
||||
"cannot contain index register or scale");
|
||||
}
|
||||
|
||||
p = bytes;
|
||||
*p++ = ea_data.modrm;
|
||||
if (ea_data.sib_present)
|
||||
|
Loading…
Reference in New Issue
Block a user