Skip to content

Fix "string table corrupt" build error on modern Linux linkers - #155

Open
Khodesaeed wants to merge 1 commit into
giltene:masterfrom
Khodesaeed:fix/modern-linker-compat
Open

Fix "string table corrupt" build error on modern Linux linkers#155
Khodesaeed wants to merge 1 commit into
giltene:masterfrom
Khodesaeed:fix/modern-linker-compat

Conversation

@Khodesaeed

Copy link
Copy Markdown

This PR fixes a build failure on newer Linux distributions (e.g., Ubuntu 22.04, 24.04) where the linker (ld) reports that obj/bytecode.o: string table [3] is corrupt.

The Problem

The current build process uses luajit -b to generate a raw object file (.o). Modern versions of binutils have stricter requirements for the ELF string table format. The object files generated by the bundled (older) LuaJIT version are often flagged as corrupt by modern linkers.

The Solution

Instead of generating a raw object file directly, this change instructs LuaJIT to output a standard C source file. This C file is then compiled by the system's gcc, ensuring the resulting object file metadata is perfectly compatible with the host's linker.

I have also added LUA_PATH to the command to ensure luajit can find its internal modules during the build process, preventing the "unknown luaJIT command" error.

Changes

  • Modified the $(ODIR)/bytecode.o rule in the Makefile.
  • Changed the output format from raw object to C source.
  • Added explicit compilation step for the generated C source.
  • Added LUA_PATH environment variable to ensure luajit executes correctly.

- Modified the $(ODIR)/bytecode.o rule in the Makefile.
- Changed the output format from raw object to C source.
- Added explicit compilation step for the generated C source.
- Added LUA_PATH environment variable to ensure luajit executes correctly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant