Re: LuaJIT for PlayStation®Vita

  • From: Mike Pall <mike-1403@xxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Thu, 13 Mar 2014 18:41:40 +0100

Anton Stenmark wrote:
> I'm working on porting LuaJIT to the PlayStation®Vita. It uses an
> ARM CPU but I've had to make some changes to compile LuaJIT with the
> Sony toolchain. I've gotten it up and running but the math library
> functions all just return trash. For example, math.sqrt(X) always
> returns 3.0.

Most likely the wrong ABI was selected. This can easily happen if
you don't use the standard build process.

Check the developer docs for the C calling conventions: are
floating-point numbers passed in integer registers or in FPU
registers?

Note there are three standard FPU/ABI variants for ARM: no-FPU/soft,
FPU/softfp and FPU/hardfp. Check the compiler defines for __SOFTFP_
(probably undefined) and __ARM_PCS_VFP (1 for hardfp, undefined for
softfp calling conventions). src/Makefile checks for the resulting
LJ_ARCH_HASFPU and LJ_ABI_SOFTFP defines and sets the appropriate
DynASM defines -D FPU and/or -D HFABI. You'll get weird errors if
those are wrong.

--Mike

Other related posts: