From 3f37cacdd287c4ce86530a4af328bbb39184cb2a Mon Sep 17 00:00:00 2001 From: KO Myung-Hun Date: Fri, 29 Nov 2024 11:20:51 +0900 Subject: [PATCH] outobj: allow for segments in the group FLAT to belong to the other group It's possible that segments belong to both the group FLAT and the other group because the group FLAT is a pseudo group. Signed-off-by: KO Myung-Hun --- output/outobj.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/output/outobj.c b/output/outobj.c index b7168d095..ce108f150 100644 --- a/output/outobj.c +++ b/output/outobj.c @@ -1518,7 +1518,12 @@ static int32_t obj_segment(char *name, int *bits) nasm_free(grp->segs[i].name); grp->segs[i] = grp->segs[grp->nindices]; grp->segs[grp->nindices++].index = seg->obj_index; - if (seg->grp) + /* + * The group FLAT is a pseudo group. Therefore, it is + * allowed to redefine a segment in the group FLAT as + * other group. + */ + if (seg->grp && strcmp(seg->grp->name, "FLAT")) nasm_warn(WARN_OTHER, "segment `%s' is already part of" " a group: first one takes precedence", seg->name); @@ -1633,7 +1638,12 @@ obj_directive(enum directive directive, char *value) */ grp->segs[grp->nentries++] = grp->segs[grp->nindices]; grp->segs[grp->nindices++].index = seg->obj_index; - if (seg->grp) + /* + * The group FLAT is a pseudo group. Therefore, it is + * allowed to redefine a segment in the group FLAT as + * other group. + */ + if (seg->grp && strcmp(seg->grp->name, "FLAT")) nasm_warn(WARN_OTHER, "segment `%s' is already part of" " a group: first one takes precedence", seg->name);