immunio 1.2.1 → 2.0.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 (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
@@ -4,7 +4,7 @@
4
4
  <title>Lua/C API Extensions</title>
5
5
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6
6
  <meta name="Author" content="Mike Pall">
7
- <meta name="Copyright" content="Copyright (C) 2005-2016, Mike Pall">
7
+ <meta name="Copyright" content="Copyright (C) 2005-2017, Mike Pall">
8
8
  <meta name="Language" content="en">
9
9
  <link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
10
10
  <link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
@@ -179,7 +179,7 @@ Also note that this mechanism is not without overhead.
179
179
  </div>
180
180
  <div id="foot">
181
181
  <hr class="hide">
182
- Copyright &copy; 2005-2016 Mike Pall
182
+ Copyright &copy; 2005-2017 Mike Pall
183
183
  <span class="noprint">
184
184
  &middot;
185
185
  <a href="contact.html">Contact</a>
@@ -4,7 +4,7 @@
4
4
  <title>FFI Library</title>
5
5
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6
6
  <meta name="Author" content="Mike Pall">
7
- <meta name="Copyright" content="Copyright (C) 2005-2016, Mike Pall">
7
+ <meta name="Copyright" content="Copyright (C) 2005-2017, Mike Pall">
8
8
  <meta name="Language" content="en">
9
9
  <link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
10
10
  <link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
@@ -322,7 +322,7 @@ without undue conversion penalties.
322
322
  </div>
323
323
  <div id="foot">
324
324
  <hr class="hide">
325
- Copyright &copy; 2005-2016 Mike Pall
325
+ Copyright &copy; 2005-2017 Mike Pall
326
326
  <span class="noprint">
327
327
  &middot;
328
328
  <a href="contact.html">Contact</a>
@@ -4,7 +4,7 @@
4
4
  <title>ffi.* API Functions</title>
5
5
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6
6
  <meta name="Author" content="Mike Pall">
7
- <meta name="Copyright" content="Copyright (C) 2005-2016, Mike Pall">
7
+ <meta name="Copyright" content="Copyright (C) 2005-2017, Mike Pall">
8
8
  <meta name="Language" content="en">
9
9
  <link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
10
10
  <link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
@@ -560,7 +560,7 @@ named <tt>i</tt>.
560
560
  </div>
561
561
  <div id="foot">
562
562
  <hr class="hide">
563
- Copyright &copy; 2005-2016 Mike Pall
563
+ Copyright &copy; 2005-2017 Mike Pall
564
564
  <span class="noprint">
565
565
  &middot;
566
566
  <a href="contact.html">Contact</a>
@@ -4,7 +4,7 @@
4
4
  <title>FFI Semantics</title>
5
5
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6
6
  <meta name="Author" content="Mike Pall">
7
- <meta name="Copyright" content="Copyright (C) 2005-2016, Mike Pall">
7
+ <meta name="Copyright" content="Copyright (C) 2005-2017, Mike Pall">
8
8
  <meta name="Language" content="en">
9
9
  <link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
10
10
  <link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
@@ -1221,13 +1221,12 @@ The following operations are currently not compiled and may exhibit
1221
1221
  suboptimal performance, especially when used in inner loops:
1222
1222
  </p>
1223
1223
  <ul>
1224
- <li>Bitfield accesses and initializations.</li>
1225
1224
  <li>Vector operations.</li>
1226
1225
  <li>Table initializers.</li>
1227
1226
  <li>Initialization of nested <tt>struct</tt>/<tt>union</tt> types.</li>
1228
1227
  <li>Non-default initialization of VLA/VLS or large C&nbsp;types
1229
1228
  (&gt; 128&nbsp;bytes or &gt; 16 array elements.</li>
1230
- <li>Conversions from lightuserdata to <tt>void&nbsp;*</tt>.</li>
1229
+ <li>Bitfield initializations.</li>
1231
1230
  <li>Pointer differences for element sizes that are not a power of
1232
1231
  two.</li>
1233
1232
  <li>Calls to C&nbsp;functions with aggregates passed or returned by
@@ -1253,7 +1252,7 @@ compiled.</li>
1253
1252
  </div>
1254
1253
  <div id="foot">
1255
1254
  <hr class="hide">
1256
- Copyright &copy; 2005-2016 Mike Pall
1255
+ Copyright &copy; 2005-2017 Mike Pall
1257
1256
  <span class="noprint">
1258
1257
  &middot;
1259
1258
  <a href="contact.html">Contact</a>
@@ -4,7 +4,7 @@
4
4
  <title>FFI Tutorial</title>
5
5
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6
6
  <meta name="Author" content="Mike Pall">
7
- <meta name="Copyright" content="Copyright (C) 2005-2016, Mike Pall">
7
+ <meta name="Copyright" content="Copyright (C) 2005-2017, Mike Pall">
8
8
  <meta name="Language" content="en">
9
9
  <link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
10
10
  <link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
@@ -593,7 +593,7 @@ it to a local variable in the function scope is unnecessary.
593
593
  </div>
594
594
  <div id="foot">
595
595
  <hr class="hide">
596
- Copyright &copy; 2005-2016 Mike Pall
596
+ Copyright &copy; 2005-2017 Mike Pall
597
597
  <span class="noprint">
598
598
  &middot;
599
599
  <a href="contact.html">Contact</a>
@@ -4,7 +4,7 @@
4
4
  <title>jit.* Library</title>
5
5
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6
6
  <meta name="Author" content="Mike Pall">
7
- <meta name="Copyright" content="Copyright (C) 2005-2016, Mike Pall">
7
+ <meta name="Copyright" content="Copyright (C) 2005-2017, Mike Pall">
8
8
  <meta name="Language" content="en">
9
9
  <link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
10
10
  <link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
@@ -153,7 +153,7 @@ Contains the target OS name:
153
153
  <h3 id="jit_arch"><tt>jit.arch</tt></h3>
154
154
  <p>
155
155
  Contains the target architecture name:
156
- "x86", "x64", "arm", "ppc", or "mips".
156
+ "x86", "x64", "arm", "arm64", "ppc", "mips" or "mips64".
157
157
  </p>
158
158
 
159
159
  <h2 id="jit_opt"><tt>jit.opt.*</tt> &mdash; JIT compiler optimization control</h2>
@@ -191,7 +191,7 @@ if you want to know more.
191
191
  </div>
192
192
  <div id="foot">
193
193
  <hr class="hide">
194
- Copyright &copy; 2005-2016 Mike Pall
194
+ Copyright &copy; 2005-2017 Mike Pall
195
195
  <span class="noprint">
196
196
  &middot;
197
197
  <a href="contact.html">Contact</a>
@@ -4,7 +4,7 @@
4
4
  <title>Profiler</title>
5
5
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6
6
  <meta name="Author" content="Mike Pall">
7
- <meta name="Copyright" content="Copyright (C) 2005-2016, Mike Pall">
7
+ <meta name="Copyright" content="Copyright (C) 2005-2017, Mike Pall">
8
8
  <meta name="Language" content="en">
9
9
  <link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
10
10
  <link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
@@ -355,7 +355,7 @@ use.
355
355
  </div>
356
356
  <div id="foot">
357
357
  <hr class="hide">
358
- Copyright &copy; 2005-2016 Mike Pall
358
+ Copyright &copy; 2005-2017 Mike Pall
359
359
  <span class="noprint">
360
360
  &middot;
361
361
  <a href="contact.html">Contact</a>
@@ -4,7 +4,7 @@
4
4
  <title>Extensions</title>
5
5
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6
6
  <meta name="Author" content="Mike Pall">
7
- <meta name="Copyright" content="Copyright (C) 2005-2016, Mike Pall">
7
+ <meta name="Copyright" content="Copyright (C) 2005-2017, Mike Pall">
8
8
  <meta name="Language" content="en">
9
9
  <link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
10
10
  <link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
@@ -210,7 +210,8 @@ bytecode (e.g. from Lua 5.1) is incompatible and cannot be loaded.
210
210
  <p>
211
211
  Note: <tt>LJ_GC64</tt> mode requires a different frame layout, which implies
212
212
  a different, incompatible bytecode format for ports that use this mode (e.g.
213
- ARM64). This may be rectified in the future.
213
+ ARM64 or MIPS64) or when explicitly enabled for x64. This may be rectified
214
+ in the future.
214
215
  </p>
215
216
 
216
217
  <h3 id="table_new"><tt>table.new(narray, nhash)</tt> allocates a pre-sized table</h3>
@@ -291,8 +292,8 @@ enabled:
291
292
  <li><tt>load(string|reader [, chunkname [,mode [,env]]])</tt>.</li>
292
293
  <li><tt>loadstring()</tt> is an alias for <tt>load()</tt>.</li>
293
294
  <li><tt>loadfile(filename [,mode [,env]])</tt>.</li>
294
- <li><tt>math.log(x [,base])</tt>.
295
- <li><tt>string.rep(s, n [,sep])</tt>.
295
+ <li><tt>math.log(x [,base])</tt>.</li>
296
+ <li><tt>string.rep(s, n [,sep])</tt>.</li>
296
297
  <li><tt>string.format()</tt>: <tt>%q</tt> reversible.
297
298
  <tt>%s</tt> checks <tt>__tostring</tt>.
298
299
  <tt>%a</tt> and <tt>"%A</tt> added.</li>
@@ -311,6 +312,26 @@ indexes for varargs.</li>
311
312
  <li><tt>debug.getupvalue()</tt> and <tt>debug.setupvalue()</tt> handle
312
313
  C&nbsp;functions.</li>
313
314
  <li><tt>debug.upvalueid()</tt> and <tt>debug.upvaluejoin()</tt>.</li>
315
+ <li>Lua/C API extensions:
316
+ <tt>lua_version()</tt>
317
+ <tt>lua_upvalueid()</tt>
318
+ <tt>lua_upvaluejoin()</tt>
319
+ <tt>lua_loadx()</tt>
320
+ <tt>lua_copy()</tt>
321
+ <tt>lua_tonumberx()</tt>
322
+ <tt>lua_tointegerx()</tt>
323
+ <tt>luaL_fileresult()</tt>
324
+ <tt>luaL_execresult()</tt>
325
+ <tt>luaL_loadfilex()</tt>
326
+ <tt>luaL_loadbufferx()</tt>
327
+ <tt>luaL_traceback()</tt>
328
+ <tt>luaL_setfuncs()</tt>
329
+ <tt>luaL_pushmodule()</tt>
330
+ <tt>luaL_newlibtable()</tt>
331
+ <tt>luaL_newlib()</tt>
332
+ <tt>luaL_testudata()</tt>
333
+ <tt>luaL_setmetatable()</tt>
334
+ </li>
314
335
  <li>Command line option <tt>-E</tt>.</li>
315
336
  <li>Command line checks <tt>__tostring</tt> for errors.</li>
316
337
  </ul>
@@ -335,7 +356,9 @@ instead of <tt>true</tt>.</li>
335
356
  exit status.</li>
336
357
  <li><tt>debug.setmetatable()</tt> returns object.</li>
337
358
  <li><tt>debug.getuservalue()</tt> and <tt>debug.setuservalue()</tt>.</li>
338
- <li>Remove <tt>math.mod()</tt>, <tt>string.gfind()</tt>.
359
+ <li>Remove <tt>math.mod()</tt>, <tt>string.gfind()</tt>.</li>
360
+ <li><tt>package.searchers</tt>.</li>
361
+ <li><tt>module()</tt> returns the module table.</li>
339
362
  </ul>
340
363
  <p>
341
364
  Note: this provides only partial compatibility with Lua 5.2 at the
@@ -349,6 +372,13 @@ break the Lua/C API and ABI (e.g. <tt>_ENV</tt>).
349
372
  LuaJIT supports some extensions from Lua&nbsp;5.3:
350
373
  <ul>
351
374
  <li>Unicode escape <tt>'\u{XX...}'</tt> embeds the UTF-8 encoding in string literals.</li>
375
+ <li>The argument table <tt>arg</tt> can be read (and modified) by <tt>LUA_INIT</tt> and <tt>-e</tt> chunks.</li>
376
+ <li><tt>io.read()</tt> and <tt>file:read()</tt> accept formats with or without a leading <tt>*</tt>.</li>
377
+ <li><tt>table.move(a1, f, e, t [,a2])</tt>.</li>
378
+ <li><tt>coroutine.isyieldable()</tt>.</li>
379
+ <li>Lua/C API extensions:
380
+ <tt>lua_isyieldable()</tt>
381
+ </li>
352
382
  </ul>
353
383
 
354
384
  <h2 id="exceptions">C++ Exception Interoperability</h2>
@@ -365,25 +395,30 @@ the toolchain used to compile LuaJIT:
365
395
  </tr>
366
396
  <tr class="odd separate">
367
397
  <td class="excplatform">POSIX/x64, DWARF2 unwinding</td>
368
- <td class="exccompiler">GCC 4.3+</td>
398
+ <td class="exccompiler">GCC 4.3+, Clang</td>
369
399
  <td class="excinterop"><b style="color: #00a000;">Full</b></td>
370
400
  </tr>
371
401
  <tr class="even">
402
+ <td class="excplatform">ARM <tt>-DLUAJIT_UNWIND_EXTERNAL</tt></td>
403
+ <td class="exccompiler">GCC, Clang</td>
404
+ <td class="excinterop"><b style="color: #00a000;">Full</b></td>
405
+ </tr>
406
+ <tr class="odd">
372
407
  <td class="excplatform">Other platforms, DWARF2 unwinding</td>
373
- <td class="exccompiler">GCC</td>
408
+ <td class="exccompiler">GCC, Clang</td>
374
409
  <td class="excinterop"><b style="color: #c06000;">Limited</b></td>
375
410
  </tr>
376
- <tr class="odd">
411
+ <tr class="even">
377
412
  <td class="excplatform">Windows/x64</td>
378
413
  <td class="exccompiler">MSVC or WinSDK</td>
379
414
  <td class="excinterop"><b style="color: #00a000;">Full</b></td>
380
415
  </tr>
381
- <tr class="even">
416
+ <tr class="odd">
382
417
  <td class="excplatform">Windows/x86</td>
383
418
  <td class="exccompiler">Any</td>
384
- <td class="excinterop"><b style="color: #a00000;">No</b></td>
419
+ <td class="excinterop"><b style="color: #00a000;">Full</b></td>
385
420
  </tr>
386
- <tr class="odd">
421
+ <tr class="even">
387
422
  <td class="excplatform">Other platforms</td>
388
423
  <td class="exccompiler">Other compilers</td>
389
424
  <td class="excinterop"><b style="color: #a00000;">No</b></td>
@@ -432,20 +467,12 @@ C++ destructors.</li>
432
467
  <li>Lua errors <b>cannot</b> be caught on the C++ side.</li>
433
468
  <li>Throwing Lua errors across C++ frames will <b>not</b> call
434
469
  C++ destructors.</li>
435
- <li>Additionally, on Windows/x86 with SEH-based C++&nbsp;exceptions:
436
- it's <b>not</b> safe to throw a Lua error across any frames containing
437
- a C++ function with any try/catch construct or using variables with
438
- (implicit) destructors. This also applies to any functions which may be
439
- inlined in such a function. It doesn't matter whether <tt>lua_error()</tt>
440
- is called inside or outside of a try/catch or whether any object actually
441
- needs to be destroyed: the SEH chain is corrupted and this will eventually
442
- lead to the termination of the process.</li>
443
470
  </ul>
444
471
  <br class="flush">
445
472
  </div>
446
473
  <div id="foot">
447
474
  <hr class="hide">
448
- Copyright &copy; 2005-2016 Mike Pall
475
+ Copyright &copy; 2005-2017 Mike Pall
449
476
  <span class="noprint">
450
477
  &middot;
451
478
  <a href="contact.html">Contact</a>
@@ -4,7 +4,7 @@
4
4
  <title>Frequently Asked Questions (FAQ)</title>
5
5
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6
6
  <meta name="Author" content="Mike Pall">
7
- <meta name="Copyright" content="Copyright (C) 2005-2016, Mike Pall">
7
+ <meta name="Copyright" content="Copyright (C) 2005-2017, Mike Pall">
8
8
  <meta name="Language" content="en">
9
9
  <link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
10
10
  <link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
@@ -176,7 +176,7 @@ the development of certain features, if they are important to you.
176
176
  </div>
177
177
  <div id="foot">
178
178
  <hr class="hide">
179
- Copyright &copy; 2005-2016 Mike Pall
179
+ Copyright &copy; 2005-2017 Mike Pall
180
180
  <span class="noprint">
181
181
  &middot;
182
182
  <a href="contact.html">Contact</a>
@@ -4,7 +4,7 @@
4
4
  <title>Installation</title>
5
5
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6
6
  <meta name="Author" content="Mike Pall">
7
- <meta name="Copyright" content="Copyright (C) 2005-2016, Mike Pall">
7
+ <meta name="Copyright" content="Copyright (C) 2005-2017, Mike Pall">
8
8
  <meta name="Language" content="en">
9
9
  <link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
10
10
  <link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
@@ -122,7 +122,7 @@ operating systems, CPUs and compilers:
122
122
  <tr class="even">
123
123
  <td class="compatcpu">x64 (64 bit)</td>
124
124
  <td class="compatos">GCC 4.2+</td>
125
- <td class="compatos">ORBIS (<a href="#ps4">PS4</a>)</td>
125
+ <td class="compatos">GCC 4.2+<br>ORBIS (<a href="#ps4">PS4</a>)</td>
126
126
  <td class="compatos">XCode 5.0+<br>Clang</td>
127
127
  <td class="compatos">MSVC + SDK v7.0<br>WinSDK v7.0<br>Durango (<a href="#xboxone">Xbox One</a>)</td>
128
128
  </tr>
@@ -148,7 +148,7 @@ operating systems, CPUs and compilers:
148
148
  <td class="compatos">XEDK (<a href="#xbox360">Xbox 360</a>)</td>
149
149
  </tr>
150
150
  <tr class="even">
151
- <td class="compatcpu"><a href="#cross2">MIPS</a></td>
151
+ <td class="compatcpu"><a href="#cross2">MIPS32<br>MIPS64</a></td>
152
152
  <td class="compatos">GCC 4.3+</td>
153
153
  <td class="compatos">GCC 4.3+</td>
154
154
  <td class="compatos compatno">&nbsp;</td>
@@ -175,6 +175,14 @@ MSVC or WinSDK.</li>
175
175
  Please read the instructions given in these files, before changing
176
176
  any settings.
177
177
  </p>
178
+ <p>
179
+ LuaJIT on x64 currently uses 32 bit GC objects by default.
180
+ <tt>LJ_GC64</tt> mode may be explicitly enabled:
181
+ add <tt>XCFLAGS=-DLUAJIT_ENABLE_GC64</tt> to the make command or run
182
+ <tt>msvcbuild gc64</tt> for MSVC/WinSDK. Please check the note
183
+ about the <a href="extensions.html#string_dump">bytecode format</a>
184
+ differences, too.
185
+ </p>
178
186
 
179
187
  <h2 id="posix">POSIX Systems (Linux, OSX, *BSD etc.)</h2>
180
188
  <h3>Prerequisites</h3>
@@ -190,8 +198,8 @@ open a terminal window and change to this directory. Now unpack the archive
190
198
  and change to the newly created directory:
191
199
  </p>
192
200
  <pre class="code">
193
- tar zxf LuaJIT-2.0.4.tar.gz
194
- cd LuaJIT-2.0.4</pre>
201
+ tar zxf LuaJIT-2.0.5.tar.gz
202
+ cd LuaJIT-2.0.5</pre>
195
203
  <h3>Building LuaJIT</h3>
196
204
  <p>
197
205
  The supplied Makefiles try to auto-detect the settings needed for your
@@ -202,7 +210,7 @@ which is probably the default on your system, anyway. Simply run:
202
210
  make
203
211
  </pre>
204
212
  <p>
205
- This always builds a native x86, x64 or PPC binary, depending on the host OS
213
+ This always builds a native binary, depending on the host OS
206
214
  you're running this command on. Check the section on
207
215
  <a href="#cross">cross-compilation</a> for more options.
208
216
  </p>
@@ -333,22 +341,36 @@ directory where <tt>luajit.exe</tt> is installed
333
341
 
334
342
  <h2 id="cross">Cross-compiling LuaJIT</h2>
335
343
  <p>
344
+ First, let's clear up some terminology:
345
+ </p>
346
+ <ul>
347
+ <li>Host: This is your development system, usually based on a x64 or x86 CPU.</li>
348
+ <li>Target: This is the target system you want LuaJIT to run on, e.g. Android/ARM.</li>
349
+ <li>Toolchain: This comprises a C compiler, linker, assembler and a matching C library.</li>
350
+ <li>Host (or system) toolchain: This is the toolchain used to build native binaries for your host system.</li>
351
+ <li>Cross-compile toolchain: This is the toolchain used to build binaries for the target system. They can only be run on the target system.</li>
352
+ </ul>
353
+ <p>
336
354
  The GNU Makefile-based build system allows cross-compiling on any host
337
- for any supported target, as long as both architectures have the same
338
- pointer size. If you want to cross-compile to any 32 bit target on an
339
- x64 OS, you need to install the multilib development package (e.g.
340
- <tt>libc6-dev-i386</tt> on Debian/Ubuntu) and build a 32 bit host part
341
- (<tt>HOST_CC="gcc -m32"</tt>).
355
+ for any supported target:
342
356
  </p>
357
+ <ul>
358
+ <li>Yes, you need a toolchain for both your host <em>and</em> your target!</li>
359
+ <li>Both host and target architectures must have the same pointer size.</li>
360
+ <li>E.g. if you want to cross-compile to a 32 bit target on a 64 bit host, you need to install the multilib development package (e.g. <tt>libc6-dev-i386</tt> on Debian/Ubuntu) and build a 32 bit host part (<tt>HOST_CC="gcc -m32"</tt>).</li>
361
+ <li>64 bit targets always require compilation on a 64 bit host.</li>
362
+ </ul>
343
363
  <p>
344
364
  You need to specify <tt>TARGET_SYS</tt> whenever the host OS and the
345
- target OS differ, or you'll get assembler or linker errors. E.g. if
346
- you're compiling on a Windows or OSX host for embedded Linux or Android,
347
- you need to add <tt>TARGET_SYS=Linux</tt> to the examples below. For a
348
- minimal target OS, you may need to disable the built-in allocator in
349
- <tt>src/Makefile</tt> and use <tt>TARGET_SYS=Other</tt>. The examples
350
- below only show some popular targets &mdash; please check the comments
351
- in <tt>src/Makefile</tt> for more details.
365
+ target OS differ, or you'll get assembler or linker errors:
366
+ </p>
367
+ <ul>
368
+ <li>E.g. if you're compiling on a Windows or OSX host for embedded Linux or Android, you need to add <tt>TARGET_SYS=Linux</tt> to the examples below.</li>
369
+ <li>For a minimal target OS, you may need to disable the built-in allocator in <tt>src/Makefile</tt> and use <tt>TARGET_SYS=Other</tt>.</li>
370
+ <li>Don't forget to specify the same <tt>TARGET_SYS</tt> for the install step, too.</li>
371
+ </ul>
372
+ <p>
373
+ Here are some examples where host and target have the same CPU:
352
374
  </p>
353
375
  <pre class="code">
354
376
  # Cross-compile to a 32 bit binary on a multilib x64 OS
@@ -366,38 +388,47 @@ use the canonical toolchain triplets for Linux.
366
388
  </p>
367
389
  <p>
368
390
  Since there's often no easy way to detect CPU features at runtime, it's
369
- important to compile with the proper CPU or architecture settings. You
370
- can specify these when building the toolchain yourself. Or add
371
- <tt>-mcpu=...</tt> or <tt>-march=...</tt> to <tt>TARGET_CFLAGS</tt>. For
372
- ARM it's important to have the correct <tt>-mfloat-abi=...</tt> setting,
373
- too. Otherwise LuaJIT may not run at the full performance of your target
374
- CPU.
391
+ important to compile with the proper CPU or architecture settings:
392
+ </o>
393
+ <ul>
394
+ <li>The best way to get consistent results is to specify the correct settings when building the toolchain yourself.</li>
395
+ <li>For a pre-built, generic toolchain add <tt>-mcpu=...</tt> or <tt>-march=...</tt> and other necessary flags to <tt>TARGET_CFLAGS</tt>.</li>
396
+ <li>For ARM it's important to have the correct <tt>-mfloat-abi=...</tt> setting, too. Otherwise LuaJIT may not run at the full performance of your target CPU.</li>
397
+ <li>For MIPS it's important to select a supported ABI (o32 on MIPS32, n64 on MIPS64) and consistently compile your project either with hard-float or soft-float compiler settings.</li>
398
+ </ul>
399
+ <p>
400
+ Here are some examples for targets with a different CPU than the host:
375
401
  </p>
376
402
  <pre class="code">
377
403
  # ARM soft-float
378
404
  make HOST_CC="gcc -m32" CROSS=arm-linux-gnueabi- \
379
405
  TARGET_CFLAGS="-mfloat-abi=soft"
380
406
 
381
- # ARM soft-float ABI with VFP (example for Cortex-A8)
407
+ # ARM soft-float ABI with VFP (example for Cortex-A9)
382
408
  make HOST_CC="gcc -m32" CROSS=arm-linux-gnueabi- \
383
- TARGET_CFLAGS="-mcpu=cortex-a8 -mfloat-abi=softfp"
409
+ TARGET_CFLAGS="-mcpu=cortex-a9 -mfloat-abi=softfp"
384
410
 
385
- # ARM hard-float ABI with VFP (armhf, requires recent toolchain)
411
+ # ARM hard-float ABI with VFP (armhf, most modern toolchains)
386
412
  make HOST_CC="gcc -m32" CROSS=arm-linux-gnueabihf-
387
413
 
388
- # ARM64 (requires x64 host)
414
+ # ARM64
389
415
  make CROSS=aarch64-linux-
390
416
 
391
417
  # PPC
392
418
  make HOST_CC="gcc -m32" CROSS=powerpc-linux-gnu-
393
419
 
394
- # MIPS big-endian
420
+ # MIPS32 big-endian
395
421
  make HOST_CC="gcc -m32" CROSS=mips-linux-
396
- # MIPS little-endian
422
+ # MIPS32 little-endian
397
423
  make HOST_CC="gcc -m32" CROSS=mipsel-linux-
424
+
425
+ # MIPS64 big-endian
426
+ make CROSS=mips-linux- TARGET_CFLAGS="-mips64r2 -mabi=64"
427
+ # MIPS64 little-endian
428
+ make CROSS=mipsel-linux- TARGET_CFLAGS="-mips64r2 -mabi=64"
398
429
  </pre>
399
430
  <p>
400
- You can cross-compile for <b id="android">Android</b> using the <a href="http://developer.android.com/sdk/ndk/index.html"><span class="ext">&raquo;</span>&nbsp;Android NDK</a>.
431
+ You can cross-compile for <b id="android">Android</b> using the <a href="https://developer.android.com/ndk/index.html">Android NDK</a>.
401
432
  The environment variables need to match the install locations and the
402
433
  desired target platform. E.g. Android&nbsp;4.0 corresponds to ABI level&nbsp;14.
403
434
  For details check the folder <tt>docs</tt> in the NDK directory.
@@ -411,7 +442,7 @@ to build/deploy or which lowest common denominator you want to pick:
411
442
  # Android/ARM, armeabi (ARMv5TE soft-float), Android 2.2+ (Froyo)
412
443
  NDK=/opt/android/ndk
413
444
  NDKABI=8
414
- NDKVER=$NDK/toolchains/arm-linux-androideabi-4.6
445
+ NDKVER=$NDK/toolchains/arm-linux-androideabi-4.9
415
446
  NDKP=$NDKVER/prebuilt/linux-x86/bin/arm-linux-androideabi-
416
447
  NDKF="--sysroot $NDK/platforms/android-$NDKABI/arch-arm"
417
448
  make HOST_CC="gcc -m32" CROSS=$NDKP TARGET_FLAGS="$NDKF"
@@ -419,16 +450,16 @@ make HOST_CC="gcc -m32" CROSS=$NDKP TARGET_FLAGS="$NDKF"
419
450
  # Android/ARM, armeabi-v7a (ARMv7 VFP), Android 4.0+ (ICS)
420
451
  NDK=/opt/android/ndk
421
452
  NDKABI=14
422
- NDKVER=$NDK/toolchains/arm-linux-androideabi-4.6
453
+ NDKVER=$NDK/toolchains/arm-linux-androideabi-4.9
423
454
  NDKP=$NDKVER/prebuilt/linux-x86/bin/arm-linux-androideabi-
424
455
  NDKF="--sysroot $NDK/platforms/android-$NDKABI/arch-arm"
425
456
  NDKARCH="-march=armv7-a -mfloat-abi=softfp -Wl,--fix-cortex-a8"
426
457
  make HOST_CC="gcc -m32" CROSS=$NDKP TARGET_FLAGS="$NDKF $NDKARCH"
427
458
 
428
- # Android/MIPS, mips (MIPS32R1 hard-float), Android 4.0+ (ICS)
459
+ # Android/MIPS, mipsel (MIPS32R1 hard-float), Android 4.0+ (ICS)
429
460
  NDK=/opt/android/ndk
430
461
  NDKABI=14
431
- NDKVER=$NDK/toolchains/mipsel-linux-android-4.6
462
+ NDKVER=$NDK/toolchains/mipsel-linux-android-4.9
432
463
  NDKP=$NDKVER/prebuilt/linux-x86/bin/mipsel-linux-android-
433
464
  NDKF="--sysroot $NDK/platforms/android-$NDKABI/arch-mips"
434
465
  make HOST_CC="gcc -m32" CROSS=$NDKP TARGET_FLAGS="$NDKF"
@@ -436,7 +467,7 @@ make HOST_CC="gcc -m32" CROSS=$NDKP TARGET_FLAGS="$NDKF"
436
467
  # Android/x86, x86 (i686 SSE3), Android 4.0+ (ICS)
437
468
  NDK=/opt/android/ndk
438
469
  NDKABI=14
439
- NDKVER=$NDK/toolchains/x86-4.6
470
+ NDKVER=$NDK/toolchains/x86-4.9
440
471
  NDKP=$NDKVER/prebuilt/linux-x86/bin/i686-linux-android-
441
472
  NDKF="--sysroot $NDK/platforms/android-$NDKABI/arch-x86"
442
473
  make HOST_CC="gcc -m32" CROSS=$NDKP TARGET_FLAGS="$NDKF"
@@ -456,14 +487,15 @@ Or use Android. :-p
456
487
  ISDKP=$(xcrun --sdk iphoneos --show-sdk-path)
457
488
  ICC=$(xcrun --sdk iphoneos --find clang)
458
489
  ISDKF="-arch armv7 -isysroot $ISDKP"
459
- make HOST_CC="clang -m32 -arch i386" CROSS="$(dirname $ICC)/" \
460
- TARGET_FLAGS="$ISDKF" TARGET_SYS=iOS
490
+ make DEFAULT_CC=clang HOST_CC="clang -m32 -arch i386" \
491
+ CROSS="$(dirname $ICC)/" TARGET_FLAGS="$ISDKF" TARGET_SYS=iOS
461
492
 
462
493
  # iOS/ARM64
463
494
  ISDKP=$(xcrun --sdk iphoneos --show-sdk-path)
464
495
  ICC=$(xcrun --sdk iphoneos --find clang)
465
496
  ISDKF="-arch arm64 -isysroot $ISDKP"
466
- make CROSS="$(dirname $ICC)/" TARGET_FLAGS="$ISDKF" TARGET_SYS=iOS
497
+ make DEFAULT_CC=clang CROSS="$(dirname $ICC)/" \
498
+ TARGET_FLAGS="$ISDKF" TARGET_SYS=iOS
467
499
  </pre>
468
500
 
469
501
  <h3 id="consoles">Cross-compiling for consoles</h3>
@@ -560,14 +592,11 @@ intend to load Lua/C modules at runtime.
560
592
  </li>
561
593
  <li>
562
594
  If you're building a 64 bit application on OSX which links directly or
563
- indirectly against LuaJIT, you need to link your main executable
564
- with these flags:
595
+ indirectly against LuaJIT which is not built for <tt>LJ_GC64</tt> mode,
596
+ you need to link your main executable with these flags:
565
597
  <pre class="code">
566
598
  -pagezero_size 10000 -image_base 100000000
567
599
  </pre>
568
- Also, it's recommended to <tt>rebase</tt> all (self-compiled) shared libraries
569
- which are loaded at runtime on OSX/x64 (e.g. C extension modules for Lua).
570
- See: <tt>man rebase</tt>
571
600
  </li>
572
601
  </ul>
573
602
  <p>Additional hints for initializing LuaJIT using the C API functions:</p>
@@ -653,7 +682,7 @@ to me (the upstream) and not you (the package maintainer), anyway.
653
682
  </div>
654
683
  <div id="foot">
655
684
  <hr class="hide">
656
- Copyright &copy; 2005-2016 Mike Pall
685
+ Copyright &copy; 2005-2017 Mike Pall
657
686
  <span class="noprint">
658
687
  &middot;
659
688
  <a href="contact.html">Contact</a>