[nasm:nasm-2.16.xx] output/legacy: when converting OUT_SEGMENT, clear the offset

nasm-bot for H. Peter Anvin hpa at zytor.com
Mon Oct 16 17:27:03 PDT 2023


Commit-ID:  21c977e717d7ecea03275810dcc11c082d4f20f0
Gitweb:     http://repo.or.cz/w/nasm.git?a=commitdiff;h=21c977e717d7ecea03275810dcc11c082d4f20f0
Author:     H. Peter Anvin <hpa at zytor.com>
AuthorDate: Mon, 16 Oct 2023 17:12:25 -0700
Committer:  H. Peter Anvin <hpa at zytor.com>
CommitDate: Mon, 16 Oct 2023 17:19:45 -0700

output/legacy: when converting OUT_SEGMENT, clear the offset

Legacy backends like obj/omf may depend on the offset being zero if
not in use.

Reported-by: Bernd Boeckmann <bernd-freedos at boeckmann.io>
Reported-by: Vladimir Chebotarev <vladimir.chebotarev at gmail.com>
Signed-off-by: H. Peter Anvin <hpa at zytor.com>


---
 output/legacy.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/output/legacy.c b/output/legacy.c
index 15d22e9e..f75291f5 100644
--- a/output/legacy.c
+++ b/output/legacy.c
@@ -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.
  *
@@ -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;


More information about the Nasm-commits mailing list