laag-nasm 2.13.03.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (455) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +57 -0
  3. data/LICENSE.txt +29 -0
  4. data/README.org +34 -0
  5. data/ext/laag/nasm/extconf.rb +16 -0
  6. data/laag-nasm.gemspec +20 -0
  7. data/lib/laag/nasm.rb +29 -0
  8. data/patches/Makefile.in.patch +13 -0
  9. data/vendor/repo.or.cz/nasm/.gitignore +102 -0
  10. data/vendor/repo.or.cz/nasm/AUTHORS +137 -0
  11. data/vendor/repo.or.cz/nasm/CHANGES +2 -0
  12. data/vendor/repo.or.cz/nasm/ChangeLog +2905 -0
  13. data/vendor/repo.or.cz/nasm/INSTALL +102 -0
  14. data/vendor/repo.or.cz/nasm/LICENSE +29 -0
  15. data/vendor/repo.or.cz/nasm/Makefile.in +855 -0
  16. data/vendor/repo.or.cz/nasm/Mkfiles/README +46 -0
  17. data/vendor/repo.or.cz/nasm/Mkfiles/msvc.mak +732 -0
  18. data/vendor/repo.or.cz/nasm/Mkfiles/openwcom.mak +706 -0
  19. data/vendor/repo.or.cz/nasm/README +23 -0
  20. data/vendor/repo.or.cz/nasm/SubmittingPatches +116 -0
  21. data/vendor/repo.or.cz/nasm/TODO +376 -0
  22. data/vendor/repo.or.cz/nasm/aclocal.m4 +139 -0
  23. data/vendor/repo.or.cz/nasm/asm/assemble.c +2957 -0
  24. data/vendor/repo.or.cz/nasm/asm/assemble.h +54 -0
  25. data/vendor/repo.or.cz/nasm/asm/directiv.c +566 -0
  26. data/vendor/repo.or.cz/nasm/asm/directiv.dat +92 -0
  27. data/vendor/repo.or.cz/nasm/asm/error.c +202 -0
  28. data/vendor/repo.or.cz/nasm/asm/eval.c +1014 -0
  29. data/vendor/repo.or.cz/nasm/asm/eval.h +49 -0
  30. data/vendor/repo.or.cz/nasm/asm/exprdump.c +79 -0
  31. data/vendor/repo.or.cz/nasm/asm/exprlib.c +200 -0
  32. data/vendor/repo.or.cz/nasm/asm/float.c +952 -0
  33. data/vendor/repo.or.cz/nasm/asm/float.h +54 -0
  34. data/vendor/repo.or.cz/nasm/asm/labels.c +540 -0
  35. data/vendor/repo.or.cz/nasm/asm/listing.c +346 -0
  36. data/vendor/repo.or.cz/nasm/asm/listing.h +113 -0
  37. data/vendor/repo.or.cz/nasm/asm/nasm.c +1855 -0
  38. data/vendor/repo.or.cz/nasm/asm/parser.c +1167 -0
  39. data/vendor/repo.or.cz/nasm/asm/parser.h +45 -0
  40. data/vendor/repo.or.cz/nasm/asm/phash.pl +109 -0
  41. data/vendor/repo.or.cz/nasm/asm/pptok.dat +96 -0
  42. data/vendor/repo.or.cz/nasm/asm/pptok.pl +271 -0
  43. data/vendor/repo.or.cz/nasm/asm/pragma.c +218 -0
  44. data/vendor/repo.or.cz/nasm/asm/preproc-nop.c +188 -0
  45. data/vendor/repo.or.cz/nasm/asm/preproc.c +5459 -0
  46. data/vendor/repo.or.cz/nasm/asm/preproc.h +55 -0
  47. data/vendor/repo.or.cz/nasm/asm/quote.c +479 -0
  48. data/vendor/repo.or.cz/nasm/asm/quote.h +44 -0
  49. data/vendor/repo.or.cz/nasm/asm/rdstrnum.c +68 -0
  50. data/vendor/repo.or.cz/nasm/asm/segalloc.c +51 -0
  51. data/vendor/repo.or.cz/nasm/asm/stdscan.c +345 -0
  52. data/vendor/repo.or.cz/nasm/asm/stdscan.h +49 -0
  53. data/vendor/repo.or.cz/nasm/asm/strfunc.c +359 -0
  54. data/vendor/repo.or.cz/nasm/asm/tokens.dat +135 -0
  55. data/vendor/repo.or.cz/nasm/asm/tokhash.pl +284 -0
  56. data/vendor/repo.or.cz/nasm/autogen.sh +9 -0
  57. data/vendor/repo.or.cz/nasm/common/common.c +122 -0
  58. data/vendor/repo.or.cz/nasm/config/msvc.h +192 -0
  59. data/vendor/repo.or.cz/nasm/config/unknown.h +51 -0
  60. data/vendor/repo.or.cz/nasm/config/watcom.h +74 -0
  61. data/vendor/repo.or.cz/nasm/configure.ac +253 -0
  62. data/vendor/repo.or.cz/nasm/contrib/MSVC6.txt +25 -0
  63. data/vendor/repo.or.cz/nasm/contrib/VSrules/nasm.README +16 -0
  64. data/vendor/repo.or.cz/nasm/contrib/VSrules/nasm.rules +79 -0
  65. data/vendor/repo.or.cz/nasm/disasm/disasm.c +1735 -0
  66. data/vendor/repo.or.cz/nasm/disasm/disasm.h +49 -0
  67. data/vendor/repo.or.cz/nasm/disasm/ndisasm.c +397 -0
  68. data/vendor/repo.or.cz/nasm/disasm/sync.c +132 -0
  69. data/vendor/repo.or.cz/nasm/disasm/sync.h +45 -0
  70. data/vendor/repo.or.cz/nasm/doc/Makefile.in +86 -0
  71. data/vendor/repo.or.cz/nasm/doc/README +20 -0
  72. data/vendor/repo.or.cz/nasm/doc/afmmetrics.ph +102 -0
  73. data/vendor/repo.or.cz/nasm/doc/changes.src +2588 -0
  74. data/vendor/repo.or.cz/nasm/doc/findfont.ph +180 -0
  75. data/vendor/repo.or.cz/nasm/doc/genps.pl +1294 -0
  76. data/vendor/repo.or.cz/nasm/doc/inslist.pl +108 -0
  77. data/vendor/repo.or.cz/nasm/doc/internal.doc +290 -0
  78. data/vendor/repo.or.cz/nasm/doc/local.css +1 -0
  79. data/vendor/repo.or.cz/nasm/doc/nasmdoc.css +150 -0
  80. data/vendor/repo.or.cz/nasm/doc/nasmdoc.src +8309 -0
  81. data/vendor/repo.or.cz/nasm/doc/nasmlogo.eps +212 -0
  82. data/vendor/repo.or.cz/nasm/doc/nasmlogw.png +0 -0
  83. data/vendor/repo.or.cz/nasm/doc/psfonts.ph +53 -0
  84. data/vendor/repo.or.cz/nasm/doc/pspdf.pl +98 -0
  85. data/vendor/repo.or.cz/nasm/doc/pswidth.ph +25 -0
  86. data/vendor/repo.or.cz/nasm/doc/rdsrc.pl +1111 -0
  87. data/vendor/repo.or.cz/nasm/doc/ttfmetrics.ph +63 -0
  88. data/vendor/repo.or.cz/nasm/headers/c +33 -0
  89. data/vendor/repo.or.cz/nasm/headers/doc +33 -0
  90. data/vendor/repo.or.cz/nasm/headers/mac +33 -0
  91. data/vendor/repo.or.cz/nasm/headers/perl +33 -0
  92. data/vendor/repo.or.cz/nasm/include/compiler.h +277 -0
  93. data/vendor/repo.or.cz/nasm/include/disp8.h +45 -0
  94. data/vendor/repo.or.cz/nasm/include/error.h +135 -0
  95. data/vendor/repo.or.cz/nasm/include/hashtbl.h +85 -0
  96. data/vendor/repo.or.cz/nasm/include/iflag.h +173 -0
  97. data/vendor/repo.or.cz/nasm/include/insns.h +76 -0
  98. data/vendor/repo.or.cz/nasm/include/labels.h +60 -0
  99. data/vendor/repo.or.cz/nasm/include/md5.h +21 -0
  100. data/vendor/repo.or.cz/nasm/include/nasm.h +1246 -0
  101. data/vendor/repo.or.cz/nasm/include/nasmint.h +219 -0
  102. data/vendor/repo.or.cz/nasm/include/nasmlib.h +524 -0
  103. data/vendor/repo.or.cz/nasm/include/opflags.h +271 -0
  104. data/vendor/repo.or.cz/nasm/include/perfhash.h +52 -0
  105. data/vendor/repo.or.cz/nasm/include/raa.h +46 -0
  106. data/vendor/repo.or.cz/nasm/include/rbtree.h +51 -0
  107. data/vendor/repo.or.cz/nasm/include/rdoff.h +169 -0
  108. data/vendor/repo.or.cz/nasm/include/saa.h +94 -0
  109. data/vendor/repo.or.cz/nasm/include/strlist.h +55 -0
  110. data/vendor/repo.or.cz/nasm/include/tables.h +70 -0
  111. data/vendor/repo.or.cz/nasm/include/ver.h +47 -0
  112. data/vendor/repo.or.cz/nasm/install-sh +250 -0
  113. data/vendor/repo.or.cz/nasm/macros/altreg.mac +107 -0
  114. data/vendor/repo.or.cz/nasm/macros/fp.mac +54 -0
  115. data/vendor/repo.or.cz/nasm/macros/ifunc.mac +48 -0
  116. data/vendor/repo.or.cz/nasm/macros/macros.pl +294 -0
  117. data/vendor/repo.or.cz/nasm/macros/smartalign.mac +189 -0
  118. data/vendor/repo.or.cz/nasm/macros/standard.mac +226 -0
  119. data/vendor/repo.or.cz/nasm/misc/Doxyfile +752 -0
  120. data/vendor/repo.or.cz/nasm/misc/Nindent +18 -0
  121. data/vendor/repo.or.cz/nasm/misc/README +2 -0
  122. data/vendor/repo.or.cz/nasm/misc/c16.mac +82 -0
  123. data/vendor/repo.or.cz/nasm/misc/c32.mac +52 -0
  124. data/vendor/repo.or.cz/nasm/misc/crcgen.c +44 -0
  125. data/vendor/repo.or.cz/nasm/misc/exebin.mac +57 -0
  126. data/vendor/repo.or.cz/nasm/misc/exebin2.mac +114 -0
  127. data/vendor/repo.or.cz/nasm/misc/fmtinsns.pl +40 -0
  128. data/vendor/repo.or.cz/nasm/misc/genfma.pl +63 -0
  129. data/vendor/repo.or.cz/nasm/misc/hints.txt +26 -0
  130. data/vendor/repo.or.cz/nasm/misc/magic +6 -0
  131. data/vendor/repo.or.cz/nasm/misc/myC32.mac +121 -0
  132. data/vendor/repo.or.cz/nasm/misc/nasm.sl +320 -0
  133. data/vendor/repo.or.cz/nasm/misc/nasmstab +296 -0
  134. data/vendor/repo.or.cz/nasm/misc/omfdump.c +517 -0
  135. data/vendor/repo.or.cz/nasm/misc/pmw.bat +9 -0
  136. data/vendor/repo.or.cz/nasm/misc/proc32.ash +441 -0
  137. data/vendor/repo.or.cz/nasm/misc/scitech.mac +1223 -0
  138. data/vendor/repo.or.cz/nasm/misc/xcrcgen.c +80 -0
  139. data/vendor/repo.or.cz/nasm/nasm.spec.in +83 -0
  140. data/vendor/repo.or.cz/nasm/nasm.spec.sed +3 -0
  141. data/vendor/repo.or.cz/nasm/nasm.txt +306 -0
  142. data/vendor/repo.or.cz/nasm/nasmlib/badenum.c +43 -0
  143. data/vendor/repo.or.cz/nasm/nasmlib/bsi.c +77 -0
  144. data/vendor/repo.or.cz/nasm/nasmlib/crc64.c +189 -0
  145. data/vendor/repo.or.cz/nasm/nasmlib/file.c +259 -0
  146. data/vendor/repo.or.cz/nasm/nasmlib/file.h +128 -0
  147. data/vendor/repo.or.cz/nasm/nasmlib/filename.c +69 -0
  148. data/vendor/repo.or.cz/nasm/nasmlib/hashtbl.c +232 -0
  149. data/vendor/repo.or.cz/nasm/nasmlib/ilog2.c +168 -0
  150. data/vendor/repo.or.cz/nasm/nasmlib/malloc.c +108 -0
  151. data/vendor/repo.or.cz/nasm/nasmlib/md5c.c +247 -0
  152. data/vendor/repo.or.cz/nasm/nasmlib/mmap.c +139 -0
  153. data/vendor/repo.or.cz/nasm/nasmlib/path.c +186 -0
  154. data/vendor/repo.or.cz/nasm/nasmlib/perfhash.c +55 -0
  155. data/vendor/repo.or.cz/nasm/nasmlib/perfhash.pl +362 -0
  156. data/vendor/repo.or.cz/nasm/nasmlib/raa.c +173 -0
  157. data/vendor/repo.or.cz/nasm/nasmlib/rbtree.c +119 -0
  158. data/vendor/repo.or.cz/nasm/nasmlib/readnum.c +172 -0
  159. data/vendor/repo.or.cz/nasm/nasmlib/realpath.c +135 -0
  160. data/vendor/repo.or.cz/nasm/nasmlib/saa.c +431 -0
  161. data/vendor/repo.or.cz/nasm/nasmlib/srcfile.c +128 -0
  162. data/vendor/repo.or.cz/nasm/nasmlib/string.c +242 -0
  163. data/vendor/repo.or.cz/nasm/nasmlib/strlist.c +100 -0
  164. data/vendor/repo.or.cz/nasm/nasmlib/ver.c +51 -0
  165. data/vendor/repo.or.cz/nasm/nasmlib/zerobuf.c +42 -0
  166. data/vendor/repo.or.cz/nasm/ndisasm.txt +94 -0
  167. data/vendor/repo.or.cz/nasm/nsis/NASMMultiUser.nsh +478 -0
  168. data/vendor/repo.or.cz/nasm/nsis/getpearch.pl +76 -0
  169. data/vendor/repo.or.cz/nasm/nsis/nasm-un.ico +0 -0
  170. data/vendor/repo.or.cz/nasm/nsis/nasm.ico +0 -0
  171. data/vendor/repo.or.cz/nasm/nsis/nasm.nsi +241 -0
  172. data/vendor/repo.or.cz/nasm/output/codeview.c +814 -0
  173. data/vendor/repo.or.cz/nasm/output/dwarf.h +566 -0
  174. data/vendor/repo.or.cz/nasm/output/elf.h +537 -0
  175. data/vendor/repo.or.cz/nasm/output/legacy.c +112 -0
  176. data/vendor/repo.or.cz/nasm/output/nulldbg.c +93 -0
  177. data/vendor/repo.or.cz/nasm/output/nullout.c +51 -0
  178. data/vendor/repo.or.cz/nasm/output/outaout.c +954 -0
  179. data/vendor/repo.or.cz/nasm/output/outaout.mac +37 -0
  180. data/vendor/repo.or.cz/nasm/output/outas86.c +650 -0
  181. data/vendor/repo.or.cz/nasm/output/outas86.mac +37 -0
  182. data/vendor/repo.or.cz/nasm/output/outbin.c +1713 -0
  183. data/vendor/repo.or.cz/nasm/output/outbin.mac +40 -0
  184. data/vendor/repo.or.cz/nasm/output/outcoff.c +1242 -0
  185. data/vendor/repo.or.cz/nasm/output/outcoff.mac +43 -0
  186. data/vendor/repo.or.cz/nasm/output/outdbg.c +425 -0
  187. data/vendor/repo.or.cz/nasm/output/outelf.c +3370 -0
  188. data/vendor/repo.or.cz/nasm/output/outelf.h +156 -0
  189. data/vendor/repo.or.cz/nasm/output/outelf.mac +41 -0
  190. data/vendor/repo.or.cz/nasm/output/outform.c +120 -0
  191. data/vendor/repo.or.cz/nasm/output/outform.h +379 -0
  192. data/vendor/repo.or.cz/nasm/output/outieee.c +1528 -0
  193. data/vendor/repo.or.cz/nasm/output/outlib.c +58 -0
  194. data/vendor/repo.or.cz/nasm/output/outlib.h +63 -0
  195. data/vendor/repo.or.cz/nasm/output/outmacho.c +2387 -0
  196. data/vendor/repo.or.cz/nasm/output/outmacho.mac +49 -0
  197. data/vendor/repo.or.cz/nasm/output/outobj.c +2725 -0
  198. data/vendor/repo.or.cz/nasm/output/outobj.mac +49 -0
  199. data/vendor/repo.or.cz/nasm/output/outrdf.mac +40 -0
  200. data/vendor/repo.or.cz/nasm/output/outrdf2.c +791 -0
  201. data/vendor/repo.or.cz/nasm/output/outrdf2.mac +43 -0
  202. data/vendor/repo.or.cz/nasm/output/pecoff.h +532 -0
  203. data/vendor/repo.or.cz/nasm/output/stabs.h +144 -0
  204. data/vendor/repo.or.cz/nasm/perllib/crc64.ph +158 -0
  205. data/vendor/repo.or.cz/nasm/perllib/gensv.pl +34 -0
  206. data/vendor/repo.or.cz/nasm/perllib/phash.ph +200 -0
  207. data/vendor/repo.or.cz/nasm/perllib/random_sv_vectors.ph +67 -0
  208. data/vendor/repo.or.cz/nasm/rdoff/README +185 -0
  209. data/vendor/repo.or.cz/nasm/rdoff/collectn.c +44 -0
  210. data/vendor/repo.or.cz/nasm/rdoff/collectn.h +22 -0
  211. data/vendor/repo.or.cz/nasm/rdoff/doc/Makefile +37 -0
  212. data/vendor/repo.or.cz/nasm/rdoff/doc/rdoff.texi +137 -0
  213. data/vendor/repo.or.cz/nasm/rdoff/doc/v1-v2.txt +62 -0
  214. data/vendor/repo.or.cz/nasm/rdoff/hash.c +122 -0
  215. data/vendor/repo.or.cz/nasm/rdoff/hash.h +17 -0
  216. data/vendor/repo.or.cz/nasm/rdoff/ldrdf.1 +41 -0
  217. data/vendor/repo.or.cz/nasm/rdoff/ldrdf.c +1395 -0
  218. data/vendor/repo.or.cz/nasm/rdoff/ldsegs.h +59 -0
  219. data/vendor/repo.or.cz/nasm/rdoff/rdf2bin.1 +65 -0
  220. data/vendor/repo.or.cz/nasm/rdoff/rdf2bin.c +431 -0
  221. data/vendor/repo.or.cz/nasm/rdoff/rdf2com.1 +1 -0
  222. data/vendor/repo.or.cz/nasm/rdoff/rdf2ihx.1 +1 -0
  223. data/vendor/repo.or.cz/nasm/rdoff/rdf2ith.1 +1 -0
  224. data/vendor/repo.or.cz/nasm/rdoff/rdf2srec.1 +1 -0
  225. data/vendor/repo.or.cz/nasm/rdoff/rdfdump.1 +24 -0
  226. data/vendor/repo.or.cz/nasm/rdoff/rdfdump.c +347 -0
  227. data/vendor/repo.or.cz/nasm/rdoff/rdflib.1 +39 -0
  228. data/vendor/repo.or.cz/nasm/rdoff/rdflib.c +434 -0
  229. data/vendor/repo.or.cz/nasm/rdoff/rdfload.c +213 -0
  230. data/vendor/repo.or.cz/nasm/rdoff/rdfload.h +29 -0
  231. data/vendor/repo.or.cz/nasm/rdoff/rdfutils.h +165 -0
  232. data/vendor/repo.or.cz/nasm/rdoff/rdlar.c +492 -0
  233. data/vendor/repo.or.cz/nasm/rdoff/rdlar.h +34 -0
  234. data/vendor/repo.or.cz/nasm/rdoff/rdlib.c +290 -0
  235. data/vendor/repo.or.cz/nasm/rdoff/rdlib.h +62 -0
  236. data/vendor/repo.or.cz/nasm/rdoff/rdoff.c +621 -0
  237. data/vendor/repo.or.cz/nasm/rdoff/rdx.1 +21 -0
  238. data/vendor/repo.or.cz/nasm/rdoff/rdx.c +90 -0
  239. data/vendor/repo.or.cz/nasm/rdoff/segtab.c +172 -0
  240. data/vendor/repo.or.cz/nasm/rdoff/segtab.h +45 -0
  241. data/vendor/repo.or.cz/nasm/rdoff/symtab.c +159 -0
  242. data/vendor/repo.or.cz/nasm/rdoff/symtab.h +55 -0
  243. data/vendor/repo.or.cz/nasm/rdoff/test/Makefile +10 -0
  244. data/vendor/repo.or.cz/nasm/rdoff/test/makelib.sh +14 -0
  245. data/vendor/repo.or.cz/nasm/rdoff/test/rdfseg.asm +20 -0
  246. data/vendor/repo.or.cz/nasm/rdoff/test/rdfseg2.asm +12 -0
  247. data/vendor/repo.or.cz/nasm/rdoff/test/rdftest1.asm +54 -0
  248. data/vendor/repo.or.cz/nasm/rdoff/test/rdftest2.asm +33 -0
  249. data/vendor/repo.or.cz/nasm/rdoff/test/rdtlib.asm +48 -0
  250. data/vendor/repo.or.cz/nasm/rdoff/test/rdtmain.asm +47 -0
  251. data/vendor/repo.or.cz/nasm/rdoff/test/testlib.asm +18 -0
  252. data/vendor/repo.or.cz/nasm/stdlib/snprintf.c +29 -0
  253. data/vendor/repo.or.cz/nasm/stdlib/strlcpy.c +51 -0
  254. data/vendor/repo.or.cz/nasm/stdlib/strnlen.c +46 -0
  255. data/vendor/repo.or.cz/nasm/stdlib/vsnprintf.c +51 -0
  256. data/vendor/repo.or.cz/nasm/test/Makefile +106 -0
  257. data/vendor/repo.or.cz/nasm/test/_file_.asm +5 -0
  258. data/vendor/repo.or.cz/nasm/test/_version.asm +2 -0
  259. data/vendor/repo.or.cz/nasm/test/a32offs.asm +9 -0
  260. data/vendor/repo.or.cz/nasm/test/absolute.asm +40 -0
  261. data/vendor/repo.or.cz/nasm/test/addr64x.asm +18 -0
  262. data/vendor/repo.or.cz/nasm/test/align13.asm +19 -0
  263. data/vendor/repo.or.cz/nasm/test/align13s.asm +20 -0
  264. data/vendor/repo.or.cz/nasm/test/alonesym-obj.asm +166 -0
  265. data/vendor/repo.or.cz/nasm/test/andbyte.asm +15 -0
  266. data/vendor/repo.or.cz/nasm/test/aoutso.asm +99 -0
  267. data/vendor/repo.or.cz/nasm/test/aouttest.asm +86 -0
  268. data/vendor/repo.or.cz/nasm/test/aouttest.c +36 -0
  269. data/vendor/repo.or.cz/nasm/test/avx.asm +46 -0
  270. data/vendor/repo.or.cz/nasm/test/avx005.asm +529 -0
  271. data/vendor/repo.or.cz/nasm/test/avx2.asm +1608 -0
  272. data/vendor/repo.or.cz/nasm/test/avx512cd.asm +106 -0
  273. data/vendor/repo.or.cz/nasm/test/avx512er.asm +144 -0
  274. data/vendor/repo.or.cz/nasm/test/avx512f.asm +7000 -0
  275. data/vendor/repo.or.cz/nasm/test/avx512pf.asm +88 -0
  276. data/vendor/repo.or.cz/nasm/test/bcd.asm +23 -0
  277. data/vendor/repo.or.cz/nasm/test/binexe.asm +35 -0
  278. data/vendor/repo.or.cz/nasm/test/bintest.asm +59 -0
  279. data/vendor/repo.or.cz/nasm/test/bisect.sh +22 -0
  280. data/vendor/repo.or.cz/nasm/test/br1879590.asm +25 -0
  281. data/vendor/repo.or.cz/nasm/test/br2003451.asm +17 -0
  282. data/vendor/repo.or.cz/nasm/test/br2030823.asm +7 -0
  283. data/vendor/repo.or.cz/nasm/test/br2148476.asm +221 -0
  284. data/vendor/repo.or.cz/nasm/test/br2222615.asm +19 -0
  285. data/vendor/repo.or.cz/nasm/test/br2496848.asm +42 -0
  286. data/vendor/repo.or.cz/nasm/test/br3005117.asm +26 -0
  287. data/vendor/repo.or.cz/nasm/test/br3026808.asm +20 -0
  288. data/vendor/repo.or.cz/nasm/test/br3028880.asm +8 -0
  289. data/vendor/repo.or.cz/nasm/test/br3041451.asm +59 -0
  290. data/vendor/repo.or.cz/nasm/test/br3058845.asm +14 -0
  291. data/vendor/repo.or.cz/nasm/test/br3066383.asm +70 -0
  292. data/vendor/repo.or.cz/nasm/test/br3074517.asm +12 -0
  293. data/vendor/repo.or.cz/nasm/test/br3092924.asm +25 -0
  294. data/vendor/repo.or.cz/nasm/test/br3104312.asm +11 -0
  295. data/vendor/repo.or.cz/nasm/test/br3109604.asm +9 -0
  296. data/vendor/repo.or.cz/nasm/test/br3174983.asm +9 -0
  297. data/vendor/repo.or.cz/nasm/test/br3187743.asm +7 -0
  298. data/vendor/repo.or.cz/nasm/test/br3189064.asm +7 -0
  299. data/vendor/repo.or.cz/nasm/test/br3200749.asm +9 -0
  300. data/vendor/repo.or.cz/nasm/test/br3385573.asm +11 -0
  301. data/vendor/repo.or.cz/nasm/test/br3392252.asm +43 -0
  302. data/vendor/repo.or.cz/nasm/test/br3392259.asm +8 -0
  303. data/vendor/repo.or.cz/nasm/test/br3392363.asm +4 -0
  304. data/vendor/repo.or.cz/nasm/test/br3392392.asm +16 -0
  305. data/vendor/repo.or.cz/nasm/test/br3392396.asm +5 -0
  306. data/vendor/repo.or.cz/nasm/test/br3392411.asm +22 -0
  307. data/vendor/repo.or.cz/nasm/test/br3392418.asm +3 -0
  308. data/vendor/repo.or.cz/nasm/test/br3392439.asm +25 -0
  309. data/vendor/repo.or.cz/nasm/test/br3392442.asm +6 -0
  310. data/vendor/repo.or.cz/nasm/test/br560575.asm +17 -0
  311. data/vendor/repo.or.cz/nasm/test/br560873.asm +27 -0
  312. data/vendor/repo.or.cz/nasm/test/br890790.asm +7 -0
  313. data/vendor/repo.or.cz/nasm/test/br890790_i.asm +1 -0
  314. data/vendor/repo.or.cz/nasm/test/br978756.asm +7 -0
  315. data/vendor/repo.or.cz/nasm/test/changed.asm +383 -0
  316. data/vendor/repo.or.cz/nasm/test/cofftest.asm +85 -0
  317. data/vendor/repo.or.cz/nasm/test/cofftest.c +35 -0
  318. data/vendor/repo.or.cz/nasm/test/crc32.asm +37 -0
  319. data/vendor/repo.or.cz/nasm/test/cv8struc.asm +14 -0
  320. data/vendor/repo.or.cz/nasm/test/dtbcd.asm +72 -0
  321. data/vendor/repo.or.cz/nasm/test/elf64so.asm +118 -0
  322. data/vendor/repo.or.cz/nasm/test/elfso.asm +100 -0
  323. data/vendor/repo.or.cz/nasm/test/elftest.asm +87 -0
  324. data/vendor/repo.or.cz/nasm/test/elftest.c +38 -0
  325. data/vendor/repo.or.cz/nasm/test/elftest64.c +43 -0
  326. data/vendor/repo.or.cz/nasm/test/elif.asm +39 -0
  327. data/vendor/repo.or.cz/nasm/test/expimp.asm +90 -0
  328. data/vendor/repo.or.cz/nasm/test/far64.asm +10 -0
  329. data/vendor/repo.or.cz/nasm/test/float.asm +186 -0
  330. data/vendor/repo.or.cz/nasm/test/float8.asm +135 -0
  331. data/vendor/repo.or.cz/nasm/test/floatb.asm +35 -0
  332. data/vendor/repo.or.cz/nasm/test/floatexp.asm +382 -0
  333. data/vendor/repo.or.cz/nasm/test/floatize.asm +19 -0
  334. data/vendor/repo.or.cz/nasm/test/floattest.asm +28 -0
  335. data/vendor/repo.or.cz/nasm/test/floatx.asm +525 -0
  336. data/vendor/repo.or.cz/nasm/test/fpu.asm +127 -0
  337. data/vendor/repo.or.cz/nasm/test/fwdopt.asm +133 -0
  338. data/vendor/repo.or.cz/nasm/test/fwdoptpp.asm +150 -0
  339. data/vendor/repo.or.cz/nasm/test/gas2nasm.py +104 -0
  340. data/vendor/repo.or.cz/nasm/test/gather.asm +11 -0
  341. data/vendor/repo.or.cz/nasm/test/gotoff64.asm +25 -0
  342. data/vendor/repo.or.cz/nasm/test/hexfp.asm +25 -0
  343. data/vendor/repo.or.cz/nasm/test/hle.asm +19 -0
  344. data/vendor/repo.or.cz/nasm/test/ifelse.asm +46 -0
  345. data/vendor/repo.or.cz/nasm/test/ifenv.asm +31 -0
  346. data/vendor/repo.or.cz/nasm/test/ifmacro.asm +413 -0
  347. data/vendor/repo.or.cz/nasm/test/iftoken.asm +317 -0
  348. data/vendor/repo.or.cz/nasm/test/iftoken.pl +32 -0
  349. data/vendor/repo.or.cz/nasm/test/ilog2.asm +271 -0
  350. data/vendor/repo.or.cz/nasm/test/imacro.asm +8 -0
  351. data/vendor/repo.or.cz/nasm/test/imm.asm +23 -0
  352. data/vendor/repo.or.cz/nasm/test/imm64.asm +61 -0
  353. data/vendor/repo.or.cz/nasm/test/immwarn.asm +91 -0
  354. data/vendor/repo.or.cz/nasm/test/imul.asm +117 -0
  355. data/vendor/repo.or.cz/nasm/test/inc1.asm +6 -0
  356. data/vendor/repo.or.cz/nasm/test/inc2.asm +8 -0
  357. data/vendor/repo.or.cz/nasm/test/incbin.asm +7 -0
  358. data/vendor/repo.or.cz/nasm/test/incbin.data +2 -0
  359. data/vendor/repo.or.cz/nasm/test/inctest.asm +15 -0
  360. data/vendor/repo.or.cz/nasm/test/insnlbl.asm +12 -0
  361. data/vendor/repo.or.cz/nasm/test/invlpga.asm +11 -0
  362. data/vendor/repo.or.cz/nasm/test/jmp64.asm +19 -0
  363. data/vendor/repo.or.cz/nasm/test/lar_lsl.asm +124 -0
  364. data/vendor/repo.or.cz/nasm/test/larlsl.asm +23 -0
  365. data/vendor/repo.or.cz/nasm/test/lnxhello.asm +54 -0
  366. data/vendor/repo.or.cz/nasm/test/local.asm +19 -0
  367. data/vendor/repo.or.cz/nasm/test/loopoffs.asm +12 -0
  368. data/vendor/repo.or.cz/nasm/test/lwp.asm +213 -0
  369. data/vendor/repo.or.cz/nasm/test/macro-defaults.asm +64 -0
  370. data/vendor/repo.or.cz/nasm/test/macroerr.asm +12 -0
  371. data/vendor/repo.or.cz/nasm/test/macroerr.inc +3 -0
  372. data/vendor/repo.or.cz/nasm/test/mmxsize.asm +38 -0
  373. data/vendor/repo.or.cz/nasm/test/movd.asm +12 -0
  374. data/vendor/repo.or.cz/nasm/test/movd64.asm +15 -0
  375. data/vendor/repo.or.cz/nasm/test/movimm.asm +28 -0
  376. data/vendor/repo.or.cz/nasm/test/movnti.asm +10 -0
  377. data/vendor/repo.or.cz/nasm/test/mpx-64.asm +120 -0
  378. data/vendor/repo.or.cz/nasm/test/mpx.asm +89 -0
  379. data/vendor/repo.or.cz/nasm/test/multisection.asm +96 -0
  380. data/vendor/repo.or.cz/nasm/test/nasmformat.asm +17 -0
  381. data/vendor/repo.or.cz/nasm/test/new +9 -0
  382. data/vendor/repo.or.cz/nasm/test/newrdwr.asm +24 -0
  383. data/vendor/repo.or.cz/nasm/test/nop.asm +17 -0
  384. data/vendor/repo.or.cz/nasm/test/nullfile.asm +4 -0
  385. data/vendor/repo.or.cz/nasm/test/objexe.asm +30 -0
  386. data/vendor/repo.or.cz/nasm/test/objlink.c +33 -0
  387. data/vendor/repo.or.cz/nasm/test/objtest.asm +85 -0
  388. data/vendor/repo.or.cz/nasm/test/optimization.asm +104 -0
  389. data/vendor/repo.or.cz/nasm/test/org.asm +18 -0
  390. data/vendor/repo.or.cz/nasm/test/paste.asm +12 -0
  391. data/vendor/repo.or.cz/nasm/test/pcrel.asm +52 -0
  392. data/vendor/repo.or.cz/nasm/test/perf/label.pl +18 -0
  393. data/vendor/repo.or.cz/nasm/test/perf/macro.pl +18 -0
  394. data/vendor/repo.or.cz/nasm/test/perf/token.pl +23 -0
  395. data/vendor/repo.or.cz/nasm/test/performtest.pl +192 -0
  396. data/vendor/repo.or.cz/nasm/test/pextrw.asm +3 -0
  397. data/vendor/repo.or.cz/nasm/test/pinsr16.asm +53 -0
  398. data/vendor/repo.or.cz/nasm/test/pinsr32.asm +53 -0
  399. data/vendor/repo.or.cz/nasm/test/pinsr64.asm +68 -0
  400. data/vendor/repo.or.cz/nasm/test/popcnt.asm +32 -0
  401. data/vendor/repo.or.cz/nasm/test/ppindirect.asm +42 -0
  402. data/vendor/repo.or.cz/nasm/test/pragma.asm +12 -0
  403. data/vendor/repo.or.cz/nasm/test/prefix66.asm +28 -0
  404. data/vendor/repo.or.cz/nasm/test/ptr.asm +4 -0
  405. data/vendor/repo.or.cz/nasm/test/pushseg.asm +17 -0
  406. data/vendor/repo.or.cz/nasm/test/r13.asm +15 -0
  407. data/vendor/repo.or.cz/nasm/test/radix.asm +54 -0
  408. data/vendor/repo.or.cz/nasm/test/rdpid.asm +21 -0
  409. data/vendor/repo.or.cz/nasm/test/reldef.asm +57 -0
  410. data/vendor/repo.or.cz/nasm/test/relocs.asm +20 -0
  411. data/vendor/repo.or.cz/nasm/test/riprel.asm +5357 -0
  412. data/vendor/repo.or.cz/nasm/test/riprel.pl +29 -0
  413. data/vendor/repo.or.cz/nasm/test/riprel2.asm +11 -0
  414. data/vendor/repo.or.cz/nasm/test/sha-64.asm +30 -0
  415. data/vendor/repo.or.cz/nasm/test/sha.asm +31 -0
  416. data/vendor/repo.or.cz/nasm/test/smartalign16.asm +36 -0
  417. data/vendor/repo.or.cz/nasm/test/smartalign32.asm +36 -0
  418. data/vendor/repo.or.cz/nasm/test/smartalign64.asm +36 -0
  419. data/vendor/repo.or.cz/nasm/test/splitea.asm +11 -0
  420. data/vendor/repo.or.cz/nasm/test/sreg.asm +65 -0
  421. data/vendor/repo.or.cz/nasm/test/strlen.asm +5 -0
  422. data/vendor/repo.or.cz/nasm/test/struc.asm +33 -0
  423. data/vendor/repo.or.cz/nasm/test/test67.asm +38 -0
  424. data/vendor/repo.or.cz/nasm/test/testdos.asm +13 -0
  425. data/vendor/repo.or.cz/nasm/test/testnos3.asm +973 -0
  426. data/vendor/repo.or.cz/nasm/test/time.asm +11 -0
  427. data/vendor/repo.or.cz/nasm/test/times.asm +21 -0
  428. data/vendor/repo.or.cz/nasm/test/timesneg.asm +3 -0
  429. data/vendor/repo.or.cz/nasm/test/tmap.nas +1447 -0
  430. data/vendor/repo.or.cz/nasm/test/uscore.asm +15 -0
  431. data/vendor/repo.or.cz/nasm/test/utf.asm +82 -0
  432. data/vendor/repo.or.cz/nasm/test/vaesenc.asm +22 -0
  433. data/vendor/repo.or.cz/nasm/test/vex.asm +9 -0
  434. data/vendor/repo.or.cz/nasm/test/vgather.asm +76 -0
  435. data/vendor/repo.or.cz/nasm/test/vmread.asm +26 -0
  436. data/vendor/repo.or.cz/nasm/test/weirdpaste.asm +29 -0
  437. data/vendor/repo.or.cz/nasm/test/xchg.asm +96 -0
  438. data/vendor/repo.or.cz/nasm/test/xcrypt.asm +24 -0
  439. data/vendor/repo.or.cz/nasm/test/xmm0.asm +12 -0
  440. data/vendor/repo.or.cz/nasm/test/zerobyte.asm +22 -0
  441. data/vendor/repo.or.cz/nasm/tools/cleanfile +176 -0
  442. data/vendor/repo.or.cz/nasm/tools/cleanpatch +258 -0
  443. data/vendor/repo.or.cz/nasm/tools/mkdep.pl +261 -0
  444. data/vendor/repo.or.cz/nasm/tools/release +105 -0
  445. data/vendor/repo.or.cz/nasm/tools/syncfiles.pl +137 -0
  446. data/vendor/repo.or.cz/nasm/tools/tag-release +58 -0
  447. data/vendor/repo.or.cz/nasm/version +1 -0
  448. data/vendor/repo.or.cz/nasm/version.pl +189 -0
  449. data/vendor/repo.or.cz/nasm/x86/disp8.c +131 -0
  450. data/vendor/repo.or.cz/nasm/x86/insns-iflags.ph +280 -0
  451. data/vendor/repo.or.cz/nasm/x86/insns.dat +5371 -0
  452. data/vendor/repo.or.cz/nasm/x86/insns.pl +1043 -0
  453. data/vendor/repo.or.cz/nasm/x86/regs.dat +138 -0
  454. data/vendor/repo.or.cz/nasm/x86/regs.pl +204 -0
  455. metadata +520 -0
