Skip to content

Instantly share code, notes, and snippets.

@markuman
Created March 1, 2016 14:54
Show Gist options
  • Save markuman/752854e7eb2528aba044 to your computer and use it in GitHub Desktop.
Save markuman/752854e7eb2528aba044 to your computer and use it in GitHub Desktop.
LuaJIT mipsr2 cross compiling
#!/bin/bash
# https://github.com/LuaJIT/LuaJIT/issues/34
git clone https://github.com/LuaJIT/LuaJIT
cd LuaJIT
git checkout v2.1
#toolchain
PREFIX=/home/markus/Downloads/buildroot-2015.11.1/output/host/usr
TARGET=mips
# re-export path
export PATH="${PATH}":${PREFIX}/bin
export C_INCLUDE_PATH="${C_INCLUDE_PATH}":${PREFIX}/include
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}":${PREFIX}/lib
make HOST_CC="gcc -fPIC -m32" CROSS=mips-buildroot-linux-uclibc- TARGET_CFLAGS="-fPIC -march=mips32r2"
[markus@arch LuaJIT]$ file src/luajit
src/luajit: ELF 32-bit MSB executable, MIPS, MIPS32 rel2 version 1 (SYSV), dynamically linked, interpreter /lib/ld-uClibc.so.0, stripped 100% 580KB 145.0KB/s 00:04
root@OpenWrt:~# ./luajit
LuaJIT 2.1.0-beta1 -- Copyright (C) 2005-2015 Mike Pall. http://luajit.org/
JIT: ON MIPS32R2 fold cse dce fwd dse narrow loop abc sink fuse
>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment