1 #include <stdint.h> 2 #include <stdlib.h> 3 4 #define CONCAT2(a, b) a##b 5 #define CONCAT(a, b) CONCAT2(a, b) 6 #define VERSIONED_SYMBOL(a) CONCAT(a, VERSIONED_SUFFIX) 7 8 #ifdef CFG_TARGET_OS_windows 9 // export required for external access. 10 __declspec(dllexport) 11 #else 12 // Note the `weak` linkage here, though, which is intended to let other code 13 // override this symbol if it's defined elsewhere, since this definition doesn't 14 // matter. 15 // Just in case cross-language LTO is enabled we set the `noinline` attribute 16 // and also try to have some sort of side effect in this function with a dummy 17 // `asm` statement. 18 __attribute__((weak, noinline)) 19 #endif 20 void __jit_debug_register_code() { 21 #ifndef CFG_TARGET_OS_windows 22 __asm__(""); 23 #endif 24 } 25 26 struct JITDescriptor { 27 uint32_t version_; 28 uint32_t action_flag_; 29 void *relevant_entry_; 30 void *first_entry_; 31 }; 32 33 #ifdef CFG_TARGET_OS_windows 34 // export required for external access. 35 __declspec(dllexport) 36 #else 37 // Note the `weak` linkage here which is the same purpose as above. We want to 38 // let other runtimes be able to override this since our own definition isn't 39 // important. 40 __attribute__((weak)) 41 #endif 42 struct JITDescriptor __jit_debug_descriptor = {1, 0, NULL, NULL}; 43 44 struct JITDescriptor *VERSIONED_SYMBOL(wasmtime_jit_debug_descriptor)() { 45 return &__jit_debug_descriptor; 46 } 47