kit

kit
git clone https://git.ryansepassi.com/git/kit.git
Log | Files | Refs | README

commit 81547a50b52e76eff75e4ddc556329b9d9f0a615
parent bfbdf529eff7cfaa0f5683bae7aa1eb75288d387
Author: Ryan Sepassi <rsepassi@gmail.com>
Date:   Thu, 16 Jul 2026 11:10:40 -0700

test: execute stripped Linux shared images

Diffstat:
Mtest/strip/linked.sh | 26+++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/test/strip/linked.sh b/test/strip/linked.sh @@ -211,7 +211,7 @@ if [ "$host_os" = Darwin ]; then elif [ "$host_os" = Linux ]; then # Native hosted output covers a runnable dynamic PIE. printf 'int main(void) { return 0; }\n' > "$work/linux-native.c" - run_ok linux-dynamic-build "$KIT" cc -g "$work/linux-native.c" \ + run_ok linux-dynamic-build "$KIT" cc -g "$work/linux-native.c" -lc \ -o "$work/linux-dynamic" if [ -f "$work/linux-dynamic" ]; then strip_shape linux-dynamic "$work/linux-dynamic" @@ -220,6 +220,30 @@ elif [ "$host_os" = Linux ]; then run_ok linux-dynamic-all-run "$work/linux-dynamic.all" fi + # Exercise a native DSO through the platform loader before and after both + # strip modes. Keep the SONAME stable while swapping the rewritten variants + # underneath one client, so a successful call proves the export and dynamic + # loader metadata remain usable rather than merely present. + printf 'int linked_answer(void) { return 42; }\n' > "$work/linux-shared.c" + printf 'int linked_answer(void); int main(void) { return linked_answer() == 42 ? 0 : 1; }\n' \ + > "$work/linux-shared-main.c" + run_ok linux-shared-build "$KIT" cc -g -fPIC -shared \ + -Wl,-soname,libanswer.so "$work/linux-shared.c" \ + -o "$work/libanswer.so" + run_ok linux-shared-client-build "$KIT" cc -g \ + "$work/linux-shared-main.c" -L"$work" -lanswer \ + '-Wl,-rpath,$ORIGIN' -lc -o "$work/linux-shared-client" + if [ -f "$work/libanswer.so" ] && [ -f "$work/linux-shared-client" ]; then + run_ok linux-shared-run-before "$work/linux-shared-client" + strip_shape linux-shared "$work/libanswer.so" + cp "$work/libanswer.so" "$work/libanswer.original" + cp "$work/linux-shared.debug" "$work/libanswer.so" + run_ok linux-shared-debug-run "$work/linux-shared-client" + cp "$work/linux-shared.all" "$work/libanswer.so" + run_ok linux-shared-all-run "$work/linux-shared-client" + cp "$work/libanswer.original" "$work/libanswer.so" + fi + # Execute a genuinely static freestanding artifact on supported native # Linux architectures; the cross-format structural cases above remain # unconditional.