diff options
author | bloodstalker <thabogre@gmail.com> | 2018-05-28 13:55:37 +0000 |
---|---|---|
committer | bloodstalker <thabogre@gmail.com> | 2018-05-28 13:55:37 +0000 |
commit | 0c522ec5bfee22c7de54987d316cfbf245a8826e (patch) | |
tree | 7023705e17e7d78226b436329f81841db6dfbd9b /bruiser/wasm/test/linker | |
parent | load.py is now imported bt another python module, should cut down on startup ... (diff) | |
download | mutator-0c522ec5bfee22c7de54987d316cfbf245a8826e.tar.gz mutator-0c522ec5bfee22c7de54987d316cfbf245a8826e.zip |
added test files for the wasm linker. added two scripts to extra-tools
Diffstat (limited to 'bruiser/wasm/test/linker')
-rw-r--r-- | bruiser/wasm/test/linker/file0.c | 20 | ||||
-rw-r--r-- | bruiser/wasm/test/linker/file0.wasm | bin | 0 -> 264 bytes | |||
-rw-r--r-- | bruiser/wasm/test/linker/file0.wast | 71 | ||||
-rw-r--r-- | bruiser/wasm/test/linker/file1.c | 25 | ||||
-rw-r--r-- | bruiser/wasm/test/linker/file1.wasm | bin | 0 -> 209 bytes | |||
-rw-r--r-- | bruiser/wasm/test/linker/file1.wast | 58 |
6 files changed, 174 insertions, 0 deletions
diff --git a/bruiser/wasm/test/linker/file0.c b/bruiser/wasm/test/linker/file0.c new file mode 100644 index 0000000..5eb172b --- /dev/null +++ b/bruiser/wasm/test/linker/file0.c @@ -0,0 +1,20 @@ +#include <stdio.h> +#include <inttypes.h> +#include "file1.c" + +#define CODE_SECTION_0_0 "constant_0_0" +#define CODE_SECTION_0_1 "constant_0_1" +#define CODE_SECTION_0_2 "constant_0_2" +#define CODE_SECTION_0_3 "constant_0_3" +#define CODE_SECTION_0_4 "constant_0_4" + +int g_int_0_0 = 0; +int g_int_0_1 = 1; + +int dummy_f_0_0(int n) { + return n*4; +} + +int main (int argc, char** argv) { + return 123; +} diff --git a/bruiser/wasm/test/linker/file0.wasm b/bruiser/wasm/test/linker/file0.wasm Binary files differnew file mode 100644 index 0000000..4d1f04f --- /dev/null +++ b/bruiser/wasm/test/linker/file0.wasm diff --git a/bruiser/wasm/test/linker/file0.wast b/bruiser/wasm/test/linker/file0.wast new file mode 100644 index 0000000..0fd44fe --- /dev/null +++ b/bruiser/wasm/test/linker/file0.wast @@ -0,0 +1,71 @@ +(module + (type $FUNCSIG$ii (func (param i32) (result i32))) + (type $FUNCSIG$iii (func (param i32 i32) (result i32))) + (import "env" "printf" (func $printf (param i32 i32) (result i32))) + (table 0 anyfunc) + (memory $0 1) + (data (i32.const 16) "external symbol\00") + (data (i32.const 32) "\n\00\00\00") + (data (i32.const 36) "\0b\00\00\00") + (data (i32.const 40) "\00\00\00\00") + (data (i32.const 44) "\01\00\00\00") + (export "memory" (memory $0)) + (export "print" (func $print)) + (export "dummy_f_1_0" (func $dummy_f_1_0)) + (export "dymmy_f_1_1" (func $dymmy_f_1_1)) + (export "dummy_f_0_0" (func $dummy_f_0_0)) + (export "main" (func $main)) + (func $print (; 1 ;) + (drop + (call $printf + (i32.const 16) + (i32.const 0) + ) + ) + ) + (func $dummy_f_1_0 (; 2 ;) (param $0 i32) (result i32) + (local $1 i32) + (set_local $1 + (i32.const 1) + ) + (block $label$0 + (loop $label$1 + (br_if $label$0 + (i32.lt_s + (get_local $0) + (i32.const 1) + ) + ) + (set_local $1 + (i32.mul + (get_local $0) + (get_local $1) + ) + ) + (set_local $0 + (i32.add + (get_local $0) + (i32.const -1) + ) + ) + (br $label$1) + ) + ) + (get_local $1) + ) + (func $dymmy_f_1_1 (; 3 ;) (param $0 i32) (result i32) + (i32.shl + (get_local $0) + (i32.const 1) + ) + ) + (func $dummy_f_0_0 (; 4 ;) (param $0 i32) (result i32) + (i32.shl + (get_local $0) + (i32.const 2) + ) + ) + (func $main (; 5 ;) (param $0 i32) (param $1 i32) (result i32) + (i32.const 123) + ) +) diff --git a/bruiser/wasm/test/linker/file1.c b/bruiser/wasm/test/linker/file1.c new file mode 100644 index 0000000..233eaad --- /dev/null +++ b/bruiser/wasm/test/linker/file1.c @@ -0,0 +1,25 @@ +#include <stdio.h> +#include <inttypes.h> +#if 1 +void print(void) { + printf("external symbol"); +} +#endif + +#define CODE_SECTION_1_0 "constant_1_0" +#define CODE_SECTION_1_1 "constant_1_1" +#define CODE_SECTION_1_2 "constant_1_2" +#define CODE_SECTION_1_3 "constant_1_3" +#define CODE_SECTION_1_4 "constant_1_4" + +int g_int_1_0 = 10; +int g_int_1_1 = 11; + +int dummy_f_1_0(int n) { + if (n >= 1) return dummy_f_1_0(n-1) * n; + else return 1; +} + +int dymmy_f_1_1(int n) { + return n*2; +} diff --git a/bruiser/wasm/test/linker/file1.wasm b/bruiser/wasm/test/linker/file1.wasm Binary files differnew file mode 100644 index 0000000..8433b31 --- /dev/null +++ b/bruiser/wasm/test/linker/file1.wasm diff --git a/bruiser/wasm/test/linker/file1.wast b/bruiser/wasm/test/linker/file1.wast new file mode 100644 index 0000000..ec2cad7 --- /dev/null +++ b/bruiser/wasm/test/linker/file1.wast @@ -0,0 +1,58 @@ +(module + (type $FUNCSIG$ii (func (param i32) (result i32))) + (type $FUNCSIG$iii (func (param i32 i32) (result i32))) + (import "env" "printf" (func $printf (param i32 i32) (result i32))) + (table 0 anyfunc) + (memory $0 1) + (data (i32.const 16) "external symbol\00") + (data (i32.const 32) "\n\00\00\00") + (data (i32.const 36) "\0b\00\00\00") + (export "memory" (memory $0)) + (export "print" (func $print)) + (export "dummy_f_1_0" (func $dummy_f_1_0)) + (export "dymmy_f_1_1" (func $dymmy_f_1_1)) + (func $print (; 1 ;) + (drop + (call $printf + (i32.const 16) + (i32.const 0) + ) + ) + ) + (func $dummy_f_1_0 (; 2 ;) (param $0 i32) (result i32) + (local $1 i32) + (set_local $1 + (i32.const 1) + ) + (block $label$0 + (loop $label$1 + (br_if $label$0 + (i32.lt_s + (get_local $0) + (i32.const 1) + ) + ) + (set_local $1 + (i32.mul + (get_local $0) + (get_local $1) + ) + ) + (set_local $0 + (i32.add + (get_local $0) + (i32.const -1) + ) + ) + (br $label$1) + ) + ) + (get_local $1) + ) + (func $dymmy_f_1_1 (; 3 ;) (param $0 i32) (result i32) + (i32.shl + (get_local $0) + (i32.const 1) + ) + ) +) |