Skip to content

Commit

Permalink
[DWARF] Fix debug intrinsics on Linux (#9866)
Browse files Browse the repository at this point in the history
* Test DWARF with --release

This would have caught the issue in CI.

It is also closer to what the end user will use.

* [prtest:debug] Use volatile for keep-alive

* Drop __attribute__((retain))

* Run tests in debug as well

* Remove debug testing; add comment
  • Loading branch information
SingleAccretion authored Dec 19, 2024
1 parent c81b6a9 commit 71ca453
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,8 @@ jobs:
# workaround for https://bugs.launchpad.net/ubuntu/+source/llvm-defaults/+bug/1972855
sudo mkdir -p /usr/lib/local/lib/python3.10/dist-packages/lldb
sudo ln -s /usr/lib/llvm-15/lib/python3.10/dist-packages/lldb/* /usr/lib/python3/dist-packages/lldb/
cargo test --test all -- --ignored --test-threads 1 debug::
# Only testing release since it is more likely to expose issues with our low-level symbol handling.
cargo test --release --test all -- --ignored --test-threads 1 debug::
env:
LLDB: lldb-15 # override default version, 14
Expand Down
9 changes: 8 additions & 1 deletion crates/wasmtime/src/runtime/vm/helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ void VERSIONED_SYMBOL(wasmtime_longjmp)(void *JmpBuf) {
#ifdef CFG_TARGET_OS_windows
#define DEBUG_BUILTIN_EXPORT __declspec(dllexport)
#else
#define DEBUG_BUILTIN_EXPORT __attribute__((used, retain))
#define DEBUG_BUILTIN_EXPORT
#endif

// This set of symbols is defined here in C because Rust's #[export_name]
Expand Down Expand Up @@ -163,6 +163,13 @@ __attribute__((weak, noinline))
void __jit_debug_register_code() {
#ifndef CFG_TARGET_OS_windows
__asm__("");
#ifdef FEATURE_DEBUG_BUILTINS
// Make sure these symbols do not get stripped by the compiler or linker.
void *volatile p;
p = (void *)&VERSIONED_SYMBOL(wasmtime_resolve_vmctx_memory_ptr);
p = (void *)&VERSIONED_SYMBOL(wasmtime_set_vmctx_memory);
(void)p;
#endif // FEATURE_DEBUG_BUILTINS
#endif
}

Expand Down

0 comments on commit 71ca453

Please sign in to comment.