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);
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,