Skip to content

Commit 71ca453

Browse files
[DWARF] Fix debug intrinsics on Linux (bytecodealliance#9866)
* 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
1 parent c81b6a9 commit 71ca453

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,8 @@ jobs:
860860
# workaround for https://bugs.launchpad.net/ubuntu/+source/llvm-defaults/+bug/1972855
861861
sudo mkdir -p /usr/lib/local/lib/python3.10/dist-packages/lldb
862862
sudo ln -s /usr/lib/llvm-15/lib/python3.10/dist-packages/lldb/* /usr/lib/python3/dist-packages/lldb/
863-
cargo test --test all -- --ignored --test-threads 1 debug::
863+
# Only testing release since it is more likely to expose issues with our low-level symbol handling.
864+
cargo test --release --test all -- --ignored --test-threads 1 debug::
864865
env:
865866
LLDB: lldb-15 # override default version, 14
866867

crates/wasmtime/src/runtime/vm/helpers.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ void VERSIONED_SYMBOL(wasmtime_longjmp)(void *JmpBuf) {
131131
#ifdef CFG_TARGET_OS_windows
132132
#define DEBUG_BUILTIN_EXPORT __declspec(dllexport)
133133
#else
134-
#define DEBUG_BUILTIN_EXPORT __attribute__((used, retain))
134+
#define DEBUG_BUILTIN_EXPORT
135135
#endif
136136

137137
// This set of symbols is defined here in C because Rust's #[export_name]
@@ -163,6 +163,13 @@ __attribute__((weak, noinline))
163163
void __jit_debug_register_code() {
164164
#ifndef CFG_TARGET_OS_windows
165165
__asm__("");
166+
#ifdef FEATURE_DEBUG_BUILTINS
167+
// Make sure these symbols do not get stripped by the compiler or linker.
168+
void *volatile p;
169+
p = (void *)&VERSIONED_SYMBOL(wasmtime_resolve_vmctx_memory_ptr);
170+
p = (void *)&VERSIONED_SYMBOL(wasmtime_set_vmctx_memory);
171+
(void)p;
172+
#endif // FEATURE_DEBUG_BUILTINS
166173
#endif
167174
}
168175

0 commit comments

Comments
 (0)