|
Hi,Attached are modified versions of ldump.c, lundump.h, and luac.c to allow for cross-compilation. They should work as drop-in replacements. I've done some basic testing, but I only have access to one architecture so I can't test endianness.
This code lets you specify: * the endianness of the target platform * the size of int as 8, 16, or 32 (no 64-bit support right now) * lua_Number as an int (8, 16, or 32 bits) or a float (32 or 64 bits)ldump.c exports a new function called "luaU_dump_crosscompile" that works like luaU_dump except that it takes a DumpTargetInfo structure.
luaU_dump_crosscompile supports different sizes of size_t but luac does not allow it to be set from the command line. Are there any targets where sizeof(int) is different from sizeof(size_t)?
This code assumes that 'float' is a standard 32-bit float and 'double' is a standard 64-bit double. It will trip a lua_assert if lua_Number is not integer but sizeof(lua_Number) is not 32 or 64. Is that portable enough?
Tim Maxwell
Attachment:
ldump.c
Description: Binary data
Attachment:
luac.c
Description: Binary data
Attachment:
lundump.h
Description: Binary data