fix(runtime): do not export PERRY_AGENT_PTRS on Windows (MSVC TLS export breaks the build) - #11595
Conversation
MSVC targets cannot export TLS across images, so rustc emits a
thread-local shim under the static's own symbol name and a #[no_mangle]
#[thread_local] static fails to build ("symbol PERRY_AGENT_PTRS is already
defined"). Only ELF executables name the symbol; Windows takes the accessor
call. This broke every release build of perry-runtime for
x86_64-pc-windows-msvc (the gc-call-effects windows leg).
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 1 remain after this review. 📝 WalkthroughWalkthroughThe ChangesAgent pointer declaration
Priority: ➖ Normal Estimated code review effort: 1 (Trivial) | ~5 minutes Change: Bug fix · Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The Windows accessor path remains compatible with the conditional TLS export, and non-Windows targets retain the named symbol. No actionable merge-blocking risk is evident. Architecture SummaryArchitecture risk: 🔵 Low · up to The change affects 2 systems. Changed systems: Architecture concerns Review detailsSystems and components
Before / after behavior
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Every release build of perry-runtime for
x86_64-pc-windows-msvcis broken on main.crates/perry-runtime/src/agent_ptrs.rsdeclares#[no_mangle] #[thread_local] static PERRY_AGENT_PTRS(added with #11489). MSVC targets cannot export TLS across images, so rustc emits a thread-local shim under the static's own symbol name, and the build fails with "symbolPERRY_AGENT_PTRSis already defined".The fix is
#[cfg_attr(not(windows), no_mangle)]. Only ELF executables name the symbol (perry-codegen/src/expr/agent_ptr.rs); Windows already takes the accessor call. Nothing changes on other targets.It was found and reproduced with a minimal crate under
cargo xwinwhile rebasing #11565, whose Windows gc-call-effects leg it broke. The same commit is on #11565's branch; landing it separately unblocks Windows builds now.Validation
cargo xwin build --release -p perry-runtime --target x86_64-pc-windows-msvcfails before this change and succeeds after it.cargo check -p perry-runtimeis unchanged.Summary by CodeRabbit