diff --git a/build-cross.py b/build-cross.py index 3e303c5..87e32cc 100755 --- a/build-cross.py +++ b/build-cross.py @@ -78,7 +78,7 @@ def build_wasi(target): run(f""" mkdir -p {build_dir} cd {build_dir} - cmake -DCMAKE_TOOLCHAIN_FILE="{WASI_SDK_PATH}/share/cmake/wasi-sdk.cmake" -DWASI_SDK_PREFIX="{WASI_SDK_PATH}" ../.. + cmake -GNinja -DCMAKE_TOOLCHAIN_FILE="{WASI_SDK_PATH}/share/cmake/wasi-sdk.cmake" -DWASI_SDK_PREFIX="{WASI_SDK_PATH}" ../.. cmake --build . cp wasm3.wasm ../wasm3-{target['name']}.wasm """) @@ -114,7 +114,7 @@ def build_musl(target): export CC="../../{muslcc}" export CFLAGS="{target['cflags']}" export LDFLAGS="-static -s" - cmake -DBUILD_NATIVE=OFF ../.. + cmake -GNinja -DBUILD_NATIVE=OFF ../.. cmake --build . cp wasm3 ../wasm3-{target['name']} """) diff --git a/source/m3_compile.c b/source/m3_compile.c index 4e6697a..d253fec 100644 --- a/source/m3_compile.c +++ b/source/m3_compile.c @@ -679,8 +679,7 @@ M3Result PushConst (IM3Compilation o, u64 i_word, u8 i_type) { if (IsSlotAllocated (o, slot) and IsSlotAllocated (o, slot + 1)) { - u64 constant; - memcpy (&constant, &o->constants [slot - o->slotFirstConstIndex], sizeof (constant)); + u64 constant = * (u64 *) & o->constants [slot - o->slotFirstConstIndex]; if (constant == i_word) { @@ -701,9 +700,9 @@ _ (Push (o, i_type, slot)); { u64 constant; if (is64BitType) { - memcpy(&constant, & o->constants [i], sizeof(u64)); + constant = * (u64 *) & o->constants [i]; } else { - memcpy(&constant, & o->constants [i], sizeof(u32)); + constant = * (u32 *) & o->constants [i]; } if (constant == i_word) { @@ -740,10 +739,15 @@ _ (PushAllocatedSlotAndEmit (o, i_type)); d_m3Assert(constTableIndex < d_m3MaxConstantTableSize); - if (is64BitType) { - memcpy (& o->constants [constTableIndex], &i_word, sizeof(u64)); - } else { - memcpy (& o->constants [constTableIndex], &i_word, sizeof(u32)); + if (is64BitType) + { + u64 * constant = (u64 *) & o->constants [constTableIndex]; + * constant = i_word; + } + else + { + u32 * constant = (u32 *) & o->constants [constTableIndex]; + * constant = (u32) i_word; } _ (Push (o, i_type, slot)); diff --git a/source/m3_config.h b/source/m3_config.h index a7f1532..c2403c2 100644 --- a/source/m3_config.h +++ b/source/m3_config.h @@ -62,7 +62,7 @@ # endif # ifndef d_m3RecordBacktraces -# define d_m3RecordBacktraces 0 +# define d_m3RecordBacktraces 1 # endif # ifndef d_m3EnableExceptionBreakpoint