@@ -35,6 +35,16 @@ pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
35
35
drop_in_place ( to_drop) ;
36
36
}
37
37
38
+ // Frame unwind info registration
39
+ //
40
+ // Each module's image contains a frame unwind info section (usually
41
+ // ".eh_frame"). When a module is loaded/unloaded into the process, the
42
+ // unwinder must be informed about the location of this section in memory. The
43
+ // methods of achieving that vary by the platform. On some (e.g., Linux), the
44
+ // unwinder can discover unwind info sections on its own (by dynamically
45
+ // enumerating currently loaded modules via the dl_iterate_phdr() API and
46
+ // finding their ".eh_frame" sections); Others, like Windows, require modules
47
+ // to actively register their unwind info sections via unwinder API.
38
48
#[ cfg( all( target_os = "windows" , target_arch = "x86" , target_env = "gnu" ) ) ]
39
49
pub mod eh_frames {
40
50
#[ no_mangle]
@@ -62,20 +72,19 @@ pub mod eh_frames {
62
72
}
63
73
64
74
// Unwind info registration/deregistration routines.
65
- // See the docs of libpanic_unwind.
66
75
extern "C" {
67
- fn rust_eh_register_frames ( eh_frame_begin : * const u8 , object : * mut u8 ) ;
68
- fn rust_eh_unregister_frames ( eh_frame_begin : * const u8 , object : * mut u8 ) ;
76
+ fn __register_frame_info ( eh_frame_begin : * const u8 , object : * mut u8 ) ;
77
+ fn __deregister_frame_info ( eh_frame_begin : * const u8 , object : * mut u8 ) ;
69
78
}
70
79
71
80
unsafe extern "C" fn init ( ) {
72
81
// register unwind info on module startup
73
- rust_eh_register_frames ( & __EH_FRAME_BEGIN__ as * const u8 , & mut OBJ as * mut _ as * mut u8 ) ;
82
+ __register_frame_info ( & __EH_FRAME_BEGIN__ as * const u8 , & mut OBJ as * mut _ as * mut u8 ) ;
74
83
}
75
84
76
85
unsafe extern "C" fn uninit ( ) {
77
86
// unregister on shutdown
78
- rust_eh_unregister_frames ( & __EH_FRAME_BEGIN__ as * const u8 , & mut OBJ as * mut _ as * mut u8 ) ;
87
+ __deregister_frame_info ( & __EH_FRAME_BEGIN__ as * const u8 , & mut OBJ as * mut _ as * mut u8 ) ;
79
88
}
80
89
81
90
// MinGW-specific init/uninit routine registration
0 commit comments