From 13587802fe602556abe5c00b7a236bfbdd98a337 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Thu, 14 Jun 2018 16:42:03 -0700 Subject: [PATCH] segalloc: DO NOT reset segment numbers We are not supposed to reset the segment numbers; this was an attempted fix for a convergence bug that didn't actually exist. The backend is required to return the same segment number for the same segment; if it does not, the front end will not converge, but that is in fact the correct behavior. Signed-off-by: H. Peter Anvin --- asm/nasm.c | 4 ---- asm/segalloc.c | 15 --------------- include/nasmlib.h | 2 -- 3 files changed, 21 deletions(-) diff --git a/asm/nasm.c b/asm/nasm.c index b647556b..4e922b4a 100644 --- a/asm/nasm.c +++ b/asm/nasm.c @@ -1390,9 +1390,6 @@ static void assemble_file(const char *fname, StrList **depend_ptr) break; } - /* Any segment numbers allocated before this point are permanent */ - seg_alloc_setup_done(); - prev_offset_changed = nasm_limit[LIMIT_PASSES]; for (passn = 1; pass0 <= 2; passn++) { pass1 = pass0 == 2 ? 2 : 1; /* 1, 1, 1, ..., 1, 2 */ @@ -1409,7 +1406,6 @@ static void assemble_file(const char *fname, StrList **depend_ptr) } in_absolute = false; global_offset_changed = 0; /* set by redefine_label */ - seg_alloc_reset(); if (passn > 1) { saa_rewind(forwrefs); forwref = saa_rstruct(forwrefs); diff --git a/asm/segalloc.c b/asm/segalloc.c index 56544b42..6d7a4202 100644 --- a/asm/segalloc.c +++ b/asm/segalloc.c @@ -41,21 +41,6 @@ #include "insns.h" static int32_t next_seg = 2; -static int32_t seg_start = 2; - -void seg_alloc_reset(void) -{ - next_seg = seg_start; -} - -/* - * This gets called after special segments are allocated, typically by - * backends; this only gets done once. - */ -void seg_alloc_setup_done(void) -{ - seg_start = next_seg; -} int32_t seg_alloc(void) { diff --git a/include/nasmlib.h b/include/nasmlib.h index f25ef827..e57d0e6d 100644 --- a/include/nasmlib.h +++ b/include/nasmlib.h @@ -193,8 +193,6 @@ int64_t readstrnum(char *str, int length, bool *warn); /* * seg_alloc: allocate a hitherto unused segment number. */ -void seg_alloc_reset(void); -void seg_alloc_setup_done(void); int32_t seg_alloc(void); /*