diff options
author | H. Peter Anvin <hpa@zytor.com> | 2008-06-20 15:20:16 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2008-06-20 15:20:16 -0700 |
commit | cfb7176ca211d2bdc8c790c1b49e6f29db42f777 (patch) | |
tree | 5c8749b99df0ac2a1b508d2e2e52248e3a170dc0 /output | |
parent | 76cbaa4b2e433ed78031dc75ae1b3183867c55ab (diff) | |
download | nasm-cfb7176ca211d2bdc8c790c1b49e6f29db42f777.tar.gz nasm-cfb7176ca211d2bdc8c790c1b49e6f29db42f777.tar.bz2 nasm-cfb7176ca211d2bdc8c790c1b49e6f29db42f777.zip |
Move the output format macros into the macros.pl mechanism
Move the handling of "extra" macros (i.e. output format macros) into
the macros.pl mechanism. This allows us to change the format of the
internal macro store in the future - e.g. to a single byte store
without redundant pointers.
Also, stop using indicies into a long array when there is no good
reason to not just use different arrays.
Diffstat (limited to 'output')
-rw-r--r-- | output/outaout.c | 7 | ||||
-rw-r--r-- | output/outaout.mac | 4 | ||||
-rw-r--r-- | output/outas86.c | 7 | ||||
-rw-r--r-- | output/outas86.mac | 4 | ||||
-rw-r--r-- | output/outbin.c | 10 | ||||
-rw-r--r-- | output/outbin.mac | 7 | ||||
-rw-r--r-- | output/outcoff.c | 13 | ||||
-rw-r--r-- | output/outcoff.mac | 10 | ||||
-rw-r--r-- | output/outelf.mac | 8 | ||||
-rw-r--r-- | output/outelf32.c | 12 | ||||
-rw-r--r-- | output/outelf64.c | 12 | ||||
-rw-r--r-- | output/outmacho.c | 7 | ||||
-rw-r--r-- | output/outmacho.mac | 4 | ||||
-rw-r--r-- | output/outobj.c | 19 | ||||
-rw-r--r-- | output/outobj.mac | 16 | ||||
-rw-r--r-- | output/outrdf.c | 10 | ||||
-rw-r--r-- | output/outrdf.mac | 7 | ||||
-rw-r--r-- | output/outrdf2.c | 13 | ||||
-rw-r--r-- | output/outrdf2.mac | 10 |
19 files changed, 82 insertions, 98 deletions
diff --git a/output/outaout.c b/output/outaout.c index 20658ac..f374b9e 100644 --- a/output/outaout.c +++ b/output/outaout.c @@ -905,12 +905,7 @@ static void aout_filename(char *inname, char *outname, efunc error) standard_extension(inname, outname, ".o", error); } -static const char *aout_stdmac[] = { - "%define __SECT__ [section .text]", - "%macro __NASM_CDecl__ 1", - "%endmacro", - NULL -}; +extern macros_t aout_stdmac[]; static int aout_set_info(enum geninfo type, char **val) { diff --git a/output/outaout.mac b/output/outaout.mac new file mode 100644 index 0000000..ef049a2 --- /dev/null +++ b/output/outaout.mac @@ -0,0 +1,4 @@ +OUT: aout +%define __SECT__ [section .text] +%macro __NASM_CDecl__ 1 +%endmacro diff --git a/output/outas86.c b/output/outas86.c index 9eb6847..b59fe6b 100644 --- a/output/outas86.c +++ b/output/outas86.c @@ -603,12 +603,7 @@ static void as86_filename(char *inname, char *outname, efunc error) standard_extension(inname, outname, ".o", error); } -static const char *as86_stdmac[] = { - "%define __SECT__ [section .text]", - "%macro __NASM_CDecl__ 1", - "%endmacro", - NULL -}; +extern macros_t as86_stdmac[]; static int as86_set_info(enum geninfo type, char **val) { diff --git a/output/outas86.mac b/output/outas86.mac new file mode 100644 index 0000000..1edf908 --- /dev/null +++ b/output/outas86.mac @@ -0,0 +1,4 @@ +OUT: as86 +%define __SECT__ [section .text] +%macro __NASM_CDecl__ 1 +%endmacro diff --git a/output/outbin.c b/output/outbin.c index d2b5742..e71a60e 100644 --- a/output/outbin.c +++ b/output/outbin.c @@ -139,15 +139,7 @@ static int origin_defined; static int map_control = 0; static char *infile, *outfile; -static const char *bin_stdmac[] = { - "%define __SECT__ [section .text]", - "%imacro org 1+.nolist", - "[org %1]", - "%endmacro", - "%macro __NASM_CDecl__ 1", - "%endmacro", - NULL -}; +extern macros_t bin_stdmac[]; static void add_reloc(struct Section *s, int32_t bytes, int32_t secref, int32_t secrel) diff --git a/output/outbin.mac b/output/outbin.mac new file mode 100644 index 0000000..d0ae2a3 --- /dev/null +++ b/output/outbin.mac @@ -0,0 +1,7 @@ +OUT: bin +%define __SECT__ [section .text] +%imacro org 1+.nolist +[org %1] +%endmacro +%macro __NASM_CDecl__ 1 +%endmacro diff --git a/output/outcoff.c b/output/outcoff.c index bbd0b57..d8d1d3d 100644 --- a/output/outcoff.c +++ b/output/outcoff.c @@ -963,18 +963,7 @@ static void coff_win32_filename(char *inname, char *outname, efunc error) standard_extension(inname, outname, ".obj", error); } -static const char *coff_stdmac[] = { - "%define __SECT__ [section .text]", - "%macro __NASM_CDecl__ 1", - "%endmacro", - "%imacro export 1+.nolist", - "[export %1]", - "%endmacro", - "%imacro safeseh 1.nolist", - "[safeseh %1]", - "%endmacro", - NULL -}; +extern macros_t coff_stdmac[]; static int coff_set_info(enum geninfo type, char **val) { diff --git a/output/outcoff.mac b/output/outcoff.mac new file mode 100644 index 0000000..c9ecb54 --- /dev/null +++ b/output/outcoff.mac @@ -0,0 +1,10 @@ +OUT: coff +%define __SECT__ [section .text] +%macro __NASM_CDecl__ 1 +%endmacro +%imacro export 1+.nolist +[export %1] +%endmacro +%imacro safeseh 1.nolist +[safeseh %1] +%endmacro diff --git a/output/outelf.mac b/output/outelf.mac new file mode 100644 index 0000000..bd6f82e --- /dev/null +++ b/output/outelf.mac @@ -0,0 +1,8 @@ +OUT: elf elf32 elf64 +%define __SECT__ [section .text] +%macro __NASM_CDecl__ 1 +%define $_%1 $%1 +%endmacro +%macro osabi 1+.nolist +[osabi %1] +%endmacro diff --git a/output/outelf32.c b/output/outelf32.c index ec4e838..f97a53c 100644 --- a/output/outelf32.c +++ b/output/outelf32.c @@ -1480,16 +1480,8 @@ static void elf_filename(char *inname, char *outname, efunc error) standard_extension(inname, outname, ".o", error); } -static const char *elf_stdmac[] = { - "%define __SECT__ [section .text]", - "%macro __NASM_CDecl__ 1", - "%define $_%1 $%1", - "%endmacro", - "%macro osabi 1+.nolist", - "[osabi %1]", - "%endmacro", - NULL -}; +extern macros_t elf_stdmac[]; + static int elf_set_info(enum geninfo type, char **val) { (void)type; diff --git a/output/outelf64.c b/output/outelf64.c index 9393e7a..3980cda 100644 --- a/output/outelf64.c +++ b/output/outelf64.c @@ -1511,16 +1511,8 @@ static void elf_filename(char *inname, char *outname, efunc error) standard_extension(inname, outname, ".o", error); } -static const char *elf_stdmac[] = { - "%define __SECT__ [section .text]", - "%macro __NASM_CDecl__ 1", - "%define $_%1 $%1", - "%endmacro", - "%macro osabi 1+.nolist", - "[osabi %1]", - "%endmacro", - NULL -}; +extern macros_t elf_stdmac[]; + static int elf_set_info(enum geninfo type, char **val) { (void)type; diff --git a/output/outmacho.c b/output/outmacho.c index 5ac2878..5e9ad8e 100644 --- a/output/outmacho.c +++ b/output/outmacho.c @@ -717,12 +717,7 @@ static void macho_filename(char *inname, char *outname, efunc error) standard_extension(inname, outname, ".o", error); } -static const char *macho_stdmac[] = { - "%define __SECT__ [section .text]", - "%macro __NASM_CDecl__ 1", - "%endmacro", - NULL -}; +extern macros_t macho_stdmac[]; /* Comparison function for qsort symbol layout. */ static int layout_compare (const struct symbol **s1, diff --git a/output/outmacho.mac b/output/outmacho.mac new file mode 100644 index 0000000..c135bf4 --- /dev/null +++ b/output/outmacho.mac @@ -0,0 +1,4 @@ +OUT: macho win32 win64 +%define __SECT__ [section .text] +%macro __NASM_CDecl__ 1 +%endmacro diff --git a/output/outobj.c b/output/outobj.c index c0736f7..74eb38e 100644 --- a/output/outobj.c +++ b/output/outobj.c @@ -2292,24 +2292,7 @@ static void obj_fwrite(ObjRecord * orp) fputc((-cksum) & 0xFF, ofp); } -static const char *obj_stdmac[] = { - "%define __SECT__ [section .text]", - "%imacro group 1+.nolist", - "[group %1]", - "%endmacro", - "%imacro uppercase 0+.nolist", - "[uppercase %1]", - "%endmacro", - "%imacro export 1+.nolist", - "[export %1]", - "%endmacro", - "%imacro import 1+.nolist", - "[import %1]", - "%endmacro", - "%macro __NASM_CDecl__ 1", - "%endmacro", - NULL -}; +extern macros_t obj_stdmac[]; void dbgbi_init(struct ofmt *of, void *id, FILE * fp, efunc error) { diff --git a/output/outobj.mac b/output/outobj.mac new file mode 100644 index 0000000..ef60638 --- /dev/null +++ b/output/outobj.mac @@ -0,0 +1,16 @@ +OUT: obj +%define __SECT__ [section .text] +%imacro group 1+.nolist +[group %1] +%endmacro +%imacro uppercase 0+.nolist +[uppercase %1] +%endmacro +%imacro export 1+.nolist +[export %1] +%endmacro +%imacro import 1+.nolist +[import %1] +%endmacro +%macro __NASM_CDecl__ 1 +%endmacro diff --git a/output/outrdf.c b/output/outrdf.c index a6de475..8c5b239 100644 --- a/output/outrdf.c +++ b/output/outrdf.c @@ -509,15 +509,7 @@ static void rdf_filename(char *inname, char *outname, efunc error) standard_extension(inname, outname, ".rdf", error); } -static char *rdf_stdmac[] = { - "%define __SECT__ [section .text]", - "%imacro library 1+.nolist", - "[library %1]", - "%endmacro", - "%macro __NASM_CDecl__ 1", - "%endmacro", - NULL -}; +extern macros_t rdf_stdmac[]; static int rdf_set_info(enum geninfo type, char **val) { diff --git a/output/outrdf.mac b/output/outrdf.mac new file mode 100644 index 0000000..f0c4155 --- /dev/null +++ b/output/outrdf.mac @@ -0,0 +1,7 @@ +OUT: rdf +%define __SECT__ [section .text] +%imacro library 1+.nolist +[library %1] +%endmacro +%macro __NASM_CDecl__ 1 +%endmacro diff --git a/output/outrdf2.c b/output/outrdf2.c index 05c7ce1..b00ad43 100644 --- a/output/outrdf2.c +++ b/output/outrdf2.c @@ -746,18 +746,7 @@ static void rdf2_filename(char *inname, char *outname, efunc error) standard_extension(inname, outname, ".rdf", error); } -static const char *rdf2_stdmac[] = { - "%define __SECT__ [section .text]", - "%imacro library 1+.nolist", - "[library %1]", - "%endmacro", - "%imacro module 1+.nolist", - "[module %1]", - "%endmacro", - "%macro __NASM_CDecl__ 1", - "%endmacro", - NULL -}; +extern macros_t rdf2_stdmac[]; static int rdf2_set_info(enum geninfo type, char **val) { diff --git a/output/outrdf2.mac b/output/outrdf2.mac new file mode 100644 index 0000000..a48cbfb --- /dev/null +++ b/output/outrdf2.mac @@ -0,0 +1,10 @@ +OUT: rdf2 +%define __SECT__ [section .text] +%imacro library 1+.nolist +[library %1] +%endmacro +%imacro module 1+.nolist +[module %1] +%endmacro +%macro __NASM_CDecl__ 1 +%endmacro |