about summary refs log tree commit diff
path: root/library/panic_unwind
diff options
context:
space:
mode:
authorJubilee Young <workingjubilee@gmail.com>2024-05-31 18:28:03 -0700
committerJubilee Young <workingjubilee@gmail.com>2024-07-22 14:54:36 -0700
commitbf454afcaabb2406dda5e5d880ad061750caf4a8 (patch)
treea062538b03aa6c827c9f9cbeb592742568c9d8b0 /library/panic_unwind
parent3fdd8d5ef3a8b26c3e24d9baf706fc7fb16717f9 (diff)
library: vary unsafety in bootstrapping for SEH
Diffstat (limited to 'library/panic_unwind')
-rw-r--r--library/panic_unwind/src/seh.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/library/panic_unwind/src/seh.rs b/library/panic_unwind/src/seh.rs
index 04c3d3bf9c3..82c248c5a7b 100644
--- a/library/panic_unwind/src/seh.rs
+++ b/library/panic_unwind/src/seh.rs
@@ -157,7 +157,10 @@ mod imp {
             // going to be cross-lang LTOed anyway. However, using expose is shorter and
             // requires less unsafe.
             let addr: usize = ptr.expose_provenance();
+            #[cfg(bootstrap)]
             let image_base = unsafe { addr_of!(__ImageBase) }.addr();
+            #[cfg(not(bootstrap))]
+            let image_base = addr_of!(__ImageBase).addr();
             let offset: usize = addr - image_base;
             Self(offset as u32)
         }
@@ -250,7 +253,10 @@ extern "C" {
 // This is fine since the MSVC runtime uses string comparison on the type name
 // to match TypeDescriptors rather than pointer equality.
 static mut TYPE_DESCRIPTOR: _TypeDescriptor = _TypeDescriptor {
+    #[cfg(bootstrap)]
     pVFTable: unsafe { addr_of!(TYPE_INFO_VTABLE) } as *const _,
+    #[cfg(not(bootstrap))]
+    pVFTable: addr_of!(TYPE_INFO_VTABLE) as *const _,
     spare: core::ptr::null_mut(),
     name: TYPE_NAME,
 };