immunio 1.2.1 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (291) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +13 -5
  3. data/ext/immunio/Rakefile +14 -6
  4. data/lib/immunio/context.rb +2 -0
  5. data/lib/immunio/plugins/action_view.rb +7 -668
  6. data/lib/immunio/plugins/action_view/action_view.rb +22 -0
  7. data/lib/immunio/plugins/action_view/active_support_hash.rb +29 -0
  8. data/lib/immunio/plugins/action_view/cache_store.rb +24 -0
  9. data/lib/immunio/plugins/action_view/erubi.rb +38 -0
  10. data/lib/immunio/plugins/action_view/erubis.rb +39 -0
  11. data/lib/immunio/plugins/action_view/fragment_caching.rb +29 -0
  12. data/lib/immunio/plugins/action_view/haml.rb +46 -0
  13. data/lib/immunio/plugins/action_view/slim.rb +42 -0
  14. data/lib/immunio/plugins/action_view/template.rb +431 -0
  15. data/lib/immunio/plugins/action_view/template_rendering.rb +45 -0
  16. data/lib/immunio/plugins/http_tracker.rb +2 -0
  17. data/lib/immunio/plugins/io.rb +34 -0
  18. data/lib/immunio/version.rb +1 -1
  19. data/lua-hooks/Makefile +36 -9
  20. data/lua-hooks/ext/luajit/COPYRIGHT +1 -1
  21. data/lua-hooks/ext/luajit/Makefile +22 -15
  22. data/lua-hooks/ext/luajit/README +2 -2
  23. data/lua-hooks/ext/luajit/doc/bluequad-print.css +1 -1
  24. data/lua-hooks/ext/luajit/doc/bluequad.css +1 -1
  25. data/lua-hooks/ext/luajit/doc/changes.html +69 -3
  26. data/lua-hooks/ext/luajit/doc/contact.html +10 -3
  27. data/lua-hooks/ext/luajit/doc/ext_c_api.html +2 -2
  28. data/lua-hooks/ext/luajit/doc/ext_ffi.html +2 -2
  29. data/lua-hooks/ext/luajit/doc/ext_ffi_api.html +2 -2
  30. data/lua-hooks/ext/luajit/doc/ext_ffi_semantics.html +3 -4
  31. data/lua-hooks/ext/luajit/doc/ext_ffi_tutorial.html +2 -2
  32. data/lua-hooks/ext/luajit/doc/ext_jit.html +3 -3
  33. data/lua-hooks/ext/luajit/doc/ext_profiler.html +2 -2
  34. data/lua-hooks/ext/luajit/doc/extensions.html +47 -20
  35. data/lua-hooks/ext/luajit/doc/faq.html +2 -2
  36. data/lua-hooks/ext/luajit/doc/install.html +74 -45
  37. data/lua-hooks/ext/luajit/doc/luajit.html +5 -5
  38. data/lua-hooks/ext/luajit/doc/running.html +3 -3
  39. data/lua-hooks/ext/luajit/doc/status.html +13 -8
  40. data/lua-hooks/ext/luajit/dynasm/dasm_arm.h +1 -1
  41. data/lua-hooks/ext/luajit/dynasm/dasm_arm.lua +1 -1
  42. data/lua-hooks/ext/luajit/dynasm/dasm_arm64.h +1 -1
  43. data/lua-hooks/ext/luajit/dynasm/dasm_arm64.lua +1 -1
  44. data/lua-hooks/ext/luajit/dynasm/dasm_mips.h +8 -5
  45. data/lua-hooks/ext/luajit/dynasm/dasm_mips.lua +66 -11
  46. data/lua-hooks/ext/luajit/dynasm/dasm_mips64.lua +12 -0
  47. data/lua-hooks/ext/luajit/dynasm/dasm_ppc.h +1 -1
  48. data/lua-hooks/ext/luajit/dynasm/dasm_ppc.lua +1 -1
  49. data/lua-hooks/ext/luajit/dynasm/dasm_proto.h +1 -1
  50. data/lua-hooks/ext/luajit/dynasm/dasm_x64.lua +1 -1
  51. data/lua-hooks/ext/luajit/dynasm/dasm_x86.h +1 -1
  52. data/lua-hooks/ext/luajit/dynasm/dasm_x86.lua +5 -1
  53. data/lua-hooks/ext/luajit/dynasm/dynasm.lua +2 -2
  54. data/lua-hooks/ext/luajit/etc/luajit.1 +1 -1
  55. data/lua-hooks/ext/luajit/etc/luajit.pc +1 -1
  56. data/lua-hooks/ext/luajit/src/Makefile +15 -11
  57. data/lua-hooks/ext/luajit/src/Makefile.dep +16 -16
  58. data/lua-hooks/ext/luajit/src/host/buildvm.c +2 -2
  59. data/lua-hooks/ext/luajit/src/host/buildvm.h +1 -1
  60. data/lua-hooks/ext/luajit/src/host/buildvm_asm.c +9 -4
  61. data/lua-hooks/ext/luajit/src/host/buildvm_fold.c +2 -2
  62. data/lua-hooks/ext/luajit/src/host/buildvm_lib.c +1 -1
  63. data/lua-hooks/ext/luajit/src/host/buildvm_libbc.h +14 -3
  64. data/lua-hooks/ext/luajit/src/host/buildvm_peobj.c +27 -3
  65. data/lua-hooks/ext/luajit/src/host/genlibbc.lua +1 -1
  66. data/lua-hooks/ext/luajit/src/host/genminilua.lua +6 -5
  67. data/lua-hooks/ext/luajit/src/host/minilua.c +1 -1
  68. data/lua-hooks/ext/luajit/src/jit/bc.lua +1 -1
  69. data/lua-hooks/ext/luajit/src/jit/bcsave.lua +8 -8
  70. data/lua-hooks/ext/luajit/src/jit/dis_arm.lua +2 -2
  71. data/lua-hooks/ext/luajit/src/jit/dis_arm64.lua +1216 -0
  72. data/lua-hooks/ext/luajit/src/jit/dis_arm64be.lua +12 -0
  73. data/lua-hooks/ext/luajit/src/jit/dis_mips.lua +35 -20
  74. data/lua-hooks/ext/luajit/src/jit/dis_mips64.lua +17 -0
  75. data/lua-hooks/ext/luajit/src/jit/dis_mips64el.lua +17 -0
  76. data/lua-hooks/ext/luajit/src/jit/dis_mipsel.lua +1 -1
  77. data/lua-hooks/ext/luajit/src/jit/dis_ppc.lua +2 -2
  78. data/lua-hooks/ext/luajit/src/jit/dis_x64.lua +1 -1
  79. data/lua-hooks/ext/luajit/src/jit/dis_x86.lua +7 -4
  80. data/lua-hooks/ext/luajit/src/jit/dump.lua +17 -12
  81. data/lua-hooks/ext/luajit/src/jit/p.lua +3 -2
  82. data/lua-hooks/ext/luajit/src/jit/v.lua +2 -2
  83. data/lua-hooks/ext/luajit/src/jit/zone.lua +1 -1
  84. data/lua-hooks/ext/luajit/src/lauxlib.h +14 -20
  85. data/lua-hooks/ext/luajit/src/lib_aux.c +38 -27
  86. data/lua-hooks/ext/luajit/src/lib_base.c +12 -5
  87. data/lua-hooks/ext/luajit/src/lib_bit.c +1 -1
  88. data/lua-hooks/ext/luajit/src/lib_debug.c +5 -5
  89. data/lua-hooks/ext/luajit/src/lib_ffi.c +2 -2
  90. data/lua-hooks/ext/luajit/src/lib_init.c +16 -16
  91. data/lua-hooks/ext/luajit/src/lib_io.c +6 -7
  92. data/lua-hooks/ext/luajit/src/lib_jit.c +14 -4
  93. data/lua-hooks/ext/luajit/src/lib_math.c +1 -5
  94. data/lua-hooks/ext/luajit/src/lib_os.c +1 -1
  95. data/lua-hooks/ext/luajit/src/lib_package.c +14 -23
  96. data/lua-hooks/ext/luajit/src/lib_string.c +1 -5
  97. data/lua-hooks/ext/luajit/src/lib_table.c +21 -1
  98. data/lua-hooks/ext/luajit/src/lj.supp +3 -3
  99. data/lua-hooks/ext/luajit/src/lj_alloc.c +174 -83
  100. data/lua-hooks/ext/luajit/src/lj_api.c +97 -18
  101. data/lua-hooks/ext/luajit/src/lj_arch.h +54 -22
  102. data/lua-hooks/ext/luajit/src/lj_asm.c +172 -53
  103. data/lua-hooks/ext/luajit/src/lj_asm.h +1 -1
  104. data/lua-hooks/ext/luajit/src/lj_asm_arm.h +19 -16
  105. data/lua-hooks/ext/luajit/src/lj_asm_arm64.h +2022 -0
  106. data/lua-hooks/ext/luajit/src/lj_asm_mips.h +564 -158
  107. data/lua-hooks/ext/luajit/src/lj_asm_ppc.h +19 -18
  108. data/lua-hooks/ext/luajit/src/lj_asm_x86.h +578 -92
  109. data/lua-hooks/ext/luajit/src/lj_bc.c +1 -1
  110. data/lua-hooks/ext/luajit/src/lj_bc.h +1 -1
  111. data/lua-hooks/ext/luajit/src/lj_bcdump.h +1 -1
  112. data/lua-hooks/ext/luajit/src/lj_bcread.c +1 -1
  113. data/lua-hooks/ext/luajit/src/lj_bcwrite.c +1 -1
  114. data/lua-hooks/ext/luajit/src/lj_buf.c +1 -1
  115. data/lua-hooks/ext/luajit/src/lj_buf.h +1 -1
  116. data/lua-hooks/ext/luajit/src/lj_carith.c +1 -1
  117. data/lua-hooks/ext/luajit/src/lj_carith.h +1 -1
  118. data/lua-hooks/ext/luajit/src/lj_ccall.c +172 -7
  119. data/lua-hooks/ext/luajit/src/lj_ccall.h +21 -5
  120. data/lua-hooks/ext/luajit/src/lj_ccallback.c +71 -17
  121. data/lua-hooks/ext/luajit/src/lj_ccallback.h +1 -1
  122. data/lua-hooks/ext/luajit/src/lj_cconv.c +4 -2
  123. data/lua-hooks/ext/luajit/src/lj_cconv.h +1 -1
  124. data/lua-hooks/ext/luajit/src/lj_cdata.c +7 -5
  125. data/lua-hooks/ext/luajit/src/lj_cdata.h +1 -1
  126. data/lua-hooks/ext/luajit/src/lj_clib.c +5 -5
  127. data/lua-hooks/ext/luajit/src/lj_clib.h +1 -1
  128. data/lua-hooks/ext/luajit/src/lj_cparse.c +11 -6
  129. data/lua-hooks/ext/luajit/src/lj_cparse.h +1 -1
  130. data/lua-hooks/ext/luajit/src/lj_crecord.c +70 -14
  131. data/lua-hooks/ext/luajit/src/lj_crecord.h +1 -1
  132. data/lua-hooks/ext/luajit/src/lj_ctype.c +1 -1
  133. data/lua-hooks/ext/luajit/src/lj_ctype.h +8 -8
  134. data/lua-hooks/ext/luajit/src/lj_debug.c +1 -1
  135. data/lua-hooks/ext/luajit/src/lj_debug.h +1 -1
  136. data/lua-hooks/ext/luajit/src/lj_def.h +6 -9
  137. data/lua-hooks/ext/luajit/src/lj_dispatch.c +3 -3
  138. data/lua-hooks/ext/luajit/src/lj_dispatch.h +2 -1
  139. data/lua-hooks/ext/luajit/src/lj_emit_arm.h +5 -4
  140. data/lua-hooks/ext/luajit/src/lj_emit_arm64.h +419 -0
  141. data/lua-hooks/ext/luajit/src/lj_emit_mips.h +100 -20
  142. data/lua-hooks/ext/luajit/src/lj_emit_ppc.h +4 -4
  143. data/lua-hooks/ext/luajit/src/lj_emit_x86.h +116 -25
  144. data/lua-hooks/ext/luajit/src/lj_err.c +34 -13
  145. data/lua-hooks/ext/luajit/src/lj_err.h +1 -1
  146. data/lua-hooks/ext/luajit/src/lj_errmsg.h +1 -1
  147. data/lua-hooks/ext/luajit/src/lj_ff.h +1 -1
  148. data/lua-hooks/ext/luajit/src/lj_ffrecord.c +58 -49
  149. data/lua-hooks/ext/luajit/src/lj_ffrecord.h +1 -1
  150. data/lua-hooks/ext/luajit/src/lj_frame.h +33 -6
  151. data/lua-hooks/ext/luajit/src/lj_func.c +4 -2
  152. data/lua-hooks/ext/luajit/src/lj_func.h +1 -1
  153. data/lua-hooks/ext/luajit/src/lj_gc.c +16 -7
  154. data/lua-hooks/ext/luajit/src/lj_gc.h +1 -1
  155. data/lua-hooks/ext/luajit/src/lj_gdbjit.c +31 -1
  156. data/lua-hooks/ext/luajit/src/lj_gdbjit.h +1 -1
  157. data/lua-hooks/ext/luajit/src/lj_ir.c +69 -96
  158. data/lua-hooks/ext/luajit/src/lj_ir.h +29 -18
  159. data/lua-hooks/ext/luajit/src/lj_ircall.h +24 -30
  160. data/lua-hooks/ext/luajit/src/lj_iropt.h +9 -9
  161. data/lua-hooks/ext/luajit/src/lj_jit.h +67 -9
  162. data/lua-hooks/ext/luajit/src/lj_lex.c +1 -1
  163. data/lua-hooks/ext/luajit/src/lj_lex.h +1 -1
  164. data/lua-hooks/ext/luajit/src/lj_lib.c +1 -1
  165. data/lua-hooks/ext/luajit/src/lj_lib.h +1 -1
  166. data/lua-hooks/ext/luajit/src/lj_load.c +1 -1
  167. data/lua-hooks/ext/luajit/src/lj_mcode.c +11 -10
  168. data/lua-hooks/ext/luajit/src/lj_mcode.h +1 -1
  169. data/lua-hooks/ext/luajit/src/lj_meta.c +1 -1
  170. data/lua-hooks/ext/luajit/src/lj_meta.h +1 -1
  171. data/lua-hooks/ext/luajit/src/lj_obj.c +1 -1
  172. data/lua-hooks/ext/luajit/src/lj_obj.h +7 -3
  173. data/lua-hooks/ext/luajit/src/lj_opt_dce.c +1 -1
  174. data/lua-hooks/ext/luajit/src/lj_opt_fold.c +84 -17
  175. data/lua-hooks/ext/luajit/src/lj_opt_loop.c +1 -1
  176. data/lua-hooks/ext/luajit/src/lj_opt_mem.c +3 -3
  177. data/lua-hooks/ext/luajit/src/lj_opt_narrow.c +24 -22
  178. data/lua-hooks/ext/luajit/src/lj_opt_sink.c +11 -6
  179. data/lua-hooks/ext/luajit/src/lj_opt_split.c +11 -2
  180. data/lua-hooks/ext/luajit/src/lj_parse.c +9 -7
  181. data/lua-hooks/ext/luajit/src/lj_parse.h +1 -1
  182. data/lua-hooks/ext/luajit/src/lj_profile.c +1 -1
  183. data/lua-hooks/ext/luajit/src/lj_profile.h +1 -1
  184. data/lua-hooks/ext/luajit/src/lj_record.c +201 -117
  185. data/lua-hooks/ext/luajit/src/lj_record.h +1 -1
  186. data/lua-hooks/ext/luajit/src/lj_snap.c +72 -26
  187. data/lua-hooks/ext/luajit/src/lj_snap.h +1 -1
  188. data/lua-hooks/ext/luajit/src/lj_state.c +6 -6
  189. data/lua-hooks/ext/luajit/src/lj_state.h +2 -2
  190. data/lua-hooks/ext/luajit/src/lj_str.c +1 -1
  191. data/lua-hooks/ext/luajit/src/lj_str.h +1 -1
  192. data/lua-hooks/ext/luajit/src/lj_strfmt.c +7 -3
  193. data/lua-hooks/ext/luajit/src/lj_strfmt.h +1 -1
  194. data/lua-hooks/ext/luajit/src/lj_strfmt_num.c +4 -3
  195. data/lua-hooks/ext/luajit/src/lj_strscan.c +1 -1
  196. data/lua-hooks/ext/luajit/src/lj_strscan.h +1 -1
  197. data/lua-hooks/ext/luajit/src/lj_tab.c +1 -2
  198. data/lua-hooks/ext/luajit/src/lj_tab.h +1 -1
  199. data/lua-hooks/ext/luajit/src/lj_target.h +3 -3
  200. data/lua-hooks/ext/luajit/src/lj_target_arm.h +1 -1
  201. data/lua-hooks/ext/luajit/src/lj_target_arm64.h +239 -7
  202. data/lua-hooks/ext/luajit/src/lj_target_mips.h +111 -22
  203. data/lua-hooks/ext/luajit/src/lj_target_ppc.h +1 -1
  204. data/lua-hooks/ext/luajit/src/lj_target_x86.h +21 -4
  205. data/lua-hooks/ext/luajit/src/lj_trace.c +63 -18
  206. data/lua-hooks/ext/luajit/src/lj_trace.h +2 -1
  207. data/lua-hooks/ext/luajit/src/lj_traceerr.h +1 -1
  208. data/lua-hooks/ext/luajit/src/lj_udata.c +1 -1
  209. data/lua-hooks/ext/luajit/src/lj_udata.h +1 -1
  210. data/lua-hooks/ext/luajit/src/lj_vm.h +5 -1
  211. data/lua-hooks/ext/luajit/src/lj_vmevent.c +1 -1
  212. data/lua-hooks/ext/luajit/src/lj_vmevent.h +1 -1
  213. data/lua-hooks/ext/luajit/src/lj_vmmath.c +1 -1
  214. data/lua-hooks/ext/luajit/src/ljamalg.c +1 -1
  215. data/lua-hooks/ext/luajit/src/lua.h +9 -1
  216. data/lua-hooks/ext/luajit/src/luaconf.h +3 -7
  217. data/lua-hooks/ext/luajit/src/luajit.c +69 -54
  218. data/lua-hooks/ext/luajit/src/luajit.h +4 -4
  219. data/lua-hooks/ext/luajit/src/lualib.h +1 -1
  220. data/lua-hooks/ext/luajit/src/msvcbuild.bat +12 -4
  221. data/lua-hooks/ext/luajit/src/vm_arm.dasc +1 -1
  222. data/lua-hooks/ext/luajit/src/vm_arm64.dasc +255 -32
  223. data/lua-hooks/ext/luajit/src/vm_mips.dasc +26 -23
  224. data/lua-hooks/ext/luajit/src/vm_mips64.dasc +5062 -0
  225. data/lua-hooks/ext/luajit/src/vm_ppc.dasc +1 -1
  226. data/lua-hooks/ext/luajit/src/vm_x64.dasc +24 -25
  227. data/lua-hooks/ext/luajit/src/vm_x86.dasc +77 -4
  228. data/lua-hooks/libluahooks.darwin.a +0 -0
  229. data/lua-hooks/libluahooks.linux.a +0 -0
  230. data/lua-hooks/options.mk +1 -1
  231. metadata +37 -77
  232. data/lua-hooks/ext/all.c +0 -69
  233. data/lua-hooks/ext/libinjection/COPYING +0 -37
  234. data/lua-hooks/ext/libinjection/libinjection.h +0 -65
  235. data/lua-hooks/ext/libinjection/libinjection_html5.c +0 -847
  236. data/lua-hooks/ext/libinjection/libinjection_html5.h +0 -54
  237. data/lua-hooks/ext/libinjection/libinjection_sqli.c +0 -2301
  238. data/lua-hooks/ext/libinjection/libinjection_sqli.h +0 -295
  239. data/lua-hooks/ext/libinjection/libinjection_sqli_data.h +0 -9349
  240. data/lua-hooks/ext/libinjection/libinjection_xss.c +0 -531
  241. data/lua-hooks/ext/libinjection/libinjection_xss.h +0 -21
  242. data/lua-hooks/ext/libinjection/lualib.c +0 -145
  243. data/lua-hooks/ext/libinjection/module.mk +0 -5
  244. data/lua-hooks/ext/lpeg/HISTORY +0 -96
  245. data/lua-hooks/ext/lpeg/lpcap.c +0 -537
  246. data/lua-hooks/ext/lpeg/lpcap.h +0 -56
  247. data/lua-hooks/ext/lpeg/lpcode.c +0 -1014
  248. data/lua-hooks/ext/lpeg/lpcode.h +0 -40
  249. data/lua-hooks/ext/lpeg/lpeg-128.gif +0 -0
  250. data/lua-hooks/ext/lpeg/lpeg.html +0 -1445
  251. data/lua-hooks/ext/lpeg/lpprint.c +0 -244
  252. data/lua-hooks/ext/lpeg/lpprint.h +0 -36
  253. data/lua-hooks/ext/lpeg/lptree.c +0 -1303
  254. data/lua-hooks/ext/lpeg/lptree.h +0 -82
  255. data/lua-hooks/ext/lpeg/lptypes.h +0 -149
  256. data/lua-hooks/ext/lpeg/lpvm.c +0 -364
  257. data/lua-hooks/ext/lpeg/lpvm.h +0 -58
  258. data/lua-hooks/ext/lpeg/makefile +0 -55
  259. data/lua-hooks/ext/lpeg/module.mk +0 -6
  260. data/lua-hooks/ext/lpeg/re.html +0 -498
  261. data/lua-hooks/ext/lua-cmsgpack/.gitignore +0 -13
  262. data/lua-hooks/ext/lua-cmsgpack/CMakeLists.txt +0 -45
  263. data/lua-hooks/ext/lua-cmsgpack/README.md +0 -115
  264. data/lua-hooks/ext/lua-cmsgpack/lua_cmsgpack.c +0 -970
  265. data/lua-hooks/ext/lua-cmsgpack/module.mk +0 -2
  266. data/lua-hooks/ext/lua-cmsgpack/test.lua +0 -570
  267. data/lua-hooks/ext/lua-snapshot/LICENSE +0 -7
  268. data/lua-hooks/ext/lua-snapshot/Makefile +0 -12
  269. data/lua-hooks/ext/lua-snapshot/README.md +0 -18
  270. data/lua-hooks/ext/lua-snapshot/dump.lua +0 -15
  271. data/lua-hooks/ext/lua-snapshot/module.mk +0 -2
  272. data/lua-hooks/ext/lua-snapshot/snapshot.c +0 -462
  273. data/lua-hooks/ext/luautf8/README.md +0 -152
  274. data/lua-hooks/ext/luautf8/lutf8lib.c +0 -1274
  275. data/lua-hooks/ext/luautf8/module.mk +0 -2
  276. data/lua-hooks/ext/luautf8/unidata.h +0 -3064
  277. data/lua-hooks/ext/module.mk +0 -15
  278. data/lua-hooks/ext/modules.h +0 -17
  279. data/lua-hooks/ext/perf/luacpu.c +0 -114
  280. data/lua-hooks/ext/perf/lualoadavg.c +0 -40
  281. data/lua-hooks/ext/perf/luameminfo.c +0 -38
  282. data/lua-hooks/ext/perf/luaoslib.c +0 -203
  283. data/lua-hooks/ext/perf/module.mk +0 -5
  284. data/lua-hooks/ext/sha1/luasha1.c +0 -74
  285. data/lua-hooks/ext/sha1/module.mk +0 -5
  286. data/lua-hooks/ext/sha1/sha1.c +0 -145
  287. data/lua-hooks/ext/sha2/luasha256.c +0 -77
  288. data/lua-hooks/ext/sha2/module.mk +0 -5
  289. data/lua-hooks/ext/sha2/sha256.c +0 -196
  290. data/lua-hooks/ext/sysutils/lua_utils.c +0 -56
  291. data/lua-hooks/ext/sysutils/module.mk +0 -2
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** DynASM encoding engine prototypes.
3
- ** Copyright (C) 2005-2016 Mike Pall. All rights reserved.
3
+ ** Copyright (C) 2005-2017 Mike Pall. All rights reserved.
4
4
  ** Released under the MIT license. See dynasm.lua for full copyright notice.
