@@ -112,29 +112,23 @@ impl<'tcx> MemoryExtra<'tcx> {
112112 ) -> InterpResult < ' tcx > {
113113 let target_os = this. tcx . sess . target . target . target_os . as_str ( ) ;
114114 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- }
128- // "environ"
115+ "linux" => {
116+ // "__cxa_thread_atexit_impl"
117+ // This should be all-zero, pointer-sized.
129118 let layout = this. layout_of ( this. tcx . types . usize ) ?;
130119 let place = this. allocate ( layout, MiriMemoryKind :: Machine . into ( ) ) ;
131120 this. write_scalar ( Scalar :: from_machine_usize ( 0 , & * this. tcx ) , place. into ( ) ) ?;
132121 this. memory
133122 . extra
134123 . extern_statics
135- . insert ( Symbol :: intern ( "environ" ) , place. ptr . assert_ptr ( ) . alloc_id )
124+ . insert ( Symbol :: intern ( "__cxa_thread_atexit_impl" ) , place. ptr . assert_ptr ( ) . alloc_id )
125+ . unwrap_none ( ) ;
126+ // "environ"
127+ this. memory
128+ . extra
129+ . extern_statics
130+ . insert ( Symbol :: intern ( "environ" ) , this. memory . extra . environ . unwrap ( ) . ptr . assert_ptr ( ) . alloc_id )
136131 . unwrap_none ( ) ;
137- this. memory . extra . environ = Some ( place) ;
138132 }
139133 _ => { } // No "extern statics" supported on this platform
140134 }
0 commit comments