aboutsummaryrefslogtreecommitdiffstats
path: root/bruiser/autogen/wasm/ft
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xbruiser/autogen/wasm/ft.sh3
-rw-r--r--bruiser/autogen/wasm/ft/autowasm.c8
-rw-r--r--bruiser/autogen/wasm/ft/makefile34
3 files changed, 27 insertions, 18 deletions
diff --git a/bruiser/autogen/wasm/ft.sh b/bruiser/autogen/wasm/ft.sh
index a7f5ac6..71a4c20 100755
--- a/bruiser/autogen/wasm/ft.sh
+++ b/bruiser/autogen/wasm/ft.sh
@@ -1,5 +1,6 @@
#!/bin/sh
cd $(dirname $0)
"../../faultreiber/faultreiber.py" --name wasm --outdir ./ft/ --datetime --xml ./wasm.xml --calloc --voidtraininitsize 60 --voidtrainfactor 1.9
-#"clang-format" -i ./test/read.c ./test/structs.c ./test/structs.h ./test/aggregate.c ./test/aggregate.h ./test/read.h
+#"../../faultreiber/faultreiber.py" --name wasm --outdir ./ft/ --datetime --xml ./wasm.xml --luaalloc --voidtraininitsize 60 --voidtrainfactor 1.9 --luaheaders ../../../lua-5.3.4/src
+"clang-format" -i ./ft/read.c ./ft/structs.c ./ft/structs.h ./ft/aggregate.c ./ft/aggregate.h ./ft/read.h
#"less" ./test/structs.h
diff --git a/bruiser/autogen/wasm/ft/autowasm.c b/bruiser/autogen/wasm/ft/autowasm.c
index 42bf474..617bd42 100644
--- a/bruiser/autogen/wasm/ft/autowasm.c
+++ b/bruiser/autogen/wasm/ft/autowasm.c
@@ -9,12 +9,14 @@
#include "./aggregate.h"
#include "./read.h"
#include "./structs.h"
+#include "../../../lua-5.3.4/src/lua.h"
#pragma weak main
int main(int argc, char **argv) {
const rlim_t kStackSize = 160 * 1024 * 1024; // min stack size = 16 MB
struct rlimit rl;
int result;
+ lua_State* LS = luaL_newstate();
result = getrlimit(RLIMIT_STACK, &rl);
if (result == 0) {
@@ -27,10 +29,10 @@ int main(int argc, char **argv) {
}
}
int wasm = open("./test.wasm", O_RDONLY);
- wasm_lib_ret_t *lib_ret = read_aggr_wasm(wasm);
+#if 0
+ wasm_lib_ret_t *lib_ret = read_aggr_wasm(wasm, LS);
printf("finished reading\n");
-#if 0
printf("magic_number:%x\n",
lib_ret->obj->magic_number_container->magic_number);
printf("version:%x\n", lib_ret->obj->version_container->version);
@@ -240,6 +242,7 @@ int main(int argc, char **argv) {
// free(lib_ret->void_train[2]);
// free(lib_ret->void_train[1]);
// free(lib_ret->void_train[0]);
+#if 0
for (int i = lib_ret->current_void_count - 1; i >= 0; --i) {
printf("%d:0x%x ", i, lib_ret->void_train[i]);
// if (i == 1) continue;
@@ -248,5 +251,6 @@ int main(int argc, char **argv) {
free(lib_ret->void_train);
free(lib_ret->obj);
free(lib_ret);
+#endif
return 0;
}
diff --git a/bruiser/autogen/wasm/ft/makefile b/bruiser/autogen/wasm/ft/makefile
index b02dcfc..08e0ffe 100644
--- a/bruiser/autogen/wasm/ft/makefile
+++ b/bruiser/autogen/wasm/ft/makefile
@@ -1,13 +1,14 @@
+TARGET=autowasm
SHELL=bash
SHELL?=bash
-TARGET=autowasm
CC=clang
CC?=clang
-CC_FLAGS=-fpic
+CC_FLAGS= -fPIC
CC_EXTRA?=
CTAGS_I_PATH?=./
LD_FLAGS=
-EXTRA_LD_FLAGS?=
+LIB_LUA=../../../lua-5.3.4/src/liblua.a
+EXTRA_LD_FLAGS?=-lm -ldl
ADD_SANITIZERS_CC= -g -fsanitize=address -fno-omit-frame-pointer
ADD_SANITIZERS_LD= -g -fsanitize=address
MEM_SANITIZERS_CC= -g -fsanitize=memory -fno-omit-frame-pointer
@@ -62,8 +63,8 @@ depend:.depend
.depend:$(SRCS)
rm -rf .depend
$(CC) -MM $(CC_FLAGS) $^ > ./.depend
- echo $(patsubst %.o:, %.odbg:, $(shell $(CC) -MM $(CC_FLAGS) $^)) | sed -r 's/[a-z0-9\-\_]+\.odbg/\n&/g' >> ./.depend
- echo $(patsubst %.o:, %.ocov:, $(shell $(CC) -MM $(CC_FLAGS) $^)) | sed -r 's/[a-z0-9\-\_]+\.ocov/\n&/g' >> ./.depend
+ echo $(patsubst %.o:, %.odbg:, $(shell $(CC) -MM $(CC_FLAGS) $^)) | sed -r 's/[A-Za-z0-9\-\_]+\.odbg/\n&/g' >> ./.depend
+ echo $(patsubst %.o:, %.ocov:, $(shell $(CC) -MM $(CC_FLAGS) $^)) | sed -r 's/[A-Za-z0-9\-\_]+\.ocov/\n&/g' >> ./.depend
-include ./.depend
@@ -76,16 +77,19 @@ depend:.depend
%.ocov:%.c
$(CC) $(CC_FLAGS) $(COV_CC) -c $< -o $@
-$(TARGET): $(TARGET).o read.o aggregate.o structs.o
- $(CC) $^ $(LD_FLAGS) -o $@
+$(LIB_LUA):
+ $(MAKE) -C ../../../lua-5.3.4/src linux
+
+$(TARGET): $(TARGET).o $(LIB_LUA) read.o aggregate.o structs.o
+ $(CC) $(LD_FLAGS) $^ -o $@
-$(TARGET)-static: $(TARGET).o read.o aggregate.o structs.o
+$(TARGET)-static: $(TARGET).o $(LIB_LUA) read.o aggregate.o structs.o
$(CC) $^ $(LD_FLAGS) -static -o $@
-$(TARGET)-dbg: $(TARGET).odbg read.odbg aggregate.odbg structs.odbg
+$(TARGET)-dbg: $(TARGET).odbg $(LIB_LUA) read.odbg aggregate.odbg structs.odbg
$(CC) $^ $(LD_FLAGS) -g -o $@
-$(TARGET)-cov: $(TARGET).ocov read.ocov aggregate.ocov structs.ocov
+$(TARGET)-cov: $(TARGET).ocov $(LIB_LUA) read.ocov aggregate.ocov structs.ocov
$(CC) $^ $(LD_FLAGS) $(COV_LD) -o $@
cov:
@@ -117,13 +121,13 @@ tags:$(SRCS)
$(TARGET).so: $(TARGET).o read.o aggregate.o structs.o
$(CC) $^ $(LD_FLAGS) -shared -o $@
-$(TARGET).a: $(TARGET).o read.o aggregate.o structs.o
- ar rcs $(TARGET).a $(TARGET).o read.o aggregate.o structs.o
+$(TARGET).a: $(LIB_LUA) read.o aggregate.o structs.o
+ ar rcs $(TARGET).a read.o aggregate.o structs.o
-$(TARGET).adbg: $(TARGET).odbg read.odbg aggregate.odbg structs.odbg
- ar rcs $(TARGET).adbg $(TARGET).odbg read.odbg aggregate.odbg structs.odbg
+$(TARGET).adbg: $(LIB_LUA) read.odbg aggregate.odbg structs.odbg
+ ar rcs $(TARGET).adbg read.odbg aggregate.odbg structs.odbg
-$(TARGET).acov: $(TARGET).ocov read.ocov aggregate.ocov structs.ocov
+$(TARGET).acov: $(LIB_LUA) read.ocov aggregate.ocov structs.ocov
ar rcs $(TARGET).acov $(TARGET).ocov read.ocov aggregate.ocov structs.ocov
valgrind: $(TARGET)