From 15ce78fc5b968c750d005a3287d3419e3a994094 Mon Sep 17 00:00:00 2001 From: Cyrill Gorcunov Date: Fri, 6 Jan 2017 20:21:28 +0300 Subject: [PATCH] macros: Define ofmt specific macros late In commits e1f985c1674951 and f7606613d047ff we reordered macros handling, but ofmt specific macros are to be handled after standart ones are processed. In particular __SECT__ handling must not change, so the order of inclusion does matter. https://bugzilla.nasm.us/show_bug.cgi?id=3392376 Signed-off-by: Cyrill Gorcunov --- asm/preproc.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/asm/preproc.c b/asm/preproc.c index 24dbc357..ee91d15b 100644 --- a/asm/preproc.c +++ b/asm/preproc.c @@ -444,6 +444,7 @@ static uint64_t nested_rep_count; static macros_t *stdmacpos; static macros_t **stdmacnext; static macros_t *stdmacros[8]; +static macros_t *extrastdmac; /* * Tokens are allocated in blocks to improve speed @@ -4969,6 +4970,9 @@ pp_reset(char *file, int apass, StrList **deplist) pp_add_stdmac(nasm_stdmac_nasm); pp_add_stdmac(nasm_stdmac_version); + if (extrastdmac) + pp_add_stdmac(extrastdmac); + stdmacpos = stdmacros[0]; stdmacnext = &stdmacros[1]; @@ -5362,6 +5366,11 @@ static void pp_add_stdmac(macros_t *macros) *mp = macros; } +static void pp_extra_stdmac(macros_t *macros) +{ + extrastdmac = macros; +} + static void make_tok_num(Token * tok, int64_t val) { char numbuf[32]; @@ -5403,7 +5412,7 @@ const struct preproc_ops nasmpp = { pp_reset, pp_getline, pp_cleanup, - pp_add_stdmac, + pp_extra_stdmac, pp_pre_define, pp_pre_undefine, pp_pre_include, -- 2.11.4.GIT