Skip to content

Commit

Permalink
Exports symbols to be shared with external GDB/JIT debugging interfac… (
Browse files Browse the repository at this point in the history
#3373)

* Exports symbols to be shared with external GDB/JIT debugging interface tools.
Windows O/S specific requirement.

* Moved comments into platform specific compiler directive sections.
  • Loading branch information
adv-sw authored Sep 20, 2021
1 parent f958c01 commit a8467d0
Showing 1 changed file with 20 additions and 13 deletions.
33 changes: 20 additions & 13 deletions crates/runtime/src/helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,16 @@ void wasmtime_longjmp(void *JmpBuf) {
platform_longjmp(*buf, 1);
}

// Just in case cross-language LTO is enabled we set the `noinline` attribute
// and also try to have some sort of side effect in this function with a dummy
// `asm` statement.
//
// Note the `weak` linkage here, though, which is intended to let other code
// override this symbol if it's defined elsewhere, since this definition doesn't
// matter.
#ifndef CFG_TARGET_OS_windows
#ifdef CFG_TARGET_OS_windows
// export required for external access.
__declspec(dllexport)
#else
// Note the `weak` linkage here, though, which is intended to let other code
// override this symbol if it's defined elsewhere, since this definition doesn't
// matter.
// Just in case cross-language LTO is enabled we set the `noinline` attribute
// and also try to have some sort of side effect in this function with a dummy
// `asm` statement.
__attribute__((weak, noinline))
#endif
void __jit_debug_register_code() {
Expand All @@ -84,14 +86,19 @@ struct JITDescriptor {
void* first_entry_;
};

// Note the `weak` linkage here which is the same purpose as above. We want to
// let other runtimes be able to override this since our own definition isn't
// important.
#ifndef CFG_TARGET_OS_windows
__attribute__((weak))
#ifdef CFG_TARGET_OS_windows
// export required for external access.
__declspec(dllexport)
#else
// Note the `weak` linkage here which is the same purpose as above. We want to
// let other runtimes be able to override this since our own definition isn't
// important.
__attribute__((weak))
#endif
struct JITDescriptor __jit_debug_descriptor = {1, 0, NULL, NULL};



struct JITDescriptor* wasmtime_jit_debug_descriptor() {
return &__jit_debug_descriptor;
}

0 comments on commit a8467d0

Please sign in to comment.