diff options
author | H. Peter Anvin <hpa@zytor.com> | 2008-10-22 11:15:00 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2008-10-22 11:15:00 -0700 |
commit | e286c7e79c36ab0ad40349d89693bae52080b664 (patch) | |
tree | 2bf79243c0fd4d62c059bf4a19224ee3b5b6d129 /assemble.c | |
parent | 9cd543e5fd6616f3c7b4de641247a419f0435527 (diff) | |
download | nasm-e286c7e79c36ab0ad40349d89693bae52080b664.tar.gz nasm-e286c7e79c36ab0ad40349d89693bae52080b664.tar.bz2 nasm-e286c7e79c36ab0ad40349d89693bae52080b664.zip |
assemble: not all backends handle intra-segment OUT_REL*ADR
Not all backends can handle being handled an intrasegment OUT_REL*ADR,
and we don't fix them up in common code either (which would be the
logical thing to do -- right now we fix them up in a bunch of
individual places.)
For now, just fix up the one in address generation.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'assemble.c')
-rw-r--r-- | assemble.c | 15 |
1 files changed, 11 insertions, 4 deletions
@@ -1811,10 +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) { - out(offset, segment, &data, - OUT_REL4ADR, insn_end - offset, - ins->oprs[(c >> 3) & 7].segment, - ins->oprs[(c >> 3) & 7].wrt); + if (ins->oprs[(c >> 3) & 7].segment == segment) { + data -= insn_end; + out(offset, segment, &data, + OUT_ADDRESS, ea_data.bytes, + NO_SEG, NO_SEG); + } else { + 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, |