5
5
  */
6
6
 
@@ -1,7 +1,7 @@
1
1
  ------------------------------------------------------------------------------
2
2
  -- DynASM x64 module.
3
3
  --
4
- -- Copyright (C) 2005-2016 Mike Pall. All rights reserved.
4
+ -- Copyright (C) 2005-2017 Mike Pall. All rights reserved.
5
5
  -- See dynasm.lua for full copyright notice.
6
6
  ------------------------------------------------------------------------------
7
7
  -- This module just sets 64 bit mode for the combined x86/x64 module.
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** DynASM x86 encoding engine.
3
- ** Copyright (C) 2005-2016 Mike Pall. All rights reserved.
3
+ ** Copyright (C) 2005-2017 Mike Pall. All rights reserved.
4
4
  ** Released under the MIT license. See dynasm.lua for full copyright notice.
5
5
  */
6
6
 
@@ -1,7 +1,7 @@
1
1
  ------------------------------------------------------------------------------
2
2
  -- DynASM x86/x64 module.
3
3
  --
4
- -- Copyright (C) 2005-2016 Mike Pall. All rights reserved.
4
+ -- Copyright (C) 2005-2017 Mike Pall. All rights reserved.
5
5
  -- See dynasm.lua for full copyright notice.
6
6
  ------------------------------------------------------------------------------
