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>
This commit is contained in:
H. Peter Anvin, Intel 2018-06-25 12:58:49 -07:00
parent bc77f9c587
commit 87d9e626c3

View File

@ -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();