Something is very wrong with floats in my Lua 5.3 build

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Something is very wrong with floats in my Lua 5.3 build

Rena
I added a platform to the Makefile:
kobo:
$(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN"
SYSLIBS="-Wl,-E -ldl"

and edited the compile commands:
TOOLCHAIN=arm-linux-gnueabihf-

CC= $(TOOLCHAIN)gcc -std=gnu99
CFLAGS= -O2 -Wall -Wextra -DLUA_COMPAT_5_2 $(SYSCFLAGS) $(MYCFLAGS)

The result is a Lua 5.3 that seems to work except when floats are involved:
> print(1.0)
503.0

I'm not sure where to begin looking to debug this. Any ideas?

--
Sent from my Game Boy.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Something is very wrong with floats in my Lua 5.3 build

Jay Carlson
First guess: your libraries]1] are having a fight about whether to use hardware or software floating point, and in particular how they are passed in registers. Time to get out out arm-linux-gnueabihf-objdump -S and see what's being emitted for 2.0+2.0. Don't forget that shared libraries can link other libraries[4], so you might want to check with ldd if the wrong kind of math is getting linked to.

Jay

[1]: Your main program also counts as a library, but I believe I've been over that issue before.

[2]: Infocom's "Hitchhiker's Guide To The Galaxy" game.

[3]: Isn't it fun reading through the footnotes? [2]

[4]: Normally, plugins are linked with the libraries they are using, so it can be relatively easy to figure out where strange objects are getting linked in. With upstream's approach to plugins, the odds of an undetected or hard to diagnose symbol clash are higher, since the linker isn't helping you out.[1]


> On Jul 16, 2017, at 9:51 PM, Rena <[hidden email]> wrote:
>
> I added a platform to the Makefile:
> kobo:
> $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN"
> SYSLIBS="-Wl,-E -ldl"
>
> and edited the compile commands:
> TOOLCHAIN=arm-linux-gnueabihf-
>
> CC= $(TOOLCHAIN)gcc -std=gnu99
> CFLAGS= -O2 -Wall -Wextra -DLUA_COMPAT_5_2 $(SYSCFLAGS) $(MYCFLAGS)
>
> The result is a Lua 5.3 that seems to work except when floats are involved:
>> print(1.0)
> 503.0
>
> I'm not sure where to begin looking to debug this. Any ideas?
>
> --
> Sent from my Game Boy.
>


Loading...