Add MIPS64 (n64 ABI) Linux test binaries - #38
Open
retrocpugeek wants to merge 7 commits into
Open
Conversation
Add freestanding statically-linked MIPS64 "hello" executables for the Qiling MIPS64 ELF-loading tests: - mips64_linux/bin/mips64_hello_static (big-endian) - mips64el_linux/bin/mips64el_hello_static (little-endian) They link at the standard MIPS64 base 0x120000000, write a greeting and exit via the n64 syscall ABI, and execute a movz instruction (a MIPS64R2 instruction) so they also exercise the emulator's default MIPS64 CPU model. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace the freestanding hello binaries with statically-linked glibc binaries built with the n64 cross toolchains (mips64-linux-gnuabi64 and mips64el-linux-gnuabi64, gcc 12.4, `-static -O2`, stripped). They exercise full libc startup (TLS setup, ll/sc locks) and both print "Hello, MIPS64 from Qiling!". Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Adds dynamic n64 hello binaries plus their loader (lib64/ld.so.1) and libc (lib/libc.so.6) for both endiannesses, mirroring the mips32_linux dynamic setup. Used by the hello_mips64*_linux_customapi.py examples, which intercept puts(). Both print "Hello, MIPS64 from Qiling!". Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Static MIPS64 big-endian binary that calls statx() on a path and prints "DIR" iff S_ISDIR(stx_mode). Used by Qiling's test_elf_linux_mips64eb_statx to guard against statx being emitted with the wrong byte order on big-endian guests. Source: examples/src/linux/statx.c. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Built from examples/src/linux/multithreading.c (n64, -static -pthread, stripped) for the MIPS64 BE multithreading example and regression test. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Built with the Buildroot 2026.02.3 mips64-buildroot-linux-gnu-gcc 14.3.0 toolchain (-no-pie -fno-pie). Independent of the Ubuntu cross-gcc used for mips64_hello, it links non-PIE n64 executables at the default 0x120000000 base (entry 0x120000880), confirming the >2GB link address is an n64 ABI convention rather than a toolchain artifact. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…uildroot)
mips64_hello_buildroot is a dynamically-linked non-PIE ET_EXEC that must
load against its own toolchain's loader + C library (Buildroot glibc 2.42);
it cannot share mips64_linux/, whose glibc is a different build and whose
ld.so aborts loading this binary. Both dynamic binaries hard-code interp
/lib64/ld.so.1, so the two glibc environments cannot coexist in one tree.
Move the binary out of mips64_linux/bin into a dedicated rootfs carrying
the matching loader + libc:
mips64_linux_buildroot/
bin/mips64_hello_buildroot
lib/{libc.so.6,ld.so.1}
lib64 -> lib
mips64_linux/ is left unchanged.
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.
Companion to qilingframework/qiling#1631 (Add MIPS64 (n64 ABI) Linux support).
That PR adds MIPS64 n64 emulation to the framework; the tests it ships need
target binaries that do not exist in this repo yet. This PR adds them.
New rootfs trees
mips64_linux/mips64_hello,mips64_hello_static,mips64_multithreading,mips64_statx, pluslib/libc.so.6andlib64/ld.so.1(big-endian)mips64el_linux/mips64el_hello,mips64el_hello_static, plus matching libc/loader (little-endian)mips64_linux_buildroot/mips64_hello_buildrootand the matching Buildrootld.so.1+libc.so.6mips64_linux_buildrootis kept separate on purpose: the Buildroot-builtnon-PIE binary needs its own loader/libc pair, and mixing it into
mips64_linuxwould break the dynamically-linked binaries there.Used by
tests/test_elf.py— static BE/EL hello, Buildroot non-PIE hello, statx, and the code-only MIPS64 casestests/test_elf_multithread.py—mips64_multithreadingtests/test_debugger.py—mips64_hello_staticSources for the compiled programs are in the qiling PR under
examples/src/linux/(multithreading.c,statx.c).