mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-08-23 10:33:50 -04:00
assemble: for OUT_REL*ADR, the "size" argument is not really size...
For OUT_REL*ADR, the "size" argument is actually the offset inside the instruction; that is in fact why we encode the real size in the instruction itself. Thus, emit the offsets properly using this mechanism when generating relative EAs. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
parent
93c7aa2302
commit
0a20bcfaf1
13
assemble.c
13
assemble.c
@ -1811,14 +1811,17 @@ static void gencode(int32_t segment, int64_t offset, int bits,
|
|||||||
warn_overflow(ea_data.bytes, opx);
|
warn_overflow(ea_data.bytes, opx);
|
||||||
s += ea_data.bytes;
|
s += ea_data.bytes;
|
||||||
if (ea_data.rip) {
|
if (ea_data.rip) {
|
||||||
data -= insn_end - (offset+ea_data.bytes);
|
out(offset, segment, &data,
|
||||||
type = OUT_REL4ADR;
|
OUT_REL4ADR, insn_end - offset,
|
||||||
|
ins->oprs[(c >> 3) & 7].segment,
|
||||||
|
ins->oprs[(c >> 3) & 7].wrt);
|
||||||
} else {
|
} else {
|
||||||
type = OUT_ADDRESS;
|
type = OUT_ADDRESS;
|
||||||
|
out(offset, segment, &data,
|
||||||
|
OUT_ADDRESS, ea_data.bytes,
|
||||||
|
ins->oprs[(c >> 3) & 7].segment,
|
||||||
|
ins->oprs[(c >> 3) & 7].wrt);
|
||||||
}
|
}
|
||||||
out(offset, segment, &data, type, ea_data.bytes,
|
|
||||||
ins->oprs[(c >> 3) & 7].segment,
|
|
||||||
ins->oprs[(c >> 3) & 7].wrt);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
offset += s;
|
offset += s;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user