Skip to content

Commit

Permalink
Improve FP argument passing test and fix MIPS register save code.
Browse files Browse the repository at this point in the history
  • Loading branch information
yugr committed Apr 10, 2024
1 parent 50593e9 commit 55b4acd
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
16 changes: 13 additions & 3 deletions tests/stack-args/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,18 @@

#include "interposed.h"

int main() {
foo(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
bar(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
#include <string.h>
#include <stdio.h>

int main(int argc, char *argv[]) {
argc = argc;
if (0 == strcmp(argv[1], "int")) {
foo(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
} else if (0 == strcmp(argv[1], "float")) {
bar(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
} else {
fprintf(stderr, "Invalid option: %s\n", argv[1]);
return 1;
}
return 0;
}
5 changes: 4 additions & 1 deletion tests/stack-args/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ ${PYTHON:-} ../../implib-gen.py -q --target $TARGET libinterposed.so
# Build app
$CC $CFLAGS main.c libinterposed.so.tramp.S libinterposed.so.init.c $LIBS

LD_LIBRARY_PATH=.:${LD_LIBRARY_PATH:-} $INTERP ./a.out > a.out.log
LD_LIBRARY_PATH=.:${LD_LIBRARY_PATH:-} $INTERP ./a.out int > a.out.log
diff test.ref a.out.log

LD_LIBRARY_PATH=.:${LD_LIBRARY_PATH:-} $INTERP ./a.out float > a.out.log
diff test.ref a.out.log

echo SUCCESS
1 change: 0 additions & 1 deletion tests/stack-args/test.ref
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

0 comments on commit 55b4acd

Please sign in to comment.