diff options
author | H. Peter Anvin <hpa@zytor.com> | 2008-10-17 23:29:11 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2008-10-17 23:29:11 -0700 |
commit | 0a20bcfaf17fc78e97fc609bb60087529df79eea (patch) | |
tree | ccc218633a953026eb81849bbc81193626bb6465 /assemble.c | |
parent | 93c7aa23028c53e6ebf43861d2c778fb01fa895a (diff) | |
download | nasm-0a20bcfaf17fc78e97fc609bb60087529df79eea.tar.gz nasm-0a20bcfaf17fc78e97fc609bb60087529df79eea.tar.bz2 nasm-0a20bcfaf17fc78e97fc609bb60087529df79eea.zip |
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>
Diffstat (limited to 'assemble.c')
-rw-r--r-- | assemble.c | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -1811,14 +1811,17 @@ static void gencode(int32_t segment, int64_t offset, int bits, warn_overflow(ea_data.bytes, opx); s += ea_data.bytes; if (ea_data.rip) { - data -= insn_end - (offset+ea_data.bytes); - type = OUT_REL4ADR; + out(offset, segment, &data, + OUT_REL4ADR, insn_end - offset, + ins->oprs[(c >> 3) & 7].segment, + ins->oprs[(c >> 3) & 7].wrt); } else { 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; } offset += s; |