removed: incorrect magic bytes when runtime is `onyx`
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Sun, 3 Dec 2023 22:53:48 +0000 (16:53 -0600)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Sun, 3 Dec 2023 22:53:48 +0000 (16:53 -0600)
compiler/src/wasm_output.h
compiler/src/wasm_runtime.c
settings.sh

index a849939ec4e1546270927ec41a8663db521cc0b4..ee5273ae854743c2b87edd663eb925be1c45b023 100644 (file)
@@ -21,7 +21,6 @@
 
 typedef i32 vector_func(void*, bh_buffer*);
 
-static const u8 ONYX_MAGIC_STRING[] = "ONYX";
 static const u8 WASM_MAGIC_STRING[] = { 0x00, 0x61, 0x73, 0x6D };
 static const u8 WASM_VERSION[] = { 0x01, 0x00, 0x00, 0x00 };
 
@@ -1082,11 +1081,7 @@ static i32 output_ovm_debug_sections(OnyxWasmModule* module, bh_buffer* buff) {
 
 void onyx_wasm_module_write_to_buffer(OnyxWasmModule* module, bh_buffer* buffer) {
     bh_buffer_init(buffer, global_heap_allocator, 128);
-    if (context.options->runtime == Runtime_Onyx) {
-        bh_buffer_append(buffer, ONYX_MAGIC_STRING, 4);
-    } else {
-        bh_buffer_append(buffer, WASM_MAGIC_STRING, 4);
-    }
+    bh_buffer_append(buffer, WASM_MAGIC_STRING, 4);
     bh_buffer_append(buffer, WASM_VERSION, 4);
 
 #ifdef ENABLE_DEBUG_INFO
index dc3f491ecf6b13e5fb1584e31c8aaddc93485434..a50383307f1c3f3379ec04af175c1a430acb10dc 100644 (file)
@@ -604,16 +604,6 @@ void onyx_run_initialize(b32 debug_enabled) {
 
 b32 onyx_run_wasm(bh_buffer wasm_bytes, int argc, char *argv[]) {
     runtime = &wasm_runtime;
-
-    if (strncmp(wasm_bytes.data, "ONYX", 4)) {
-        printf("Bad magic bytes for Onyx binary.\n");
-        return 0;
-    }
-
-    wasm_bytes.data[0] = '\0';
-    wasm_bytes.data[1] = 'a';
-    wasm_bytes.data[2] = 's';
-    wasm_bytes.data[3] = 'm';
     wasm_raw_bytes = wasm_bytes;
 
     bh_arr(WasmFuncDefinition **) linkable_functions = NULL;
index d203f02057f3a4ef134a93adf3c8b903b85a45e1..b4307b7b233abdc385a29b4c1eccafdb9235cf11 100644 (file)
@@ -8,8 +8,8 @@ export ONYX_CC='gcc'
 # The architecture of your system. If your not sure, leave this alone.
 export ONYX_ARCH="$(uname | tr '[:upper:]' '[:lower:]')_$(uname -m)"
 
-export ONYX_RUNTIME_LIBRARY="ovmwasm"
-export ONYX_RUNTIME_LIBRARY="wasmer"
+export ONYX_RUNTIME_LIBRARY="ovmwasm"
+export ONYX_RUNTIME_LIBRARY="wasmer"
 
 # Enable Dynamic call
 export ONYX_USE_DYNCALL=1