Skip to content

Commit fe12d38

Browse files
authored
Try to fix x86_64-apple-darwin release builds (#12245)
This is an attempt to address #12217 which applies a similar workaround found in #11960 to this naked function as well. Effectively it looks like `#[unsafe(naked)]` is buggy to the point that the user of the function symbol must be `#[inline(never)]` and in the same module, otherwise it won't work correctly. Closes #12217
1 parent ecd1cb3 commit fe12d38

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

crates/wasmtime/src/runtime/vm/stack_switching/stack/unix.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ impl VMContinuationStack {
258258

259259
let to_store = [
260260
// Data near top of stack:
261-
(0x08, (wasmtime_continuation_start as *const ()).addr()),
261+
(0x08, wasmtime_continuation_start_address().addr()),
262262
(0x10, tos.sub(0x10).addr()),
263263
(0x18, tos.sub(0x40 + args_data_size).addr()),
264264
(0x20, usize::try_from(args_capacity).unwrap()),

crates/wasmtime/src/runtime/vm/stack_switching/stack/unix/x86_64.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77

88
use core::arch::naked_asm;
99

10+
#[inline(never)] // FIXME(rust-lang/rust#148307)
11+
pub fn wasmtime_continuation_start_address() -> *const () {
12+
wasmtime_continuation_start as *const ()
13+
}
14+
1015
// This is a pretty special function that has no real signature. Its use is to
1116
// be the "base" function of all fibers. This entrypoint is used in
1217
// `wasmtime_continuation_init` to bootstrap the execution of a new fiber.

0 commit comments

Comments
 (0)