mirror of
https://github.com/netwide-assembler/nasm.git
synced 2024-11-27 08:10:07 +08:00
output/legacy.c: OUT_SEGMENT -> OUT_ADDRESS with a zero addend
The legacy output doesn't distinguish between segments and other addresses, so we need to force the offset to zero before passing it down to the output layer. This addresses BR 3392406. Reported-by: <rugxulo@gmail.com> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
parent
08e71e7dc4
commit
217e714e6b
@ -495,7 +495,7 @@ static inline void out_segment(struct out_data *data,
|
||||
data->type = OUT_SEGMENT;
|
||||
data->sign = OUT_UNSIGNED;
|
||||
data->size = 2;
|
||||
data->toffset = opx->offset;
|
||||
data->toffset = opx->offset; /* Is this really needed/wanted? */
|
||||
data->tsegment = ofmt->segbase(opx->segment + 1);
|
||||
data->twrt = opx->wrt;
|
||||
out(data);
|
||||
|
@ -89,7 +89,9 @@ void nasm_do_legacy_output(const struct out_data *data)
|
||||
|
||||
case OUT_SEGMENT:
|
||||
type = OUT_ADDRESS;
|
||||
/* fall through */
|
||||
dptr = &zero_buffer;
|
||||
size = (data->sign == OUT_SIGNED) ? -data->size : data->size;
|
||||
break;
|
||||
|
||||
case OUT_ADDRESS:
|
||||
dptr = &data->toffset;
|
||||
|
Loading…
Reference in New Issue
Block a user