summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin, Intel <h.peter.anvin@intel.com>2018-06-25 12:58:49 -0700
committerH. Peter Anvin, Intel <h.peter.anvin@intel.com>2018-06-25 12:58:49 -0700
commit87d9e626c3218c04eb8b217f2e5cf0ed7a487ebe (patch)
treea3d9969fcf9c70a8271f948ad049080516f7f0ab
parentbc77f9c5874db1729bc1fae13d9bf38ba579d3d1 (diff)
downloadnasm-87d9e626c3218c04eb8b217f2e5cf0ed7a487ebe.tar.gz
nasm: need to call init_labels() before command line parsing
The prefix and suffix options call perm_alloc() in labels.c, which is not available until init_labels() have run. There is no reason not to call init_labels() early. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
-rw-r--r--asm/nasm.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/asm/nasm.c b/asm/nasm.c
index 6299831f..b851ac4c 100644
--- a/asm/nasm.c
+++ b/asm/nasm.c
@@ -424,6 +424,13 @@ int main(int argc, char **argv)
tolower_init();
src_init();
+ /*
+ * We must call init_labels() before the command line parsing,
+ * because we may be setting prefixes/suffixes from the command
+ * line.
+ */
+ init_labels();
+
offsets = raa_init();
forwrefs = saa_init((int32_t)sizeof(struct forwrefinfo));
@@ -553,13 +560,6 @@ int main(int argc, char **argv)
nasm_fatal(ERR_NOFILE,
"unable to open output file `%s'", outname);
- /*
- * We must call init_labels() before ofmt->init() since
- * some object formats will want to define labels in their
- * init routines. (eg OS/2 defines the FLAT group)
- */
- init_labels();
-
ofmt->init();
dfmt->init();