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>
This commit is contained in:
H. Peter Anvin 2008-10-22 11:15:00 -07:00
parent 9cd543e5fd
commit e286c7e79c

View File

@ -1811,10 +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) {
out(offset, segment, &data, if (ins->oprs[(c >> 3) & 7].segment == segment) {
OUT_REL4ADR, insn_end - offset, data -= insn_end;
ins->oprs[(c >> 3) & 7].segment, out(offset, segment, &data,
ins->oprs[(c >> 3) & 7].wrt); 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 { } else {
type = OUT_ADDRESS; type = OUT_ADDRESS;
out(offset, segment, &data, out(offset, segment, &data,