@@ -0,0 +1,76 @@
1
+ #!/usr/bin/perl
2
+ #
3
+ # Get the appropriate variables to make an NSIS installer file
4
+ # based on the PE architecture of a specific file
5
+ #
6
+
7
+ use strict;
8
+ use bytes;
9
+
10
+ my %archnames = (
11
+ 0x01de => 'am33',
12
+ 0x8664 => 'x64',
13
+ 0x01c0 => 'arm32',
14
+ 0x01c4 => 'thumb',
15
+ 0xaa64 => 'arm64',
16
+ 0x0ebc => 'efi',
17
+ 0x014c => 'x86',
18
+ 0x0200 => 'ia64',
19
+ 0x9041 => 'm32r',
20
+ 0x0266 => 'mips16',
21
+ 0x0366 => 'mips',
22
+ 0x0466 => 'mips16',
23
+ 0x01f0 => 'powerpc',
24
+ 0x01f1 => 'powerpc',
25
+ 0x0166 => 'mips',
26
+ 0x01a2 => 'sh3',
27
+ 0x01a3 => 'sh3',
28
+ 0x01a6 => 'sh4',
29
+ 0x01a8 => 'sh5',
30
+ 0x01c2 => 'arm32',
31
+ 0x0169 => 'wcemipsv2'
32
+ );
33
+
34
+ my ($file) = @ARGV;
35
+ open(my $fh, '<', $file)
36
+ or die "$0: cannot open file: $file: $!\n";
37
+
38
+ read($fh, my $mz, 2);
39
+ exit 1 if ($mz ne 'MZ');
40
+
41
+ exit 0 unless (seek($fh, 0x3c, 0));
42
+ exit 0 unless (read($fh, my $pe_offset, 4) == 4);
43
+ $pe_offset = unpack("V", $pe_offset);
44
+
45
+ exit 1 unless (seek($fh, $pe_offset, 0));
46
+ read($fh, my $pe, 4);
47
+ exit 1 unless ($pe eq "PE\0\0");
48
+
49
+ exit 1 unless (read($fh, my $arch, 2) == 2);
50
+ $arch = $archnames{unpack("v", $arch)};
51
+ if (defined($arch)) {
52
+ print "!define ARCH ${arch}\n";
53
+ }
54
+
55
+ exit 1 unless (seek($fh, 14, 1));
56
+ exit 1 unless (read($fh, my $auxheaderlen, 2) == 2);
57
+ exit 1 unless (unpack("v", $auxheaderlen) >= 2);
58
+
59
+ exit 1 unless (seek($fh, 2, 1));
60
+ exit 1 unless (read($fh, my $petype, 2) == 2);
61
+ $petype = unpack("v", $petype);
62
+ if ($petype == 0x010b) {
63
+ # It is a 32-bit PE32 file
64
+ print "!define BITS 32\n";
65
+ print "!define GLOBALINSTDIR \$PROGRAMFILES\n";
66
+ } elsif ($petype == 0x020b) {
67
+ # It is a 64-bit PE32+ file
68
+ print "!define BITS 64\n";
69
+ print "!define GLOBALINSTDIR \$PROGRAMFILES64\n";
70
+ } else {
71
+ # No idea...
72
+ exit 1;
73
+ }
74
+
75
+ close($fh);
76
+ exit 0;
@@ -0,0 +1,241 @@
1
+ #!Nsis Installer Command Script
2
+
3
+ #
4
+ # Copyright (c) 2009, Shao Miller (shao.miller@yrdsb.edu.on.ca)
5
+ # Copyright (c) 2009, Cyrill Gorcunov (gorcunov@gmail.com)
6
+ # All rights reserved.
7
+ #
8
+ # The script requires NSIS v2.45 (or any later)
9
+ #
10
+ # Redistribution and use in source and binary forms, with or without
11
+ # modification, are permitted provided that the following conditions are met:
12
+ # * Redistributions of source code must retain the above copyright
13
+ # notice, this list of conditions and the following disclaimer.
14
+ # * Redistributions in binary form must reproduce the above copyright
15
+ # notice, this list of conditions and the following disclaimer in the
16
+ # documentation and/or other materials provided with the distribution.
17
+ #
18
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
+ # ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20
+ # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21
+ # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR
22
+ # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23
+ # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
+ # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25
+ # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26
+ # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27
+ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
+
29
+ !addincludedir "${objdir}\nsis"
30
+ !addincludedir "${srcdir}\nsis"
31
+ !include "version.nsh"
32
+ !include "arch.nsh"
33
+
34
+ !define PRODUCT_NAME "Netwide Assembler"
35
+ !define PRODUCT_SHORT_NAME "nasm"
36
+ !define PACKAGE_NAME "${PRODUCT_NAME} ${VERSION}"
37
+ !define PACKAGE_SHORT_NAME "${PRODUCT_SHORT_NAME}-${VERSION}"
38
+
39
+ SetCompressor /solid lzma
40
+
41
+ !if "${NSIS_PACKEDVERSION}" >= 0x3000000
42
+ Unicode true
43
+ !endif
44
+
45
+ !define MULTIUSER_EXECUTIONLEVEL Highest
46
+ !define MULTIUSER_MUI
47
+ !define MULTIUSER_INSTALLMODE_COMMANDLINE
48
+ !define MULTIUSER_INSTALLMODE_INSTDIR "NASM"
49
+ !include "NASMMultiUser.nsh"
50
+
51
+ !insertmacro MULTIUSER_PAGE_INSTALLMODE
52
+ !insertmacro MULTIUSER_INSTALLMODEPAGE_INTERFACE
53
+
54
+ ;--------------------------------
55
+ ;General
56
+
57
+ ;Name and file
58
+ Name "${PACKAGE_NAME}"
59
+ OutFile "${objdir}\${PACKAGE_SHORT_NAME}-installer-${ARCH}.exe"
60
+
61
+ ;Get installation folder from registry if available
62
+ InstallDirRegKey HKCU "Software\${PRODUCT_SHORT_NAME}" ""
63
+
64
+ ;Request application privileges for Windows Vista
65
+ RequestExecutionLevel user
66
+
67
+ ;--------------------------------
68
+ ;Variables
69
+
70
+ Var StartMenuFolder
71
+ Var CmdFailed
72
+
73
+ ;--------------------------------
74
+ ;Interface Settings
75
+ Caption "${PACKAGE_SHORT_NAME} installation"
76
+ Icon "${srcdir}\nsis\nasm.ico"
77
+ UninstallIcon "${srcdir}\nsis\nasm-un.ico"
78
+
79
+ !define MUI_ABORTWARNING
80
+
81
+ ;--------------------------------
82
+ ;Pages
83
+
84
+ !insertmacro MUI_PAGE_COMPONENTS
85
+ !insertmacro MUI_PAGE_DIRECTORY
86
+
87
+ ;Start Menu Folder Page Configuration
88
+ !define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU"
89
+ !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\${PRODUCT_SHORT_NAME}"
90
+ !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "${PRODUCT_SHORT_NAME}"
91
+
92
+ !insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder
93
+
94
+ !insertmacro MUI_PAGE_INSTFILES
95
+
96
+ !insertmacro MUI_UNPAGE_CONFIRM
97
+ !insertmacro MUI_UNPAGE_INSTFILES
98
+
99
+ ;--------------------------------
100
+ ;Installer Sections
101
+
102
+ !insertmacro MUI_LANGUAGE English
103
+
104
+ Section "NASM" SecNasm
105
+ Sectionin RO
106
+ SetOutPath "$INSTDIR"
107
+ File "${srcdir}\LICENSE"
108
+ File "${objdir}\nasm.exe"
109
+ File "${objdir}\ndisasm.exe"
110
+ File "${srcdir}\nsis\nasm.ico"
111
+
112
+ ;Store installation folder
113
+ WriteRegStr HKCU "Software\${PRODUCT_SHORT_NAME}" "" $INSTDIR
114
+
115
+ ;Store shortcuts folder
116
+ WriteRegStr HKCU "Software\${PRODUCT_SHORT_NAME}\" "lnk" $SMPROGRAMS\$StartMenuFolder
117
+ WriteRegStr HKCU "Software\${PRODUCT_SHORT_NAME}\" "bat-lnk" $DESKTOP\${PRODUCT_SHORT_NAME}.lnk
118
+
119
+ ;
120
+ ; the bat we need
121
+ StrCpy $CmdFailed "true"
122
+ FileOpen $0 "nasmpath.bat" w
123
+ IfErrors skip
124
+ StrCpy $CmdFailed "false"
125
+ FileWrite $0 "@set path=$INSTDIR;%path%$\r$\n"
126
+ FileWrite $0 "@%comspec%"
127
+ FileClose $0
128
+ CreateShortCut "$DESKTOP\${PRODUCT_SHORT_NAME}.lnk" "$INSTDIR\nasmpath.bat" "" "$INSTDIR\nasm.ico" 0
129
+ skip:
130
+ ;Create uninstaller
131
+ WriteUninstaller "$INSTDIR\Uninstall.exe"
132
+
133
+ !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
134
+
135
+ ;Create shortcuts
136
+ CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
137
+ StrCmp $CmdFailed "true" +2
138
+ CreateShortCut "$SMPROGRAMS\$StartMenuFolder\${PRODUCT_SHORT_NAME}-shell.lnk" "$INSTDIR\nasmpath.bat"
139
+ CreateShortCut "$SMPROGRAMS\$StartMenuFolder\${PRODUCT_SHORT_NAME}.lnk" "$INSTDIR\nasm.exe" "" "$INSTDIR\nasm.ico" 0
140
+ CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
141
+
142
+ !insertmacro MUI_STARTMENU_WRITE_END
143
+ SectionEnd
144
+
145
+ Section "RDOFF" SecRdoff
146
+ File "${objdir}\rdoff\ldrdf.exe"
147
+ File "${objdir}\rdoff\rdf2bin.exe"
148
+ File "${objdir}\rdoff\rdf2com.exe"
149
+ File "${objdir}\rdoff\rdf2ith.exe"
150
+ File "${objdir}\rdoff\rdf2ihx.exe"
151
+ File "${objdir}\rdoff\rdf2srec.exe"
152
+ File "${objdir}\rdoff\rdfdump.exe"
153
+ File "${objdir}\rdoff\rdflib.exe"
154
+ SectionEnd
155
+
156
+ Section "Manual" SecManual
157
+ SetOutPath "$INSTDIR"
158
+ File "${objdir}\doc\nasmdoc.pdf"
159
+ CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Manual.lnk" "$INSTDIR\nasmdoc.pdf"
160
+ SectionEnd
161
+
162
+ Section "VS8 integration" SecVS8
163
+ CreateDirectory "$INSTDIR\VSrules"
164
+ SetOutPath "$INSTDIR\VSrules"
165
+ File "${srcdir}\contrib\VSrules\nasm.README"
166
+ File "${srcdir}\contrib\VSrules\nasm.rules"
167
+ SectionEnd
168
+
169
+ ;--------------------------------
170
+ ;Descriptions
171
+
172
+ ;Language strings
173
+ LangString DESC_SecNasm ${LANG_ENGLISH} "NASM assembler and disassember modules"
174
+ LangString DESC_SecManual ${LANG_ENGLISH} "Complete NASM manual (pdf file)"
175
+ LangString DESC_SecRdoff ${LANG_ENGLISH} "RDOFF utilities (you may not need it if you don't know what is it)"
176
+ LangString DESC_SecVS8 ${LANG_ENGLISH} "Visual Studio 2008 NASM integration (rules file)"
177
+
178
+ ;Assign language strings to sections
179
+ !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
180
+ !insertmacro MUI_DESCRIPTION_TEXT ${SecNasm} $(DESC_SecNasm)
181
+ !insertmacro MUI_DESCRIPTION_TEXT ${SecRdoff} $(DESC_SecRdoff)
182
+ !insertmacro MUI_DESCRIPTION_TEXT ${SecManual} $(DESC_SecManual)
183
+ !insertmacro MUI_DESCRIPTION_TEXT ${SecVS8} $(DESC_SecVS8)
184
+ !insertmacro MUI_FUNCTION_DESCRIPTION_END
185
+
186
+ ;--------------------------------
187
+ ;Uninstaller Section
188
+
189
+ Section "Uninstall"
190
+ ;
191
+ ; files on HDD
192
+ IfFileExists "$INSTDIR" +3 +1
193
+ MessageBox MB_OK "No files found, aborting."
194
+ Abort
195
+ MessageBox MB_YESNO "The following directory will be deleted$\n$INSTDIR" IDYES rm_instdir_true IDNO rm_instdir_false
196
+ rm_instdir_true:
197
+ RMDir /r /rebootok "$INSTDIR"
198
+ rm_instdir_false:
199
+
200
+ ;
201
+ ; Desktop link
202
+ ReadRegStr $0 HKCU Software\${PRODUCT_SHORT_NAME} "bat-lnk"
203
+ StrCmp $0 0 +1 +3
204
+ MessageBox MB_OK "Invalid path to a bat-lnk file, aborting"
205
+ Abort
206
+ IfFileExists $0 +3 +1
207
+ MessageBox MB_OK "No bat-lnk files found, aborting."
208
+ Abort
209
+ MessageBox MB_YESNO "The following file will be deleted$\n$0" IDYES rm_batlinks_true IDNO rm_batlinks_false
210
+ rm_batlinks_true:
211
+ Delete /rebootok "$0"
212
+ RMDir "$0"
213
+ rm_batlinks_false:
214
+
215
+ ;
216
+ ; Start menu folder
217
+ ReadRegStr $0 HKCU Software\${PRODUCT_SHORT_NAME} "lnk"
218
+ StrCmp $0 0 +1 +3
219
+ MessageBox MB_OK "Invalid path to a lnk file, aborting"
220
+ Abort
221
+ IfFileExists $0 +3 +1
222
+ MessageBox MB_OK "No lnk files found, aborting."
223
+ Abort
224
+ MessageBox MB_YESNO "The following directory will be deleted$\n$0" IDYES rm_links_true IDNO rm_links_false
225
+ rm_links_true:
226
+ Delete /rebootok "$0\*"
227
+ RMDir "$0"
228
+ rm_links_false:
229
+ DeleteRegKey /ifempty HKCU "Software\${PRODUCT_SHORT_NAME}"
230
+ SectionEnd
231
+
232
+ ;
233
+ ; MUI requires this hooks
234
+ Function .onInit
235
+ SetRegView ${BITS}
236
+ !insertmacro MULTIUSER_INIT
237
+ FunctionEnd
238
+
239
+ Function un.onInit
240
+ !insertmacro MULTIUSER_UNINIT
241
+ FunctionEnd
@@ -0,0 +1,814 @@
1
+ /* ----------------------------------------------------------------------- *
2
+ *
3
+ * Copyright 1996-2017 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
+ * codeview.c Codeview Debug Format support for COFF
36
+ */
37
+
38
+ #include "version.h"
39
+ #include "compiler.h"
40
+
41
+ #include <stdio.h>
42
+ #include <stddef.h>
43
+ #include <stdlib.h>
44
+
45
+ #include "nasm.h"
46
+ #include "nasmlib.h"
47
+ #include "error.h"
48
+ #include "preproc.h"
49
+ #include "saa.h"
50
+ #include "hashtbl.h"
51
+ #include "outlib.h"
52
+ #include "pecoff.h"
53
+ #include "md5.h"
54
+
55
+ static void cv8_init(void);
56
+ static void cv8_linenum(const char *filename, int32_t linenumber,
57
+ int32_t segto);
58
+ static void cv8_deflabel(char *name, int32_t segment, int64_t offset,
59
+ int is_global, char *special);
60
+ static void cv8_typevalue(int32_t type);
61
+ static void cv8_output(int type, void *param);
62
+ static void cv8_cleanup(void);
63
+
64
+ const struct dfmt df_cv8 = {
65
+ "Codeview 8", /* .fullname */
66
+ "cv8", /* .shortname */
67
+ cv8_init, /* .init */
68
+ cv8_linenum, /* .linenum */
69
+ cv8_deflabel, /* .debug_deflabel */
70
+ null_debug_directive, /* .debug_directive */
71
+ cv8_typevalue, /* .debug_typevalue */
72
+ cv8_output, /* .debug_output */
73
+ cv8_cleanup, /* .cleanup */
74
+ NULL /* pragma list */
75
+ };
76
+
77
+ /*******************************************************************************
78
+ * dfmt callbacks
79
+ ******************************************************************************/
80
+ struct source_file;
81
+
82
+ struct source_file {
83
+ const char *filename;
84
+ char *fullname;
85
+ uint32_t fullnamelen;
86
+
87
+ struct source_file *next;
88
+
89
+ uint32_t filetbl_off;
90
+ uint32_t sourcetbl_off;
91
+
92
+ struct SAA *lines;
93
+ uint32_t num_lines;
94
+
95
+ unsigned char md5sum[MD5_HASHBYTES];
96
+ };
97
+
98
+ struct linepair {
99
+ uint32_t file_offset;
100
+ uint32_t linenumber;
101
+ };
102
+
103
+ enum symbol_type {
104
+ SYMTYPE_CODE,
105
+ SYMTYPE_PROC,
106
+ SYMTYPE_LDATA,
107
+ SYMTYPE_GDATA,
108
+
109
+ SYMTYPE_MAX
110
+ };
111
+
112
+ struct cv8_symbol {
113
+ enum symbol_type type;
114
+ char *name;
115
+
116
+ uint32_t secrel;
117
+ uint16_t section;
118
+ uint32_t size;
119
+ uint32_t typeindex;
120
+
121
+ enum symtype {
122
+ TYPE_UNREGISTERED = 0x0000, /* T_NOTYPE */
123
+ TYPE_BYTE = 0x0020,
124
+ TYPE_WORD = 0x0021,
125
+ TYPE_DWORD= 0x0022,
126
+ TYPE_QUAD = 0x0023,
127
+
128
+ TYPE_REAL32 = 0x0040,
129
+ TYPE_REAL64 = 0x0041,
130
+ TYPE_REAL80 = 0x0042,
131
+ TYPE_REAL128= 0x0043,
132
+ TYPE_REAL256= 0x0044,
133
+ TYPE_REAL512= 0x0045
134
+ } symtype;
135
+ };
136
+
137
+ struct cv8_state {
138
+ int symbol_sect;
139
+ int type_sect;
140
+
141
+ uint32_t text_offset;
142
+
143
+ struct source_file *source_files, **source_files_tail;
144
+ const char *last_filename;
145
+ struct source_file *last_source_file;
146
+ struct hash_table file_hash;
147
+ unsigned num_files;
148
+ uint32_t total_filename_len;
149
+
150
+
151
+ unsigned total_lines;
152
+
153
+ struct SAA *symbols;
154
+ struct cv8_symbol *last_sym;
155
+ unsigned num_syms[SYMTYPE_MAX];
156
+ unsigned symbol_lengths;
157
+ unsigned total_syms;
158
+
159
+ struct {
160
+ char *name;
161
+ size_t namebytes;
162
+ } outfile;
163
+ };
164
+ struct cv8_state cv8_state;
165
+
166
+ static void cv8_init(void)
167
+ {
168
+ const uint32_t sect_flags = IMAGE_SCN_MEM_READ |
169
+ IMAGE_SCN_MEM_DISCARDABLE |
170
+ IMAGE_SCN_CNT_INITIALIZED_DATA |
171
+ IMAGE_SCN_ALIGN_1BYTES;
172
+
173
+ cv8_state.symbol_sect = coff_make_section(".debug$S", sect_flags);
174
+ cv8_state.type_sect = coff_make_section(".debug$T", sect_flags);
175
+
176
+ cv8_state.text_offset = 0;
177
+
178
+ cv8_state.source_files = NULL;
179
+ cv8_state.source_files_tail = &cv8_state.source_files;
180
+ hash_init(&cv8_state.file_hash, HASH_MEDIUM);
181
+
182
+ cv8_state.num_files = 0;
183
+ cv8_state.total_filename_len = 0;
184
+
185
+ cv8_state.total_lines = 0;
186
+
187
+ cv8_state.symbols = saa_init(sizeof(struct cv8_symbol));
188
+ cv8_state.last_sym = NULL;
189
+ }
190
+
191
+ static struct source_file *register_file(const char *filename);
192
+ static struct coff_Section *find_section(int32_t segto);
193
+
194
+ static void cv8_linenum(const char *filename, int32_t linenumber,
195
+ int32_t segto)
196
+ {
197
+ struct coff_Section *s;
198
+ struct linepair *li;
199
+ struct source_file *file;
200
+
201
+ file = register_file(filename);
202
+
203
+ s = find_section(segto);
204
+ if (s == NULL)
205
+ return;
206
+
207
+ if ((s->flags & IMAGE_SCN_MEM_EXECUTE) == 0)
208
+ return;
209
+
210
+ li = saa_wstruct(file->lines);
211
+ li->file_offset = cv8_state.text_offset;
212
+ li->linenumber = linenumber;
213
+
214
+ file->num_lines++;
215
+ cv8_state.total_lines++;
216
+ }
217
+
218
+ static void cv8_deflabel(char *name, int32_t segment, int64_t offset,
219
+ int is_global, char *special)
220
+ {
221
+ struct cv8_symbol *sym;
222
+ struct coff_Section *s;
223
+
224
+ (void)special;
225
+
226
+ s = find_section(segment);
227
+ if (s == NULL)
228
+ return;
229
+
230
+ sym = saa_wstruct(cv8_state.symbols);
231
+
232
+ if (s->flags & IMAGE_SCN_MEM_EXECUTE)
233
+ sym->type = is_global ? SYMTYPE_PROC : SYMTYPE_CODE;
234
+ else
235
+ sym->type = is_global ? SYMTYPE_GDATA : SYMTYPE_LDATA;
236
+ cv8_state.num_syms[sym->type]++;
237
+ cv8_state.total_syms++;
238
+
239
+ sym->section = segment;
240
+ sym->secrel = offset;
241
+ sym->symtype = TYPE_UNREGISTERED;
242
+ sym->size = 0;
243
+ sym->typeindex = 0;
244
+
245
+ sym->name = nasm_strdup(name);
246
+ cv8_state.symbol_lengths += strlen(sym->name) + 1;
247
+
248
+ if (cv8_state.last_sym && cv8_state.last_sym->section == segment)
249
+ cv8_state.last_sym->size = offset - cv8_state.last_sym->secrel;
250
+ cv8_state.last_sym = sym;
251
+ }
252
+
253
+ static void cv8_typevalue(int32_t type)
254
+ {
255
+ if (!cv8_state.last_sym)
256
+ return;
257
+ if (cv8_state.last_sym->symtype != TYPE_UNREGISTERED)
258
+ return;
259
+
260
+ switch (TYM_TYPE(type)) {
261
+ case TY_BYTE:
262
+ cv8_state.last_sym->symtype = TYPE_BYTE;
263
+ break;
264
+ case TY_WORD:
265
+ cv8_state.last_sym->symtype = TYPE_WORD;
266
+ break;
267
+ case TY_DWORD:
268
+ cv8_state.last_sym->symtype = TYPE_DWORD;
269
+ break;
270
+ case TY_QWORD:
271
+ cv8_state.last_sym->symtype = TYPE_QUAD;
272
+ break;
273
+ case TY_FLOAT:
274
+ cv8_state.last_sym->symtype = TYPE_REAL32;
275
+ break;
276
+ case TY_TBYTE:
277
+ cv8_state.last_sym->symtype = TYPE_REAL80;
278
+ break;
279
+ case TY_OWORD:
280
+ cv8_state.last_sym->symtype = TYPE_REAL128;
281
+ break;
282
+ case TY_YWORD:
283
+ cv8_state.last_sym->symtype = TYPE_REAL256;
284
+ break;
285
+ case TY_ZWORD:
286
+ cv8_state.last_sym->symtype = TYPE_REAL512;
287
+ break;
288
+ case TY_UNKNOWN:
289
+ break;
290
+ case TY_LABEL:
291
+ break;
292
+ }
293
+ }
294
+
295
+ static void cv8_output(int type, void *param)
296
+ {
297
+ struct coff_DebugInfo *dinfo = param;
298
+
299
+ (void)type;
300
+
301
+ if (dinfo->section && dinfo->section->name &&
302
+ !strncmp(dinfo->section->name, ".text", 5))
303
+ cv8_state.text_offset += dinfo->size;
304
+ }
305
+
306
+ static void build_symbol_table(struct coff_Section *const sect);
307
+ static void build_type_table(struct coff_Section *const sect);
308
+
309
+ static void cv8_cleanup(void)
310
+ {
311
+ struct cv8_symbol *sym;
312
+ struct source_file *file;
313
+
314
+ struct coff_Section *symbol_sect = coff_sects[cv8_state.symbol_sect];
315
+ struct coff_Section *type_sect = coff_sects[cv8_state.type_sect];
316
+
317
+ cv8_state.outfile.name = nasm_realpath(coff_outfile);
318
+ cv8_state.outfile.namebytes = strlen(cv8_state.outfile.name) + 1;
319
+
320
+ build_symbol_table(symbol_sect);
321
+ build_type_table(type_sect);
322
+
323
+ list_for_each(file, cv8_state.source_files) {
324
+ nasm_free(file->fullname);
325
+ saa_free(file->lines);
326
+ free(file);
327
+ }
328
+ hash_free(&cv8_state.file_hash);
329
+
330
+ saa_rewind(cv8_state.symbols);
331
+ while ((sym = saa_rstruct(cv8_state.symbols)))
332
+ nasm_free(sym->name);
333
+ saa_free(cv8_state.symbols);
334
+
335
+ nasm_free(cv8_state.outfile.name);
336
+ }
337
+
338
+ /*******************************************************************************
339
+ * implementation
340
+ ******************************************************************************/
341
+ static void calc_md5(const char *const filename,
342
+ unsigned char sum[MD5_HASHBYTES])
343
+ {
344
+ int success = 0;
345
+ unsigned char *file_buf;
346
+ FILE *f;
347
+ MD5_CTX ctx;
348
+
349
+ f = pp_input_fopen(filename, NF_BINARY);
350
+ if (!f)
351
+ goto done;
352
+
353
+ file_buf = nasm_zalloc(BUFSIZ);
354
+
355
+ MD5Init(&ctx);
356
+ while (!feof(f)) {
357
+ size_t i = fread(file_buf, 1, BUFSIZ, f);
358
+ if (ferror(f))
359
+ goto done_0;
360
+ else if (i == 0)
361
+ break;
362
+ MD5Update(&ctx, file_buf, i);
363
+ }
364
+ MD5Final(sum, &ctx);
365
+
366
+ success = 1;
367
+ done_0:
368
+ nasm_free(file_buf);
369
+ fclose(f);
370
+ done:
371
+ if (!success) {
372
+ nasm_error(ERR_NONFATAL, "unable to hash file %s. "
373
+ "Debug information may be unavailable.\n",
374
+ filename);
375
+ }
376
+ return;
377
+ }
378
+
379
+ static struct source_file *register_file(const char *filename)
380
+ {
381
+ struct source_file *file;
382
+ void **filep;
383
+ char *fullpath;
384
+ struct hash_insert hi;
385
+
386
+ /*
387
+ * The common case is that we are invoked with the same filename
388
+ * as we were last time. Make this a pointer comparison: this is
389
+ * safe because the NASM core code allocates each filename once
390
+ * and never frees it.
391
+ */
392
+ if (likely(cv8_state.last_filename == filename))
393
+ return cv8_state.last_source_file;
394
+
395
+ cv8_state.last_filename = filename;
396
+
397
+ filep = hash_find(&cv8_state.file_hash, filename, &hi);
398
+ if (likely(filep)) {
399
+ file = *filep;
400
+ } else {
401
+ /* New filename encounter */
402
+
403
+ fullpath = nasm_realpath(filename);
404
+
405
+ file = nasm_zalloc(sizeof(*file));
406
+
407
+ file->filename = filename;
408
+ file->fullname = fullpath;
409
+ file->fullnamelen = strlen(fullpath);
410
+ file->lines = saa_init(sizeof(struct linepair));
411
+ *cv8_state.source_files_tail = file;
412
+ cv8_state.source_files_tail = &file->next;
413
+ calc_md5(fullpath, file->md5sum);
414
+
415
+ hash_add(&hi, filename, file);
416
+
417
+ cv8_state.num_files++;
418
+ cv8_state.total_filename_len += file->fullnamelen + 1;
419
+ }
420
+
421
+ cv8_state.last_source_file = file;
422
+ return file;
423
+ }
424
+
425
+ static struct coff_Section *find_section(int32_t segto)
426
+ {
427
+ int i;
428
+
429
+ for (i = 0; i < coff_nsects; i++) {
430
+ struct coff_Section *sec;
431
+
432
+ sec = coff_sects[i];
433
+ if (segto == sec->index)
434
+ return sec;
435
+ }
436
+ return NULL;
437
+ }
438
+
439
+ static void register_reloc(struct coff_Section *const sect,
440
+ char *sym, uint32_t addr, uint16_t type)
441
+ {
442
+ struct coff_Reloc *r;
443
+ struct coff_Section *sec;
444
+ uint32_t i;
445
+
446
+ r = *sect->tail = nasm_malloc(sizeof(struct coff_Reloc));
447
+ sect->tail = &r->next;
448
+ r->next = NULL;
449
+ sect->nrelocs++;
450
+
451
+ r->address = addr;
452
+ r->symbase = SECT_SYMBOLS;
453
+ r->type = type;
454
+
455
+ r->symbol = 0;
456
+ for (i = 0; i < (uint32_t)coff_nsects; i++) {
457
+ sec = coff_sects[i];
458
+ if (!strcmp(sym, sec->name)) {
459
+ return;
460
+ }
461
+ r->symbol += 2;
462
+ }
463
+
464
+ saa_rewind(coff_syms);
465
+ for (i = 0; i < coff_nsyms; i++) {
466
+ struct coff_Symbol *s = saa_rstruct(coff_syms);
467
+ r->symbol++;
468
+ if (s->strpos == -1 && !strcmp(sym, s->name)) {
469
+ return;
470
+ } else if (s->strpos != -1) {
471
+ int res;
472
+ char *symname;
473
+
474
+ symname = nasm_malloc(s->namlen + 1);
475
+ saa_fread(coff_strs, s->strpos-4, symname, s->namlen);
476
+ symname[s->namlen] = '\0';
477
+ res = strcmp(sym, symname);
478
+ nasm_free(symname);
479
+ if (!res)
480
+ return;
481
+ }
482
+ }
483
+ nasm_panic(0, "codeview: relocation for unregistered symbol: %s", sym);
484
+ }
485
+
486
+ static inline void section_write32(struct coff_Section *sect, uint32_t val)
487
+ {
488
+ saa_write32(sect->data, val);
489
+ sect->len += 4;
490
+ }
491
+
492
+ static inline void section_write16(struct coff_Section *sect, uint16_t val)
493
+ {
494
+ saa_write16(sect->data, val);
495
+ sect->len += 2;
496
+ }
497
+
498
+ static inline void section_write8(struct coff_Section *sect, uint8_t val)
499
+ {
500
+ saa_write8(sect->data, val);
501
+ sect->len++;
502
+ }
503
+
504
+ static inline void section_wbytes(struct coff_Section *sect, const void *buf,
505
+ size_t len)
506
+ {
507
+ saa_wbytes(sect->data, buf, len);
508
+ sect->len += len;
509
+ }
510
+
511
+ static void write_filename_table(struct coff_Section *const sect)
512
+ {
513
+ uint32_t field_length;
514
+ uint32_t tbl_off = 1; /* offset starts at 1 to skip NULL entry */
515
+ struct source_file *file;
516
+
517
+ nasm_assert(cv8_state.source_files != NULL);
518
+ nasm_assert(cv8_state.num_files > 0);
519
+ nasm_assert(cv8_state.total_filename_len > 0);
520
+
521
+ field_length = 1 + cv8_state.total_filename_len;
522
+
523
+ section_write32(sect, 0x000000F3);
524
+ section_write32(sect, field_length);
525
+
526
+ section_write8(sect, 0);
527
+
528
+ list_for_each(file, cv8_state.source_files) {
529
+ section_wbytes(sect, file->fullname, file->fullnamelen + 1);
530
+ file->filetbl_off = tbl_off;
531
+ tbl_off += file->fullnamelen + 1;
532
+ }
533
+ }
534
+
535
+ static void write_sourcefile_table(struct coff_Section *const sect)
536
+ {
537
+ const uint32_t entry_size = 4 + 2 + MD5_HASHBYTES + 2;
538
+
539
+ uint32_t field_length = 0;
540
+ uint32_t tbl_off = 0;
541
+ struct source_file *file;
542
+
543
+ field_length = entry_size * cv8_state.num_files;
544
+
545
+ section_write32(sect, 0x000000F4);
546
+ section_write32(sect, field_length);
547
+
548
+ list_for_each(file, cv8_state.source_files) {
549
+ nasm_assert(file->filetbl_off > 0);
550
+ section_write32(sect, file->filetbl_off);
551
+ section_write16(sect, 0x0110);
552
+ section_wbytes(sect, file->md5sum, MD5_HASHBYTES);
553
+ section_write16(sect, 0);
554
+
555
+ file->sourcetbl_off = tbl_off;
556
+ tbl_off += entry_size;
557
+ }
558
+ }
559
+
560
+ static void write_linenumber_table(struct coff_Section *const sect)
561
+ {
562
+ const uint32_t file_field_len = 12;
563
+ const uint32_t line_field_len = 8;
564
+
565
+ int i;
566
+ uint32_t field_length = 0;
567
+ size_t field_base;
568
+ struct source_file *file;
569
+ struct coff_Section *s;
570
+
571
+ for (i = 0; i < coff_nsects; i++) {
572
+ if (!strncmp(coff_sects[i]->name, ".text", 5))
573
+ break;
574
+ }
575
+
576
+ if (i == coff_nsects)
577
+ return;
578
+ s = coff_sects[i];
579
+
580
+ field_length = 12;
581
+ field_length += (cv8_state.num_files * file_field_len);
582
+ field_length += (cv8_state.total_lines * line_field_len);
583
+
584
+ section_write32(sect, 0x000000F2);
585
+ section_write32(sect, field_length);
586
+
587
+ field_base = sect->len;
588
+ section_write32(sect, 0); /* SECREL, updated by relocation */
589
+ section_write16(sect, 0); /* SECTION, updated by relocation*/
590
+ section_write16(sect, 0); /* pad */
591
+ section_write32(sect, s->len);
592
+
593
+ register_reloc(sect, ".text", field_base,
594
+ win64 ? IMAGE_REL_AMD64_SECREL : IMAGE_REL_I386_SECREL);
595
+
596
+ register_reloc(sect, ".text", field_base + 4,
597
+ win64 ? IMAGE_REL_AMD64_SECTION : IMAGE_REL_I386_SECTION);
598
+
599
+ list_for_each(file, cv8_state.source_files) {
600
+ struct linepair *li;
601
+
602
+ /* source mapping */
603
+ section_write32(sect, file->sourcetbl_off);
604
+ section_write32(sect, file->num_lines);
605
+ section_write32(sect, file_field_len + (file->num_lines * line_field_len));
606
+
607
+ /* the pairs */
608
+ saa_rewind(file->lines);
609
+ while ((li = saa_rstruct(file->lines))) {
610
+ section_write32(sect, li->file_offset);
611
+ section_write32(sect, li->linenumber |= 0x80000000);
612
+ }
613
+ }
614
+ }
615
+
616
+ static uint16_t write_symbolinfo_obj(struct coff_Section *sect)
617
+ {
618
+ uint16_t obj_len;
619
+
620
+ obj_len = 2 + 4 + cv8_state.outfile.namebytes;
621
+
622
+ section_write16(sect, obj_len);
623
+ section_write16(sect, 0x1101);
624
+ section_write32(sect, 0); /* ASM language */
625
+ section_wbytes(sect, cv8_state.outfile.name, cv8_state.outfile.namebytes);
626
+
627
+ return obj_len;
628
+ }
629
+
630
+ static uint16_t write_symbolinfo_properties(struct coff_Section *sect,
631
+ const char *const creator_str)
632
+ {
633
+ /* https://github.com/Microsoft/microsoft-pdb/blob/1d60e041/include/cvinfo.h#L3313 */
634
+ uint16_t creator_len;
635
+
636
+ creator_len = 2 + 4 + 2 + 3*2 + 3*2 + strlen(creator_str)+1 + 2;
637
+
638
+ section_write16(sect, creator_len);
639
+ section_write16(sect, 0x1116);
640
+ section_write32(sect, 3); /* language/flags */
641
+ if (win64)
642
+ section_write16(sect, 0x00D0); /* machine */
643
+ else if (win32)
644
+ section_write16(sect, 0x0006); /* machine */
645
+ else
646
+ nasm_assert(!"neither win32 nor win64 are set!");
647
+ section_write16(sect, 0); /* verFEMajor */
648
+ section_write16(sect, 0); /* verFEMinor */
649
+ section_write16(sect, 0); /* verFEBuild */
650
+
651
+ /* BinScope/WACK insist on version >= 8.0.50727 */
652
+ section_write16(sect, 8); /* verMajor */
653
+ section_write16(sect, 0); /* verMinor */
654
+ section_write16(sect, 50727); /* verBuild */
655
+
656
+ section_wbytes(sect, creator_str, strlen(creator_str)+1); /* verSt */
657
+ /*
658
+ * normally there would be key/value pairs here, but they aren't
659
+ * necessary. They are terminated by 2B
660
+ */
661
+ section_write16(sect, 0);
662
+
663
+ return creator_len;
664
+ }
665
+
666
+ static uint16_t write_symbolinfo_symbols(struct coff_Section *sect)
667
+ {
668
+ uint16_t len = 0, field_len;
669
+ uint32_t field_base;
670
+ struct cv8_symbol *sym;
671
+
672
+ saa_rewind(cv8_state.symbols);
673
+ while ((sym = saa_rstruct(cv8_state.symbols))) {
674
+ switch (sym->type) {
675
+ case SYMTYPE_LDATA:
676
+ case SYMTYPE_GDATA:
677
+ field_len = 12 + strlen(sym->name) + 1;
678
+ len += field_len - 2;
679
+ section_write16(sect, field_len);
680
+ if (sym->type == SYMTYPE_LDATA)
681
+ section_write16(sect, 0x110C);
682
+ else
683
+ section_write16(sect, 0x110D);
684
+ section_write32(sect, sym->symtype);
685
+
686
+ field_base = sect->len;
687
+ section_write32(sect, 0); /* SECREL */
688
+ section_write16(sect, 0); /* SECTION */
689
+ break;
690
+ case SYMTYPE_PROC:
691
+ case SYMTYPE_CODE:
692
+ field_len = 9 + strlen(sym->name) + 1;
693
+ len += field_len - 2;
694
+ section_write16(sect, field_len);
695
+ section_write16(sect, 0x1105);
696
+
697
+ field_base = sect->len;
698
+ section_write32(sect, 0); /* SECREL */
699
+ section_write16(sect, 0); /* SECTION */
700
+ section_write8(sect, 0); /* FLAG */
701
+ break;
702
+ default:
703
+ nasm_assert(!"unknown symbol type");
704
+ }
705
+
706
+ section_wbytes(sect, sym->name, strlen(sym->name) + 1);
707
+
708
+ register_reloc(sect, sym->name, field_base,
709
+ win64 ? IMAGE_REL_AMD64_SECREL :
710
+ IMAGE_REL_I386_SECREL);
711
+ register_reloc(sect, sym->name, field_base + 4,
712
+ win64 ? IMAGE_REL_AMD64_SECTION :
713
+ IMAGE_REL_I386_SECTION);
714
+ }
715
+
716
+ return len;
717
+ }
718
+
719
+ static void write_symbolinfo_table(struct coff_Section *const sect)
720
+ {
721
+ static const char creator_str[] = "The Netwide Assembler " NASM_VER;
722
+ uint16_t obj_length, creator_length, sym_length;
723
+ uint32_t field_length = 0, out_len;
724
+
725
+ nasm_assert(cv8_state.outfile.namebytes);
726
+
727
+ /* signature, language, outfile NULL */
728
+ obj_length = 2 + 4 + cv8_state.outfile.namebytes;
729
+ creator_length = 2 + 4 + 2 + 3*2 + 3*2 + strlen(creator_str)+1 + 2;
730
+
731
+ sym_length = ( cv8_state.num_syms[SYMTYPE_CODE] * 7) +
732
+ ( cv8_state.num_syms[SYMTYPE_PROC] * 7) +
733
+ ( cv8_state.num_syms[SYMTYPE_LDATA] * 10) +
734
+ ( cv8_state.num_syms[SYMTYPE_GDATA] * 10) +
735
+ cv8_state.symbol_lengths;
736
+
737
+ field_length = 2 + obj_length +
738
+ 2 + creator_length +
739
+ (4 * cv8_state.total_syms) + sym_length;
740
+
741
+ section_write32(sect, 0x000000F1);
742
+ section_write32(sect, field_length);
743
+
744
+ /* for sub fields, length preceeds type */
745
+
746
+ out_len = write_symbolinfo_obj(sect);
747
+ nasm_assert(out_len == obj_length);
748
+
749
+ out_len = write_symbolinfo_properties(sect, creator_str);
750
+ nasm_assert(out_len == creator_length);
751
+
752
+ out_len = write_symbolinfo_symbols(sect);
753
+ nasm_assert(out_len == sym_length);
754
+ }
755
+
756
+ static inline void align4_table(struct coff_Section *const sect)
757
+ {
758
+ unsigned diff;
759
+ uint32_t zero = 0;
760
+ struct SAA *data = sect->data;
761
+
762
+ if (data->wptr % 4 == 0)
763
+ return;
764
+
765
+ diff = 4 - (data->wptr % 4);
766
+ if (diff)
767
+ section_wbytes(sect, &zero, diff);
768
+ }
769
+
770
+ static void build_symbol_table(struct coff_Section *const sect)
771
+ {
772
+ section_write32(sect, 0x00000004);
773
+
774
+ write_filename_table(sect);
775
+ align4_table(sect);
776
+ write_sourcefile_table(sect);
777
+ align4_table(sect);
778
+ write_linenumber_table(sect);
779
+ align4_table(sect);
780
+ write_symbolinfo_table(sect);
781
+ align4_table(sect);
782
+ }
783
+
784
+ static void build_type_table(struct coff_Section *const sect)
785
+ {
786
+ uint16_t field_len;
787
+ struct cv8_symbol *sym;
788
+
789
+ section_write32(sect, 0x00000004);
790
+
791
+ saa_rewind(cv8_state.symbols);
792
+ while ((sym = saa_rstruct(cv8_state.symbols))) {
793
+ if (sym->type != SYMTYPE_PROC)
794
+ continue;
795
+
796
+ /* proc leaf */
797
+
798
+ field_len = 2 + 4 + 4 + 4 + 2;
799
+ section_write16(sect, field_len);
800
+ section_write16(sect, 0x1008); /* PROC type */
801
+
802
+ section_write32(sect, 0x00000003); /* return type */
803
+ section_write32(sect, 0); /* calling convention (default) */
804
+ section_write32(sect, sym->typeindex);
805
+ section_write16(sect, 0); /* # params */
806
+
807
+ /* arglist */
808
+
809
+ field_len = 2 + 4;
810
+ section_write16(sect, field_len);
811
+ section_write16(sect, 0x1201); /* ARGLIST */
812
+ section_write32(sect, 0); /*num params */
813
+ }
814
+ }