Files
rust/library
Jonathan Brouwer c00735c1c3 Rollup merge of #160183 - Darksonn:seh-imgrel, r=Mark-Simulacrum
panic_unwind: Use global_asm! for IMGREL relocations

Rust consteval cannot construct 32-bit values that contain the offset between two symbols, but this is required for panic_unwind on some architectures because unwinding on Windows SEH uses image-base-relative pointers for the panic information (which makes them fit in 32-bit rather than 64-bit).

Currently, this is worked around by initializing these globals on panic with atomic stores. This works, but is undefined behavior as the panic runtime reads the values with non-atomic loads, which leads to a data race.

Instead, utilize `global_asm!` to create the globals with `@IMGREL` relocations so that the linker constructs the relative pointers for us at link or load time.

For context: [#t-compiler > relative pointers in windows SEH panic_unwind @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/relative.20pointers.20in.20windows.20SEH.20panic_unwind/near/613200087)

AI assistance was involved with writing the assembly code.
2026-08-26 08:00:56 +02:00
..
2026-08-25 18:15:18 +00:00
2026-08-19 09:27:38 -07:00
2026-08-23 14:10:31 +02:00
2026-08-25 18:15:16 +00:00