mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 00:03:43 +00:00
Remove custom frame info registration on i686-pc-windows-gnu
The indirection is no longer needed since we always link to libgcc even when the panic_abort runtime is used. Instead we can just call the libgcc functions directly.
This commit is contained in:
parent
5ff0876694
commit
c110329f25
@ -123,13 +123,4 @@ pub mod personalities {
|
||||
#[allow(non_upper_case_globals)]
|
||||
#[cfg(target_os = "emscripten")]
|
||||
static rust_eh_catch_typeinfo: [usize; 2] = [0; 2];
|
||||
|
||||
// These two are called by our startup objects on i686-pc-windows-gnu, but
|
||||
// they don't need to do anything so the bodies are nops.
|
||||
#[rustc_std_internal_symbol]
|
||||
#[cfg(all(target_os = "windows", target_env = "gnu", target_arch = "x86"))]
|
||||
pub extern "C" fn rust_eh_register_frames() {}
|
||||
#[rustc_std_internal_symbol]
|
||||
#[cfg(all(target_os = "windows", target_env = "gnu", target_arch = "x86"))]
|
||||
pub extern "C" fn rust_eh_unregister_frames() {}
|
||||
}
|
||||
|
@ -87,37 +87,3 @@ fn rust_exception_class() -> uw::_Unwind_Exception_Class {
|
||||
// M O Z \0 R U S T -- vendor, language
|
||||
0x4d4f5a_00_52555354
|
||||
}
|
||||
|
||||
// Frame unwind info registration
|
||||
//
|
||||
// Each module's image contains a frame unwind info section (usually
|
||||
// ".eh_frame"). When a module is loaded/unloaded into the process, the
|
||||
// unwinder must be informed about the location of this section in memory. The
|
||||
// methods of achieving that vary by the platform. On some (e.g., Linux), the
|
||||
// unwinder can discover unwind info sections on its own (by dynamically
|
||||
// enumerating currently loaded modules via the dl_iterate_phdr() API and
|
||||
// finding their ".eh_frame" sections); Others, like Windows, require modules
|
||||
// to actively register their unwind info sections via unwinder API.
|
||||
//
|
||||
// This module defines two symbols which are referenced and called from
|
||||
// rsbegin.rs to register our information with the GCC runtime. The
|
||||
// implementation of stack unwinding is (for now) deferred to libgcc_eh, however
|
||||
// Rust crates use these Rust-specific entry points to avoid potential clashes
|
||||
// with any GCC runtime.
|
||||
#[cfg(all(target_os = "windows", target_arch = "x86", target_env = "gnu"))]
|
||||
pub mod eh_frame_registry {
|
||||
extern "C" {
|
||||
fn __register_frame_info(eh_frame_begin: *const u8, object: *mut u8);
|
||||
fn __deregister_frame_info(eh_frame_begin: *const u8, object: *mut u8);
|
||||
}
|
||||
|
||||
#[rustc_std_internal_symbol]
|
||||
pub unsafe extern "C" fn rust_eh_register_frames(eh_frame_begin: *const u8, object: *mut u8) {
|
||||
__register_frame_info(eh_frame_begin, object);
|
||||
}
|
||||
|
||||
#[rustc_std_internal_symbol]
|
||||
pub unsafe extern "C" fn rust_eh_unregister_frames(eh_frame_begin: *const u8, object: *mut u8) {
|
||||
__deregister_frame_info(eh_frame_begin, object);
|
||||
}
|
||||
}
|
||||
|
@ -52,9 +52,6 @@ cfg_if::cfg_if! {
|
||||
all(target_family = "unix", not(target_os = "espidf")),
|
||||
all(target_vendor = "fortanix", target_env = "sgx"),
|
||||
))] {
|
||||
// Rust runtime's startup objects depend on these symbols, so make them public.
|
||||
#[cfg(all(target_os="windows", target_arch = "x86", target_env="gnu"))]
|
||||
pub use real_imp::eh_frame_registry::*;
|
||||
#[path = "gcc.rs"]
|
||||
mod real_imp;
|
||||
} else {
|
||||
|
@ -35,6 +35,16 @@ pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
|
||||
drop_in_place(to_drop);
|
||||
}
|
||||
|
||||
// Frame unwind info registration
|
||||
//
|
||||
// Each module's image contains a frame unwind info section (usually
|
||||
// ".eh_frame"). When a module is loaded/unloaded into the process, the
|
||||
// unwinder must be informed about the location of this section in memory. The
|
||||
// methods of achieving that vary by the platform. On some (e.g., Linux), the
|
||||
// unwinder can discover unwind info sections on its own (by dynamically
|
||||
// enumerating currently loaded modules via the dl_iterate_phdr() API and
|
||||
// finding their ".eh_frame" sections); Others, like Windows, require modules
|
||||
// to actively register their unwind info sections via unwinder API.
|
||||
#[cfg(all(target_os = "windows", target_arch = "x86", target_env = "gnu"))]
|
||||
pub mod eh_frames {
|
||||
#[no_mangle]
|
||||
@ -62,20 +72,19 @@ pub mod eh_frames {
|
||||
}
|
||||
|
||||
// Unwind info registration/deregistration routines.
|
||||
// See the docs of libpanic_unwind.
|
||||
extern "C" {
|
||||
fn rust_eh_register_frames(eh_frame_begin: *const u8, object: *mut u8);
|
||||
fn rust_eh_unregister_frames(eh_frame_begin: *const u8, object: *mut u8);
|
||||
fn __register_frame_info(eh_frame_begin: *const u8, object: *mut u8);
|
||||
fn __deregister_frame_info(eh_frame_begin: *const u8, object: *mut u8);
|
||||
}
|
||||
|
||||
unsafe extern "C" fn init() {
|
||||
// register unwind info on module startup
|
||||
rust_eh_register_frames(&__EH_FRAME_BEGIN__ as *const u8, &mut OBJ as *mut _ as *mut u8);
|
||||
__register_frame_info(&__EH_FRAME_BEGIN__ as *const u8, &mut OBJ as *mut _ as *mut u8);
|
||||
}
|
||||
|
||||
unsafe extern "C" fn uninit() {
|
||||
// unregister on shutdown
|
||||
rust_eh_unregister_frames(&__EH_FRAME_BEGIN__ as *const u8, &mut OBJ as *mut _ as *mut u8);
|
||||
__deregister_frame_info(&__EH_FRAME_BEGIN__ as *const u8, &mut OBJ as *mut _ as *mut u8);
|
||||
}
|
||||
|
||||
// MinGW-specific init/uninit routine registration
|
||||
|
Loading…
Reference in New Issue
Block a user