aboutsummaryrefslogtreecommitdiffstats
path: root/extra-tools
diff options
context:
space:
mode:
authorbloodstalker <thabogre@gmail.com>2018-05-28 13:55:37 +0000
committerbloodstalker <thabogre@gmail.com>2018-05-28 13:55:37 +0000
commit0c522ec5bfee22c7de54987d316cfbf245a8826e (patch)
tree7023705e17e7d78226b436329f81841db6dfbd9b /extra-tools
parentload.py is now imported bt another python module, should cut down on startup ... (diff)
downloadmutator-0c522ec5bfee22c7de54987d316cfbf245a8826e.tar.gz
mutator-0c522ec5bfee22c7de54987d316cfbf245a8826e.zip
added test files for the wasm linker. added two scripts to extra-tools
Diffstat (limited to 'extra-tools')
-rw-r--r--extra-tools/llvm-build.sh2
-rwxr-xr-xextra-tools/llvm-wasm17
2 files changed, 19 insertions, 0 deletions
diff --git a/extra-tools/llvm-build.sh b/extra-tools/llvm-build.sh
new file mode 100644
index 0000000..9830cb5
--- /dev/null
+++ b/extra-tools/llvm-build.sh
@@ -0,0 +1,2 @@
+#!/bin/bash
+"cmake" -G "Unix Makefiles" ../llvm -DLLVM_ENABLE_RTTI=1 -DCMAKE_BUILD_TYPE=Release -DLLDB_TEST_C_COMPILER=cc -DLLDB_TEST_CXX_COMPILER=g++ -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly -DLLVM_ENABLE_ASSERTIONS=1
diff --git a/extra-tools/llvm-wasm b/extra-tools/llvm-wasm
new file mode 100755
index 0000000..bf31f7a
--- /dev/null
+++ b/extra-tools/llvm-wasm
@@ -0,0 +1,17 @@
+#!/bin/bash
+# needs wabt, binaryen and clang's wasm backend to work.
+# https://github.com/WebAssembly/binaryen
+# https://github.com/WebAssembly/wabt
+# as far as i know, up to clang 6, you need to
+# explicitly ask for the wasm backend to be built.
+# you can look at llvm-build.sh in this directory for the
+# llvm/clang build command i use.
+
+fullname=$1
+namelength=${#fullname}
+offset=$((${#fullname} - 2))
+filename=${fullname:0:$offset}
+"clang" -emit-llvm --target=wasm32 -Oz "$1" -c
+"llc" -asm-verbose=false -o $filename.s $filename.bc
+"s2wasm" $filename.s > $filename.wast
+"wast2wasm" $filename.wast -o $filename.wasm