aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2018-11-26 13:37:25 -0800
committerH. Peter Anvin <hpa@zytor.com>2018-11-26 13:41:37 -0800
commit4885cc2ba880e74d953bc859379358194f801cd1 (patch)
treeffed14f94aed3f9b7b82c71efd6c5612c004bc9a
parentfd143104694ff3d92a8639c2eaf42dabad79b64e (diff)
downloadnasm-4885cc2ba880e74d953bc859379358194f801cd1.tar.gz
nasm-4885cc2ba880e74d953bc859379358194f801cd1.tar.xz
nasm-4885cc2ba880e74d953bc859379358194f801cd1.zip
BR 3392532: outobj: fix forward references to the SEG of external symbols
External symbols are defined via deflabel(), but deflabel() is not called until pass0 == 1. Until that happens, segbase has no way to know what the proper segment base of the segment actually is. Thus, testing for pass0 == 0 will always fail for a forward reference; correct the test to test for pass0 < 2, i.e. the assert should fail only for the final code-generation pass. Reported-by: <stsp@list.ru> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--output/outobj.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/output/outobj.c b/output/outobj.c
index beb1615c..b4f2c499 100644
--- a/output/outobj.c
+++ b/output/outobj.c
@@ -1912,8 +1912,8 @@ static int32_t obj_segbase(int32_t segment)
if (eb) {
e = eb->exts[i];
if (!e) {
- nasm_assert(pass0 == 0);
- /* Not available - can happen during optimization */
+ /* Not available yet, probably a forward reference */
+ nasm_assert(pass0 < 2); /* Convergence failure */
return NO_SEG;
}