33
44//! Module for System V ABI unwind registry.
55
6- use core:: sync:: atomic:: {
7- AtomicBool , AtomicUsize ,
8- Ordering :: { self , Relaxed } ,
9- } ;
10- use std:: sync:: Once ;
6+ use core:: sync:: atomic:: { AtomicUsize , Ordering :: Relaxed } ;
117
128use crate :: types:: unwind:: CompiledFunctionUnwindInfoReference ;
139
@@ -143,12 +139,6 @@ impl UnwindRegistry {
143139
144140 #[ allow( clippy:: cast_ptr_alignment) ]
145141 unsafe fn register_frames ( & mut self , eh_frame : & [ u8 ] ) {
146- // Register atexit handler that will tell us if exit has been called.
147- static INIT : Once = Once :: new ( ) ;
148- INIT . call_once ( || unsafe {
149- libc:: atexit ( atexit_handler) ;
150- } ) ;
151-
152142 #[ cfg( all( target_os = "macos" , target_arch = "aarch64" ) ) ]
153143 {
154144 // Special call for macOS on aarch64 to register the `.eh_frame` section.
@@ -247,12 +237,6 @@ impl UnwindRegistry {
247237 }
248238}
249239
250- static EXIT_CALLED : AtomicBool = AtomicBool :: new ( false ) ;
251-
252- extern "C" fn atexit_handler ( ) {
253- EXIT_CALLED . store ( true , Ordering :: SeqCst ) ;
254- }
255-
256240impl Drop for UnwindRegistry {
257241 fn drop ( & mut self ) {
258242 if self . published {
@@ -274,12 +258,6 @@ impl Drop for UnwindRegistry {
274258
275259 #[ cfg( not( all( target_os = "macos" , target_arch = "aarch64" ) ) ) ]
276260 {
277- // We don't want to deregister frames in UnwindRegistry::Drop as that could be called during
278- // program shutdown and can collide with release_registered_frames and lead to
279- // crashes.
280- if EXIT_CALLED . load ( Ordering :: SeqCst ) {
281- return ;
282- }
283261 __deregister_frame ( * registration as * const _ ) ;
284262 }
285263 }
0 commit comments