Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/11595-windows-agent-ptrs-export.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- **perry-runtime (Windows)**: `PERRY_AGENT_PTRS` is no longer `#[no_mangle]` on Windows. MSVC cannot export TLS across images, and the duplicate thread-local shim symbol broke every `x86_64-pc-windows-msvc` release build of perry-runtime since #11489.
8 changes: 7 additions & 1 deletion crates/perry-runtime/src/agent_ptrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,13 @@ pub struct AgentPtrs([Cell<*const u8>; AGENT_PTR_SLOTS]);
/// `#[thread_local]` (not `thread_local!`) because generated code must be able
/// to name the TLS symbol itself. Const-initialised and without drop glue, so
/// no destructor is registered and a late read during teardown sees null.
#[no_mangle]
///
/// Not exported on Windows: MSVC targets cannot export TLS across images, so
/// rustc emits a thread-local shim for the static under the same symbol name
/// and a `#[no_mangle]` static fails to build ("symbol `PERRY_AGENT_PTRS` is
/// already defined"). Only ELF executables name it
/// (`perry-codegen/src/expr/agent_ptr.rs`); Windows takes the accessor call.
#[cfg_attr(not(windows), no_mangle)]
#[thread_local]
pub static PERRY_AGENT_PTRS: AgentPtrs =
AgentPtrs([const { Cell::new(std::ptr::null()) }; AGENT_PTR_SLOTS]);
Expand Down
Loading