From 381a95e59c2e8d03d609fdb8945ba09ecaee405c Mon Sep 17 00:00:00 2001 From: bloodstalker Date: Sat, 6 Oct 2018 15:17:25 +0330 Subject: fixed more bugs on ft and ltg side. i had some fundamental misunderstandings on how clang encodes wasm objects. todo: test custom section getters and setters, garbage collection, repacking --- bruiser/autogen/wasm/ft/autowasm.c | 14 ++++++------- bruiser/autogen/wasm/test/aggregate.wasm | Bin 0 -> 6668 bytes bruiser/autogen/wasm/test/read.wasm | Bin 0 -> 21963 bytes bruiser/autogen/wasm/wasm.xml | 33 +++++-------------------------- 4 files changed, 12 insertions(+), 35 deletions(-) create mode 100644 bruiser/autogen/wasm/test/aggregate.wasm create mode 100644 bruiser/autogen/wasm/test/read.wasm (limited to 'bruiser/autogen/wasm') diff --git a/bruiser/autogen/wasm/ft/autowasm.c b/bruiser/autogen/wasm/ft/autowasm.c index a766d2a..043f220 100644 --- a/bruiser/autogen/wasm/ft/autowasm.c +++ b/bruiser/autogen/wasm/ft/autowasm.c @@ -30,7 +30,7 @@ int main(int argc, char **argv) { wasm_lib_ret_t *lib_ret = read_aggr_wasm(wasm); printf("finished reading\n"); -#if 1 +#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); @@ -229,12 +229,12 @@ int main(int argc, char **argv) { } #endif - printf("sizeof magic:%d\n", sizeof(magic_number)); - printf("sizeof version:%d\n", sizeof(version)); - printf("current void count:%d\n", lib_ret->current_void_count); - printf("void_train first:0x%x\n", lib_ret->void_train[0]); - printf("void_train first:0x%x\n", lib_ret->void_train[1]); - printf("void_train self address:0x%x\n", lib_ret->void_train); + //printf("sizeof magic:%d\n", sizeof(magic_number)); + //printf("sizeof version:%d\n", sizeof(version)); + //printf("current void count:%d\n", lib_ret->current_void_count); + //printf("void_train first:0x%x\n", lib_ret->void_train[0]); + //printf("void_train first:0x%x\n", lib_ret->void_train[1]); + //printf("void_train self address:0x%x\n", lib_ret->void_train); // free(lib_ret->void_train[0]); // release_all(lib_ret->void_train, lib_ret->current_void_count); // free(lib_ret->void_train[2]); diff --git a/bruiser/autogen/wasm/test/aggregate.wasm b/bruiser/autogen/wasm/test/aggregate.wasm new file mode 100644 index 0000000..615e33b Binary files /dev/null and b/bruiser/autogen/wasm/test/aggregate.wasm differ diff --git a/bruiser/autogen/wasm/test/read.wasm b/bruiser/autogen/wasm/test/read.wasm new file mode 100644 index 0000000..838851e Binary files /dev/null and b/bruiser/autogen/wasm/test/read.wasm differ diff --git a/bruiser/autogen/wasm/wasm.xml b/bruiser/autogen/wasm/wasm.xml index db68ed7..e1b9b32 100644 --- a/bruiser/autogen/wasm/wasm.xml +++ b/bruiser/autogen/wasm/wasm.xml @@ -2,91 +2,68 @@ - + 1 - - 2 - - 3 - - 4 - - 5 - - - 6 - - 7 - - 8 - - 9 - - 10 - - 11 - - @@ -154,15 +131,15 @@ - + - - - + + + -- cgit v1.2.3