From 88a049aca1f4e1ce8a072d0f1757a4de1dfb0608 Mon Sep 17 00:00:00 2001 From: Stanislav Karchebny Date: Wed, 24 Sep 2003 10:30:56 +0000 Subject: [PATCH] Added _NASM_FORMAT_ macro --- CHANGES | 4 ++++ output/outaout.c | 1 + output/outas86.c | 1 + output/outbin.c | 1 + output/outcoff.c | 1 + output/outelf.c | 1 + output/outobj.c | 1 + output/outrdf.c | 1 + output/outrdf2.c | 1 + test/nasmformat.asm | 14 ++++++++++++++ 10 files changed, 26 insertions(+) create mode 100644 test/nasmformat.asm diff --git a/CHANGES b/CHANGES index c4843da..8bef6dd 100644 --- a/CHANGES +++ b/CHANGES @@ -3,6 +3,10 @@ * "make spotless" no longer deletes config.h.in. * Unterminated string auto termination. * %(el)if(n)idn insensitivity to string quotes difference (#809300). +* _NASM_FORMAT_ now gives output format chosen for compiling. + See test/nasmformat.asm for details and output/out*.c for actual values + for this macro. + !!NEEDS DOCUMENTING!! 0.98.38 ------- diff --git a/output/outaout.c b/output/outaout.c index 24e2b58..495e9ac 100644 --- a/output/outaout.c +++ b/output/outaout.c @@ -877,6 +877,7 @@ static void aout_filename (char *inname, char *outname, efunc error) static const char *aout_stdmac[] = { "%define __SECT__ [section .text]", + "%define _NASM_FORMAT_ 'aout'", "%macro __NASM_CDecl__ 1", "%endmacro", NULL diff --git a/output/outas86.c b/output/outas86.c index 3026ad9..b623a15 100644 --- a/output/outas86.c +++ b/output/outas86.c @@ -555,6 +555,7 @@ static void as86_filename (char *inname, char *outname, efunc error) static const char *as86_stdmac[] = { "%define __SECT__ [section .text]", + "%define _NASM_FORMAT_ 'as86'", "%macro __NASM_CDecl__ 1", "%endmacro", NULL diff --git a/output/outbin.c b/output/outbin.c index 80be83c..72821ff 100644 --- a/output/outbin.c +++ b/output/outbin.c @@ -137,6 +137,7 @@ static char *infile, *outfile; static const char *bin_stdmac[] = { "%define __SECT__ [section .text]", + "%define _NASM_FORMAT_ 'bin'", "%imacro org 1+.nolist", "[org %1]", "%endmacro", diff --git a/output/outcoff.c b/output/outcoff.c index 856da58..655e3fc 100644 --- a/output/outcoff.c +++ b/output/outcoff.c @@ -820,6 +820,7 @@ static void coff_win32_filename (char *inname, char *outname, efunc error) static const char *coff_stdmac[] = { "%define __SECT__ [section .text]", + "%define _NASM_FORMAT_ 'coff'", "%macro __NASM_CDecl__ 1", "%endmacro", "%imacro export 1+.nolist", diff --git a/output/outelf.c b/output/outelf.c index 16c25d1..276feac 100644 --- a/output/outelf.c +++ b/output/outelf.c @@ -1225,6 +1225,7 @@ static void elf_filename (char *inname, char *outname, efunc error) static const char *elf_stdmac[] = { "%define __SECT__ [section .text]", + "%define _NASM_FORMAT_ 'elf'", "%macro __NASM_CDecl__ 1", "%define $_%1 $%1", "%endmacro", diff --git a/output/outobj.c b/output/outobj.c index 14b6cd9..188ff73 100644 --- a/output/outobj.c +++ b/output/outobj.c @@ -2285,6 +2285,7 @@ void obj_fwrite(ObjRecord *orp) static const char *obj_stdmac[] = { "%define __SECT__ [section .text]", + "%define _NASM_FORMAT_ 'obj'", "%imacro group 1+.nolist", "[group %1]", "%endmacro", diff --git a/output/outrdf.c b/output/outrdf.c index d9989e5..6ae492e 100644 --- a/output/outrdf.c +++ b/output/outrdf.c @@ -501,6 +501,7 @@ static void rdf_filename (char *inname, char *outname, efunc error) { static char *rdf_stdmac[] = { "%define __SECT__ [section .text]", + "%define _NASM_FORMAT_ 'oldrdf'", /* Its always oldrdf for consistency with rdf version 2 */ "%imacro library 1+.nolist", "[library %1]", "%endmacro", diff --git a/output/outrdf2.c b/output/outrdf2.c index 1dfef93..8fdf6a4 100644 --- a/output/outrdf2.c +++ b/output/outrdf2.c @@ -753,6 +753,7 @@ static void rdf2_filename (char *inname, char *outname, efunc error) { static const char *rdf2_stdmac[] = { "%define __SECT__ [section .text]", + "%define _NASM_FORMAT_ 'rdf'", "%imacro library 1+.nolist", "[library %1]", "%endmacro", diff --git a/test/nasmformat.asm b/test/nasmformat.asm new file mode 100644 index 0000000..decf090 --- /dev/null +++ b/test/nasmformat.asm @@ -0,0 +1,14 @@ + +%if _NASM_FORMAT_ == 'bin' + +db 'This is binary format file' + +%elif _NASM_FORMAT_ == 'obj' + +db 'This is object format file' + +%else + +db 'This is some other format file' + +%endif -- 2.7.4