Repository navigation
[AUTOMATED] Bind glibc's void declaration at a MIPS import its symbol version ties to glibc - #1950
Merged
Merged
Conversation
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.
The problem
A MIPS PIC wrapper that hands its pointer straight to glibc's
freenever writesa0, so Kuna drops the argument even when the image linksfree@GLIBC_2.0fromlibc.so.6:The built-in table knows
void free(void *), but a type-only declaration with avoidresult was never bound at a MIPS import. That guard is right for the import name alone: afreethat takes nothing compiles to the same instructions.The fix
GLIBC_*version of one of glibc's own libraries (libc.so.6,libpthread.so.0,libm.so.6, ...), read from.gnu.versiononce per undefined dynamic function.GLIBC_PRIVATEdoes not count, nor does a name also imported under another version.voidresult when it has at most four integer or pointer parameters no wider than a pointer, which every MIPS ABI passes in argument registers. The wrapper above becomesvoid release(void *a0) { free(a0); }.GLIBC_PRIVATE, a declaration of another name (--define-functionnaming thefreestubexit), a debug-info declaration, and a floating-point or fifth parameter keep today's rule. Aprototypeassertion still wins.Tests
tests/stages/kuna-glibcvoidimport.xmlcovers N32, O32 and N64 images linked to a versionedlibc.so.6, one linked tolibpthread.so.0, the unversioned, other-library andGLIBC_PRIVATEcontrols, console declarations naming the stubfreeandexit, a caller'svoid free(void)declaration,strlen, andsincos, which no table declares on MIPS. The forwarding cases fail on main. A loader test checks which imports each fixture binds to glibc, and a console test checks the name, provenance, parameter-count, type and width guards. The fixtures are built from source with clang and GNU ld (recipe in their README). Compiled emitted C for each ABI forwards the same pointers as the original under QEMU, where main's output does not.Model:
anthropic/claude-opus-5-5