@@ -54,14 +54,17 @@ pub enum MiriMemoryKind {
5454 C ,
5555 /// Windows `HeapAlloc` memory.
5656 WinHeap ,
57- /// Memory for args, errno, extern statics and other parts of the machine-managed environment.
57+ /// Memory for args, errno, and other parts of the machine-managed environment.
5858 /// This memory may leak.
5959 Machine ,
6060 /// Memory for env vars. Separate from `Machine` because we clean it up and leak-check it.
6161 Env ,
6262 /// Globals copied from `tcx`.
6363 /// This memory may leak.
6464 Global ,
65+ /// Memory for extern statics.
66+ /// This memory may leak.
67+ ExternGlobal ,
6568}
6669
6770impl Into < MemoryKind < MiriMemoryKind > > for MiriMemoryKind {
@@ -77,7 +80,7 @@ impl MayLeak for MiriMemoryKind {
7780 use self :: MiriMemoryKind :: * ;
7881 match self {
7982 Rust | C | WinHeap | Env => false ,
80- Machine | Global => true ,
83+ Machine | Global | ExternGlobal => true ,
8184 }
8285 }
8386}
@@ -92,6 +95,7 @@ impl fmt::Display for MiriMemoryKind {
9295 Machine => write ! ( f, "machine-managed memory" ) ,
9396 Env => write ! ( f, "environment variable" ) ,
9497 Global => write ! ( f, "global" ) ,
98+ ExternGlobal => write ! ( f, "extern global" ) ,
9599 }
96100 }
97101}
@@ -171,7 +175,7 @@ impl MemoryExtra {
171175 // "__cxa_thread_atexit_impl"
172176 // This should be all-zero, pointer-sized.
173177 let layout = this. machine . layouts . usize ;
174- let place = this. allocate ( layout, MiriMemoryKind :: Machine . into ( ) ) ;
178+ let place = this. allocate ( layout, MiriMemoryKind :: ExternGlobal . into ( ) ) ;
175179 this. write_scalar ( Scalar :: from_machine_usize ( 0 , this) , place. into ( ) ) ?;
176180 Self :: add_extern_static ( this, "__cxa_thread_atexit_impl" , place. ptr ) ;
177181 // "environ"
@@ -181,7 +185,7 @@ impl MemoryExtra {
181185 // "_tls_used"
182186 // This is some obscure hack that is part of the Windows TLS story. It's a `u8`.
183187 let layout = this. machine . layouts . u8 ;
184- let place = this. allocate ( layout, MiriMemoryKind :: Machine . into ( ) ) ;
188+ let place = this. allocate ( layout, MiriMemoryKind :: ExternGlobal . into ( ) ) ;
185189 this. write_scalar ( Scalar :: from_u8 ( 0 ) , place. into ( ) ) ?;
186190 Self :: add_extern_static ( this, "_tls_used" , place. ptr ) ;
187191 }
0 commit comments