From 0ea5821854e6150dfd1a9b1056654869069a057f Mon Sep 17 00:00:00 2001 From: Jer6y <3229960773@qq.com> Date: Tue, 2 Apr 2024 15:06:43 +0800 Subject: [PATCH] riscv: add luajit riscv support patch *add luajit riscv support patch Signed-off-by: luojun (cherry picked from commit 7afffb8e912cf8d58cdd28a88bc47b457a5c5bc6) --- luajit-riscv-makefile.patch | 12 + luajit-riscv.patch | 34768 ++++++++++++++++++++++++++++++++++ wrk.spec | 14 +- 3 files changed, 34792 insertions(+), 2 deletions(-) create mode 100644 luajit-riscv-makefile.patch create mode 100644 luajit-riscv.patch diff --git a/luajit-riscv-makefile.patch b/luajit-riscv-makefile.patch new file mode 100644 index 0000000..aa45161 --- /dev/null +++ b/luajit-riscv-makefile.patch @@ -0,0 +1,12 @@ +Index: wrk-4.2.0/Makefile +=================================================================== +--- wrk-4.2.0.orig/Makefile ++++ wrk-4.2.0/Makefile +@@ -87,7 +87,6 @@ $(ODIR)/$(OPENSSL): deps/$(OPENSSL).tar. + $(ODIR)/lib/libluajit-5.1.a: $(ODIR)/$(LUAJIT) + @echo Building LuaJIT... + @$(MAKE) -C $< PREFIX=$(abspath $(ODIR)) BUILDMODE=static install +- @cd $(ODIR)/bin && ln -s luajit-2.1.0-beta3 luajit + + $(ODIR)/lib/libssl.a: $(ODIR)/$(OPENSSL) + @echo Building OpenSSL... diff --git a/luajit-riscv.patch b/luajit-riscv.patch new file mode 100644 index 0000000..f4e4652 --- /dev/null +++ b/luajit-riscv.patch @@ -0,0 +1,34768 @@ +Index: wrk-4.2.0/obj/LuaJIT-2.1/.gitattributes +=================================================================== +--- /dev/null ++++ wrk-4.2.0/obj/LuaJIT-2.1/.gitattributes +@@ -0,0 +1 @@ ++/.relver export-subst +Index: wrk-4.2.0/obj/LuaJIT-2.1/.relver +=================================================================== +--- /dev/null ++++ wrk-4.2.0/obj/LuaJIT-2.1/.relver +@@ -0,0 +1 @@ ++$Format:%ct$ +Index: wrk-4.2.0/obj/LuaJIT-2.1/COPYRIGHT +=================================================================== +--- wrk-4.2.0.orig/obj/LuaJIT-2.1/COPYRIGHT ++++ wrk-4.2.0/obj/LuaJIT-2.1/COPYRIGHT +@@ -1,7 +1,7 @@ + =============================================================================== + LuaJIT -- a Just-In-Time Compiler for Lua. https://luajit.org/ + +-Copyright (C) 2005-2021 Mike Pall. All rights reserved. ++Copyright (C) 2005-2023 Mike Pall. All rights reserved. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal +Index: wrk-4.2.0/obj/LuaJIT-2.1/Makefile +=================================================================== +--- wrk-4.2.0.orig/obj/LuaJIT-2.1/Makefile ++++ wrk-4.2.0/obj/LuaJIT-2.1/Makefile +@@ -10,16 +10,21 @@ + # For MSVC, please follow the instructions given in src/msvcbuild.bat. + # For MinGW and Cygwin, cd to src and run make with the Makefile there. + # +-# Copyright (C) 2005-2021 Mike Pall. See Copyright Notice in luajit.h ++# Copyright (C) 2005-2023 Mike Pall. See Copyright Notice in luajit.h + ############################################################################## + + MAJVER= 2 + MINVER= 1 +-RELVER= 0 +-PREREL= -beta3 +-VERSION= $(MAJVER).$(MINVER).$(RELVER)$(PREREL) + ABIVER= 5.1 + ++# LuaJIT uses rolling releases. The release version is based on the time of ++# the latest git commit. The 'git' command must be available during the build. ++RELVER= $(shell cat src/luajit_relver.txt 2>/dev/null || : ) ++# Note: setting it with := doesn't work, since it will change during the build. ++ ++MMVERSION= $(MAJVER).$(MINVER) ++VERSION= $(MMVERSION).$(RELVER) ++ + ############################################################################## + # + # Change the installation path as needed. This automatically adjusts +@@ -33,9 +38,10 @@ DPREFIX= $(DESTDIR)$(PREFIX) + INSTALL_BIN= $(DPREFIX)/bin + INSTALL_LIB= $(DPREFIX)/$(MULTILIB) + INSTALL_SHARE= $(DPREFIX)/share +-INSTALL_INC= $(DPREFIX)/include/luajit-$(MAJVER).$(MINVER) ++INSTALL_DEFINC= $(DPREFIX)/include/luajit-$(MMVERSION) ++INSTALL_INC= $(INSTALL_DEFINC) + +-INSTALL_LJLIBD= $(INSTALL_SHARE)/luajit-$(VERSION) ++INSTALL_LJLIBD= $(INSTALL_SHARE)/luajit-$(MMVERSION) + INSTALL_JITLIB= $(INSTALL_LJLIBD)/jit + INSTALL_LMODD= $(INSTALL_SHARE)/lua + INSTALL_LMOD= $(INSTALL_LMODD)/$(ABIVER) +@@ -49,10 +55,10 @@ INSTALL_TSYMNAME= luajit + INSTALL_ANAME= libluajit-$(ABIVER).a + INSTALL_SOSHORT1= libluajit-$(ABIVER).so + INSTALL_SOSHORT2= libluajit-$(ABIVER).so.$(MAJVER) +-INSTALL_SONAME= $(INSTALL_SOSHORT2).$(MINVER).$(RELVER) ++INSTALL_SONAME= libluajit-$(ABIVER).so.$(VERSION) + INSTALL_DYLIBSHORT1= libluajit-$(ABIVER).dylib + INSTALL_DYLIBSHORT2= libluajit-$(ABIVER).$(MAJVER).dylib +-INSTALL_DYLIBNAME= libluajit-$(ABIVER).$(MAJVER).$(MINVER).$(RELVER).dylib ++INSTALL_DYLIBNAME= libluajit-$(ABIVER).$(VERSION).dylib + INSTALL_PCNAME= luajit.pc + + INSTALL_STATIC= $(INSTALL_LIB)/$(INSTALL_ANAME) +@@ -77,7 +83,11 @@ INSTALL_F= install -m 0644 + UNINSTALL= $(RM) + LDCONFIG= ldconfig -n 2>/dev/null + SED_PC= sed -e "s|^prefix=.*|prefix=$(PREFIX)|" \ +- -e "s|^multilib=.*|multilib=$(MULTILIB)|" ++ -e "s|^multilib=.*|multilib=$(MULTILIB)|" \ ++ -e "s|^relver=.*|relver=$(RELVER)|" ++ifneq ($(INSTALL_DEFINC),$(INSTALL_INC)) ++ SED_PC+= -e "s|^includedir=.*|includedir=$(INSTALL_INC)|" ++endif + + FILE_T= luajit + FILE_A= libluajit.a +@@ -88,7 +98,10 @@ FILES_INC= lua.h lualib.h lauxlib.h luac + FILES_JITLIB= bc.lua bcsave.lua dump.lua p.lua v.lua zone.lua \ + dis_x86.lua dis_x64.lua dis_arm.lua dis_arm64.lua \ + dis_arm64be.lua dis_ppc.lua dis_mips.lua dis_mipsel.lua \ +- dis_mips64.lua dis_mips64el.lua vmdef.lua ++ dis_mips64.lua dis_mips64el.lua \ ++ dis_mips64r6.lua dis_mips64r6el.lua \ ++ dis_riscv.lua dis_riscv64.lua \ ++ vmdef.lua + + ifeq (,$(findstring Windows,$(OS))) + HOST_SYS:= $(shell uname -s) +@@ -109,9 +122,9 @@ endif + INSTALL_DEP= src/luajit + + default all $(INSTALL_DEP): +- @echo "==== Building LuaJIT $(VERSION) ====" ++ @echo "==== Building LuaJIT $(MMVERSION) ====" + $(MAKE) -C src +- @echo "==== Successfully built LuaJIT $(VERSION) ====" ++ @echo "==== Successfully built LuaJIT $(MMVERSION) ====" + + install: $(INSTALL_DEP) + @echo "==== Installing LuaJIT $(VERSION) to $(PREFIX) ====" +@@ -130,18 +143,12 @@ install: $(INSTALL_DEP) + $(RM) $(FILE_PC).tmp + cd src && $(INSTALL_F) $(FILES_INC) $(INSTALL_INC) + cd src/jit && $(INSTALL_F) $(FILES_JITLIB) $(INSTALL_JITLIB) ++ $(SYMLINK) $(INSTALL_TNAME) $(INSTALL_TSYM) + @echo "==== Successfully installed LuaJIT $(VERSION) to $(PREFIX) ====" +- @echo "" +- @echo "Note: the development releases deliberately do NOT install a symlink for luajit" +- @echo "You can do this now by running this command (with sudo):" +- @echo "" +- @echo " $(SYMLINK) $(INSTALL_TNAME) $(INSTALL_TSYM)" +- @echo "" +- + + uninstall: + @echo "==== Uninstalling LuaJIT $(VERSION) from $(PREFIX) ====" +- $(UNINSTALL) $(INSTALL_T) $(INSTALL_STATIC) $(INSTALL_DYN) $(INSTALL_SHORT1) $(INSTALL_SHORT2) $(INSTALL_MAN)/$(FILE_MAN) $(INSTALL_PC) ++ $(UNINSTALL) $(INSTALL_TSYM) $(INSTALL_T) $(INSTALL_STATIC) $(INSTALL_DYN) $(INSTALL_SHORT1) $(INSTALL_SHORT2) $(INSTALL_MAN)/$(FILE_MAN) $(INSTALL_PC) + for file in $(FILES_JITLIB); do \ + $(UNINSTALL) $(INSTALL_JITLIB)/$$file; \ + done +@@ -155,8 +162,9 @@ uninstall: + ############################################################################## + + amalg: +- @echo "Building LuaJIT $(VERSION)" ++ @echo "==== Building LuaJIT $(MMVERSION) (amalgamation) ====" + $(MAKE) -C src amalg ++ @echo "==== Successfully built LuaJIT $(MMVERSION) (amalgamation) ====" + + clean: + $(MAKE) -C src clean +Index: wrk-4.2.0/obj/LuaJIT-2.1/README +=================================================================== +--- wrk-4.2.0.orig/obj/LuaJIT-2.1/README ++++ wrk-4.2.0/obj/LuaJIT-2.1/README +@@ -1,11 +1,11 @@ +-README for LuaJIT 2.1.0-beta3 +------------------------------ ++README for LuaJIT 2.1 ++--------------------- + + LuaJIT is a Just-In-Time (JIT) compiler for the Lua programming language. + + Project Homepage: https://luajit.org/ + +-LuaJIT is Copyright (C) 2005-2021 Mike Pall. ++LuaJIT is Copyright (C) 2005-2023 Mike Pall. + LuaJIT is free software, released under the MIT license. + See full Copyright Notice in the COPYRIGHT file or in luajit.h. + +Index: wrk-4.2.0/obj/LuaJIT-2.1/README.md +=================================================================== +--- /dev/null ++++ wrk-4.2.0/obj/LuaJIT-2.1/README.md +@@ -0,0 +1,31 @@ ++# LJRV - LuaJIT RISC-V 64 Port ++ ++LuaJIT is a Just-In-Time (JIT) compiler for the Lua programming language, ++RISC-V is a free and open ISA enabling a new era of processor innovation. ++ ++## Introduction ++ ++LJRV is a ongoing porting project of LuaJIT to the RISC-V 64-bit architecture by PLCT Lab, ISCAS. ++The ultimate goal is to provide a RISC-V 64 LuaJIT implementation and have it upstreamed to the official LuaJIT repository. ++ ++## Progress ++ ++- [x] Interpreter Runtime ++- [x] JIT Compiler ++ ++LJRV is still of beta quality, particularly the JIT compiler. ++For production usage, we suggests disable the JIT compiler during compilation by setting `XCFLAGS+= -DLUAJIT_DISABLE_JIT` in Makefile or environment variable. ++ ++## Bug Report ++ ++Please report bugs to [Issues](https://github.com/ruyisdk/LuaJIT/issues). ++ ++## Copyright ++ ++LuaJIT is Copyright (C) 2005-2023 Mike Pall. ++LuaJIT is free software, released under the MIT license. ++See full Copyright Notice in the COPYRIGHT file or in luajit.h. ++ ++LJRV is Copyright (C) 2022-2023 PLCT Lab, ISCAS. Contributed by gns. ++LJRV is free software, released under the MIT license. ++LJRV is part of RuyiSDK. +Index: wrk-4.2.0/obj/LuaJIT-2.1/doc/bluequad-print.css +=================================================================== +--- wrk-4.2.0.orig/obj/LuaJIT-2.1/doc/bluequad-print.css ++++ wrk-4.2.0/obj/LuaJIT-2.1/doc/bluequad-print.css +@@ -1,4 +1,4 @@ +-/* Copyright (C) 2004-2021 Mike Pall. ++/* Copyright (C) 2004-2023 Mike Pall. + * + * You are welcome to use the general ideas of this design for your own sites. + * But please do not steal the stylesheet, the layout or the color scheme. +Index: wrk-4.2.0/obj/LuaJIT-2.1/doc/bluequad.css +=================================================================== +--- wrk-4.2.0.orig/obj/LuaJIT-2.1/doc/bluequad.css ++++ wrk-4.2.0/obj/LuaJIT-2.1/doc/bluequad.css +@@ -1,4 +1,4 @@ +-/* Copyright (C) 2004-2021 Mike Pall. ++/* Copyright (C) 2004-2023 Mike Pall. + * + * You are welcome to use the general ideas of this design for your own sites. + * But please do not steal the stylesheet, the layout or the color scheme. +@@ -206,11 +206,9 @@ img.right { + .ext { + color: #ff8000; + } +-.new { +- font-size: 6pt; +- vertical-align: middle; +- background: #ff8000; +- color: #ffffff; ++.note { ++ padding: 0.5em 1em; ++ border-left: 3px solid #bfcfff; + } + #site { + clear: both; +Index: wrk-4.2.0/obj/LuaJIT-2.1/doc/contact.html +=================================================================== +--- wrk-4.2.0.orig/obj/LuaJIT-2.1/doc/contact.html ++++ wrk-4.2.0/obj/LuaJIT-2.1/doc/contact.html +@@ -1,9 +1,9 @@ +- ++ + + + Contact +- +- ++ ++ + + + +@@ -37,6 +37,8 @@ + FFI Semantics + +
  • ++String Buffers ++
  • + jit.* Library +
  • + Lua/C API +@@ -44,11 +46,9 @@ + Profiler +
  • +
  • +-Status +-
  • +-FAQ ++Status » +
  • +-Wiki » ++FAQ » +
  • + Mailing List » +
  • +@@ -84,10 +84,17 @@ xD("fyZKB8xv\"FJytmz8.KAB0u52D") +

    + + ++

    ++Note: I cannot reply to GMail, Google Workplace, Outlook or Office365 ++mail addresses, since they prefer to mindlessly filter out mails sent ++from small domains using independent mail servers, such as mine. If you ++don't like that, please complain to Google or Microsoft, not me. ++

    ++ +

    Copyright

    +

    + All documentation is +-Copyright © 2005-2021 Mike Pall. ++Copyright © 2005-2023 Mike Pall. +

    + + +@@ -95,7 +102,7 @@ Copyright © 2005-2021 Mike Pall. + + + + + + + + + +
    ++ +

    + LuaJIT is fully upwards-compatible with Lua 5.1. It supports all + » standard Lua +@@ -86,7 +87,7 @@ or LuaJIT. +

    +

    + LuaJIT extends the standard Lua VM with new functionality and adds +-several extension modules. Please note this page is only about ++several extension modules. Please note, this page is only about + functional enhancements and not about performance enhancements, + such as the optimized VM, the faster interpreter or the JIT compiler. +

    +@@ -195,7 +196,7 @@ usage. See also the +

    +

    + The generated bytecode is portable and can be loaded on any architecture +-that LuaJIT supports, independent of word size or endianess. However the ++that LuaJIT supports, independent of word size or endianess. However, the + bytecode compatibility versions must match. Bytecode stays compatible + for dot releases (x.y.0 → x.y.1), but may change with major or + minor releases (2.0 → 2.1) or between any beta release. Foreign +@@ -227,7 +228,7 @@ avoids managing backlinks, saves an allo + incremental array/hash part growth. +

    +

    +-Please note this function is meant for very specific situations. In most ++Please note, this function is meant for very specific situations. In most + cases it's better to replace the (usually single) link with a new table + and let the GC do its work. +

    +@@ -237,7 +238,7 @@ and let the GC do its work. + LuaJIT uses a Tausworthe PRNG with period 2^223 to implement + math.random() and math.randomseed(). The quality of + the PRNG results is much superior compared to the standard Lua +-implementation which uses the platform-specific ANSI rand(). ++implementation, which uses the platform-specific ANSI rand(). +

    +

    + The PRNG generates the same sequences from the same seeds on all +@@ -255,7 +256,7 @@ Important: Neither this nor any other PR +

    io.* functions handle 64 bit file offsets

    +

    + The file I/O functions in the standard io.* library handle +-64 bit file offsets. In particular this means it's possible ++64 bit file offsets. In particular, this means it's possible + to open files larger than 2 Gigabytes and to reposition or obtain + the current file position for offsets beyond 2 GB + (fp:seek() method). +@@ -392,29 +393,19 @@ the toolchain used to compile LuaJIT: + Interoperability + + +-POSIX/x64, DWARF2 unwinding +-GCC 4.3+, Clang ++External frame unwinding ++GCC, Clang, MSVC + Full + + +-ARM -DLUAJIT_UNWIND_EXTERNAL +-GCC, Clang +-Full +- +- +-Other platforms, DWARF2 unwinding ++Internal frame unwinding + DWARF2 + GCC, Clang + Limited + +- +-Windows/x64 +-MSVC +-Full +- + +-Windows/x86 +-Any +-Full ++Windows 64 bit ++non-MSVC ++Limited + + + Other platforms +@@ -470,7 +461,7 @@ C++ destructors. +

    + +
    +

    +-LuaJIT is only distributed as a source package. This page explains +-how to build and install LuaJIT with different operating systems +-and C compilers. ++LuaJIT is only distributed as source code — get it from the ++» git repository. This page explains how to build ++and install the LuaJIT binary and library for different operating systems. +

    +

    + For the impatient (on POSIX systems): +@@ -93,62 +88,24 @@ For the impatient (on POSIX systems): +

    + make && sudo make install
    + 
    ++ ++

    Requirements

    +

    +-LuaJIT currently builds out-of-the box on most systems. +-Here's the compatibility matrix for the supported combinations of +-operating systems, CPUs and compilers: ++LuaJIT currently builds out-of-the box on most systems. Please check the ++supported operating systems and CPU architectures on the ++» status page. ++

    ++

    ++Building LuaJIT requires a recent toolchain based on GCC, Clang/LLVM or ++MSVC++. ++

    ++

    ++The Makefile-based build system requires GNU Make and supports ++cross-builds. ++

    ++

    ++Batch files are provided for MSVC++ builds and console cross-builds. +

    +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +-
    CPU / OSLinux or
    Android
    *BSD, OthermacOS 10.4+ or
    iOS 3.0+
    Windows 7
    or later
    x86 (32 bit)GCC 4.2+GCC 4.2+XCode 5.0+
    Clang
    MSVC
    MinGW, Cygwin
    x64 (64 bit)GCC 4.2+GCC 4.2+
    ORBIS (PS4)
    XCode 5.0+
    Clang
    MSVC
    Durango (Xbox One)
    ARMv5+
    ARM9E+
    GCC 4.2+GCC 4.2+
    PSP2 (PS VITA)
    XCode 5.0+
    Clang
     
    ARM64
    ARM64be
    GCC 4.8+ XCode 6.0+
    Clang 3.5+
     
    PPCGCC 4.3+GCC 4.3+
    GCC 4.1 (PS3)
     XEDK (Xbox 360)
    MIPS32
    MIPS64
    MIPS64r6
    GCC 4.3+GCC 4.3+  
    + +

    Configuring LuaJIT

    +

    +@@ -157,7 +114,6 @@ Usually there is no need to tweak the se + hold all user-configurable settings: +

    +
      +-
    • src/luaconf.h sets some configuration variables.
    • +
    • Makefile has settings for installing LuaJIT (POSIX + only).
    • +
    • src/Makefile has settings for compiling LuaJIT +@@ -180,20 +136,12 @@ Please check the note about the +

      POSIX Systems (Linux, macOS, *BSD etc.)

      +

      Prerequisites

      +

      +-Depending on your distribution, you may need to install a package for +-GCC, the development headers and/or a complete SDK. E.g. on a current +-Debian/Ubuntu, install libc6-dev with the package manager. ++Depending on your distribution, you may need to install a package for a ++compiler (GCC or Clang/LLVM), the development headers and/or a complete SDK. ++E.g. on a current Debian/Ubuntu, install build-essential with the ++package manager. +

      +-

      +-The recommended way to fetch the latest version is to do a pull from +-the git repository. Alternatively download the latest source package of +-LuaJIT (pick the .tar.gz). Move it to a directory of your choice, +-open a terminal window and change to this directory. Now unpack the archive +-and change to the newly created directory: +-

      +-
      +-tar zxf LuaJIT-2.1.0-beta3.tar.gz
      +-cd LuaJIT-2.1.0-beta3
      ++ +

      Building LuaJIT

      +

      + The supplied Makefiles try to auto-detect the settings needed for your +@@ -253,15 +201,10 @@ Either install one of the open source SD + GCC plus the required development headers. + Or install Microsoft's Visual Studio (MSVC). +

      +-

      +-Next, pull from the git repository or download the source package and +-unpack it using an archive manager (e.g. the Windows Explorer) to +-a directory of your choice. +-

      +

      Building with MSVC

      +

      +-Open a "Visual Studio Command Prompt" (either x86 or x64), cd to the +-directory where you've unpacked the sources and run these commands: ++Open a "Visual Studio Command Prompt" (x86, x64 or ARM64), cd to the ++directory with the source code and run these commands: +

      +
      + cd src
      +@@ -271,11 +214,14 @@ msvcbuild
      + Check the msvcbuild.bat file for more options.
      + Then follow the installation instructions below.
      + 

      ++

      ++For an x64 to ARM64 cross-build run this first: vcvarsall.bat x64_arm64 ++

      +

      Building with MinGW or Cygwin

      +

      + Open a command prompt window and make sure the MinGW or Cygwin programs +-are in your path. Then cd to the directory of the git repository +-or where you've unpacked the sources. Then run this command for MinGW: ++are in your path. Then cd to the directory of the git repository. ++Then run this command for MinGW: +

      +
      + mingw32-make
      +@@ -377,15 +323,15 @@ make HOST_CC="gcc -m32" CROSS=arm-linux-
      + make HOST_CC="gcc -m32" CROSS=arm-linux-gnueabihf-
      + 
      + # ARM64
      +-make CROSS=aarch64-linux-
      ++make CROSS=aarch64-linux-gnu-
      + 
      + # PPC
      + make HOST_CC="gcc -m32" CROSS=powerpc-linux-gnu-
      + 
      + # MIPS32 big-endian
      +-make HOST_CC="gcc -m32" CROSS=mips-linux-
      ++make HOST_CC="gcc -m32" CROSS=mips-linux-gnu-
      + # MIPS32 little-endian
      +-make HOST_CC="gcc -m32" CROSS=mipsel-linux-
      ++make HOST_CC="gcc -m32" CROSS=mipsel-linux-gnu-
      + 
      + # MIPS64 big-endian
      + make CROSS=mips-linux- TARGET_CFLAGS="-mips64r2 -mabi=64"
      +@@ -405,7 +351,8 @@ NDKCROSS=$NDKBIN/aarch64-linux-android-
      + NDKCC=$NDKBIN/aarch64-linux-android21-clang
      + make CROSS=$NDKCROSS \
      +      STATIC_CC=$NDKCC DYNAMIC_CC="$NDKCC -fPIC" \
      +-     TARGET_LD=$NDKCC
      ++     TARGET_LD=$NDKCC TARGET_AR="$NDKBIN/llvm-ar rcus" \
      ++     TARGET_STRIP=$NDKBIN/llvm-strip
      + 
      + # Android/ARM, armeabi-v7a (ARMv7 VFP), Android 4.1+ (JB)
      + NDKDIR=/opt/android/ndk
      +@@ -414,7 +361,8 @@ NDKCROSS=$NDKBIN/arm-linux-androideabi-
      + NDKCC=$NDKBIN/armv7a-linux-androideabi16-clang
      + make HOST_CC="gcc -m32" CROSS=$NDKCROSS \
      +      STATIC_CC=$NDKCC DYNAMIC_CC="$NDKCC -fPIC" \
      +-     TARGET_LD=$NDKCC
      ++     TARGET_LD=$NDKCC TARGET_AR="$NDKBIN/llvm-ar rcus" \
      ++     TARGET_STRIP=$NDKBIN/llvm-strip
      + 
      +

      + You can cross-compile for iOS 3.0+ (iPhone/iPad) using the » iOS SDK: +@@ -438,8 +386,7 @@ make DEFAULT_CC=clang CROSS="$(dirname $ +

      Cross-compiling for consoles

      +

      + Building LuaJIT for consoles requires both a supported host compiler +-(x86 or x64) and a cross-compiler (to PPC or ARM) from the official +-console SDK. ++(x86 or x64) and a cross-compiler from the official console SDK. +

      +

      + Due to restrictions on consoles, the JIT compiler is disabled and only +@@ -460,45 +407,58 @@ To cross-compile for PS3 + make HOST_CC="gcc -m32" CROSS=ppu-lv2- +

      +

      +-To cross-compile for PS4 from a Windows host, +-open a "Visual Studio .NET Command Prompt" (64 bit host compiler), +-cd to the directory where you've unpacked the sources and +-run the following commands: ++To cross-compile for the other consoles from a Windows host, open a ++"Native Tools Command Prompt for VS". You need to choose either the 32 ++or the 64 bit version of the host compiler to match the target. ++Then cd to the src directory below the source code ++and run the build command given in the table: +

      +-
      +-cd src
      +-ps4build
      +-
      +-

      +-To cross-compile for PS Vita from a Windows host, +-open a "Visual Studio .NET Command Prompt" (32 bit host compiler), +-cd to the directory where you've unpacked the sources and +-run the following commands: +-

      +-
      +-cd src
      +-psvitabuild
      +-
      +-

      +-To cross-compile for Xbox 360 from a Windows host, +-open a "Visual Studio .NET Command Prompt" (32 bit host compiler), +-cd to the directory where you've unpacked the sources and run +-the following commands: +-

      +-
      +-cd src
      +-xedkbuild
      +-
      ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++
      ConsoleBitsBuild Command
      PS464ps4build
      PS564ps5build
      PS Vita32psvitabuild
      Xbox 36032xedkbuild
      Xbox One64xb1build
      Nintendo Switch NX3232nxbuild
      Nintendo Switch NX6464nxbuild
      +

      +-To cross-compile for Xbox One from a Windows host, +-open a "Visual Studio .NET Command Prompt" (64 bit host compiler), +-cd to the directory where you've unpacked the sources and run +-the following commands: ++Please check out the comments in the corresponding *.bat ++file for more options. +

      +-
      +-cd src
      +-xb1build
      +-
      + +

      Embedding LuaJIT

      +

      +@@ -540,7 +500,7 @@ allocator from your system (no support f + of calling luaopen_base etc. directly.

    • +
    • To change or extend the list of standard libraries to load, copy + src/lib_init.c to your project and modify it accordingly. +-Make sure the jit library is loaded or the JIT compiler ++Make sure the jit library is loaded, or the JIT compiler + will not be activated.
    • +
    • The bit.* module for bitwise operations + is already built-in. There's no need to statically link +@@ -559,7 +519,7 @@ in unspeakable ways. + There should be absolutely no need to patch luaconf.h or any + of the Makefiles. And please do not hand-pick files for your packages — + simply use whatever make install creates. There's a reason +-for all of the files and directories it creates. ++for all the files and directories it creates. +

      +

      + The build system uses GNU make and auto-detects most settings based on +@@ -611,7 +571,7 @@ to me (the upstream) and not you (the pa +

    + + +
    ++ +

    + LuaJIT has only a single stand-alone executable, called luajit on + POSIX systems or luajit.exe on Windows. It can be used to run simple +@@ -109,6 +110,7 @@ are accepted: +

  • -t type — Set output file type (default: auto-detect from output name).
  • +
  • -a arch — Override architecture for object files (default: native).
  • +
  • -o os — Override OS for object files (default: native).
  • ++
  • -F name — Override filename (default: input filename).
  • +
  • -e chunk — Use chunk string as input.
  • +
  • - (a single minus sign) — Use stdin as input and/or stdout as output.
  • + +@@ -118,7 +120,8 @@ file name: +

    +
      +
    • c — C source file, exported bytecode data.
    • +-
    • h — C header file, static bytecode data.
    • ++
    • cc — C++ source file, exported bytecode data.
    • ++
    • h — C/C++ header file, static bytecode data.
    • +
    • obj or o — Object file, exported bytecode data + (OS- and architecture-specific).
    • +
    • raw or any other extension — Raw bytecode file (portable). +@@ -182,9 +185,9 @@ written in Lua. They are mainly used for + itself. For a description of their options and output format, please + read the comment block at the start of their source. + They can be found in the lib directory of the source +-distribution or installed under the jit directory. By default +-this is /usr/local/share/luajit-2.1.0-beta3/jit on POSIX +-systems. ++distribution or installed under the jit directory. By default, ++this is /usr/local/share/luajit-XX.YY.ZZ>/jit on POSIX ++systems (replace XX.YY.ZZ by the installed version). +

      + +

      -O[level]
      +@@ -214,11 +217,17 @@ to a specific value. + You can either use this option multiple times (like -Ocse + -O-dce -Ohotloop=10) or separate several settings with a comma + (like -O+cse,-dce,hotloop=10). The settings are applied from +-left to right and later settings override earlier ones. You can freely ++left to right, and later settings override earlier ones. You can freely + mix the three forms, but note that setting an optimization level + overrides all earlier flags. +

      +

      ++Note that -Ofma is not enabled by default at any level, ++because it affects floating-point result accuracy. Only enable this, ++if you fully understand the trade-offs of FMA for performance (higher), ++determinism (lower) and numerical accuracy (higher). ++

      ++

      + Here are the available flags and at what optimization levels they + are enabled: +

      +@@ -250,6 +259,8 @@ are enabled: + sink  •Allocation/Store Sinking + + fuse  •Fusion of operands into instructions ++ ++fma    Fused multiply-add + +

      + Here are the parameters and their default settings: +@@ -293,7 +304,7 @@ Here are the parameters and their defaul +

    +