Add Linux support via ELF symbol scanner#22
Open
changelingonberry wants to merge 2 commits intospacestation13:mainfrom
Open
Add Linux support via ELF symbol scanner#22changelingonberry wants to merge 2 commits intospacestation13:mainfrom
changelingonberry wants to merge 2 commits intospacestation13:mainfrom
Conversation
At library load time, lua_compat.c:
1. Reads the host binary's .symtab from /proc/self/exe.
2. For each needed Lua API symbol, tries an exact C-name match first,
then a prefix match on the Itanium C++ mangled form _Z<len><name>,
which identifies the function regardless of its parameter types.
This handles aseprite's Lua being compiled as C++ without extern
"C".
3. Resolves the ASLR slide via dl_iterate_phdr and computes runtime
addresses as base + symtab offset.
4. Exposes plain C-named wrapper functions covering all 47 Lua/luaL
symbols that mlua requires.
build.rs compiles lua_compat.c via the cc crate on Linux only, linking
it into libdmi.so so mlua's extern declarations are satisfied at link
time with no undefined Lua symbols remaining.
Requires only a non-stripped self-built aseprite binary (.symtab
present).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
At library load time, lua_compat.c:
build.rs compiles lua_compat.c via the cc crate on Linux only, linking it into libdmi.so so mlua's extern declarations are satisfied at link time with no undefined Lua symbols remaining.
Requires only a non-stripped self-built aseprite binary (.symtab present).
This PR has been created with AI assistance.