7
7
 
@@ -1673,6 +1673,10 @@ local map_op = {
1673
1673
  vpsravd_3 = "rrmoy:660F38V46rM",
1674
1674
  vpsrlvd_3 = "rrmoy:660F38V45rM",
1675
1675
  vpsrlvq_3 = "rrmoy:660F38VX45rM",
1676
+
1677
+ -- Intel ADX
1678
+ adcx_2 = "rmqd:660F38F6rM",
1679
+ adox_2 = "rmqd:F30F38F6rM",
1676
1680
  }
1677
1681
 
1678
1682
  ------------------------------------------------------------------------------
@@ -2,7 +2,7 @@
2
2
  -- DynASM. A dynamic assembler for code generation engines.
3
3
  -- Originally designed and implemented for LuaJIT.
4
4
  --
5
- -- Copyright (C) 2005-2016 Mike Pall. All rights reserved.
5
+ -- Copyright (C) 2005-2017 Mike Pall. All rights reserved.
6
6
  -- See below for full copyright notice.
7
7
  ------------------------------------------------------------------------------
8
8
 
@@ -17,7 +17,7 @@ local _info = {
17
17
  url = "http://luajit.org/dynasm.html",
18
18
  license = "MIT",
19
19
  copyright = [[
20
- Copyright (C) 2005-2016 Mike Pall. All rights reserved.
20
+ Copyright (C) 2005-2017 Mike Pall. All rights reserved.
21
21
 
22
22
  Permission is hereby granted, free of charge, to any person obtaining
23
23
  a copy of this software and associated documentation files (the
@@ -74,7 +74,7 @@ luajit \-jv \-e "for i=1,10 do for j=1,10 do for k=1,100 do end end end"
74
74
  Runs some nested loops and shows the resulting traces.
75
75
  .SH COPYRIGHT
76
76
  .PP
77
- \fBLuaJIT\fR is Copyright \(co 2005-2016 Mike Pall.
77
+ \fBLuaJIT\fR is Copyright \(co 2005-2017 Mike Pall.
78
78
  .br
79
79
  \fBLuaJIT\fR is open source software, released under the MIT license.
80
80
  .SH SEE ALSO
@@ -2,7 +2,7 @@
2
2
  majver=2
3
3
  minver=1
4
4
  relver=0
5
- version=${majver}.${minver}.${relver}-beta2
5
+ version=${majver}.${minver}.${relver}-beta3
6
6
  abiver=5.1
7
7
 
8
8
  prefix=/usr/local
@@ -7,7 +7,7 @@
7
7
  # Also works with MinGW and Cygwin on Windows.
8
8
  # Please check msvcbuild.bat for building with MSVC on Windows.
9
9
  #
10
- # Copyright (C) 2005-2016 Mike Pall. See Copyright Notice in luajit.h
10
+ # Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
11
11
  ##############################################################################
12
12
 
13
13
  MAJVER= 2
@@ -110,6 +110,9 @@ XCFLAGS=
110
110
  #XCFLAGS+= -DLUAJIT_NUMMODE=1
111
111
  #XCFLAGS+= -DLUAJIT_NUMMODE=2
112
112
  #
113
+ # Enable GC64 mode for x64.
114
+ #XCFLAGS+= -DLUAJIT_ENABLE_GC64
115
+ #
113
116
  ##############################################################################
114
117
 
115
118
  ##############################################################################
@@ -121,8 +124,8 @@ XCFLAGS=
121
124
  #
122
125
  # Use the system provided memory allocator (realloc) instead of the
123
126
  # bundled memory allocator. This is slower, but sometimes helpful for
124
- # debugging. This option cannot be enabled on x64, since realloc usually
125
- # doesn't return addresses in the right address range.
127
+ # debugging. This option cannot be enabled on x64 without GC64, since
128
+ # realloc usually doesn't return addresses in the right address range.
126
129
  # OTOH this option is mandatory for Valgrind's memcheck tool on x64 and
127
130
  # the only way to get useful results from it for all other architectures.
128
131
  #XCFLAGS+= -DLUAJIT_USE_SYSMALLOC
@@ -166,10 +169,6 @@ else
166
169
  HOST_SYS= Windows
167
170
  HOST_MSYS= cygwin
168
171
  endif
169
- # Use Clang for OSX host.
170
- ifeq (Darwin,$(HOST_SYS))
171
- DEFAULT_CC= clang
172
- endif
173
172
  endif
174
173
 
175
174
  ##############################################################################
@@ -210,7 +209,7 @@ TARGET_CC= $(STATIC_CC)
210
209
  TARGET_STCC= $(STATIC_CC)
211
210
  TARGET_DYNCC= $(DYNAMIC_CC)
212
211
  TARGET_LD= $(CROSS)$(CC)
213
- TARGET_AR= $(CROSS)ar rcus
212
+ TARGET_AR= $(CROSS)ar rcus 2>/dev/null
214
213
  TARGET_STRIP= $(CROSS)strip
215
214
 
216
215
  TARGET_LIBPATH= $(or $(PREFIX),/usr/local)/$(or $(MULTILIB),lib)
@@ -243,6 +242,9 @@ ifneq (,$(findstring LJ_TARGET_ARM ,$(TARGET_TESTARCH)))
243
242
  TARGET_LJARCH= arm
244
243
  else
245
244
  ifneq (,$(findstring LJ_TARGET_ARM64 ,$(TARGET_TESTARCH)))
245
+ ifneq (,$(findstring __AARCH64EB__ ,$(TARGET_TESTARCH)))
246
+ TARGET_ARCH= -D__AARCH64EB__=1
247
+ endif
246
248
  TARGET_LJARCH= arm64
247
249
  else
248
250
  ifneq (,$(findstring LJ_TARGET_PPC ,$(TARGET_TESTARCH)))
@@ -257,7 +259,11 @@ ifneq (,$(findstring LJ_TARGET_MIPS ,$(TARGET_TESTARCH)))
257
259
  ifneq (,$(findstring MIPSEL ,$(TARGET_TESTARCH)))
258
260
  TARGET_ARCH= -D__MIPSEL__=1
259
261
  endif
260
- TARGET_LJARCH= mips
262
+ ifneq (,$(findstring LJ_TARGET_MIPS64 ,$(TARGET_TESTARCH)))
263
+ TARGET_LJARCH= mips64
264
+ else
265
+ TARGET_LJARCH= mips
266
+ endif
261
267
  else
262
268
  $(error Unsupported target architecture)
263
269
  endif
@@ -310,7 +316,6 @@ ifeq (Darwin,$(TARGET_SYS))
310
316
  export MACOSX_DEPLOYMENT_TARGET=10.4
311
317
  endif
312
318
  TARGET_STRIP+= -x
313
- TARGET_AR+= 2>/dev/null
314
319
  TARGET_XSHLDFLAGS= -dynamiclib -single_module -undefined dynamic_lookup -fPIC
315
320
  TARGET_DYNXLDOPTS=
316
321
  TARGET_XSHLDFLAGS+= -install_name $(TARGET_DYLIBPATH) -compatibility_version $(MAJVER).$(MINVER) -current_version $(MAJVER).$(MINVER).$(RELVER)
@@ -321,7 +326,6 @@ ifeq (Darwin,$(TARGET_SYS))
321
326
  else
322
327
  ifeq (iOS,$(TARGET_SYS))
323
328
  TARGET_STRIP+= -x
324
- TARGET_AR+= 2>/dev/null
325
329
  TARGET_XSHLDFLAGS= -dynamiclib -single_module -undefined dynamic_lookup -fPIC
326
330
  TARGET_DYNXLDOPTS=
327
331
  TARGET_XSHLDFLAGS+= -install_name $(TARGET_DYLIBPATH) -compatibility_version $(MAJVER).$(MINVER) -current_version $(MAJVER).$(MINVER).$(RELVER)
@@ -3,8 +3,8 @@ lib_aux.o: lib_aux.c lua.h luaconf.h lauxlib.h lj_obj.h lj_def.h \
3
3
  lj_dispatch.h lj_bc.h lj_traceerr.h lj_lib.h lj_alloc.h
4
4
  lib_base.o: lib_base.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h \
5
5
  lj_def.h lj_arch.h lj_gc.h lj_err.h lj_errmsg.h lj_debug.h lj_str.h \
6
- lj_tab.h lj_meta.h lj_state.h lj_ctype.h lj_cconv.h lj_bc.h lj_ff.h \
7
- lj_ffdef.h lj_dispatch.h lj_jit.h lj_ir.h lj_char.h lj_strscan.h \
6
+ lj_tab.h lj_meta.h lj_state.h lj_frame.h lj_bc.h lj_ctype.h lj_cconv.h \
7
+ lj_ff.h lj_ffdef.h lj_dispatch.h lj_jit.h lj_ir.h lj_char.h lj_strscan.h \
8
8
  lj_strfmt.h lj_lib.h lj_libdef.h
9
9
  lib_bit.o: lib_bit.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h lj_def.h \
10
10
  lj_arch.h lj_err.h lj_errmsg.h lj_buf.h lj_gc.h lj_str.h lj_strscan.h \
@@ -163,7 +163,7 @@ lj_opt_sink.o: lj_opt_sink.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h \
163
163
  lj_ir.h lj_jit.h lj_iropt.h lj_target.h lj_target_*.h
164
164
  lj_opt_split.o: lj_opt_split.c lj_obj.h lua.h luaconf.h lj_def.h \
165
165
  lj_arch.h lj_err.h lj_errmsg.h lj_buf.h lj_gc.h lj_str.h lj_ir.h \
166
- lj_jit.h lj_ircall.h lj_iropt.h lj_vm.h
166
+ lj_jit.h lj_ircall.h lj_iropt.h lj_dispatch.h lj_bc.h lj_vm.h
167
167
  lj_parse.o: lj_parse.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h \
168
168
  lj_gc.h lj_err.h lj_errmsg.h lj_debug.h lj_buf.h lj_str.h lj_tab.h \
169
169
  lj_func.h lj_state.h lj_bc.h lj_ctype.h lj_strfmt.h lj_lex.h lj_parse.h \
@@ -215,19 +215,19 @@ ljamalg.o: ljamalg.c lua.h luaconf.h lauxlib.h lj_gc.c lj_obj.h lj_def.h \
215
215
  lj_func.c lj_udata.c lj_meta.c lj_strscan.h lj_lib.h lj_debug.c \
216
216
  lj_state.c lj_lex.h lj_alloc.h luajit.h lj_dispatch.c lj_ccallback.h \
217
217
  lj_profile.h lj_vmevent.c lj_vmevent.h lj_vmmath.c lj_strscan.c \
218
- lj_strfmt.c lj_api.c lj_profile.c lj_lex.c lualib.h lj_parse.h \
219
- lj_parse.c lj_bcread.c lj_bcdump.h lj_bcwrite.c lj_load.c lj_ctype.c \
220
- lj_cdata.c lj_cconv.h lj_cconv.c lj_ccall.c lj_ccall.h lj_ccallback.c \
221
- lj_target.h lj_target_*.h lj_mcode.h lj_carith.c lj_carith.h lj_clib.c \
222
- lj_clib.h lj_cparse.c lj_cparse.h lj_lib.c lj_ir.c lj_ircall.h \
223
- lj_iropt.h lj_opt_mem.c lj_opt_fold.c lj_folddef.h lj_opt_narrow.c \
224
- lj_opt_dce.c lj_opt_loop.c lj_snap.h lj_opt_split.c lj_opt_sink.c \
225
- lj_mcode.c lj_snap.c lj_record.c lj_record.h lj_ffrecord.h lj_crecord.c \
226
- lj_crecord.h lj_ffrecord.c lj_recdef.h lj_asm.c lj_asm.h lj_emit_*.h \
227
- lj_asm_*.h lj_trace.c lj_gdbjit.h lj_gdbjit.c lj_alloc.c lib_aux.c \
228
- lib_base.c lj_libdef.h lib_math.c lib_string.c lib_table.c lib_io.c \
229
- lib_os.c lib_package.c lib_debug.c lib_bit.c lib_jit.c lib_ffi.c \
230
- lib_init.c
218
+ lj_strfmt.c lj_strfmt_num.c lj_api.c lj_profile.c lj_lex.c lualib.h \
219
+ lj_parse.h lj_parse.c lj_bcread.c lj_bcdump.h lj_bcwrite.c lj_load.c \
220
+ lj_ctype.c lj_cdata.c lj_cconv.h lj_cconv.c lj_ccall.c lj_ccall.h \
221
+ lj_ccallback.c lj_target.h lj_target_*.h lj_mcode.h lj_carith.c \
222
+ lj_carith.h lj_clib.c lj_clib.h lj_cparse.c lj_cparse.h lj_lib.c lj_ir.c \
223
+ lj_ircall.h lj_iropt.h lj_opt_mem.c lj_opt_fold.c lj_folddef.h \
224
+ lj_opt_narrow.c lj_opt_dce.c lj_opt_loop.c lj_snap.h lj_opt_split.c \
225
+ lj_opt_sink.c lj_mcode.c lj_snap.c lj_record.c lj_record.h lj_ffrecord.h \
226
+ lj_crecord.c lj_crecord.h lj_ffrecord.c lj_recdef.h lj_asm.c lj_asm.h \
227
+ lj_emit_*.h lj_asm_*.h lj_trace.c lj_gdbjit.h lj_gdbjit.c lj_alloc.c \
228
+ lib_aux.c lib_base.c lj_libdef.h lib_math.c lib_string.c lib_table.c \
229
+ lib_io.c lib_os.c lib_package.c lib_debug.c lib_bit.c lib_jit.c \
230
+ lib_ffi.c lib_init.c
231
231
  luajit.o: luajit.c lua.h luaconf.h lauxlib.h lualib.h luajit.h lj_arch.h
232
232
  host/buildvm.o: host/buildvm.c host/buildvm.h lj_def.h lua.h luaconf.h \
233
233
  lj_arch.h lj_obj.h lj_def.h lj_arch.h lj_gc.h lj_obj.h lj_bc.h lj_ir.h \
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** LuaJIT VM builder.
3
- ** Copyright (C) 2005-2016 Mike Pall. See Copyright Notice in luajit.h
3
+ ** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
4
4
  **
5
5
  ** This is a tool to build the hand-tuned assembler code required for
6
6
  ** LuaJIT's bytecode interpreter. It supports a variety of output formats
@@ -110,7 +110,7 @@ static const char *sym_decorate(BuildCtx *ctx,
110
110
  if (p) {
111
111
  #if LJ_TARGET_X86ORX64
112
112
  if (!LJ_64 && (ctx->mode == BUILD_coffasm || ctx->mode == BUILD_peobj))
113
- name[0] = '@';
113
+ name[0] = name[1] == 'R' ? '_' : '@'; /* Just for _RtlUnwind@16. */
114
114
  else
115
115
  *p = '\0';
116
116
  #elif LJ_TARGET_PPC && !LJ_TARGET_CONSOLE
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** LuaJIT VM builder.
3
- ** Copyright (C) 2005-2016 Mike Pall. See Copyright Notice in luajit.h
3
+ ** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
4
4
  */
5
5
 
6
6
  #ifndef _BUILDVM_H
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** LuaJIT VM builder: Assembler source code emitter.
3
- ** Copyright (C) 2005-2016 Mike Pall. See Copyright Notice in luajit.h
3
+ ** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
4
4
  */
5
5
 
6
6
  #include "buildvm.h"
@@ -93,10 +93,14 @@ static void emit_asm_words(BuildCtx *ctx, uint8_t *p, int n)
93
93
  {
94
94
  int i;
95
95
  for (i = 0; i < n; i += 4) {
96
+ uint32_t ins = *(uint32_t *)(p+i);
97
+ #if LJ_TARGET_ARM64 && LJ_BE
98
+ ins = lj_bswap(ins); /* ARM64 instructions are always little-endian. */
99
+ #endif
96
100
  if ((i & 15) == 0)
97
- fprintf(ctx->fp, "\t.long 0x%08x", *(uint32_t *)(p+i));
101
+ fprintf(ctx->fp, "\t.long 0x%08x", ins);
98
102
  else
99
- fprintf(ctx->fp, ",0x%08x", *(uint32_t *)(p+i));
103
+ fprintf(ctx->fp, ",0x%08x", ins);
100
104
  if ((i & 15) == 12) putc('\n', ctx->fp);
101
105
  }
102
106
  if ((n & 15) != 0) putc('\n', ctx->fp);
@@ -214,7 +218,8 @@ static void emit_asm_label(BuildCtx *ctx, const char *name, int size, int isfunc
214
218
  case BUILD_machasm:
215
219
  fprintf(ctx->fp,
216
220
  "\n\t.private_extern %s\n"
217
- "%s:\n", name, name);
221
+ "\t.no_dead_strip %s\n"
222
+ "%s:\n", name, name, name);
218
223
  break;
219
224
  default:
220
225
  break;
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** LuaJIT VM builder: IR folding hash table generator.
3
- ** Copyright (C) 2005-2016 Mike Pall. See Copyright Notice in luajit.h
3
+ ** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
4
4
  */
5
5
 
6
6
  #include "buildvm.h"
@@ -9,7 +9,7 @@
9
9
 
10
10
  /* Context for the folding hash table generator. */
11
11
  static int lineno;
12
- static int funcidx;
12
+ static uint32_t funcidx;
13
13
  static uint32_t foldkeys[BUILD_MAX_FOLD];
14
14
  static uint32_t nkeys;
15
15
 
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** LuaJIT VM builder: library definition compiler.
3
- ** Copyright (C) 2005-2016 Mike Pall. See Copyright Notice in luajit.h
3
+ ** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
4
4
  */
5
5
 
6
6
  #include "buildvm.h"
@@ -15,7 +15,12 @@ static const uint8_t libbc_code[] = {
15
15
  8,2,0,0,88,3,23,128,59,3,2,0,43,4,0,0,64,4,2,0,76,3,2,0,88,3,18,128,16,1,14,
16
16
  0,41,3,1,0,3,3,1,0,88,3,14,128,3,1,2,0,88,3,12,128,59,3,1,0,22,4,1,1,18,5,2,
17
17
  0,41,6,1,0,77,4,4,128,23,8,1,7,59,9,7,0,64,9,8,0,79,4,252,127,43,4,0,0,64,4,
18
- 2,0,76,3,2,0,75,0,1,0,0,2,0
18
+ 2,0,76,3,2,0,75,0,1,0,0,2,0,5,12,0,0,0,35,16,0,12,0,16,1,14,0,16,2,14,0,16,
19
+ 3,14,0,11,4,0,0,88,5,1,128,18,4,0,0,16,4,12,0,3,1,2,0,88,5,24,128,33,5,1,3,
20
+ 0,2,3,0,88,6,4,128,2,3,1,0,88,6,2,128,4,4,0,0,88,6,9,128,18,6,1,0,18,7,2,0,
21
+ 41,8,1,0,77,6,4,128,32,10,5,9,59,11,9,0,64,11,10,4,79,6,252,127,88,6,8,128,
22
+ 18,6,2,0,18,7,1,0,41,8,255,255,77,6,4,128,32,10,5,9,59,11,9,0,64,11,10,4,79,
23
+ 6,252,127,76,4,2,0,0
19
24
  #else
20
25
  0,1,2,0,0,1,2,24,1,0,0,76,1,2,0,241,135,158,166,3,220,203,178,130,4,0,1,2,0,
21
26
  0,1,2,24,1,0,0,76,1,2,0,243,244,148,165,20,198,190,199,252,3,0,1,2,0,0,0,3,
@@ -28,7 +33,12 @@ static const uint8_t libbc_code[] = {
28
33
  8,2,0,0,88,3,23,128,59,3,2,0,43,4,0,0,64,4,2,0,76,3,2,0,88,3,18,128,16,1,14,
29
34
  0,41,3,1,0,3,3,1,0,88,3,14,128,3,1,2,0,88,3,12,128,59,3,1,0,22,4,1,1,18,5,2,
30
35
  0,41,6,1,0,77,4,4,128,23,8,1,7,59,9,7,0,64,9,8,0,79,4,252,127,43,4,0,0,64,4,
31
- 2,0,76,3,2,0,75,0,1,0,0,2,0
36
+ 2,0,76,3,2,0,75,0,1,0,0,2,0,5,12,0,0,0,35,16,0,12,0,16,1,14,0,16,2,14,0,16,
37
+ 3,14,0,11,4,0,0,88,5,1,128,18,4,0,0,16,4,12,0,3,1,2,0,88,5,24,128,33,5,1,3,
38
+ 0,2,3,0,88,6,4,128,2,3,1,0,88,6,2,128,4,4,0,0,88,6,9,128,18,6,1,0,18,7,2,0,
39
+ 41,8,1,0,77,6,4,128,32,10,5,9,59,11,9,0,64,11,10,4,79,6,252,127,88,6,8,128,
40
+ 18,6,2,0,18,7,1,0,41,8,255,255,77,6,4,128,32,10,5,9,59,11,9,0,64,11,10,4,79,
41
+ 6,252,127,76,4,2,0,0
32
42
  #endif
33
43
  };
34
44
 
@@ -40,6 +50,7 @@ static const struct { const char *name; int ofs; } libbc_map[] = {
40
50
  {"table_foreach",136},
41
51
  {"table_getn",207},
42
52
  {"table_remove",226},
43
- {NULL,355}
53
+ {"table_move",355},
54
+ {NULL,502}
44
55
  };
45
56
 
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** LuaJIT VM builder: PE object emitter.
3
- ** Copyright (C) 2005-2016 Mike Pall. See Copyright Notice in luajit.h
3
+ ** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
4
4
  **
5
5
  ** Only used for building on Windows, since we cannot assume the presence
6
6
  ** of a suitable assembler. The host and target byte order must match.
@@ -109,6 +109,8 @@ enum {
109
109
  #if LJ_TARGET_X64
110
110
  PEOBJ_SECT_PDATA,
111
111
  PEOBJ_SECT_XDATA,
112
+ #elif LJ_TARGET_X86
113
+ PEOBJ_SECT_SXDATA,
112
114
  #endif
113
115
  PEOBJ_SECT_RDATA_Z,
114
116
  PEOBJ_NSECTIONS
@@ -208,6 +210,13 @@ void emit_peobj(BuildCtx *ctx)
208
210
  sofs += (pesect[PEOBJ_SECT_XDATA].nreloc = 1) * PEOBJ_RELOC_SIZE;
209
211
  /* Flags: 40 = read, 30 = align4, 40 = initialized data. */
210
212
  pesect[PEOBJ_SECT_XDATA].flags = 0x40300040;
213
+ #elif LJ_TARGET_X86
214
+ memcpy(pesect[PEOBJ_SECT_SXDATA].name, ".sxdata", sizeof(".sxdata")-1);
215
+ pesect[PEOBJ_SECT_SXDATA].ofs = sofs;
216
+ sofs += (pesect[PEOBJ_SECT_SXDATA].size = 4);
217
+ pesect[PEOBJ_SECT_SXDATA].relocofs = sofs;
218
+ /* Flags: 40 = read, 30 = align4, 02 = lnk_info, 40 = initialized data. */
219
+ pesect[PEOBJ_SECT_SXDATA].flags = 0x40300240;
211
220
  #endif
212
221
 
213
222
  memcpy(pesect[PEOBJ_SECT_RDATA_Z].name, ".rdata$Z", sizeof(".rdata$Z")-1);
@@ -232,7 +241,7 @@ void emit_peobj(BuildCtx *ctx)
232
241
  nrsym = ctx->nrelocsym;
233
242
  pehdr.nsyms = 1+PEOBJ_NSECTIONS*2 + 1+ctx->nsym + nrsym;
234
243
  #if LJ_TARGET_X64
235
- pehdr.nsyms += 1; /* Symbol for lj_err_unwind_win64. */
244
+ pehdr.nsyms += 1; /* Symbol for lj_err_unwind_win. */
236
245
  #endif
237
246
 
238
247
  /* Write PE object header and all sections. */
@@ -312,6 +321,19 @@ void emit_peobj(BuildCtx *ctx)
312
321
  reloc.type = PEOBJ_RELOC_ADDR32NB;
313
322
  owrite(ctx, &reloc, PEOBJ_RELOC_SIZE);
314
323
  }
324
+ #elif LJ_TARGET_X86
325
+ /* Write .sxdata section. */
326
+ for (i = 0; i < nrsym; i++) {
327
+ if (!strcmp(ctx->relocsym[i], "_lj_err_unwind_win")) {
328
+ uint32_t symidx = 1+2+i;
329
+ owrite(ctx, &symidx, 4);
330
+ break;
331
+ }
332
+ }
333
+ if (i == nrsym) {
334
+ fprintf(stderr, "Error: extern lj_err_unwind_win not used\n");
335
+ exit(1);
336
+ }
315
337
  #endif
316
338
 
317
339
  /* Write .rdata$Z section. */
@@ -333,8 +355,10 @@ void emit_peobj(BuildCtx *ctx)
333
355
  #if LJ_TARGET_X64
334
356
  emit_peobj_sym_sect(ctx, pesect, PEOBJ_SECT_PDATA);
335
357
  emit_peobj_sym_sect(ctx, pesect, PEOBJ_SECT_XDATA);
336
- emit_peobj_sym(ctx, "lj_err_unwind_win64", 0,
358
+ emit_peobj_sym(ctx, "lj_err_unwind_win", 0,
337
359
  PEOBJ_SECT_UNDEF, PEOBJ_TYPE_FUNC, PEOBJ_SCL_EXTERN);
360
+ #elif LJ_TARGET_X86
361
+ emit_peobj_sym_sect(ctx, pesect, PEOBJ_SECT_SXDATA);
338
362
  #endif
339
363
 
340
364
  emit_peobj_sym(ctx, ctx->beginsym, 0,
@@ -2,7 +2,7 @@
2
2
  -- Lua script to dump the bytecode of the library functions written in Lua.
3
3
  -- The resulting 'buildvm_libbc.h' is used for the build process of LuaJIT.
4
4
  ----------------------------------------------------------------------------
5
- -- Copyright (C) 2005-2016 Mike Pall. All rights reserved.
5
+ -- Copyright (C) 2005-2017 Mike Pall. All rights reserved.
6
6
  -- Released under the MIT license. See Copyright Notice in luajit.h
7
7
  ----------------------------------------------------------------------------
8
8
 
@@ -2,7 +2,7 @@
2
2
  -- Lua script to generate a customized, minified version of Lua.
3
3
  -- The resulting 'minilua' is used for the build process of LuaJIT.
4
4
  ----------------------------------------------------------------------------
5
- -- Copyright (C) 2005-2016 Mike Pall. All rights reserved.
5
+ -- Copyright (C) 2005-2017 Mike Pall. All rights reserved.
6
6
  -- Released under the MIT license. See Copyright Notice in luajit.h
7
7
  ----------------------------------------------------------------------------
8
8
 
@@ -157,11 +157,11 @@ local function merge_includes(src)
157
157
  if includes[name] then return "" end
158
158
  includes[name] = true
159
159
  local fp = assert(io.open(LUA_SOURCE..name, "r"))
160
- local src = fp:read("*a")
160
+ local inc = fp:read("*a")
161
161
  assert(fp:close())
162
- src = gsub(src, "#ifndef%s+%w+_h\n#define%s+%w+_h\n", "")
163
- src = gsub(src, "#endif%s*$", "")
164
- return merge_includes(src)
162
+ inc = gsub(inc, "#ifndef%s+%w+_h\n#define%s+%w+_h\n", "")
163
+ inc = gsub(inc, "#endif%s*$", "")
164
+ return merge_includes(inc)
165
165
  end)
166
166
  end
167
167
 
@@ -300,6 +300,7 @@ local function strip_unused3(src)
300
300
  src = gsub(src, "if%([^\n]*hookmask[^\n]*&&\n[^\n]*%b{}\n", "")
301
301
  src = gsub(src, "(twoto%b()%()", "%1(size_t)")
302
302
  src = gsub(src, "i<sizenode", "i<(int)sizenode")
303
+ src = gsub(src, "cast%(unsigned int,key%-1%)", "cast(unsigned int,key)-1")
303
304
  return gsub(src, "\n\n+", "\n")
304
305
  end
305
306