laag-nasm 2.13.03.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +57 -0
- data/LICENSE.txt +29 -0
- data/README.org +34 -0
- data/ext/laag/nasm/extconf.rb +16 -0
- data/laag-nasm.gemspec +20 -0
- data/lib/laag/nasm.rb +29 -0
- data/patches/Makefile.in.patch +13 -0
- data/vendor/repo.or.cz/nasm/.gitignore +102 -0
- data/vendor/repo.or.cz/nasm/AUTHORS +137 -0
- data/vendor/repo.or.cz/nasm/CHANGES +2 -0
- data/vendor/repo.or.cz/nasm/ChangeLog +2905 -0
- data/vendor/repo.or.cz/nasm/INSTALL +102 -0
- data/vendor/repo.or.cz/nasm/LICENSE +29 -0
- data/vendor/repo.or.cz/nasm/Makefile.in +855 -0
- data/vendor/repo.or.cz/nasm/Mkfiles/README +46 -0
- data/vendor/repo.or.cz/nasm/Mkfiles/msvc.mak +732 -0
- data/vendor/repo.or.cz/nasm/Mkfiles/openwcom.mak +706 -0
- data/vendor/repo.or.cz/nasm/README +23 -0
- data/vendor/repo.or.cz/nasm/SubmittingPatches +116 -0
- data/vendor/repo.or.cz/nasm/TODO +376 -0
- data/vendor/repo.or.cz/nasm/aclocal.m4 +139 -0
- data/vendor/repo.or.cz/nasm/asm/assemble.c +2957 -0
- data/vendor/repo.or.cz/nasm/asm/assemble.h +54 -0
- data/vendor/repo.or.cz/nasm/asm/directiv.c +566 -0
- data/vendor/repo.or.cz/nasm/asm/directiv.dat +92 -0
- data/vendor/repo.or.cz/nasm/asm/error.c +202 -0
- data/vendor/repo.or.cz/nasm/asm/eval.c +1014 -0
- data/vendor/repo.or.cz/nasm/asm/eval.h +49 -0
- data/vendor/repo.or.cz/nasm/asm/exprdump.c +79 -0
- data/vendor/repo.or.cz/nasm/asm/exprlib.c +200 -0
- data/vendor/repo.or.cz/nasm/asm/float.c +952 -0
- data/vendor/repo.or.cz/nasm/asm/float.h +54 -0
- data/vendor/repo.or.cz/nasm/asm/labels.c +540 -0
- data/vendor/repo.or.cz/nasm/asm/listing.c +346 -0
- data/vendor/repo.or.cz/nasm/asm/listing.h +113 -0
- data/vendor/repo.or.cz/nasm/asm/nasm.c +1855 -0
- data/vendor/repo.or.cz/nasm/asm/parser.c +1167 -0
- data/vendor/repo.or.cz/nasm/asm/parser.h +45 -0
- data/vendor/repo.or.cz/nasm/asm/phash.pl +109 -0
- data/vendor/repo.or.cz/nasm/asm/pptok.dat +96 -0
- data/vendor/repo.or.cz/nasm/asm/pptok.pl +271 -0
- data/vendor/repo.or.cz/nasm/asm/pragma.c +218 -0
- data/vendor/repo.or.cz/nasm/asm/preproc-nop.c +188 -0
- data/vendor/repo.or.cz/nasm/asm/preproc.c +5459 -0
- data/vendor/repo.or.cz/nasm/asm/preproc.h +55 -0
- data/vendor/repo.or.cz/nasm/asm/quote.c +479 -0
- data/vendor/repo.or.cz/nasm/asm/quote.h +44 -0
- data/vendor/repo.or.cz/nasm/asm/rdstrnum.c +68 -0
- data/vendor/repo.or.cz/nasm/asm/segalloc.c +51 -0
- data/vendor/repo.or.cz/nasm/asm/stdscan.c +345 -0
- data/vendor/repo.or.cz/nasm/asm/stdscan.h +49 -0
- data/vendor/repo.or.cz/nasm/asm/strfunc.c +359 -0
- data/vendor/repo.or.cz/nasm/asm/tokens.dat +135 -0
- data/vendor/repo.or.cz/nasm/asm/tokhash.pl +284 -0
- data/vendor/repo.or.cz/nasm/autogen.sh +9 -0
- data/vendor/repo.or.cz/nasm/common/common.c +122 -0
- data/vendor/repo.or.cz/nasm/config/msvc.h +192 -0
- data/vendor/repo.or.cz/nasm/config/unknown.h +51 -0
- data/vendor/repo.or.cz/nasm/config/watcom.h +74 -0
- data/vendor/repo.or.cz/nasm/configure.ac +253 -0
- data/vendor/repo.or.cz/nasm/contrib/MSVC6.txt +25 -0
- data/vendor/repo.or.cz/nasm/contrib/VSrules/nasm.README +16 -0
- data/vendor/repo.or.cz/nasm/contrib/VSrules/nasm.rules +79 -0
- data/vendor/repo.or.cz/nasm/disasm/disasm.c +1735 -0
- data/vendor/repo.or.cz/nasm/disasm/disasm.h +49 -0
- data/vendor/repo.or.cz/nasm/disasm/ndisasm.c +397 -0
- data/vendor/repo.or.cz/nasm/disasm/sync.c +132 -0
- data/vendor/repo.or.cz/nasm/disasm/sync.h +45 -0
- data/vendor/repo.or.cz/nasm/doc/Makefile.in +86 -0
- data/vendor/repo.or.cz/nasm/doc/README +20 -0
- data/vendor/repo.or.cz/nasm/doc/afmmetrics.ph +102 -0
- data/vendor/repo.or.cz/nasm/doc/changes.src +2588 -0
- data/vendor/repo.or.cz/nasm/doc/findfont.ph +180 -0
- data/vendor/repo.or.cz/nasm/doc/genps.pl +1294 -0
- data/vendor/repo.or.cz/nasm/doc/inslist.pl +108 -0
- data/vendor/repo.or.cz/nasm/doc/internal.doc +290 -0
- data/vendor/repo.or.cz/nasm/doc/local.css +1 -0
- data/vendor/repo.or.cz/nasm/doc/nasmdoc.css +150 -0
- data/vendor/repo.or.cz/nasm/doc/nasmdoc.src +8309 -0
- data/vendor/repo.or.cz/nasm/doc/nasmlogo.eps +212 -0
- data/vendor/repo.or.cz/nasm/doc/nasmlogw.png +0 -0
- data/vendor/repo.or.cz/nasm/doc/psfonts.ph +53 -0
- data/vendor/repo.or.cz/nasm/doc/pspdf.pl +98 -0
- data/vendor/repo.or.cz/nasm/doc/pswidth.ph +25 -0
- data/vendor/repo.or.cz/nasm/doc/rdsrc.pl +1111 -0
- data/vendor/repo.or.cz/nasm/doc/ttfmetrics.ph +63 -0
- data/vendor/repo.or.cz/nasm/headers/c +33 -0
- data/vendor/repo.or.cz/nasm/headers/doc +33 -0
- data/vendor/repo.or.cz/nasm/headers/mac +33 -0
- data/vendor/repo.or.cz/nasm/headers/perl +33 -0
- data/vendor/repo.or.cz/nasm/include/compiler.h +277 -0
- data/vendor/repo.or.cz/nasm/include/disp8.h +45 -0
- data/vendor/repo.or.cz/nasm/include/error.h +135 -0
- data/vendor/repo.or.cz/nasm/include/hashtbl.h +85 -0
- data/vendor/repo.or.cz/nasm/include/iflag.h +173 -0
- data/vendor/repo.or.cz/nasm/include/insns.h +76 -0
- data/vendor/repo.or.cz/nasm/include/labels.h +60 -0
- data/vendor/repo.or.cz/nasm/include/md5.h +21 -0
- data/vendor/repo.or.cz/nasm/include/nasm.h +1246 -0
- data/vendor/repo.or.cz/nasm/include/nasmint.h +219 -0
- data/vendor/repo.or.cz/nasm/include/nasmlib.h +524 -0
- data/vendor/repo.or.cz/nasm/include/opflags.h +271 -0
- data/vendor/repo.or.cz/nasm/include/perfhash.h +52 -0
- data/vendor/repo.or.cz/nasm/include/raa.h +46 -0
- data/vendor/repo.or.cz/nasm/include/rbtree.h +51 -0
- data/vendor/repo.or.cz/nasm/include/rdoff.h +169 -0
- data/vendor/repo.or.cz/nasm/include/saa.h +94 -0
- data/vendor/repo.or.cz/nasm/include/strlist.h +55 -0
- data/vendor/repo.or.cz/nasm/include/tables.h +70 -0
- data/vendor/repo.or.cz/nasm/include/ver.h +47 -0
- data/vendor/repo.or.cz/nasm/install-sh +250 -0
- data/vendor/repo.or.cz/nasm/macros/altreg.mac +107 -0
- data/vendor/repo.or.cz/nasm/macros/fp.mac +54 -0
- data/vendor/repo.or.cz/nasm/macros/ifunc.mac +48 -0
- data/vendor/repo.or.cz/nasm/macros/macros.pl +294 -0
- data/vendor/repo.or.cz/nasm/macros/smartalign.mac +189 -0
- data/vendor/repo.or.cz/nasm/macros/standard.mac +226 -0
- data/vendor/repo.or.cz/nasm/misc/Doxyfile +752 -0
- data/vendor/repo.or.cz/nasm/misc/Nindent +18 -0
- data/vendor/repo.or.cz/nasm/misc/README +2 -0
- data/vendor/repo.or.cz/nasm/misc/c16.mac +82 -0
- data/vendor/repo.or.cz/nasm/misc/c32.mac +52 -0
- data/vendor/repo.or.cz/nasm/misc/crcgen.c +44 -0
- data/vendor/repo.or.cz/nasm/misc/exebin.mac +57 -0
- data/vendor/repo.or.cz/nasm/misc/exebin2.mac +114 -0
- data/vendor/repo.or.cz/nasm/misc/fmtinsns.pl +40 -0
- data/vendor/repo.or.cz/nasm/misc/genfma.pl +63 -0
- data/vendor/repo.or.cz/nasm/misc/hints.txt +26 -0
- data/vendor/repo.or.cz/nasm/misc/magic +6 -0
- data/vendor/repo.or.cz/nasm/misc/myC32.mac +121 -0
- data/vendor/repo.or.cz/nasm/misc/nasm.sl +320 -0
- data/vendor/repo.or.cz/nasm/misc/nasmstab +296 -0
- data/vendor/repo.or.cz/nasm/misc/omfdump.c +517 -0
- data/vendor/repo.or.cz/nasm/misc/pmw.bat +9 -0
- data/vendor/repo.or.cz/nasm/misc/proc32.ash +441 -0
- data/vendor/repo.or.cz/nasm/misc/scitech.mac +1223 -0
- data/vendor/repo.or.cz/nasm/misc/xcrcgen.c +80 -0
- data/vendor/repo.or.cz/nasm/nasm.spec.in +83 -0
- data/vendor/repo.or.cz/nasm/nasm.spec.sed +3 -0
- data/vendor/repo.or.cz/nasm/nasm.txt +306 -0
- data/vendor/repo.or.cz/nasm/nasmlib/badenum.c +43 -0
- data/vendor/repo.or.cz/nasm/nasmlib/bsi.c +77 -0
- data/vendor/repo.or.cz/nasm/nasmlib/crc64.c +189 -0
- data/vendor/repo.or.cz/nasm/nasmlib/file.c +259 -0
- data/vendor/repo.or.cz/nasm/nasmlib/file.h +128 -0
- data/vendor/repo.or.cz/nasm/nasmlib/filename.c +69 -0
- data/vendor/repo.or.cz/nasm/nasmlib/hashtbl.c +232 -0
- data/vendor/repo.or.cz/nasm/nasmlib/ilog2.c +168 -0
- data/vendor/repo.or.cz/nasm/nasmlib/malloc.c +108 -0
- data/vendor/repo.or.cz/nasm/nasmlib/md5c.c +247 -0
- data/vendor/repo.or.cz/nasm/nasmlib/mmap.c +139 -0
- data/vendor/repo.or.cz/nasm/nasmlib/path.c +186 -0
- data/vendor/repo.or.cz/nasm/nasmlib/perfhash.c +55 -0
- data/vendor/repo.or.cz/nasm/nasmlib/perfhash.pl +362 -0
- data/vendor/repo.or.cz/nasm/nasmlib/raa.c +173 -0
- data/vendor/repo.or.cz/nasm/nasmlib/rbtree.c +119 -0
- data/vendor/repo.or.cz/nasm/nasmlib/readnum.c +172 -0
- data/vendor/repo.or.cz/nasm/nasmlib/realpath.c +135 -0
- data/vendor/repo.or.cz/nasm/nasmlib/saa.c +431 -0
- data/vendor/repo.or.cz/nasm/nasmlib/srcfile.c +128 -0
- data/vendor/repo.or.cz/nasm/nasmlib/string.c +242 -0
- data/vendor/repo.or.cz/nasm/nasmlib/strlist.c +100 -0
- data/vendor/repo.or.cz/nasm/nasmlib/ver.c +51 -0
- data/vendor/repo.or.cz/nasm/nasmlib/zerobuf.c +42 -0
- data/vendor/repo.or.cz/nasm/ndisasm.txt +94 -0
- data/vendor/repo.or.cz/nasm/nsis/NASMMultiUser.nsh +478 -0
- data/vendor/repo.or.cz/nasm/nsis/getpearch.pl +76 -0
- data/vendor/repo.or.cz/nasm/nsis/nasm-un.ico +0 -0
- data/vendor/repo.or.cz/nasm/nsis/nasm.ico +0 -0
- data/vendor/repo.or.cz/nasm/nsis/nasm.nsi +241 -0
- data/vendor/repo.or.cz/nasm/output/codeview.c +814 -0
- data/vendor/repo.or.cz/nasm/output/dwarf.h +566 -0
- data/vendor/repo.or.cz/nasm/output/elf.h +537 -0
- data/vendor/repo.or.cz/nasm/output/legacy.c +112 -0
- data/vendor/repo.or.cz/nasm/output/nulldbg.c +93 -0
- data/vendor/repo.or.cz/nasm/output/nullout.c +51 -0
- data/vendor/repo.or.cz/nasm/output/outaout.c +954 -0
- data/vendor/repo.or.cz/nasm/output/outaout.mac +37 -0
- data/vendor/repo.or.cz/nasm/output/outas86.c +650 -0
- data/vendor/repo.or.cz/nasm/output/outas86.mac +37 -0
- data/vendor/repo.or.cz/nasm/output/outbin.c +1713 -0
- data/vendor/repo.or.cz/nasm/output/outbin.mac +40 -0
- data/vendor/repo.or.cz/nasm/output/outcoff.c +1242 -0
- data/vendor/repo.or.cz/nasm/output/outcoff.mac +43 -0
- data/vendor/repo.or.cz/nasm/output/outdbg.c +425 -0
- data/vendor/repo.or.cz/nasm/output/outelf.c +3370 -0
- data/vendor/repo.or.cz/nasm/output/outelf.h +156 -0
- data/vendor/repo.or.cz/nasm/output/outelf.mac +41 -0
- data/vendor/repo.or.cz/nasm/output/outform.c +120 -0
- data/vendor/repo.or.cz/nasm/output/outform.h +379 -0
- data/vendor/repo.or.cz/nasm/output/outieee.c +1528 -0
- data/vendor/repo.or.cz/nasm/output/outlib.c +58 -0
- data/vendor/repo.or.cz/nasm/output/outlib.h +63 -0
- data/vendor/repo.or.cz/nasm/output/outmacho.c +2387 -0
- data/vendor/repo.or.cz/nasm/output/outmacho.mac +49 -0
- data/vendor/repo.or.cz/nasm/output/outobj.c +2725 -0
- data/vendor/repo.or.cz/nasm/output/outobj.mac +49 -0
- data/vendor/repo.or.cz/nasm/output/outrdf.mac +40 -0
- data/vendor/repo.or.cz/nasm/output/outrdf2.c +791 -0
- data/vendor/repo.or.cz/nasm/output/outrdf2.mac +43 -0
- data/vendor/repo.or.cz/nasm/output/pecoff.h +532 -0
- data/vendor/repo.or.cz/nasm/output/stabs.h +144 -0
- data/vendor/repo.or.cz/nasm/perllib/crc64.ph +158 -0
- data/vendor/repo.or.cz/nasm/perllib/gensv.pl +34 -0
- data/vendor/repo.or.cz/nasm/perllib/phash.ph +200 -0
- data/vendor/repo.or.cz/nasm/perllib/random_sv_vectors.ph +67 -0
- data/vendor/repo.or.cz/nasm/rdoff/README +185 -0
- data/vendor/repo.or.cz/nasm/rdoff/collectn.c +44 -0
- data/vendor/repo.or.cz/nasm/rdoff/collectn.h +22 -0
- data/vendor/repo.or.cz/nasm/rdoff/doc/Makefile +37 -0
- data/vendor/repo.or.cz/nasm/rdoff/doc/rdoff.texi +137 -0
- data/vendor/repo.or.cz/nasm/rdoff/doc/v1-v2.txt +62 -0
- data/vendor/repo.or.cz/nasm/rdoff/hash.c +122 -0
- data/vendor/repo.or.cz/nasm/rdoff/hash.h +17 -0
- data/vendor/repo.or.cz/nasm/rdoff/ldrdf.1 +41 -0
- data/vendor/repo.or.cz/nasm/rdoff/ldrdf.c +1395 -0
- data/vendor/repo.or.cz/nasm/rdoff/ldsegs.h +59 -0
- data/vendor/repo.or.cz/nasm/rdoff/rdf2bin.1 +65 -0
- data/vendor/repo.or.cz/nasm/rdoff/rdf2bin.c +431 -0
- data/vendor/repo.or.cz/nasm/rdoff/rdf2com.1 +1 -0
- data/vendor/repo.or.cz/nasm/rdoff/rdf2ihx.1 +1 -0
- data/vendor/repo.or.cz/nasm/rdoff/rdf2ith.1 +1 -0
- data/vendor/repo.or.cz/nasm/rdoff/rdf2srec.1 +1 -0
- data/vendor/repo.or.cz/nasm/rdoff/rdfdump.1 +24 -0
- data/vendor/repo.or.cz/nasm/rdoff/rdfdump.c +347 -0
- data/vendor/repo.or.cz/nasm/rdoff/rdflib.1 +39 -0
- data/vendor/repo.or.cz/nasm/rdoff/rdflib.c +434 -0
- data/vendor/repo.or.cz/nasm/rdoff/rdfload.c +213 -0
- data/vendor/repo.or.cz/nasm/rdoff/rdfload.h +29 -0
- data/vendor/repo.or.cz/nasm/rdoff/rdfutils.h +165 -0
- data/vendor/repo.or.cz/nasm/rdoff/rdlar.c +492 -0
- data/vendor/repo.or.cz/nasm/rdoff/rdlar.h +34 -0
- data/vendor/repo.or.cz/nasm/rdoff/rdlib.c +290 -0
- data/vendor/repo.or.cz/nasm/rdoff/rdlib.h +62 -0
- data/vendor/repo.or.cz/nasm/rdoff/rdoff.c +621 -0
- data/vendor/repo.or.cz/nasm/rdoff/rdx.1 +21 -0
- data/vendor/repo.or.cz/nasm/rdoff/rdx.c +90 -0
- data/vendor/repo.or.cz/nasm/rdoff/segtab.c +172 -0
- data/vendor/repo.or.cz/nasm/rdoff/segtab.h +45 -0
- data/vendor/repo.or.cz/nasm/rdoff/symtab.c +159 -0
- data/vendor/repo.or.cz/nasm/rdoff/symtab.h +55 -0
- data/vendor/repo.or.cz/nasm/rdoff/test/Makefile +10 -0
- data/vendor/repo.or.cz/nasm/rdoff/test/makelib.sh +14 -0
- data/vendor/repo.or.cz/nasm/rdoff/test/rdfseg.asm +20 -0
- data/vendor/repo.or.cz/nasm/rdoff/test/rdfseg2.asm +12 -0
- data/vendor/repo.or.cz/nasm/rdoff/test/rdftest1.asm +54 -0
- data/vendor/repo.or.cz/nasm/rdoff/test/rdftest2.asm +33 -0
- data/vendor/repo.or.cz/nasm/rdoff/test/rdtlib.asm +48 -0
- data/vendor/repo.or.cz/nasm/rdoff/test/rdtmain.asm +47 -0
- data/vendor/repo.or.cz/nasm/rdoff/test/testlib.asm +18 -0
- data/vendor/repo.or.cz/nasm/stdlib/snprintf.c +29 -0
- data/vendor/repo.or.cz/nasm/stdlib/strlcpy.c +51 -0
- data/vendor/repo.or.cz/nasm/stdlib/strnlen.c +46 -0
- data/vendor/repo.or.cz/nasm/stdlib/vsnprintf.c +51 -0
- data/vendor/repo.or.cz/nasm/test/Makefile +106 -0
- data/vendor/repo.or.cz/nasm/test/_file_.asm +5 -0
- data/vendor/repo.or.cz/nasm/test/_version.asm +2 -0
- data/vendor/repo.or.cz/nasm/test/a32offs.asm +9 -0
- data/vendor/repo.or.cz/nasm/test/absolute.asm +40 -0
- data/vendor/repo.or.cz/nasm/test/addr64x.asm +18 -0
- data/vendor/repo.or.cz/nasm/test/align13.asm +19 -0
- data/vendor/repo.or.cz/nasm/test/align13s.asm +20 -0
- data/vendor/repo.or.cz/nasm/test/alonesym-obj.asm +166 -0
- data/vendor/repo.or.cz/nasm/test/andbyte.asm +15 -0
- data/vendor/repo.or.cz/nasm/test/aoutso.asm +99 -0
- data/vendor/repo.or.cz/nasm/test/aouttest.asm +86 -0
- data/vendor/repo.or.cz/nasm/test/aouttest.c +36 -0
- data/vendor/repo.or.cz/nasm/test/avx.asm +46 -0
- data/vendor/repo.or.cz/nasm/test/avx005.asm +529 -0
- data/vendor/repo.or.cz/nasm/test/avx2.asm +1608 -0
- data/vendor/repo.or.cz/nasm/test/avx512cd.asm +106 -0
- data/vendor/repo.or.cz/nasm/test/avx512er.asm +144 -0
- data/vendor/repo.or.cz/nasm/test/avx512f.asm +7000 -0
- data/vendor/repo.or.cz/nasm/test/avx512pf.asm +88 -0
- data/vendor/repo.or.cz/nasm/test/bcd.asm +23 -0
- data/vendor/repo.or.cz/nasm/test/binexe.asm +35 -0
- data/vendor/repo.or.cz/nasm/test/bintest.asm +59 -0
- data/vendor/repo.or.cz/nasm/test/bisect.sh +22 -0
- data/vendor/repo.or.cz/nasm/test/br1879590.asm +25 -0
- data/vendor/repo.or.cz/nasm/test/br2003451.asm +17 -0
- data/vendor/repo.or.cz/nasm/test/br2030823.asm +7 -0
- data/vendor/repo.or.cz/nasm/test/br2148476.asm +221 -0
- data/vendor/repo.or.cz/nasm/test/br2222615.asm +19 -0
- data/vendor/repo.or.cz/nasm/test/br2496848.asm +42 -0
- data/vendor/repo.or.cz/nasm/test/br3005117.asm +26 -0
- data/vendor/repo.or.cz/nasm/test/br3026808.asm +20 -0
- data/vendor/repo.or.cz/nasm/test/br3028880.asm +8 -0
- data/vendor/repo.or.cz/nasm/test/br3041451.asm +59 -0
- data/vendor/repo.or.cz/nasm/test/br3058845.asm +14 -0
- data/vendor/repo.or.cz/nasm/test/br3066383.asm +70 -0
- data/vendor/repo.or.cz/nasm/test/br3074517.asm +12 -0
- data/vendor/repo.or.cz/nasm/test/br3092924.asm +25 -0
- data/vendor/repo.or.cz/nasm/test/br3104312.asm +11 -0
- data/vendor/repo.or.cz/nasm/test/br3109604.asm +9 -0
- data/vendor/repo.or.cz/nasm/test/br3174983.asm +9 -0
- data/vendor/repo.or.cz/nasm/test/br3187743.asm +7 -0
- data/vendor/repo.or.cz/nasm/test/br3189064.asm +7 -0
- data/vendor/repo.or.cz/nasm/test/br3200749.asm +9 -0
- data/vendor/repo.or.cz/nasm/test/br3385573.asm +11 -0
- data/vendor/repo.or.cz/nasm/test/br3392252.asm +43 -0
- data/vendor/repo.or.cz/nasm/test/br3392259.asm +8 -0
- data/vendor/repo.or.cz/nasm/test/br3392363.asm +4 -0
- data/vendor/repo.or.cz/nasm/test/br3392392.asm +16 -0
- data/vendor/repo.or.cz/nasm/test/br3392396.asm +5 -0
- data/vendor/repo.or.cz/nasm/test/br3392411.asm +22 -0
- data/vendor/repo.or.cz/nasm/test/br3392418.asm +3 -0
- data/vendor/repo.or.cz/nasm/test/br3392439.asm +25 -0
- data/vendor/repo.or.cz/nasm/test/br3392442.asm +6 -0
- data/vendor/repo.or.cz/nasm/test/br560575.asm +17 -0
- data/vendor/repo.or.cz/nasm/test/br560873.asm +27 -0
- data/vendor/repo.or.cz/nasm/test/br890790.asm +7 -0
- data/vendor/repo.or.cz/nasm/test/br890790_i.asm +1 -0
- data/vendor/repo.or.cz/nasm/test/br978756.asm +7 -0
- data/vendor/repo.or.cz/nasm/test/changed.asm +383 -0
- data/vendor/repo.or.cz/nasm/test/cofftest.asm +85 -0
- data/vendor/repo.or.cz/nasm/test/cofftest.c +35 -0
- data/vendor/repo.or.cz/nasm/test/crc32.asm +37 -0
- data/vendor/repo.or.cz/nasm/test/cv8struc.asm +14 -0
- data/vendor/repo.or.cz/nasm/test/dtbcd.asm +72 -0
- data/vendor/repo.or.cz/nasm/test/elf64so.asm +118 -0
- data/vendor/repo.or.cz/nasm/test/elfso.asm +100 -0
- data/vendor/repo.or.cz/nasm/test/elftest.asm +87 -0
- data/vendor/repo.or.cz/nasm/test/elftest.c +38 -0
- data/vendor/repo.or.cz/nasm/test/elftest64.c +43 -0
- data/vendor/repo.or.cz/nasm/test/elif.asm +39 -0
- data/vendor/repo.or.cz/nasm/test/expimp.asm +90 -0
- data/vendor/repo.or.cz/nasm/test/far64.asm +10 -0
- data/vendor/repo.or.cz/nasm/test/float.asm +186 -0
- data/vendor/repo.or.cz/nasm/test/float8.asm +135 -0
- data/vendor/repo.or.cz/nasm/test/floatb.asm +35 -0
- data/vendor/repo.or.cz/nasm/test/floatexp.asm +382 -0
- data/vendor/repo.or.cz/nasm/test/floatize.asm +19 -0
- data/vendor/repo.or.cz/nasm/test/floattest.asm +28 -0
- data/vendor/repo.or.cz/nasm/test/floatx.asm +525 -0
- data/vendor/repo.or.cz/nasm/test/fpu.asm +127 -0
- data/vendor/repo.or.cz/nasm/test/fwdopt.asm +133 -0
- data/vendor/repo.or.cz/nasm/test/fwdoptpp.asm +150 -0
- data/vendor/repo.or.cz/nasm/test/gas2nasm.py +104 -0
- data/vendor/repo.or.cz/nasm/test/gather.asm +11 -0
- data/vendor/repo.or.cz/nasm/test/gotoff64.asm +25 -0
- data/vendor/repo.or.cz/nasm/test/hexfp.asm +25 -0
- data/vendor/repo.or.cz/nasm/test/hle.asm +19 -0
- data/vendor/repo.or.cz/nasm/test/ifelse.asm +46 -0
- data/vendor/repo.or.cz/nasm/test/ifenv.asm +31 -0
- data/vendor/repo.or.cz/nasm/test/ifmacro.asm +413 -0
- data/vendor/repo.or.cz/nasm/test/iftoken.asm +317 -0
- data/vendor/repo.or.cz/nasm/test/iftoken.pl +32 -0
- data/vendor/repo.or.cz/nasm/test/ilog2.asm +271 -0
- data/vendor/repo.or.cz/nasm/test/imacro.asm +8 -0
- data/vendor/repo.or.cz/nasm/test/imm.asm +23 -0
- data/vendor/repo.or.cz/nasm/test/imm64.asm +61 -0
- data/vendor/repo.or.cz/nasm/test/immwarn.asm +91 -0
- data/vendor/repo.or.cz/nasm/test/imul.asm +117 -0
- data/vendor/repo.or.cz/nasm/test/inc1.asm +6 -0
- data/vendor/repo.or.cz/nasm/test/inc2.asm +8 -0
- data/vendor/repo.or.cz/nasm/test/incbin.asm +7 -0
- data/vendor/repo.or.cz/nasm/test/incbin.data +2 -0
- data/vendor/repo.or.cz/nasm/test/inctest.asm +15 -0
- data/vendor/repo.or.cz/nasm/test/insnlbl.asm +12 -0
- data/vendor/repo.or.cz/nasm/test/invlpga.asm +11 -0
- data/vendor/repo.or.cz/nasm/test/jmp64.asm +19 -0
- data/vendor/repo.or.cz/nasm/test/lar_lsl.asm +124 -0
- data/vendor/repo.or.cz/nasm/test/larlsl.asm +23 -0
- data/vendor/repo.or.cz/nasm/test/lnxhello.asm +54 -0
- data/vendor/repo.or.cz/nasm/test/local.asm +19 -0
- data/vendor/repo.or.cz/nasm/test/loopoffs.asm +12 -0
- data/vendor/repo.or.cz/nasm/test/lwp.asm +213 -0
- data/vendor/repo.or.cz/nasm/test/macro-defaults.asm +64 -0
- data/vendor/repo.or.cz/nasm/test/macroerr.asm +12 -0
- data/vendor/repo.or.cz/nasm/test/macroerr.inc +3 -0
- data/vendor/repo.or.cz/nasm/test/mmxsize.asm +38 -0
- data/vendor/repo.or.cz/nasm/test/movd.asm +12 -0
- data/vendor/repo.or.cz/nasm/test/movd64.asm +15 -0
- data/vendor/repo.or.cz/nasm/test/movimm.asm +28 -0
- data/vendor/repo.or.cz/nasm/test/movnti.asm +10 -0
- data/vendor/repo.or.cz/nasm/test/mpx-64.asm +120 -0
- data/vendor/repo.or.cz/nasm/test/mpx.asm +89 -0
- data/vendor/repo.or.cz/nasm/test/multisection.asm +96 -0
- data/vendor/repo.or.cz/nasm/test/nasmformat.asm +17 -0
- data/vendor/repo.or.cz/nasm/test/new +9 -0
- data/vendor/repo.or.cz/nasm/test/newrdwr.asm +24 -0
- data/vendor/repo.or.cz/nasm/test/nop.asm +17 -0
- data/vendor/repo.or.cz/nasm/test/nullfile.asm +4 -0
- data/vendor/repo.or.cz/nasm/test/objexe.asm +30 -0
- data/vendor/repo.or.cz/nasm/test/objlink.c +33 -0
- data/vendor/repo.or.cz/nasm/test/objtest.asm +85 -0
- data/vendor/repo.or.cz/nasm/test/optimization.asm +104 -0
- data/vendor/repo.or.cz/nasm/test/org.asm +18 -0
- data/vendor/repo.or.cz/nasm/test/paste.asm +12 -0
- data/vendor/repo.or.cz/nasm/test/pcrel.asm +52 -0
- data/vendor/repo.or.cz/nasm/test/perf/label.pl +18 -0
- data/vendor/repo.or.cz/nasm/test/perf/macro.pl +18 -0
- data/vendor/repo.or.cz/nasm/test/perf/token.pl +23 -0
- data/vendor/repo.or.cz/nasm/test/performtest.pl +192 -0
- data/vendor/repo.or.cz/nasm/test/pextrw.asm +3 -0
- data/vendor/repo.or.cz/nasm/test/pinsr16.asm +53 -0
- data/vendor/repo.or.cz/nasm/test/pinsr32.asm +53 -0
- data/vendor/repo.or.cz/nasm/test/pinsr64.asm +68 -0
- data/vendor/repo.or.cz/nasm/test/popcnt.asm +32 -0
- data/vendor/repo.or.cz/nasm/test/ppindirect.asm +42 -0
- data/vendor/repo.or.cz/nasm/test/pragma.asm +12 -0
- data/vendor/repo.or.cz/nasm/test/prefix66.asm +28 -0
- data/vendor/repo.or.cz/nasm/test/ptr.asm +4 -0
- data/vendor/repo.or.cz/nasm/test/pushseg.asm +17 -0
- data/vendor/repo.or.cz/nasm/test/r13.asm +15 -0
- data/vendor/repo.or.cz/nasm/test/radix.asm +54 -0
- data/vendor/repo.or.cz/nasm/test/rdpid.asm +21 -0
- data/vendor/repo.or.cz/nasm/test/reldef.asm +57 -0
- data/vendor/repo.or.cz/nasm/test/relocs.asm +20 -0
- data/vendor/repo.or.cz/nasm/test/riprel.asm +5357 -0
- data/vendor/repo.or.cz/nasm/test/riprel.pl +29 -0
- data/vendor/repo.or.cz/nasm/test/riprel2.asm +11 -0
- data/vendor/repo.or.cz/nasm/test/sha-64.asm +30 -0
- data/vendor/repo.or.cz/nasm/test/sha.asm +31 -0
- data/vendor/repo.or.cz/nasm/test/smartalign16.asm +36 -0
- data/vendor/repo.or.cz/nasm/test/smartalign32.asm +36 -0
- data/vendor/repo.or.cz/nasm/test/smartalign64.asm +36 -0
- data/vendor/repo.or.cz/nasm/test/splitea.asm +11 -0
- data/vendor/repo.or.cz/nasm/test/sreg.asm +65 -0
- data/vendor/repo.or.cz/nasm/test/strlen.asm +5 -0
- data/vendor/repo.or.cz/nasm/test/struc.asm +33 -0
- data/vendor/repo.or.cz/nasm/test/test67.asm +38 -0
- data/vendor/repo.or.cz/nasm/test/testdos.asm +13 -0
- data/vendor/repo.or.cz/nasm/test/testnos3.asm +973 -0
- data/vendor/repo.or.cz/nasm/test/time.asm +11 -0
- data/vendor/repo.or.cz/nasm/test/times.asm +21 -0
- data/vendor/repo.or.cz/nasm/test/timesneg.asm +3 -0
- data/vendor/repo.or.cz/nasm/test/tmap.nas +1447 -0
- data/vendor/repo.or.cz/nasm/test/uscore.asm +15 -0
- data/vendor/repo.or.cz/nasm/test/utf.asm +82 -0
- data/vendor/repo.or.cz/nasm/test/vaesenc.asm +22 -0
- data/vendor/repo.or.cz/nasm/test/vex.asm +9 -0
- data/vendor/repo.or.cz/nasm/test/vgather.asm +76 -0
- data/vendor/repo.or.cz/nasm/test/vmread.asm +26 -0
- data/vendor/repo.or.cz/nasm/test/weirdpaste.asm +29 -0
- data/vendor/repo.or.cz/nasm/test/xchg.asm +96 -0
- data/vendor/repo.or.cz/nasm/test/xcrypt.asm +24 -0
- data/vendor/repo.or.cz/nasm/test/xmm0.asm +12 -0
- data/vendor/repo.or.cz/nasm/test/zerobyte.asm +22 -0
- data/vendor/repo.or.cz/nasm/tools/cleanfile +176 -0
- data/vendor/repo.or.cz/nasm/tools/cleanpatch +258 -0
- data/vendor/repo.or.cz/nasm/tools/mkdep.pl +261 -0
- data/vendor/repo.or.cz/nasm/tools/release +105 -0
- data/vendor/repo.or.cz/nasm/tools/syncfiles.pl +137 -0
- data/vendor/repo.or.cz/nasm/tools/tag-release +58 -0
- data/vendor/repo.or.cz/nasm/version +1 -0
- data/vendor/repo.or.cz/nasm/version.pl +189 -0
- data/vendor/repo.or.cz/nasm/x86/disp8.c +131 -0
- data/vendor/repo.or.cz/nasm/x86/insns-iflags.ph +280 -0
- data/vendor/repo.or.cz/nasm/x86/insns.dat +5371 -0
- data/vendor/repo.or.cz/nasm/x86/insns.pl +1043 -0
- data/vendor/repo.or.cz/nasm/x86/regs.dat +138 -0
- data/vendor/repo.or.cz/nasm/x86/regs.pl +204 -0
- metadata +520 -0
@@ -0,0 +1,37 @@
|
|
1
|
+
;; --------------------------------------------------------------------------
|
2
|
+
;;
|
3
|
+
;; Copyright 1996-2009 The NASM Authors - All Rights Reserved
|
4
|
+
;; See the file AUTHORS included with the NASM distribution for
|
5
|
+
;; the specific copyright holders.
|
6
|
+
;;
|
7
|
+
;; Redistribution and use in source and binary forms, with or without
|
8
|
+
;; modification, are permitted provided that the following
|
9
|
+
;; conditions are met:
|
10
|
+
;;
|
11
|
+
;; * Redistributions of source code must retain the above copyright
|
12
|
+
;; notice, this list of conditions and the following disclaimer.
|
13
|
+
;; * Redistributions in binary form must reproduce the above
|
14
|
+
;; copyright notice, this list of conditions and the following
|
15
|
+
;; disclaimer in the documentation and/or other materials provided
|
16
|
+
;; with the distribution.
|
17
|
+
;;
|
18
|
+
;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
19
|
+
;; CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
20
|
+
;; INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
21
|
+
;; MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
22
|
+
;; DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
23
|
+
;; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
24
|
+
;; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
25
|
+
;; NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
26
|
+
;; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
27
|
+
;; HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
28
|
+
;; CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
29
|
+
;; OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
30
|
+
;; EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
31
|
+
;;
|
32
|
+
;; --------------------------------------------------------------------------
|
33
|
+
|
34
|
+
OUT: as86
|
35
|
+
%define __SECT__ [section .text]
|
36
|
+
%macro __NASM_CDecl__ 1
|
37
|
+
%endmacro
|
@@ -0,0 +1,1713 @@
|
|
1
|
+
/* ----------------------------------------------------------------------- *
|
2
|
+
*
|
3
|
+
* Copyright 1996-2013 The NASM Authors - All Rights Reserved
|
4
|
+
* See the file AUTHORS included with the NASM distribution for
|
5
|
+
* the specific copyright holders.
|
6
|
+
*
|
7
|
+
* Redistribution and use in source and binary forms, with or without
|
8
|
+
* modification, are permitted provided that the following
|
9
|
+
* conditions are met:
|
10
|
+
*
|
11
|
+
* * Redistributions of source code must retain the above copyright
|
12
|
+
* notice, this list of conditions and the following disclaimer.
|
13
|
+
* * Redistributions in binary form must reproduce the above
|
14
|
+
* copyright notice, this list of conditions and the following
|
15
|
+
* disclaimer in the documentation and/or other materials provided
|
16
|
+
* with the distribution.
|
17
|
+
*
|
18
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
19
|
+
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
20
|
+
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
21
|
+
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
22
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
23
|
+
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
24
|
+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
25
|
+
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
26
|
+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
27
|
+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
28
|
+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
29
|
+
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
30
|
+
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
31
|
+
*
|
32
|
+
* ----------------------------------------------------------------------- */
|
33
|
+
|
34
|
+
/*
|
35
|
+
* outbin.c output routines for the Netwide Assembler to produce
|
36
|
+
* flat-form binary files
|
37
|
+
*/
|
38
|
+
|
39
|
+
/* This is the extended version of NASM's original binary output
|
40
|
+
* format. It is backward compatible with the original BIN format,
|
41
|
+
* and contains support for multiple sections and advanced section
|
42
|
+
* ordering.
|
43
|
+
*
|
44
|
+
* Feature summary:
|
45
|
+
*
|
46
|
+
* - Users can create an arbitrary number of sections; they are not
|
47
|
+
* limited to just ".text", ".data", and ".bss".
|
48
|
+
*
|
49
|
+
* - Sections can be either progbits or nobits type.
|
50
|
+
*
|
51
|
+
* - You can specify that they be aligned at a certian boundary
|
52
|
+
* following the previous section ("align="), or positioned at an
|
53
|
+
* arbitrary byte-granular location ("start=").
|
54
|
+
*
|
55
|
+
* - You can specify a "virtual" start address for a section, which
|
56
|
+
* will be used for the calculation for all address references
|
57
|
+
* with respect to that section ("vstart=").
|
58
|
+
*
|
59
|
+
* - The ORG directive, as well as the section/segment directive
|
60
|
+
* arguments ("align=", "start=", "vstart="), can take a critical
|
61
|
+
* expression as their value. For example: "align=(1 << 12)".
|
62
|
+
*
|
63
|
+
* - You can generate map files using the 'map' directive.
|
64
|
+
*
|
65
|
+
*/
|
66
|
+
|
67
|
+
/* Uncomment the following define if you want sections to adapt
|
68
|
+
* their progbits/nobits state depending on what type of
|
69
|
+
* instructions are issued, rather than defaulting to progbits.
|
70
|
+
* Note that this behavior violates the specification.
|
71
|
+
|
72
|
+
#define ABIN_SMART_ADAPT
|
73
|
+
|
74
|
+
*/
|
75
|
+
|
76
|
+
#include "compiler.h"
|
77
|
+
|
78
|
+
#include <stdio.h>
|
79
|
+
#include <stdlib.h>
|
80
|
+
#include <string.h>
|
81
|
+
#include <ctype.h>
|
82
|
+
|
83
|
+
#include "nasm.h"
|
84
|
+
#include "nasmlib.h"
|
85
|
+
#include "error.h"
|
86
|
+
#include "saa.h"
|
87
|
+
#include "stdscan.h"
|
88
|
+
#include "labels.h"
|
89
|
+
#include "eval.h"
|
90
|
+
#include "outform.h"
|
91
|
+
#include "outlib.h"
|
92
|
+
|
93
|
+
#ifdef OF_BIN
|
94
|
+
|
95
|
+
static FILE *rf = NULL;
|
96
|
+
static void (*do_output)(void);
|
97
|
+
|
98
|
+
/* Section flags keep track of which attributes the user has defined. */
|
99
|
+
#define START_DEFINED 0x001
|
100
|
+
#define ALIGN_DEFINED 0x002
|
101
|
+
#define FOLLOWS_DEFINED 0x004
|
102
|
+
#define VSTART_DEFINED 0x008
|
103
|
+
#define VALIGN_DEFINED 0x010
|
104
|
+
#define VFOLLOWS_DEFINED 0x020
|
105
|
+
#define TYPE_DEFINED 0x040
|
106
|
+
#define TYPE_PROGBITS 0x080
|
107
|
+
#define TYPE_NOBITS 0x100
|
108
|
+
|
109
|
+
/* This struct is used to keep track of symbols for map-file generation. */
|
110
|
+
static struct bin_label {
|
111
|
+
char *name;
|
112
|
+
struct bin_label *next;
|
113
|
+
} *no_seg_labels, **nsl_tail;
|
114
|
+
|
115
|
+
static struct Section {
|
116
|
+
char *name;
|
117
|
+
struct SAA *contents;
|
118
|
+
int64_t length; /* section length in bytes */
|
119
|
+
|
120
|
+
/* Section attributes */
|
121
|
+
int flags; /* see flag definitions above */
|
122
|
+
uint64_t align; /* section alignment */
|
123
|
+
uint64_t valign; /* notional section alignment */
|
124
|
+
uint64_t start; /* section start address */
|
125
|
+
uint64_t vstart; /* section virtual start address */
|
126
|
+
char *follows; /* the section that this one will follow */
|
127
|
+
char *vfollows; /* the section that this one will notionally follow */
|
128
|
+
int32_t start_index; /* NASM section id for non-relocated version */
|
129
|
+
int32_t vstart_index; /* the NASM section id */
|
130
|
+
|
131
|
+
struct bin_label *labels; /* linked-list of label handles for map output. */
|
132
|
+
struct bin_label **labels_end; /* Holds address of end of labels list. */
|
133
|
+
struct Section *prev; /* Points to previous section (implicit follows). */
|
134
|
+
struct Section *next; /* This links sections with a defined start address. */
|
135
|
+
|
136
|
+
/* The extended bin format allows for sections to have a "virtual"
|
137
|
+
* start address. This is accomplished by creating two sections:
|
138
|
+
* one beginning at the Load Memory Address and the other beginning
|
139
|
+
* at the Virtual Memory Address. The LMA section is only used to
|
140
|
+
* define the section.<section_name>.start label, but there isn't
|
141
|
+
* any other good way for us to handle that label.
|
142
|
+
*/
|
143
|
+
|
144
|
+
} *sections, *last_section;
|
145
|
+
|
146
|
+
static struct Reloc {
|
147
|
+
struct Reloc *next;
|
148
|
+
int32_t posn;
|
149
|
+
int32_t bytes;
|
150
|
+
int32_t secref;
|
151
|
+
int32_t secrel;
|
152
|
+
struct Section *target;
|
153
|
+
} *relocs, **reloctail;
|
154
|
+
|
155
|
+
static uint64_t origin;
|
156
|
+
static int origin_defined;
|
157
|
+
|
158
|
+
/* Stuff we need for map-file generation. */
|
159
|
+
#define MAP_ORIGIN 1
|
160
|
+
#define MAP_SUMMARY 2
|
161
|
+
#define MAP_SECTIONS 4
|
162
|
+
#define MAP_SYMBOLS 8
|
163
|
+
static int map_control = 0;
|
164
|
+
static char *infile, *outfile;
|
165
|
+
|
166
|
+
extern macros_t bin_stdmac[];
|
167
|
+
|
168
|
+
static void add_reloc(struct Section *s, int32_t bytes, int32_t secref,
|
169
|
+
int32_t secrel)
|
170
|
+
{
|
171
|
+
struct Reloc *r;
|
172
|
+
|
173
|
+
r = *reloctail = nasm_malloc(sizeof(struct Reloc));
|
174
|
+
reloctail = &r->next;
|
175
|
+
r->next = NULL;
|
176
|
+
r->posn = s->length;
|
177
|
+
r->bytes = bytes;
|
178
|
+
r->secref = secref;
|
179
|
+
r->secrel = secrel;
|
180
|
+
r->target = s;
|
181
|
+
}
|
182
|
+
|
183
|
+
static struct Section *find_section_by_name(const char *name)
|
184
|
+
{
|
185
|
+
struct Section *s;
|
186
|
+
|
187
|
+
list_for_each(s, sections)
|
188
|
+
if (!strcmp(s->name, name))
|
189
|
+
break;
|
190
|
+
return s;
|
191
|
+
}
|
192
|
+
|
193
|
+
static struct Section *find_section_by_index(int32_t index)
|
194
|
+
{
|
195
|
+
struct Section *s;
|
196
|
+
|
197
|
+
list_for_each(s, sections)
|
198
|
+
if ((index == s->vstart_index) || (index == s->start_index))
|
199
|
+
break;
|
200
|
+
return s;
|
201
|
+
}
|
202
|
+
|
203
|
+
static struct Section *create_section(char *name)
|
204
|
+
{
|
205
|
+
struct Section *s = nasm_zalloc(sizeof(*s));
|
206
|
+
|
207
|
+
s->prev = last_section;
|
208
|
+
s->name = nasm_strdup(name);
|
209
|
+
s->labels_end = &(s->labels);
|
210
|
+
s->contents = saa_init(1L);
|
211
|
+
|
212
|
+
/* Register our sections with NASM. */
|
213
|
+
s->vstart_index = seg_alloc();
|
214
|
+
s->start_index = seg_alloc();
|
215
|
+
|
216
|
+
/* FIXME: Append to a tail, we need some helper */
|
217
|
+
last_section->next = s;
|
218
|
+
last_section = s;
|
219
|
+
|
220
|
+
return last_section;
|
221
|
+
}
|
222
|
+
|
223
|
+
static void bin_cleanup(void)
|
224
|
+
{
|
225
|
+
struct Section *g, **gp;
|
226
|
+
struct Section *gs = NULL, **gsp;
|
227
|
+
struct Section *s, **sp;
|
228
|
+
struct Section *nobits = NULL, **nt;
|
229
|
+
struct Section *last_progbits;
|
230
|
+
struct bin_label *l;
|
231
|
+
struct Reloc *r;
|
232
|
+
uint64_t pend;
|
233
|
+
int h;
|
234
|
+
|
235
|
+
#ifdef DEBUG
|
236
|
+
nasm_error(ERR_DEBUG,
|
237
|
+
"bin_cleanup: Sections were initially referenced in this order:\n");
|
238
|
+
for (h = 0, s = sections; s; h++, s = s->next)
|
239
|
+
fprintf(stdout, "%i. %s\n", h, s->name);
|
240
|
+
#endif
|
241
|
+
|
242
|
+
/* Assembly has completed, so now we need to generate the output file.
|
243
|
+
* Step 1: Separate progbits and nobits sections into separate lists.
|
244
|
+
* Step 2: Sort the progbits sections into their output order.
|
245
|
+
* Step 3: Compute start addresses for all progbits sections.
|
246
|
+
* Step 4: Compute vstart addresses for all sections.
|
247
|
+
* Step 5: Apply relocations.
|
248
|
+
* Step 6: Write the sections' data to the output file.
|
249
|
+
* Step 7: Generate the map file.
|
250
|
+
* Step 8: Release all allocated memory.
|
251
|
+
*/
|
252
|
+
|
253
|
+
/* To do: Smart section-type adaptation could leave some empty sections
|
254
|
+
* without a defined type (progbits/nobits). Won't fix now since this
|
255
|
+
* feature will be disabled. */
|
256
|
+
|
257
|
+
/* Step 1: Split progbits and nobits sections into separate lists. */
|
258
|
+
|
259
|
+
nt = &nobits;
|
260
|
+
/* Move nobits sections into a separate list. Also pre-process nobits
|
261
|
+
* sections' attributes. */
|
262
|
+
for (sp = §ions->next, s = sections->next; s; s = *sp) { /* Skip progbits sections. */
|
263
|
+
if (s->flags & TYPE_PROGBITS) {
|
264
|
+
sp = &s->next;
|
265
|
+
continue;
|
266
|
+
}
|
267
|
+
/* Do some special pre-processing on nobits sections' attributes. */
|
268
|
+
if (s->flags & (START_DEFINED | ALIGN_DEFINED | FOLLOWS_DEFINED)) { /* Check for a mixture of real and virtual section attributes. */
|
269
|
+
if (s->flags & (VSTART_DEFINED | VALIGN_DEFINED |
|
270
|
+
VFOLLOWS_DEFINED))
|
271
|
+
nasm_fatal(ERR_NOFILE,
|
272
|
+
"cannot mix real and virtual attributes"
|
273
|
+
" in nobits section (%s)", s->name);
|
274
|
+
/* Real and virtual attributes mean the same thing for nobits sections. */
|
275
|
+
if (s->flags & START_DEFINED) {
|
276
|
+
s->vstart = s->start;
|
277
|
+
s->flags |= VSTART_DEFINED;
|
278
|
+
}
|
279
|
+
if (s->flags & ALIGN_DEFINED) {
|
280
|
+
s->valign = s->align;
|
281
|
+
s->flags |= VALIGN_DEFINED;
|
282
|
+
}
|
283
|
+
if (s->flags & FOLLOWS_DEFINED) {
|
284
|
+
s->vfollows = s->follows;
|
285
|
+
s->flags |= VFOLLOWS_DEFINED;
|
286
|
+
s->flags &= ~FOLLOWS_DEFINED;
|
287
|
+
}
|
288
|
+
}
|
289
|
+
/* Every section must have a start address. */
|
290
|
+
if (s->flags & VSTART_DEFINED) {
|
291
|
+
s->start = s->vstart;
|
292
|
+
s->flags |= START_DEFINED;
|
293
|
+
}
|
294
|
+
/* Move the section into the nobits list. */
|
295
|
+
*sp = s->next;
|
296
|
+
s->next = NULL;
|
297
|
+
*nt = s;
|
298
|
+
nt = &s->next;
|
299
|
+
}
|
300
|
+
|
301
|
+
/* Step 2: Sort the progbits sections into their output order. */
|
302
|
+
|
303
|
+
/* In Step 2 we move around sections in groups. A group
|
304
|
+
* begins with a section (group leader) that has a user-
|
305
|
+
* defined start address or follows section. The remainder
|
306
|
+
* of the group is made up of the sections that implicitly
|
307
|
+
* follow the group leader (i.e., they were defined after
|
308
|
+
* the group leader and were not given an explicit start
|
309
|
+
* address or follows section by the user). */
|
310
|
+
|
311
|
+
/* For anyone attempting to read this code:
|
312
|
+
* g (group) points to a group of sections, the first one of which has
|
313
|
+
* a user-defined start address or follows section.
|
314
|
+
* gp (g previous) holds the location of the pointer to g.
|
315
|
+
* gs (g scan) is a temp variable that we use to scan to the end of the group.
|
316
|
+
* gsp (gs previous) holds the location of the pointer to gs.
|
317
|
+
* nt (nobits tail) points to the nobits section-list tail.
|
318
|
+
*/
|
319
|
+
|
320
|
+
/* Link all 'follows' groups to their proper position. To do
|
321
|
+
* this we need to know three things: the start of the group
|
322
|
+
* to relocate (g), the section it is following (s), and the
|
323
|
+
* end of the group we're relocating (gs). */
|
324
|
+
for (gp = §ions, g = sections; g; g = gs) { /* Find the next follows group that is out of place (g). */
|
325
|
+
if (!(g->flags & FOLLOWS_DEFINED)) {
|
326
|
+
while (g->next) {
|
327
|
+
if ((g->next->flags & FOLLOWS_DEFINED) &&
|
328
|
+
strcmp(g->name, g->next->follows))
|
329
|
+
break;
|
330
|
+
g = g->next;
|
331
|
+
}
|
332
|
+
if (!g->next)
|
333
|
+
break;
|
334
|
+
gp = &g->next;
|
335
|
+
g = g->next;
|
336
|
+
}
|
337
|
+
/* Find the section that this group follows (s). */
|
338
|
+
for (sp = §ions, s = sections;
|
339
|
+
s && strcmp(s->name, g->follows);
|
340
|
+
sp = &s->next, s = s->next) ;
|
341
|
+
if (!s)
|
342
|
+
nasm_fatal(ERR_NOFILE, "section %s follows an invalid or"
|
343
|
+
" unknown section (%s)", g->name, g->follows);
|
344
|
+
if (s->next && (s->next->flags & FOLLOWS_DEFINED) &&
|
345
|
+
!strcmp(s->name, s->next->follows))
|
346
|
+
nasm_fatal(ERR_NOFILE, "sections %s and %s can't both follow"
|
347
|
+
" section %s", g->name, s->next->name, s->name);
|
348
|
+
/* Find the end of the current follows group (gs). */
|
349
|
+
for (gsp = &g->next, gs = g->next;
|
350
|
+
gs && (gs != s) && !(gs->flags & START_DEFINED);
|
351
|
+
gsp = &gs->next, gs = gs->next) {
|
352
|
+
if (gs->next && (gs->next->flags & FOLLOWS_DEFINED) &&
|
353
|
+
strcmp(gs->name, gs->next->follows)) {
|
354
|
+
gsp = &gs->next;
|
355
|
+
gs = gs->next;
|
356
|
+
break;
|
357
|
+
}
|
358
|
+
}
|
359
|
+
/* Re-link the group after its follows section. */
|
360
|
+
*gsp = s->next;
|
361
|
+
s->next = g;
|
362
|
+
*gp = gs;
|
363
|
+
}
|
364
|
+
|
365
|
+
/* Link all 'start' groups to their proper position. Once
|
366
|
+
* again we need to know g, s, and gs (see above). The main
|
367
|
+
* difference is we already know g since we sort by moving
|
368
|
+
* groups from the 'unsorted' list into a 'sorted' list (g
|
369
|
+
* will always be the first section in the unsorted list). */
|
370
|
+
for (g = sections, sections = NULL; g; g = gs) { /* Find the section that we will insert this group before (s). */
|
371
|
+
for (sp = §ions, s = sections; s; sp = &s->next, s = s->next)
|
372
|
+
if ((s->flags & START_DEFINED) && (g->start < s->start))
|
373
|
+
break;
|
374
|
+
/* Find the end of the group (gs). */
|
375
|
+
for (gs = g->next, gsp = &g->next;
|
376
|
+
gs && !(gs->flags & START_DEFINED);
|
377
|
+
gsp = &gs->next, gs = gs->next) ;
|
378
|
+
/* Re-link the group before the target section. */
|
379
|
+
*sp = g;
|
380
|
+
*gsp = s;
|
381
|
+
}
|
382
|
+
|
383
|
+
/* Step 3: Compute start addresses for all progbits sections. */
|
384
|
+
|
385
|
+
/* Make sure we have an origin and a start address for the first section. */
|
386
|
+
if (origin_defined) {
|
387
|
+
if (sections->flags & START_DEFINED) {
|
388
|
+
/* Make sure this section doesn't begin before the origin. */
|
389
|
+
if (sections->start < origin)
|
390
|
+
nasm_fatal(ERR_NOFILE, "section %s begins"
|
391
|
+
" before program origin", sections->name);
|
392
|
+
} else if (sections->flags & ALIGN_DEFINED) {
|
393
|
+
sections->start = ALIGN(origin, sections->align);
|
394
|
+
} else {
|
395
|
+
sections->start = origin;
|
396
|
+
}
|
397
|
+
} else {
|
398
|
+
if (!(sections->flags & START_DEFINED))
|
399
|
+
sections->start = 0;
|
400
|
+
origin = sections->start;
|
401
|
+
}
|
402
|
+
sections->flags |= START_DEFINED;
|
403
|
+
|
404
|
+
/* Make sure each section has an explicit start address. If it
|
405
|
+
* doesn't, then compute one based its alignment and the end of
|
406
|
+
* the previous section. */
|
407
|
+
for (pend = sections->start, g = s = sections; g; g = g->next) { /* Find the next section that could cause an overlap situation
|
408
|
+
* (has a defined start address, and is not zero length). */
|
409
|
+
if (g == s)
|
410
|
+
for (s = g->next;
|
411
|
+
s && ((s->length == 0) || !(s->flags & START_DEFINED));
|
412
|
+
s = s->next) ;
|
413
|
+
/* Compute the start address of this section, if necessary. */
|
414
|
+
if (!(g->flags & START_DEFINED)) { /* Default to an alignment of 4 if unspecified. */
|
415
|
+
if (!(g->flags & ALIGN_DEFINED)) {
|
416
|
+
g->align = 4;
|
417
|
+
g->flags |= ALIGN_DEFINED;
|
418
|
+
}
|
419
|
+
/* Set the section start address. */
|
420
|
+
g->start = ALIGN(pend, g->align);
|
421
|
+
g->flags |= START_DEFINED;
|
422
|
+
}
|
423
|
+
/* Ugly special case for progbits sections' virtual attributes:
|
424
|
+
* If there is a defined valign, but no vstart and no vfollows, then
|
425
|
+
* we valign after the previous progbits section. This case doesn't
|
426
|
+
* really make much sense for progbits sections with a defined start
|
427
|
+
* address, but it is possible and we must do *something*.
|
428
|
+
* Not-so-ugly special case:
|
429
|
+
* If a progbits section has no virtual attributes, we set the
|
430
|
+
* vstart equal to the start address. */
|
431
|
+
if (!(g->flags & (VSTART_DEFINED | VFOLLOWS_DEFINED))) {
|
432
|
+
if (g->flags & VALIGN_DEFINED)
|
433
|
+
g->vstart = ALIGN(pend, g->valign);
|
434
|
+
else
|
435
|
+
g->vstart = g->start;
|
436
|
+
g->flags |= VSTART_DEFINED;
|
437
|
+
}
|
438
|
+
/* Ignore zero-length sections. */
|
439
|
+
if (g->start < pend)
|
440
|
+
continue;
|
441
|
+
/* Compute the span of this section. */
|
442
|
+
pend = g->start + g->length;
|
443
|
+
/* Check for section overlap. */
|
444
|
+
if (s) {
|
445
|
+
if (s->start < origin)
|
446
|
+
nasm_fatal(ERR_NOFILE, "section %s beings before program origin",
|
447
|
+
s->name);
|
448
|
+
if (g->start > s->start)
|
449
|
+
nasm_fatal(ERR_NOFILE, "sections %s ~ %s and %s overlap!",
|
450
|
+
gs->name, g->name, s->name);
|
451
|
+
if (pend > s->start)
|
452
|
+
nasm_fatal(ERR_NOFILE, "sections %s and %s overlap!",
|
453
|
+
g->name, s->name);
|
454
|
+
}
|
455
|
+
/* Remember this section as the latest >0 length section. */
|
456
|
+
gs = g;
|
457
|
+
}
|
458
|
+
|
459
|
+
/* Step 4: Compute vstart addresses for all sections. */
|
460
|
+
|
461
|
+
/* Attach the nobits sections to the end of the progbits sections. */
|
462
|
+
for (s = sections; s->next; s = s->next) ;
|
463
|
+
s->next = nobits;
|
464
|
+
last_progbits = s;
|
465
|
+
/*
|
466
|
+
* Scan for sections that don't have a vstart address. If we find
|
467
|
+
* one we'll attempt to compute its vstart. If we can't compute
|
468
|
+
* the vstart, we leave it alone and come back to it in a
|
469
|
+
* subsequent scan. We continue scanning and re-scanning until
|
470
|
+
* we've gone one full cycle without computing any vstarts.
|
471
|
+
*/
|
472
|
+
do { /* Do one full scan of the sections list. */
|
473
|
+
for (h = 0, g = sections; g; g = g->next) {
|
474
|
+
if (g->flags & VSTART_DEFINED)
|
475
|
+
continue;
|
476
|
+
/* Find the section that this one virtually follows. */
|
477
|
+
if (g->flags & VFOLLOWS_DEFINED) {
|
478
|
+
for (s = sections; s && strcmp(g->vfollows, s->name);
|
479
|
+
s = s->next) ;
|
480
|
+
if (!s)
|
481
|
+
nasm_fatal(ERR_NOFILE,
|
482
|
+
"section %s vfollows unknown section (%s)",
|
483
|
+
g->name, g->vfollows);
|
484
|
+
} else if (g->prev != NULL)
|
485
|
+
for (s = sections; s && (s != g->prev); s = s->next) ;
|
486
|
+
/* The .bss section is the only one with prev = NULL.
|
487
|
+
In this case we implicitly follow the last progbits
|
488
|
+
section. */
|
489
|
+
else
|
490
|
+
s = last_progbits;
|
491
|
+
|
492
|
+
/* If the section we're following has a vstart, we can proceed. */
|
493
|
+
if (s->flags & VSTART_DEFINED) { /* Default to virtual alignment of four. */
|
494
|
+
if (!(g->flags & VALIGN_DEFINED)) {
|
495
|
+
g->valign = 4;
|
496
|
+
g->flags |= VALIGN_DEFINED;
|
497
|
+
}
|
498
|
+
/* Compute the vstart address. */
|
499
|
+
g->vstart = ALIGN(s->vstart + s->length, g->valign);
|
500
|
+
g->flags |= VSTART_DEFINED;
|
501
|
+
h++;
|
502
|
+
/* Start and vstart mean the same thing for nobits sections. */
|
503
|
+
if (g->flags & TYPE_NOBITS)
|
504
|
+
g->start = g->vstart;
|
505
|
+
}
|
506
|
+
}
|
507
|
+
} while (h);
|
508
|
+
|
509
|
+
/* Now check for any circular vfollows references, which will manifest
|
510
|
+
* themselves as sections without a defined vstart. */
|
511
|
+
for (h = 0, s = sections; s; s = s->next) {
|
512
|
+
if (!(s->flags & VSTART_DEFINED)) { /* Non-fatal errors after assembly has completed are generally a
|
513
|
+
* no-no, but we'll throw a fatal one eventually so it's ok. */
|
514
|
+
nasm_error(ERR_NONFATAL, "cannot compute vstart for section %s",
|
515
|
+
s->name);
|
516
|
+
h++;
|
517
|
+
}
|
518
|
+
}
|
519
|
+
if (h)
|
520
|
+
nasm_fatal(ERR_NOFILE, "circular vfollows path detected");
|
521
|
+
|
522
|
+
#ifdef DEBUG
|
523
|
+
nasm_error(ERR_DEBUG,
|
524
|
+
"bin_cleanup: Confirm final section order for output file:\n");
|
525
|
+
for (h = 0, s = sections; s && (s->flags & TYPE_PROGBITS);
|
526
|
+
h++, s = s->next)
|
527
|
+
fprintf(stdout, "%i. %s\n", h, s->name);
|
528
|
+
#endif
|
529
|
+
|
530
|
+
/* Step 5: Apply relocations. */
|
531
|
+
|
532
|
+
/* Prepare the sections for relocating. */
|
533
|
+
list_for_each(s, sections)
|
534
|
+
saa_rewind(s->contents);
|
535
|
+
/* Apply relocations. */
|
536
|
+
list_for_each(r, relocs) {
|
537
|
+
uint8_t *p, mydata[8];
|
538
|
+
int64_t l;
|
539
|
+
int b;
|
540
|
+
|
541
|
+
nasm_assert(r->bytes <= 8);
|
542
|
+
|
543
|
+
memset(mydata, 0, sizeof(mydata));
|
544
|
+
|
545
|
+
saa_fread(r->target->contents, r->posn, mydata, r->bytes);
|
546
|
+
p = mydata;
|
547
|
+
l = 0;
|
548
|
+
for (b = r->bytes - 1; b >= 0; b--)
|
549
|
+
l = (l << 8) + mydata[b];
|
550
|
+
|
551
|
+
s = find_section_by_index(r->secref);
|
552
|
+
if (s) {
|
553
|
+
if (r->secref == s->start_index)
|
554
|
+
l += s->start;
|
555
|
+
else
|
556
|
+
l += s->vstart;
|
557
|
+
}
|
558
|
+
s = find_section_by_index(r->secrel);
|
559
|
+
if (s) {
|
560
|
+
if (r->secrel == s->start_index)
|
561
|
+
l -= s->start;
|
562
|
+
else
|
563
|
+
l -= s->vstart;
|
564
|
+
}
|
565
|
+
|
566
|
+
WRITEADDR(p, l, r->bytes);
|
567
|
+
saa_fwrite(r->target->contents, r->posn, mydata, r->bytes);
|
568
|
+
}
|
569
|
+
|
570
|
+
/* Step 6: Write the section data to the output file. */
|
571
|
+
do_output();
|
572
|
+
|
573
|
+
/* Step 7: Generate the map file. */
|
574
|
+
|
575
|
+
if (map_control) {
|
576
|
+
static const char not_defined[] = "not defined";
|
577
|
+
|
578
|
+
/* Display input and output file names. */
|
579
|
+
fprintf(rf, "\n- NASM Map file ");
|
580
|
+
for (h = 63; h; h--)
|
581
|
+
fputc('-', rf);
|
582
|
+
fprintf(rf, "\n\nSource file: %s\nOutput file: %s\n\n",
|
583
|
+
infile, outfile);
|
584
|
+
|
585
|
+
if (map_control & MAP_ORIGIN) { /* Display program origin. */
|
586
|
+
fprintf(rf, "-- Program origin ");
|
587
|
+
for (h = 61; h; h--)
|
588
|
+
fputc('-', rf);
|
589
|
+
fprintf(rf, "\n\n%08"PRIX64"\n\n", origin);
|
590
|
+
}
|
591
|
+
/* Display sections summary. */
|
592
|
+
if (map_control & MAP_SUMMARY) {
|
593
|
+
fprintf(rf, "-- Sections (summary) ");
|
594
|
+
for (h = 57; h; h--)
|
595
|
+
fputc('-', rf);
|
596
|
+
fprintf(rf, "\n\nVstart Start Stop "
|
597
|
+
"Length Class Name\n");
|
598
|
+
list_for_each(s, sections) {
|
599
|
+
fprintf(rf, "%16"PRIX64" %16"PRIX64" %16"PRIX64" %08"PRIX64" ",
|
600
|
+
s->vstart, s->start, s->start + s->length,
|
601
|
+
s->length);
|
602
|
+
if (s->flags & TYPE_PROGBITS)
|
603
|
+
fprintf(rf, "progbits ");
|
604
|
+
else
|
605
|
+
fprintf(rf, "nobits ");
|
606
|
+
fprintf(rf, "%s\n", s->name);
|
607
|
+
}
|
608
|
+
fprintf(rf, "\n");
|
609
|
+
}
|
610
|
+
/* Display detailed section information. */
|
611
|
+
if (map_control & MAP_SECTIONS) {
|
612
|
+
fprintf(rf, "-- Sections (detailed) ");
|
613
|
+
for (h = 56; h; h--)
|
614
|
+
fputc('-', rf);
|
615
|
+
fprintf(rf, "\n\n");
|
616
|
+
list_for_each(s, sections) {
|
617
|
+
fprintf(rf, "---- Section %s ", s->name);
|
618
|
+
for (h = 65 - strlen(s->name); h; h--)
|
619
|
+
fputc('-', rf);
|
620
|
+
fprintf(rf, "\n\nclass: ");
|
621
|
+
if (s->flags & TYPE_PROGBITS)
|
622
|
+
fprintf(rf, "progbits");
|
623
|
+
else
|
624
|
+
fprintf(rf, "nobits");
|
625
|
+
fprintf(rf, "\nlength: %16"PRIX64"\nstart: %16"PRIX64""
|
626
|
+
"\nalign: ", s->length, s->start);
|
627
|
+
if (s->flags & ALIGN_DEFINED)
|
628
|
+
fprintf(rf, "%16"PRIX64"", s->align);
|
629
|
+
else
|
630
|
+
fputs(not_defined, rf);
|
631
|
+
fprintf(rf, "\nfollows: ");
|
632
|
+
if (s->flags & FOLLOWS_DEFINED)
|
633
|
+
fprintf(rf, "%s", s->follows);
|
634
|
+
else
|
635
|
+
fputs(not_defined, rf);
|
636
|
+
fprintf(rf, "\nvstart: %16"PRIX64"\nvalign: ", s->vstart);
|
637
|
+
if (s->flags & VALIGN_DEFINED)
|
638
|
+
fprintf(rf, "%16"PRIX64"", s->valign);
|
639
|
+
else
|
640
|
+
fputs(not_defined, rf);
|
641
|
+
fprintf(rf, "\nvfollows: ");
|
642
|
+
if (s->flags & VFOLLOWS_DEFINED)
|
643
|
+
fprintf(rf, "%s", s->vfollows);
|
644
|
+
else
|
645
|
+
fputs(not_defined, rf);
|
646
|
+
fprintf(rf, "\n\n");
|
647
|
+
}
|
648
|
+
}
|
649
|
+
/* Display symbols information. */
|
650
|
+
if (map_control & MAP_SYMBOLS) {
|
651
|
+
int32_t segment;
|
652
|
+
int64_t offset;
|
653
|
+
|
654
|
+
fprintf(rf, "-- Symbols ");
|
655
|
+
for (h = 68; h; h--)
|
656
|
+
fputc('-', rf);
|
657
|
+
fprintf(rf, "\n\n");
|
658
|
+
if (no_seg_labels) {
|
659
|
+
fprintf(rf, "---- No Section ");
|
660
|
+
for (h = 63; h; h--)
|
661
|
+
fputc('-', rf);
|
662
|
+
fprintf(rf, "\n\nValue Name\n");
|
663
|
+
list_for_each(l, no_seg_labels) {
|
664
|
+
lookup_label(l->name, &segment, &offset);
|
665
|
+
fprintf(rf, "%08"PRIX64" %s\n", offset, l->name);
|
666
|
+
}
|
667
|
+
fprintf(rf, "\n\n");
|
668
|
+
}
|
669
|
+
list_for_each(s, sections) {
|
670
|
+
if (s->labels) {
|
671
|
+
fprintf(rf, "---- Section %s ", s->name);
|
672
|
+
for (h = 65 - strlen(s->name); h; h--)
|
673
|
+
fputc('-', rf);
|
674
|
+
fprintf(rf, "\n\nReal Virtual Name\n");
|
675
|
+
list_for_each(l, s->labels) {
|
676
|
+
lookup_label(l->name, &segment, &offset);
|
677
|
+
fprintf(rf, "%16"PRIX64" %16"PRIX64" %s\n",
|
678
|
+
s->start + offset, s->vstart + offset,
|
679
|
+
l->name);
|
680
|
+
}
|
681
|
+
fprintf(rf, "\n");
|
682
|
+
}
|
683
|
+
}
|
684
|
+
}
|
685
|
+
}
|
686
|
+
|
687
|
+
/* Close the report file. */
|
688
|
+
if (map_control && (rf != stdout) && (rf != stderr))
|
689
|
+
fclose(rf);
|
690
|
+
|
691
|
+
/* Step 8: Release all allocated memory. */
|
692
|
+
|
693
|
+
/* Free sections, label pointer structs, etc.. */
|
694
|
+
while (sections) {
|
695
|
+
s = sections;
|
696
|
+
sections = s->next;
|
697
|
+
saa_free(s->contents);
|
698
|
+
nasm_free(s->name);
|
699
|
+
if (s->flags & FOLLOWS_DEFINED)
|
700
|
+
nasm_free(s->follows);
|
701
|
+
if (s->flags & VFOLLOWS_DEFINED)
|
702
|
+
nasm_free(s->vfollows);
|
703
|
+
while (s->labels) {
|
704
|
+
l = s->labels;
|
705
|
+
s->labels = l->next;
|
706
|
+
nasm_free(l);
|
707
|
+
}
|
708
|
+
nasm_free(s);
|
709
|
+
}
|
710
|
+
|
711
|
+
/* Free no-section labels. */
|
712
|
+
while (no_seg_labels) {
|
713
|
+
l = no_seg_labels;
|
714
|
+
no_seg_labels = l->next;
|
715
|
+
nasm_free(l);
|
716
|
+
}
|
717
|
+
|
718
|
+
/* Free relocation structures. */
|
719
|
+
while (relocs) {
|
720
|
+
r = relocs->next;
|
721
|
+
nasm_free(relocs);
|
722
|
+
relocs = r;
|
723
|
+
}
|
724
|
+
}
|
725
|
+
|
726
|
+
static void bin_out(int32_t segto, const void *data,
|
727
|
+
enum out_type type, uint64_t size,
|
728
|
+
int32_t segment, int32_t wrt)
|
729
|
+
{
|
730
|
+
uint8_t *p, mydata[8];
|
731
|
+
struct Section *s;
|
732
|
+
|
733
|
+
if (wrt != NO_SEG) {
|
734
|
+
wrt = NO_SEG; /* continue to do _something_ */
|
735
|
+
nasm_error(ERR_NONFATAL, "WRT not supported by binary output format");
|
736
|
+
}
|
737
|
+
|
738
|
+
/* Handle absolute-assembly (structure definitions). */
|
739
|
+
if (segto == NO_SEG) {
|
740
|
+
if (type != OUT_RESERVE)
|
741
|
+
nasm_error(ERR_NONFATAL, "attempt to assemble code in"
|
742
|
+
" [ABSOLUTE] space");
|
743
|
+
return;
|
744
|
+
}
|
745
|
+
|
746
|
+
/* Find the segment we are targeting. */
|
747
|
+
s = find_section_by_index(segto);
|
748
|
+
if (!s)
|
749
|
+
nasm_panic(0, "code directed to nonexistent segment?");
|
750
|
+
|
751
|
+
/* "Smart" section-type adaptation code. */
|
752
|
+
if (!(s->flags & TYPE_DEFINED)) {
|
753
|
+
if (type == OUT_RESERVE)
|
754
|
+
s->flags |= TYPE_DEFINED | TYPE_NOBITS;
|
755
|
+
else
|
756
|
+
s->flags |= TYPE_DEFINED | TYPE_PROGBITS;
|
757
|
+
}
|
758
|
+
|
759
|
+
if ((s->flags & TYPE_NOBITS) && (type != OUT_RESERVE))
|
760
|
+
nasm_error(ERR_WARNING, "attempt to initialize memory in a"
|
761
|
+
" nobits section: ignored");
|
762
|
+
|
763
|
+
switch (type) {
|
764
|
+
case OUT_ADDRESS:
|
765
|
+
{
|
766
|
+
int asize = abs((int)size);
|
767
|
+
|
768
|
+
if (segment != NO_SEG && !find_section_by_index(segment)) {
|
769
|
+
if (segment % 2)
|
770
|
+
nasm_error(ERR_NONFATAL, "binary output format does not support"
|
771
|
+
" segment base references");
|
772
|
+
else
|
773
|
+
nasm_error(ERR_NONFATAL, "binary output format does not support"
|
774
|
+
" external references");
|
775
|
+
segment = NO_SEG;
|
776
|
+
}
|
777
|
+
if (s->flags & TYPE_PROGBITS) {
|
778
|
+
if (segment != NO_SEG)
|
779
|
+
add_reloc(s, asize, segment, -1L);
|
780
|
+
p = mydata;
|
781
|
+
WRITEADDR(p, *(int64_t *)data, asize);
|
782
|
+
saa_wbytes(s->contents, mydata, asize);
|
783
|
+
}
|
784
|
+
|
785
|
+
/*
|
786
|
+
* Reassign size with sign dropped, we will need it
|
787
|
+
* for section length calculation.
|
788
|
+
*/
|
789
|
+
size = asize;
|
790
|
+
break;
|
791
|
+
}
|
792
|
+
|
793
|
+
case OUT_RAWDATA:
|
794
|
+
if (s->flags & TYPE_PROGBITS)
|
795
|
+
saa_wbytes(s->contents, data, size);
|
796
|
+
break;
|
797
|
+
|
798
|
+
case OUT_RESERVE:
|
799
|
+
if (s->flags & TYPE_PROGBITS) {
|
800
|
+
nasm_error(ERR_WARNING, "uninitialized space declared in"
|
801
|
+
" %s section: zeroing", s->name);
|
802
|
+
saa_wbytes(s->contents, NULL, size);
|
803
|
+
}
|
804
|
+
break;
|
805
|
+
|
806
|
+
case OUT_REL1ADR:
|
807
|
+
case OUT_REL2ADR:
|
808
|
+
case OUT_REL4ADR:
|
809
|
+
case OUT_REL8ADR:
|
810
|
+
{
|
811
|
+
int64_t addr = *(int64_t *)data - size;
|
812
|
+
size = realsize(type, size);
|
813
|
+
if (segment != NO_SEG && !find_section_by_index(segment)) {
|
814
|
+
if (segment % 2)
|
815
|
+
nasm_error(ERR_NONFATAL, "binary output format does not support"
|
816
|
+
" segment base references");
|
817
|
+
else
|
818
|
+
nasm_error(ERR_NONFATAL, "binary output format does not support"
|
819
|
+
" external references");
|
820
|
+
segment = NO_SEG;
|
821
|
+
}
|
822
|
+
if (s->flags & TYPE_PROGBITS) {
|
823
|
+
add_reloc(s, size, segment, segto);
|
824
|
+
p = mydata;
|
825
|
+
WRITEADDR(p, addr - s->length, size);
|
826
|
+
saa_wbytes(s->contents, mydata, size);
|
827
|
+
}
|
828
|
+
break;
|
829
|
+
}
|
830
|
+
|
831
|
+
default:
|
832
|
+
nasm_error(ERR_NONFATAL, "unsupported relocation type %d\n", type);
|
833
|
+
break;
|
834
|
+
}
|
835
|
+
|
836
|
+
s->length += size;
|
837
|
+
}
|
838
|
+
|
839
|
+
static void bin_deflabel(char *name, int32_t segment, int64_t offset,
|
840
|
+
int is_global, char *special)
|
841
|
+
{
|
842
|
+
(void)segment; /* Don't warn that this parameter is unused */
|
843
|
+
(void)offset; /* Don't warn that this parameter is unused */
|
844
|
+
|
845
|
+
if (special)
|
846
|
+
nasm_error(ERR_NONFATAL, "binary format does not support any"
|
847
|
+
" special symbol types");
|
848
|
+
else if (name[0] == '.' && name[1] == '.' && name[2] != '@')
|
849
|
+
nasm_error(ERR_NONFATAL, "unrecognised special symbol `%s'", name);
|
850
|
+
else if (is_global == 2)
|
851
|
+
nasm_error(ERR_NONFATAL, "binary output format does not support common"
|
852
|
+
" variables");
|
853
|
+
else {
|
854
|
+
struct Section *s;
|
855
|
+
struct bin_label ***ltp;
|
856
|
+
|
857
|
+
/* Remember label definition so we can look it up later when
|
858
|
+
* creating the map file. */
|
859
|
+
s = find_section_by_index(segment);
|
860
|
+
if (s)
|
861
|
+
ltp = &(s->labels_end);
|
862
|
+
else
|
863
|
+
ltp = &nsl_tail;
|
864
|
+
(**ltp) = nasm_malloc(sizeof(struct bin_label));
|
865
|
+
(**ltp)->name = name;
|
866
|
+
(**ltp)->next = NULL;
|
867
|
+
*ltp = &((**ltp)->next);
|
868
|
+
}
|
869
|
+
|
870
|
+
}
|
871
|
+
|
872
|
+
/* These constants and the following function are used
|
873
|
+
* by bin_secname() to parse attribute assignments. */
|
874
|
+
|
875
|
+
enum { ATTRIB_START, ATTRIB_ALIGN, ATTRIB_FOLLOWS,
|
876
|
+
ATTRIB_VSTART, ATTRIB_VALIGN, ATTRIB_VFOLLOWS,
|
877
|
+
ATTRIB_NOBITS, ATTRIB_PROGBITS
|
878
|
+
};
|
879
|
+
|
880
|
+
static int bin_read_attribute(char **line, int *attribute,
|
881
|
+
uint64_t *value)
|
882
|
+
{
|
883
|
+
expr *e;
|
884
|
+
int attrib_name_size;
|
885
|
+
struct tokenval tokval;
|
886
|
+
char *exp;
|
887
|
+
|
888
|
+
/* Skip whitespace. */
|
889
|
+
while (**line && nasm_isspace(**line))
|
890
|
+
(*line)++;
|
891
|
+
if (!**line)
|
892
|
+
return 0;
|
893
|
+
|
894
|
+
/* Figure out what attribute we're reading. */
|
895
|
+
if (!nasm_strnicmp(*line, "align=", 6)) {
|
896
|
+
*attribute = ATTRIB_ALIGN;
|
897
|
+
attrib_name_size = 6;
|
898
|
+
} else {
|
899
|
+
if (!nasm_strnicmp(*line, "start=", 6)) {
|
900
|
+
*attribute = ATTRIB_START;
|
901
|
+
attrib_name_size = 6;
|
902
|
+
} else if (!nasm_strnicmp(*line, "follows=", 8)) {
|
903
|
+
*attribute = ATTRIB_FOLLOWS;
|
904
|
+
*line += 8;
|
905
|
+
return 1;
|
906
|
+
} else if (!nasm_strnicmp(*line, "vstart=", 7)) {
|
907
|
+
*attribute = ATTRIB_VSTART;
|
908
|
+
attrib_name_size = 7;
|
909
|
+
} else if (!nasm_strnicmp(*line, "valign=", 7)) {
|
910
|
+
*attribute = ATTRIB_VALIGN;
|
911
|
+
attrib_name_size = 7;
|
912
|
+
} else if (!nasm_strnicmp(*line, "vfollows=", 9)) {
|
913
|
+
*attribute = ATTRIB_VFOLLOWS;
|
914
|
+
*line += 9;
|
915
|
+
return 1;
|
916
|
+
} else if (!nasm_strnicmp(*line, "nobits", 6) &&
|
917
|
+
(nasm_isspace((*line)[6]) || ((*line)[6] == '\0'))) {
|
918
|
+
*attribute = ATTRIB_NOBITS;
|
919
|
+
*line += 6;
|
920
|
+
return 1;
|
921
|
+
} else if (!nasm_strnicmp(*line, "progbits", 8) &&
|
922
|
+
(nasm_isspace((*line)[8]) || ((*line)[8] == '\0'))) {
|
923
|
+
*attribute = ATTRIB_PROGBITS;
|
924
|
+
*line += 8;
|
925
|
+
return 1;
|
926
|
+
} else
|
927
|
+
return 0;
|
928
|
+
}
|
929
|
+
|
930
|
+
/* Find the end of the expression. */
|
931
|
+
if ((*line)[attrib_name_size] != '(') {
|
932
|
+
/* Single term (no parenthesis). */
|
933
|
+
exp = *line += attrib_name_size;
|
934
|
+
while (**line && !nasm_isspace(**line))
|
935
|
+
(*line)++;
|
936
|
+
if (**line) {
|
937
|
+
**line = '\0';
|
938
|
+
(*line)++;
|
939
|
+
}
|
940
|
+
} else {
|
941
|
+
char c;
|
942
|
+
int pcount = 1;
|
943
|
+
|
944
|
+
/* Full expression (delimited by parenthesis) */
|
945
|
+
exp = *line += attrib_name_size + 1;
|
946
|
+
while (1) {
|
947
|
+
(*line) += strcspn(*line, "()'\"");
|
948
|
+
if (**line == '(') {
|
949
|
+
++(*line);
|
950
|
+
++pcount;
|
951
|
+
}
|
952
|
+
if (**line == ')') {
|
953
|
+
++(*line);
|
954
|
+
--pcount;
|
955
|
+
if (!pcount)
|
956
|
+
break;
|
957
|
+
}
|
958
|
+
if ((**line == '"') || (**line == '\'')) {
|
959
|
+
c = **line;
|
960
|
+
while (**line) {
|
961
|
+
++(*line);
|
962
|
+
if (**line == c)
|
963
|
+
break;
|
964
|
+
}
|
965
|
+
if (!**line) {
|
966
|
+
nasm_error(ERR_NONFATAL,
|
967
|
+
"invalid syntax in `section' directive");
|
968
|
+
return -1;
|
969
|
+
}
|
970
|
+
++(*line);
|
971
|
+
}
|
972
|
+
if (!**line) {
|
973
|
+
nasm_error(ERR_NONFATAL, "expecting `)'");
|
974
|
+
return -1;
|
975
|
+
}
|
976
|
+
}
|
977
|
+
*(*line - 1) = '\0'; /* Terminate the expression. */
|
978
|
+
}
|
979
|
+
|
980
|
+
/* Check for no value given. */
|
981
|
+
if (!*exp) {
|
982
|
+
nasm_error(ERR_WARNING, "No value given to attribute in"
|
983
|
+
" `section' directive");
|
984
|
+
return -1;
|
985
|
+
}
|
986
|
+
|
987
|
+
/* Read and evaluate the expression. */
|
988
|
+
stdscan_reset();
|
989
|
+
stdscan_set(exp);
|
990
|
+
tokval.t_type = TOKEN_INVALID;
|
991
|
+
e = evaluate(stdscan, NULL, &tokval, NULL, 1, NULL);
|
992
|
+
if (e) {
|
993
|
+
if (!is_really_simple(e)) {
|
994
|
+
nasm_error(ERR_NONFATAL, "section attribute value must be"
|
995
|
+
" a critical expression");
|
996
|
+
return -1;
|
997
|
+
}
|
998
|
+
} else {
|
999
|
+
nasm_error(ERR_NONFATAL, "Invalid attribute value"
|
1000
|
+
" specified in `section' directive.");
|
1001
|
+
return -1;
|
1002
|
+
}
|
1003
|
+
*value = (uint64_t)reloc_value(e);
|
1004
|
+
return 1;
|
1005
|
+
}
|
1006
|
+
|
1007
|
+
static void bin_sectalign(int32_t seg, unsigned int value)
|
1008
|
+
{
|
1009
|
+
struct Section *s = find_section_by_index(seg);
|
1010
|
+
|
1011
|
+
if (!s || !is_power2(value))
|
1012
|
+
return;
|
1013
|
+
|
1014
|
+
if (value > s->align)
|
1015
|
+
s->align = value;
|
1016
|
+
|
1017
|
+
if (!(s->flags & ALIGN_DEFINED))
|
1018
|
+
s->flags |= ALIGN_DEFINED;
|
1019
|
+
}
|
1020
|
+
|
1021
|
+
static void bin_assign_attributes(struct Section *sec, char *astring)
|
1022
|
+
{
|
1023
|
+
int attribute, check;
|
1024
|
+
uint64_t value;
|
1025
|
+
char *p;
|
1026
|
+
|
1027
|
+
while (1) { /* Get the next attribute. */
|
1028
|
+
check = bin_read_attribute(&astring, &attribute, &value);
|
1029
|
+
/* Skip bad attribute. */
|
1030
|
+
if (check == -1)
|
1031
|
+
continue;
|
1032
|
+
/* Unknown section attribute, so skip it and warn the user. */
|
1033
|
+
if (!check) {
|
1034
|
+
if (!*astring)
|
1035
|
+
break; /* End of line. */
|
1036
|
+
else {
|
1037
|
+
p = astring;
|
1038
|
+
while (*astring && !nasm_isspace(*astring))
|
1039
|
+
astring++;
|
1040
|
+
if (*astring) {
|
1041
|
+
*astring = '\0';
|
1042
|
+
astring++;
|
1043
|
+
}
|
1044
|
+
nasm_error(ERR_WARNING, "ignoring unknown section attribute:"
|
1045
|
+
" \"%s\"", p);
|
1046
|
+
}
|
1047
|
+
continue;
|
1048
|
+
}
|
1049
|
+
|
1050
|
+
switch (attribute) { /* Handle nobits attribute. */
|
1051
|
+
case ATTRIB_NOBITS:
|
1052
|
+
if ((sec->flags & TYPE_DEFINED)
|
1053
|
+
&& (sec->flags & TYPE_PROGBITS))
|
1054
|
+
nasm_error(ERR_NONFATAL,
|
1055
|
+
"attempt to change section type"
|
1056
|
+
" from progbits to nobits");
|
1057
|
+
else
|
1058
|
+
sec->flags |= TYPE_DEFINED | TYPE_NOBITS;
|
1059
|
+
continue;
|
1060
|
+
|
1061
|
+
/* Handle progbits attribute. */
|
1062
|
+
case ATTRIB_PROGBITS:
|
1063
|
+
if ((sec->flags & TYPE_DEFINED) && (sec->flags & TYPE_NOBITS))
|
1064
|
+
nasm_error(ERR_NONFATAL, "attempt to change section type"
|
1065
|
+
" from nobits to progbits");
|
1066
|
+
else
|
1067
|
+
sec->flags |= TYPE_DEFINED | TYPE_PROGBITS;
|
1068
|
+
continue;
|
1069
|
+
|
1070
|
+
/* Handle align attribute. */
|
1071
|
+
case ATTRIB_ALIGN:
|
1072
|
+
if (!value || ((value - 1) & value)) {
|
1073
|
+
nasm_error(ERR_NONFATAL,
|
1074
|
+
"argument to `align' is not a power of two");
|
1075
|
+
} else {
|
1076
|
+
/*
|
1077
|
+
* Alignment is already satisfied if
|
1078
|
+
* the previous align value is greater
|
1079
|
+
*/
|
1080
|
+
if ((sec->flags & ALIGN_DEFINED) && (value < sec->align))
|
1081
|
+
value = sec->align;
|
1082
|
+
|
1083
|
+
/* Don't allow a conflicting align value. */
|
1084
|
+
if ((sec->flags & START_DEFINED) && (sec->start & (value - 1))) {
|
1085
|
+
nasm_error(ERR_NONFATAL,
|
1086
|
+
"`align' value conflicts with section start address");
|
1087
|
+
} else {
|
1088
|
+
sec->align = value;
|
1089
|
+
sec->flags |= ALIGN_DEFINED;
|
1090
|
+
}
|
1091
|
+
}
|
1092
|
+
continue;
|
1093
|
+
|
1094
|
+
/* Handle valign attribute. */
|
1095
|
+
case ATTRIB_VALIGN:
|
1096
|
+
if (!value || ((value - 1) & value))
|
1097
|
+
nasm_error(ERR_NONFATAL, "argument to `valign' is not a"
|
1098
|
+
" power of two");
|
1099
|
+
else { /* Alignment is already satisfied if the previous
|
1100
|
+
* align value is greater. */
|
1101
|
+
if ((sec->flags & VALIGN_DEFINED) && (value < sec->valign))
|
1102
|
+
value = sec->valign;
|
1103
|
+
|
1104
|
+
/* Don't allow a conflicting valign value. */
|
1105
|
+
if ((sec->flags & VSTART_DEFINED)
|
1106
|
+
&& (sec->vstart & (value - 1)))
|
1107
|
+
nasm_error(ERR_NONFATAL,
|
1108
|
+
"`valign' value conflicts "
|
1109
|
+
"with `vstart' address");
|
1110
|
+
else {
|
1111
|
+
sec->valign = value;
|
1112
|
+
sec->flags |= VALIGN_DEFINED;
|
1113
|
+
}
|
1114
|
+
}
|
1115
|
+
continue;
|
1116
|
+
|
1117
|
+
/* Handle start attribute. */
|
1118
|
+
case ATTRIB_START:
|
1119
|
+
if (sec->flags & FOLLOWS_DEFINED)
|
1120
|
+
nasm_error(ERR_NONFATAL, "cannot combine `start' and `follows'"
|
1121
|
+
" section attributes");
|
1122
|
+
else if ((sec->flags & START_DEFINED) && (value != sec->start))
|
1123
|
+
nasm_error(ERR_NONFATAL, "section start address redefined");
|
1124
|
+
else {
|
1125
|
+
sec->start = value;
|
1126
|
+
sec->flags |= START_DEFINED;
|
1127
|
+
if (sec->flags & ALIGN_DEFINED) {
|
1128
|
+
if (sec->start & (sec->align - 1))
|
1129
|
+
nasm_error(ERR_NONFATAL, "`start' address conflicts"
|
1130
|
+
" with section alignment");
|
1131
|
+
sec->flags ^= ALIGN_DEFINED;
|
1132
|
+
}
|
1133
|
+
}
|
1134
|
+
continue;
|
1135
|
+
|
1136
|
+
/* Handle vstart attribute. */
|
1137
|
+
case ATTRIB_VSTART:
|
1138
|
+
if (sec->flags & VFOLLOWS_DEFINED)
|
1139
|
+
nasm_error(ERR_NONFATAL,
|
1140
|
+
"cannot combine `vstart' and `vfollows'"
|
1141
|
+
" section attributes");
|
1142
|
+
else if ((sec->flags & VSTART_DEFINED)
|
1143
|
+
&& (value != sec->vstart))
|
1144
|
+
nasm_error(ERR_NONFATAL,
|
1145
|
+
"section virtual start address"
|
1146
|
+
" (vstart) redefined");
|
1147
|
+
else {
|
1148
|
+
sec->vstart = value;
|
1149
|
+
sec->flags |= VSTART_DEFINED;
|
1150
|
+
if (sec->flags & VALIGN_DEFINED) {
|
1151
|
+
if (sec->vstart & (sec->valign - 1))
|
1152
|
+
nasm_error(ERR_NONFATAL, "`vstart' address conflicts"
|
1153
|
+
" with `valign' value");
|
1154
|
+
sec->flags ^= VALIGN_DEFINED;
|
1155
|
+
}
|
1156
|
+
}
|
1157
|
+
continue;
|
1158
|
+
|
1159
|
+
/* Handle follows attribute. */
|
1160
|
+
case ATTRIB_FOLLOWS:
|
1161
|
+
p = astring;
|
1162
|
+
astring += strcspn(astring, " \t");
|
1163
|
+
if (astring == p)
|
1164
|
+
nasm_error(ERR_NONFATAL, "expecting section name for `follows'"
|
1165
|
+
" attribute");
|
1166
|
+
else {
|
1167
|
+
*(astring++) = '\0';
|
1168
|
+
if (sec->flags & START_DEFINED)
|
1169
|
+
nasm_error(ERR_NONFATAL,
|
1170
|
+
"cannot combine `start' and `follows'"
|
1171
|
+
" section attributes");
|
1172
|
+
sec->follows = nasm_strdup(p);
|
1173
|
+
sec->flags |= FOLLOWS_DEFINED;
|
1174
|
+
}
|
1175
|
+
continue;
|
1176
|
+
|
1177
|
+
/* Handle vfollows attribute. */
|
1178
|
+
case ATTRIB_VFOLLOWS:
|
1179
|
+
if (sec->flags & VSTART_DEFINED)
|
1180
|
+
nasm_error(ERR_NONFATAL,
|
1181
|
+
"cannot combine `vstart' and `vfollows'"
|
1182
|
+
" section attributes");
|
1183
|
+
else {
|
1184
|
+
p = astring;
|
1185
|
+
astring += strcspn(astring, " \t");
|
1186
|
+
if (astring == p)
|
1187
|
+
nasm_error(ERR_NONFATAL,
|
1188
|
+
"expecting section name for `vfollows'"
|
1189
|
+
" attribute");
|
1190
|
+
else {
|
1191
|
+
*(astring++) = '\0';
|
1192
|
+
sec->vfollows = nasm_strdup(p);
|
1193
|
+
sec->flags |= VFOLLOWS_DEFINED;
|
1194
|
+
}
|
1195
|
+
}
|
1196
|
+
continue;
|
1197
|
+
}
|
1198
|
+
}
|
1199
|
+
}
|
1200
|
+
|
1201
|
+
static void bin_define_section_labels(void)
|
1202
|
+
{
|
1203
|
+
static int labels_defined = 0;
|
1204
|
+
struct Section *sec;
|
1205
|
+
char *label_name;
|
1206
|
+
size_t base_len;
|
1207
|
+
|
1208
|
+
if (labels_defined)
|
1209
|
+
return;
|
1210
|
+
list_for_each(sec, sections) {
|
1211
|
+
base_len = strlen(sec->name) + 8;
|
1212
|
+
label_name = nasm_malloc(base_len + 8);
|
1213
|
+
strcpy(label_name, "section.");
|
1214
|
+
strcpy(label_name + 8, sec->name);
|
1215
|
+
|
1216
|
+
/* section.<name>.start */
|
1217
|
+
strcpy(label_name + base_len, ".start");
|
1218
|
+
define_label(label_name, sec->start_index, 0L, NULL, 0, 0);
|
1219
|
+
|
1220
|
+
/* section.<name>.vstart */
|
1221
|
+
strcpy(label_name + base_len, ".vstart");
|
1222
|
+
define_label(label_name, sec->vstart_index, 0L, NULL, 0, 0);
|
1223
|
+
|
1224
|
+
nasm_free(label_name);
|
1225
|
+
}
|
1226
|
+
labels_defined = 1;
|
1227
|
+
}
|
1228
|
+
|
1229
|
+
static int32_t bin_secname(char *name, int pass, int *bits)
|
1230
|
+
{
|
1231
|
+
char *p;
|
1232
|
+
struct Section *sec;
|
1233
|
+
|
1234
|
+
/* bin_secname is called with *name = NULL at the start of each
|
1235
|
+
* pass. Use this opportunity to establish the default section
|
1236
|
+
* (default is BITS-16 ".text" segment).
|
1237
|
+
*/
|
1238
|
+
if (!name) { /* Reset ORG and section attributes at the start of each pass. */
|
1239
|
+
origin_defined = 0;
|
1240
|
+
list_for_each(sec, sections)
|
1241
|
+
sec->flags &= ~(START_DEFINED | VSTART_DEFINED |
|
1242
|
+
ALIGN_DEFINED | VALIGN_DEFINED);
|
1243
|
+
|
1244
|
+
/* Define section start and vstart labels. */
|
1245
|
+
if (pass != 1)
|
1246
|
+
bin_define_section_labels();
|
1247
|
+
|
1248
|
+
/* Establish the default (.text) section. */
|
1249
|
+
*bits = 16;
|
1250
|
+
sec = find_section_by_name(".text");
|
1251
|
+
sec->flags |= TYPE_DEFINED | TYPE_PROGBITS;
|
1252
|
+
return sec->vstart_index;
|
1253
|
+
}
|
1254
|
+
|
1255
|
+
/* Attempt to find the requested section. If it does not
|
1256
|
+
* exist, create it. */
|
1257
|
+
p = name;
|
1258
|
+
while (*p && !nasm_isspace(*p))
|
1259
|
+
p++;
|
1260
|
+
if (*p)
|
1261
|
+
*p++ = '\0';
|
1262
|
+
sec = find_section_by_name(name);
|
1263
|
+
if (!sec) {
|
1264
|
+
sec = create_section(name);
|
1265
|
+
if (!strcmp(name, ".data"))
|
1266
|
+
sec->flags |= TYPE_DEFINED | TYPE_PROGBITS;
|
1267
|
+
else if (!strcmp(name, ".bss")) {
|
1268
|
+
sec->flags |= TYPE_DEFINED | TYPE_NOBITS;
|
1269
|
+
sec->prev = NULL;
|
1270
|
+
}
|
1271
|
+
}
|
1272
|
+
|
1273
|
+
/* Handle attribute assignments. */
|
1274
|
+
if (pass != 1)
|
1275
|
+
bin_assign_attributes(sec, p);
|
1276
|
+
|
1277
|
+
#ifndef ABIN_SMART_ADAPT
|
1278
|
+
/* The following line disables smart adaptation of
|
1279
|
+
* PROGBITS/NOBITS section types (it forces sections to
|
1280
|
+
* default to PROGBITS). */
|
1281
|
+
if ((pass != 1) && !(sec->flags & TYPE_DEFINED))
|
1282
|
+
sec->flags |= TYPE_DEFINED | TYPE_PROGBITS;
|
1283
|
+
#endif
|
1284
|
+
|
1285
|
+
return sec->vstart_index;
|
1286
|
+
}
|
1287
|
+
|
1288
|
+
static enum directive_result
|
1289
|
+
bin_directive(enum directive directive, char *args, int pass)
|
1290
|
+
{
|
1291
|
+
switch (directive) {
|
1292
|
+
case D_ORG:
|
1293
|
+
{
|
1294
|
+
struct tokenval tokval;
|
1295
|
+
uint64_t value;
|
1296
|
+
expr *e;
|
1297
|
+
|
1298
|
+
stdscan_reset();
|
1299
|
+
stdscan_set(args);
|
1300
|
+
tokval.t_type = TOKEN_INVALID;
|
1301
|
+
e = evaluate(stdscan, NULL, &tokval, NULL, 1, NULL);
|
1302
|
+
if (e) {
|
1303
|
+
if (!is_really_simple(e))
|
1304
|
+
nasm_error(ERR_NONFATAL, "org value must be a critical"
|
1305
|
+
" expression");
|
1306
|
+
else {
|
1307
|
+
value = reloc_value(e);
|
1308
|
+
/* Check for ORG redefinition. */
|
1309
|
+
if (origin_defined && (value != origin))
|
1310
|
+
nasm_error(ERR_NONFATAL, "program origin redefined");
|
1311
|
+
else {
|
1312
|
+
origin = value;
|
1313
|
+
origin_defined = 1;
|
1314
|
+
}
|
1315
|
+
}
|
1316
|
+
} else
|
1317
|
+
nasm_error(ERR_NONFATAL, "No or invalid offset specified"
|
1318
|
+
" in ORG directive.");
|
1319
|
+
return DIRR_OK;
|
1320
|
+
}
|
1321
|
+
case D_MAP:
|
1322
|
+
{
|
1323
|
+
/* The 'map' directive allows the user to generate section
|
1324
|
+
* and symbol information to stdout, stderr, or to a file. */
|
1325
|
+
char *p;
|
1326
|
+
|
1327
|
+
if (pass != 1)
|
1328
|
+
return DIRR_OK;
|
1329
|
+
args += strspn(args, " \t");
|
1330
|
+
while (*args) {
|
1331
|
+
p = args;
|
1332
|
+
args += strcspn(args, " \t");
|
1333
|
+
if (*args != '\0')
|
1334
|
+
*(args++) = '\0';
|
1335
|
+
if (!nasm_stricmp(p, "all"))
|
1336
|
+
map_control |=
|
1337
|
+
MAP_ORIGIN | MAP_SUMMARY | MAP_SECTIONS | MAP_SYMBOLS;
|
1338
|
+
else if (!nasm_stricmp(p, "brief"))
|
1339
|
+
map_control |= MAP_ORIGIN | MAP_SUMMARY;
|
1340
|
+
else if (!nasm_stricmp(p, "sections"))
|
1341
|
+
map_control |= MAP_ORIGIN | MAP_SUMMARY | MAP_SECTIONS;
|
1342
|
+
else if (!nasm_stricmp(p, "segments"))
|
1343
|
+
map_control |= MAP_ORIGIN | MAP_SUMMARY | MAP_SECTIONS;
|
1344
|
+
else if (!nasm_stricmp(p, "symbols"))
|
1345
|
+
map_control |= MAP_SYMBOLS;
|
1346
|
+
else if (!rf) {
|
1347
|
+
if (!nasm_stricmp(p, "stdout"))
|
1348
|
+
rf = stdout;
|
1349
|
+
else if (!nasm_stricmp(p, "stderr"))
|
1350
|
+
rf = stderr;
|
1351
|
+
else { /* Must be a filename. */
|
1352
|
+
rf = nasm_open_write(p, NF_TEXT);
|
1353
|
+
if (!rf) {
|
1354
|
+
nasm_error(ERR_WARNING, "unable to open map file `%s'",
|
1355
|
+
p);
|
1356
|
+
map_control = 0;
|
1357
|
+
return DIRR_OK;
|
1358
|
+
}
|
1359
|
+
}
|
1360
|
+
} else
|
1361
|
+
nasm_error(ERR_WARNING, "map file already specified");
|
1362
|
+
}
|
1363
|
+
if (map_control == 0)
|
1364
|
+
map_control |= MAP_ORIGIN | MAP_SUMMARY;
|
1365
|
+
if (!rf)
|
1366
|
+
rf = stdout;
|
1367
|
+
return DIRR_OK;
|
1368
|
+
}
|
1369
|
+
default:
|
1370
|
+
return DIRR_UNKNOWN;
|
1371
|
+
}
|
1372
|
+
}
|
1373
|
+
|
1374
|
+
static void bin_filename(char *inname, char *outname)
|
1375
|
+
{
|
1376
|
+
standard_extension(inname, outname, "");
|
1377
|
+
infile = inname;
|
1378
|
+
outfile = outname;
|
1379
|
+
}
|
1380
|
+
|
1381
|
+
static void ith_filename(char *inname, char *outname)
|
1382
|
+
{
|
1383
|
+
standard_extension(inname, outname, ".ith");
|
1384
|
+
infile = inname;
|
1385
|
+
outfile = outname;
|
1386
|
+
}
|
1387
|
+
|
1388
|
+
static void srec_filename(char *inname, char *outname)
|
1389
|
+
{
|
1390
|
+
standard_extension(inname, outname, ".srec");
|
1391
|
+
infile = inname;
|
1392
|
+
outfile = outname;
|
1393
|
+
}
|
1394
|
+
|
1395
|
+
static int32_t bin_segbase(int32_t segment)
|
1396
|
+
{
|
1397
|
+
return segment;
|
1398
|
+
}
|
1399
|
+
|
1400
|
+
const struct ofmt of_bin, of_ith, of_srec;
|
1401
|
+
static void binfmt_init(void);
|
1402
|
+
static void do_output_bin(void);
|
1403
|
+
static void do_output_ith(void);
|
1404
|
+
static void do_output_srec(void);
|
1405
|
+
|
1406
|
+
static void bin_init(void)
|
1407
|
+
{
|
1408
|
+
do_output = do_output_bin;
|
1409
|
+
binfmt_init();
|
1410
|
+
}
|
1411
|
+
|
1412
|
+
static void ith_init(void)
|
1413
|
+
{
|
1414
|
+
do_output = do_output_ith;
|
1415
|
+
binfmt_init();
|
1416
|
+
}
|
1417
|
+
|
1418
|
+
static void srec_init(void)
|
1419
|
+
{
|
1420
|
+
do_output = do_output_srec;
|
1421
|
+
binfmt_init();
|
1422
|
+
}
|
1423
|
+
|
1424
|
+
static void binfmt_init(void)
|
1425
|
+
{
|
1426
|
+
relocs = NULL;
|
1427
|
+
reloctail = &relocs;
|
1428
|
+
origin_defined = 0;
|
1429
|
+
no_seg_labels = NULL;
|
1430
|
+
nsl_tail = &no_seg_labels;
|
1431
|
+
|
1432
|
+
/* Create default section (.text). */
|
1433
|
+
sections = last_section = nasm_zalloc(sizeof(struct Section));
|
1434
|
+
last_section->name = nasm_strdup(".text");
|
1435
|
+
last_section->contents = saa_init(1L);
|
1436
|
+
last_section->flags = TYPE_DEFINED | TYPE_PROGBITS;
|
1437
|
+
last_section->labels_end = &(last_section->labels);
|
1438
|
+
last_section->start_index = seg_alloc();
|
1439
|
+
last_section->vstart_index = seg_alloc();
|
1440
|
+
}
|
1441
|
+
|
1442
|
+
/* Generate binary file output */
|
1443
|
+
static void do_output_bin(void)
|
1444
|
+
{
|
1445
|
+
struct Section *s;
|
1446
|
+
uint64_t addr = origin;
|
1447
|
+
|
1448
|
+
/* Write the progbits sections to the output file. */
|
1449
|
+
list_for_each(s, sections) {
|
1450
|
+
/* Skip non-progbits sections */
|
1451
|
+
if (!(s->flags & TYPE_PROGBITS))
|
1452
|
+
continue;
|
1453
|
+
/* Skip zero-length sections */
|
1454
|
+
if (s->length == 0)
|
1455
|
+
continue;
|
1456
|
+
|
1457
|
+
/* Pad the space between sections. */
|
1458
|
+
nasm_assert(addr <= s->start);
|
1459
|
+
fwritezero(s->start - addr, ofile);
|
1460
|
+
|
1461
|
+
/* Write the section to the output file. */
|
1462
|
+
saa_fpwrite(s->contents, ofile);
|
1463
|
+
|
1464
|
+
/* Keep track of the current file position */
|
1465
|
+
addr = s->start + s->length;
|
1466
|
+
}
|
1467
|
+
}
|
1468
|
+
|
1469
|
+
/* Generate Intel hex file output */
|
1470
|
+
static void write_ith_record(unsigned int len, uint16_t addr,
|
1471
|
+
uint8_t type, void *data)
|
1472
|
+
{
|
1473
|
+
char buf[1+2+4+2+255*2+2+2];
|
1474
|
+
char *p = buf;
|
1475
|
+
uint8_t csum, *dptr = data;
|
1476
|
+
unsigned int i;
|
1477
|
+
|
1478
|
+
nasm_assert(len <= 255);
|
1479
|
+
|
1480
|
+
csum = len + addr + (addr >> 8) + type;
|
1481
|
+
for (i = 0; i < len; i++)
|
1482
|
+
csum += dptr[i];
|
1483
|
+
csum = -csum;
|
1484
|
+
|
1485
|
+
p += sprintf(p, ":%02X%04X%02X", len, addr, type);
|
1486
|
+
for (i = 0; i < len; i++)
|
1487
|
+
p += sprintf(p, "%02X", dptr[i]);
|
1488
|
+
p += sprintf(p, "%02X\n", csum);
|
1489
|
+
|
1490
|
+
nasm_write(buf, p-buf, ofile);
|
1491
|
+
}
|
1492
|
+
|
1493
|
+
static void do_output_ith(void)
|
1494
|
+
{
|
1495
|
+
uint8_t buf[32];
|
1496
|
+
struct Section *s;
|
1497
|
+
uint64_t addr, hiaddr, hilba;
|
1498
|
+
uint64_t length;
|
1499
|
+
unsigned int chunk;
|
1500
|
+
|
1501
|
+
/* Write the progbits sections to the output file. */
|
1502
|
+
hilba = 0;
|
1503
|
+
list_for_each(s, sections) {
|
1504
|
+
/* Skip non-progbits sections */
|
1505
|
+
if (!(s->flags & TYPE_PROGBITS))
|
1506
|
+
continue;
|
1507
|
+
/* Skip zero-length sections */
|
1508
|
+
if (s->length == 0)
|
1509
|
+
continue;
|
1510
|
+
|
1511
|
+
addr = s->start;
|
1512
|
+
length = s->length;
|
1513
|
+
saa_rewind(s->contents);
|
1514
|
+
|
1515
|
+
while (length) {
|
1516
|
+
hiaddr = addr >> 16;
|
1517
|
+
if (hiaddr != hilba) {
|
1518
|
+
buf[0] = hiaddr >> 8;
|
1519
|
+
buf[1] = hiaddr;
|
1520
|
+
write_ith_record(2, 0, 4, buf);
|
1521
|
+
hilba = hiaddr;
|
1522
|
+
}
|
1523
|
+
|
1524
|
+
chunk = 32 - (addr & 31);
|
1525
|
+
if (length < chunk)
|
1526
|
+
chunk = length;
|
1527
|
+
|
1528
|
+
saa_rnbytes(s->contents, buf, chunk);
|
1529
|
+
write_ith_record(chunk, (uint16_t)addr, 0, buf);
|
1530
|
+
|
1531
|
+
addr += chunk;
|
1532
|
+
length -= chunk;
|
1533
|
+
}
|
1534
|
+
}
|
1535
|
+
|
1536
|
+
/* Write closing record */
|
1537
|
+
write_ith_record(0, 0, 1, NULL);
|
1538
|
+
}
|
1539
|
+
|
1540
|
+
/* Generate Motorola S-records */
|
1541
|
+
static void write_srecord(unsigned int len, unsigned int alen,
|
1542
|
+
uint32_t addr, uint8_t type, void *data)
|
1543
|
+
{
|
1544
|
+
char buf[2+2+8+255*2+2+2];
|
1545
|
+
char *p = buf;
|
1546
|
+
uint8_t csum, *dptr = data;
|
1547
|
+
unsigned int i;
|
1548
|
+
|
1549
|
+
nasm_assert(len <= 255);
|
1550
|
+
|
1551
|
+
switch (alen) {
|
1552
|
+
case 2:
|
1553
|
+
addr &= 0xffff;
|
1554
|
+
break;
|
1555
|
+
case 3:
|
1556
|
+
addr &= 0xffffff;
|
1557
|
+
break;
|
1558
|
+
case 4:
|
1559
|
+
break;
|
1560
|
+
default:
|
1561
|
+
nasm_assert(0);
|
1562
|
+
break;
|
1563
|
+
}
|
1564
|
+
|
1565
|
+
csum = (len+alen+1) + addr + (addr >> 8) + (addr >> 16) + (addr >> 24);
|
1566
|
+
for (i = 0; i < len; i++)
|
1567
|
+
csum += dptr[i];
|
1568
|
+
csum = 0xff-csum;
|
1569
|
+
|
1570
|
+
p += sprintf(p, "S%c%02X%0*X", type, len+alen+1, alen*2, addr);
|
1571
|
+
for (i = 0; i < len; i++)
|
1572
|
+
p += sprintf(p, "%02X", dptr[i]);
|
1573
|
+
p += sprintf(p, "%02X\n", csum);
|
1574
|
+
|
1575
|
+
nasm_write(buf, p-buf, ofile);
|
1576
|
+
}
|
1577
|
+
|
1578
|
+
static void do_output_srec(void)
|
1579
|
+
{
|
1580
|
+
uint8_t buf[32];
|
1581
|
+
struct Section *s;
|
1582
|
+
uint64_t addr, maxaddr;
|
1583
|
+
uint64_t length;
|
1584
|
+
int alen;
|
1585
|
+
unsigned int chunk;
|
1586
|
+
char dtype, etype;
|
1587
|
+
|
1588
|
+
maxaddr = 0;
|
1589
|
+
list_for_each(s, sections) {
|
1590
|
+
/* Skip non-progbits sections */
|
1591
|
+
if (!(s->flags & TYPE_PROGBITS))
|
1592
|
+
continue;
|
1593
|
+
/* Skip zero-length sections */
|
1594
|
+
if (s->length == 0)
|
1595
|
+
continue;
|
1596
|
+
|
1597
|
+
addr = s->start + s->length - 1;
|
1598
|
+
if (addr > maxaddr)
|
1599
|
+
maxaddr = addr;
|
1600
|
+
}
|
1601
|
+
|
1602
|
+
if (maxaddr <= 0xffff) {
|
1603
|
+
alen = 2;
|
1604
|
+
dtype = '1'; /* S1 = 16-bit data */
|
1605
|
+
etype = '9'; /* S9 = 16-bit end */
|
1606
|
+
} else if (maxaddr <= 0xffffff) {
|
1607
|
+
alen = 3;
|
1608
|
+
dtype = '2'; /* S2 = 24-bit data */
|
1609
|
+
etype = '8'; /* S8 = 24-bit end */
|
1610
|
+
} else {
|
1611
|
+
alen = 4;
|
1612
|
+
dtype = '3'; /* S3 = 32-bit data */
|
1613
|
+
etype = '7'; /* S7 = 32-bit end */
|
1614
|
+
}
|
1615
|
+
|
1616
|
+
/* Write head record */
|
1617
|
+
write_srecord(0, 2, 0, '0', NULL);
|
1618
|
+
|
1619
|
+
/* Write the progbits sections to the output file. */
|
1620
|
+
list_for_each(s, sections) {
|
1621
|
+
/* Skip non-progbits sections */
|
1622
|
+
if (!(s->flags & TYPE_PROGBITS))
|
1623
|
+
continue;
|
1624
|
+
/* Skip zero-length sections */
|
1625
|
+
if (s->length == 0)
|
1626
|
+
continue;
|
1627
|
+
|
1628
|
+
addr = s->start;
|
1629
|
+
length = s->length;
|
1630
|
+
saa_rewind(s->contents);
|
1631
|
+
|
1632
|
+
while (length) {
|
1633
|
+
chunk = 32 - (addr & 31);
|
1634
|
+
if (length < chunk)
|
1635
|
+
chunk = length;
|
1636
|
+
|
1637
|
+
saa_rnbytes(s->contents, buf, chunk);
|
1638
|
+
write_srecord(chunk, alen, (uint32_t)addr, dtype, buf);
|
1639
|
+
|
1640
|
+
addr += chunk;
|
1641
|
+
length -= chunk;
|
1642
|
+
}
|
1643
|
+
}
|
1644
|
+
|
1645
|
+
/* Write closing record */
|
1646
|
+
write_srecord(0, alen, 0, etype, NULL);
|
1647
|
+
}
|
1648
|
+
|
1649
|
+
|
1650
|
+
const struct ofmt of_bin = {
|
1651
|
+
"flat-form binary files (e.g. DOS .COM, .SYS)",
|
1652
|
+
"bin",
|
1653
|
+
0,
|
1654
|
+
64,
|
1655
|
+
null_debug_arr,
|
1656
|
+
&null_debug_form,
|
1657
|
+
bin_stdmac,
|
1658
|
+
bin_init,
|
1659
|
+
nasm_do_legacy_output,
|
1660
|
+
bin_out,
|
1661
|
+
bin_deflabel,
|
1662
|
+
bin_secname,
|
1663
|
+
bin_sectalign,
|
1664
|
+
bin_segbase,
|
1665
|
+
bin_directive,
|
1666
|
+
bin_filename,
|
1667
|
+
bin_cleanup,
|
1668
|
+
NULL /* pragma list */
|
1669
|
+
};
|
1670
|
+
|
1671
|
+
const struct ofmt of_ith = {
|
1672
|
+
"Intel hex",
|
1673
|
+
"ith",
|
1674
|
+
OFMT_TEXT,
|
1675
|
+
64,
|
1676
|
+
null_debug_arr,
|
1677
|
+
&null_debug_form,
|
1678
|
+
bin_stdmac,
|
1679
|
+
ith_init,
|
1680
|
+
nasm_do_legacy_output,
|
1681
|
+
bin_out,
|
1682
|
+
bin_deflabel,
|
1683
|
+
bin_secname,
|
1684
|
+
bin_sectalign,
|
1685
|
+
bin_segbase,
|
1686
|
+
bin_directive,
|
1687
|
+
ith_filename,
|
1688
|
+
bin_cleanup,
|
1689
|
+
NULL /* pragma list */
|
1690
|
+
};
|
1691
|
+
|
1692
|
+
const struct ofmt of_srec = {
|
1693
|
+
"Motorola S-records",
|
1694
|
+
"srec",
|
1695
|
+
OFMT_TEXT,
|
1696
|
+
64,
|
1697
|
+
null_debug_arr,
|
1698
|
+
&null_debug_form,
|
1699
|
+
bin_stdmac,
|
1700
|
+
srec_init,
|
1701
|
+
nasm_do_legacy_output,
|
1702
|
+
bin_out,
|
1703
|
+
bin_deflabel,
|
1704
|
+
bin_secname,
|
1705
|
+
bin_sectalign,
|
1706
|
+
bin_segbase,
|
1707
|
+
bin_directive,
|
1708
|
+
srec_filename,
|
1709
|
+
bin_cleanup,
|
1710
|
+
NULL /* pragma list */
|
1711
|
+
};
|
1712
|
+
|
1713
|
+
#endif /* #ifdef OF_BIN */
|