Skip to content

Commit

Permalink
output/legacy: when converting OUT_SEGMENT, clear the offset
Browse files Browse the repository at this point in the history
Legacy backends like obj/omf may depend on the offset being zero if
not in use.

Reported-by: Bernd Boeckmann <[email protected]>
Reported-by: Vladimir Chebotarev <[email protected]>
Signed-off-by: H. Peter Anvin <[email protected]>
  • Loading branch information
H. Peter Anvin committed Oct 17, 2023
1 parent 7d5e549 commit 21c977e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions output/legacy.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------- *
*
* Copyright 2016-2022 The NASM Authors - All Rights Reserved
* Copyright 2016-2023 The NASM Authors - All Rights Reserved
* See the file AUTHORS included with the NASM distribution for
* the specific copyright holders.
*
Expand Down Expand Up @@ -89,8 +89,11 @@ void nasm_do_legacy_output(const struct out_data *data)

case OUT_SEGMENT:
type = OUT_ADDRESS;
tsegment |= 1;
/* fall through */
if (tsegment != NO_SEG && tsegment < SEG_ABS)
tsegment |= 1;
dptr = zero_buffer;
size = data->size;
break;

case OUT_ADDRESS:
dptr = &data->toffset;
Expand Down

0 comments on commit 21c977e

Please sign in to comment.