@@ -110,19 +110,21 @@ impl<'tcx> MemoryExtra<'tcx> {
110110 pub fn init_extern_statics < ' mir > (
111111 this : & mut MiriEvalContext < ' mir , ' tcx > ,
112112 ) -> InterpResult < ' tcx > {
113- match this. tcx . sess . target . target . target_os . as_str ( ) {
114- "linux" => {
115- // "__cxa_thread_atexit_impl"
116- // This should be all-zero, pointer-sized.
117- let layout = this. layout_of ( this. tcx . types . usize ) ?;
118- let place = this. allocate ( layout, MiriMemoryKind :: Machine . into ( ) ) ;
119- this. write_scalar ( Scalar :: from_machine_usize ( 0 , & * this. tcx ) , place. into ( ) ) ?;
120- this. memory
121- . extra
122- . extern_statics
123- . insert ( Symbol :: intern ( "__cxa_thread_atexit_impl" ) , place. ptr . assert_ptr ( ) . alloc_id )
124- . unwrap_none ( ) ;
125-
113+ let target_os = this. tcx . sess . target . target . target_os . as_str ( ) ;
114+ match target_os {
115+ "linux" | "macos" => {
116+ if target_os == "linux" {
117+ // "__cxa_thread_atexit_impl"
118+ // This should be all-zero, pointer-sized.
119+ let layout = this. layout_of ( this. tcx . types . usize ) ?;
120+ let place = this. allocate ( layout, MiriMemoryKind :: Machine . into ( ) ) ;
121+ this. write_scalar ( Scalar :: from_machine_usize ( 0 , & * this. tcx ) , place. into ( ) ) ?;
122+ this. memory
123+ . extra
124+ . extern_statics
125+ . insert ( Symbol :: intern ( "__cxa_thread_atexit_impl" ) , place. ptr . assert_ptr ( ) . alloc_id )
126+ . unwrap_none ( ) ;
127+ }
126128 // "environ"
127129 let layout = this. layout_of ( this. tcx . types . usize ) ?;
128130 let place = this. allocate ( layout, MiriMemoryKind :: Machine . into ( ) ) ;
0 commit comments