diff --git a/build b/build index 9bb0559..0f5158f 100755 --- a/build +++ b/build @@ -3,8 +3,13 @@ mkdir -p target gcc -c meow.s -o target/amogus.o || exit gnu() { shift 1 && gcc "$@"; } "$(command -v ~/stuff/zig/zig || echo gnu)" \ -cc -static -nostdlib -nodefaultlibs target/amogus.o -o target/amogus || exit +cc -O3 -shared -static -nostdlib -nodefaultlibs target/amogus.o -o target/amogus || exit objdump -d target/amogus -strip --strip-section-headers -K entry target/amogus +strip -K entry target/amogus +objdump -t target/amogus du -b target/amogus +rm -rf target/cg/ +mkdir -p target/cg +cp target/amogus target/cg/ +cp amogus.h target/cg/ diff --git a/ctest b/ctest new file mode 100755 index 0000000..0537da2 --- /dev/null +++ b/ctest @@ -0,0 +1,7 @@ +#!/bin/sh +./build || exit +export C_INCLUDE_PATH="$PWD:$C_INCLUDE_PATH" +export LD_LIBRARY_PATH="$PWD/target:$LD_LIBRARY_PATH" +export LIBRARY_PATH="$PWD/target:$LIBRARY_PATH" +gcc test.c -o target/cmogus -L"$LIBRARY_PATH" -l:amogus || exit +target/cmogus diff --git a/meow.s b/meow.s index b78ad83..6addb5e 100644 --- a/meow.s +++ b/meow.s @@ -24,7 +24,7 @@ usage: mov $help0l,%rsi call write - mov [argv],%rdi + mov argv(%rip),%rdi push %rdi call strlen pop %rdi diff --git a/test.c b/test.c index 5feb20b..c2fee51 100644 --- a/test.c +++ b/test.c @@ -1,4 +1,9 @@ #include +#include int main() { + char* match; + if(!entry("meow.*|m(r(r(p..*)))",&match)) + return 1; + printf("%s",match); }