aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--.travis.yml1
-rw-r--r--bruiser/makefile12
-rwxr-xr-xbruiser/tablegen.sh6
-rwxr-xr-xextra-tools/luatablegen.py19
-rw-r--r--makefile1
5 files changed, 28 insertions, 11 deletions
diff --git a/.travis.yml b/.travis.yml
index 88aabf3..f7543c5 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -50,6 +50,7 @@ before_script:
- python3-config --includes
- python3-config --ldflags
- llvm-config-5.0 --has-rtti
+ - (cd bruiser && bash ./tablegen.sh)
script:
- make PY_CONF=python3.5-config CXX=clang-5.0 LLVM_CONF=llvm-config-5.0 BUILD_MODE=COV_NO_CLANG CC=clang-5.0 -j2
diff --git a/bruiser/makefile b/bruiser/makefile
index 3f38539..393a7ae 100644
--- a/bruiser/makefile
+++ b/bruiser/makefile
@@ -21,7 +21,7 @@ TBG_OBJLIST_INC=$(patsubst ./luatablegen/%.c, ./luatablegen/%.o, $(wildcard ./lu
######################################RULES####################################
.DEFAULT: all
-.PHONY: all clean help tablegen
+.PHONY: all clean help
all: $(BRUISER)
@@ -46,8 +46,13 @@ dependc:.dependc
linenoise.o:
$(CC) $(CC_FLAGS) linenoise/linenoise.c -c -o linenoise.o
-tablegen:
- ../extra-tools/tablegen-test/run.sh
+./wasmtablegen.json:
+ if [[ ls -l ./luatablegen | wc -l == 2 ]];then ./tablegen.sh;else :;fi
+
+./luatablegen/%.c: ./wasmtablegen.json
+ ./tablegen.sh
+
+./luatablegen/%.o:./luatablegen/%.c
$(MAKE) -C luatablegen
$(LIB_LUA):
@@ -59,6 +64,7 @@ $(LIB_LUA_JIT):
@echo "building with jit"
$(BRUISER): $(BRUISER).o ../mutator_aux.o ../tinyxml2/tinyxml2.o linenoise.o CompletionHints.o mutagen.o ORCmutation.o bruiserffi.o asmrewriter.o bruisercapstone.o ramdump.o ffs.o $(LIB_LUA) $(TBG_OBJLIST_INC)
+ @echo $(TBG_OBJLIST_INC)
$(CXX) $^ $(LD_FLAGS) -o $@
clean:
diff --git a/bruiser/tablegen.sh b/bruiser/tablegen.sh
index 5172d60..03a660c 100755
--- a/bruiser/tablegen.sh
+++ b/bruiser/tablegen.sh
@@ -1,5 +1,7 @@
#!/usr/bin/bash
cd $(dirname $0)
../extra-tools/luatablegen.py --tbg ./wasmtablegen.json --out ./luatablegen --luaheader ../lua-5.3.4/src --pre ./luatablegen/wasmheader.txt --headeraggr ./luatablegen/wasm_tables.h --lualibpath ./lua-scripts/wasm.lua
-make -C ./luatablegen
-make clean
+if [[ $1 == test ]]; then
+ make -C ./luatablegen
+ make clean
+fi
diff --git a/extra-tools/luatablegen.py b/extra-tools/luatablegen.py
index 7443c39..c66b94c 100755
--- a/extra-tools/luatablegen.py
+++ b/extra-tools/luatablegen.py
@@ -328,21 +328,30 @@ class TbgParser(object):
table_reg_list.append(struct_name + "_register(__ls);\n")
h_source.write(TABLE_REGISTER[0].replace("XXX", struct_name).replace(" {\n", ";\n"))
self.end(h_source)
+ # header aggregate
if self.argparser.args.headeraggr:
- aggr_header = open(self.argparser.args.headeraggr, "w")
- aggr_header.write(HEADER_GUARD[0].replace("XXX", "WASM_TABLES_AGGR"))
- aggr_header.write(EXTERN_C[0])
+ name = self.argparser.args.headeraggr
+ dummy = name[name.rfind("/"):]
+ aggr_header = open(self.argparser.args.headeraggr.replace(".h", ".c"), "w")
+ aggr_header_h = open(self.argparser.args.headeraggr, "w")
+ aggr_header.write("// automatically generated by luatablegen\n")
+ aggr_header_h.write("// automatically generated by luatablegen\n")
+ aggr_header_h.write(HEADER_GUARD[0].replace("XXX", "WASM_TABLES_AGGR"))
+ aggr_header_h.write(EXTERN_C[0])
aggr_header.write("\n")
for item in header_aggr_list:
aggr_header.write("#include " + '"' + item + '"\n')
+ aggr_header_h.write("#include " + '"' + item + '"\n')
+ aggr_header.write("#include " + '".' + dummy + '"\n')
aggr_header.write("\n")
aggr_header.write("void reg_tablegen_tables(lua_State* __ls) {\n")
+ aggr_header_h.write("void reg_tablegen_tables(lua_State* __ls);\n")
for func_sig in table_reg_list:
aggr_header.write("\t" + func_sig)
aggr_header.write("\t" + "lua_pop(__ls, 1);\n")
aggr_header.write("}\n")
- aggr_header.write(EXTERN_C[1])
- aggr_header.write(HEADER_GUARD[1])
+ aggr_header_h.write(EXTERN_C[1])
+ aggr_header_h.write(HEADER_GUARD[1])
aggr_header.write("\n")
if self.argparser.args.makemacro:
if self.argparser.args.out[-1] == "/":
diff --git a/makefile b/makefile
index 6f511b4..6449da3 100644
--- a/makefile
+++ b/makefile
@@ -48,7 +48,6 @@ $(SFCPP01):
$(MAKE) -C safercpp CXX=$(CXX) LLVM_CONF=$(LLVM_CONF) BUILD_MODE=$(BUILD_MODE)
$(BRUISER):
- $(MAKE) -C bruiser tablegen bruiser CXX=$(CXX) LLVM_CONF=$(LLVM_CONF) BUILD_MODE=$(BUILD_MODE)
$(MAKE) -C bruiser CXX=$(CXX) LLVM_CONF=$(LLVM_CONF) BUILD_MODE=$(BUILD_MODE)
$(OBSC):