@@ -54,14 +54,17 @@ pub enum MiriMemoryKind {
54
54
C ,
55
55
/// Windows `HeapAlloc` memory.
56
56
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.
58
58
/// This memory may leak.
59
59
Machine ,
60
60
/// Memory for env vars. Separate from `Machine` because we clean it up and leak-check it.
61
61
Env ,
62
62
/// Globals copied from `tcx`.
63
63
/// This memory may leak.
64
64
Global ,
65
+ /// Memory for extern statics.
66
+ /// This memory may leak.
67
+ ExternGlobal ,
65
68
}
66
69
67
70
impl Into < MemoryKind < MiriMemoryKind > > for MiriMemoryKind {
@@ -77,7 +80,7 @@ impl MayLeak for MiriMemoryKind {
77
80
use self :: MiriMemoryKind :: * ;
78
81
match self {
79
82
Rust | C | WinHeap | Env => false ,
80
- Machine | Global => true ,
83
+ Machine | Global | ExternGlobal => true ,
81
84
}
82
85
}
83
86
}
@@ -92,6 +95,7 @@ impl fmt::Display for MiriMemoryKind {
92
95
Machine => write ! ( f, "machine-managed memory" ) ,
93
96
Env => write ! ( f, "environment variable" ) ,
94
97
Global => write ! ( f, "global" ) ,
98
+ ExternGlobal => write ! ( f, "extern global" ) ,
95
99
}
96
100
}
97
101
}
@@ -171,7 +175,7 @@ impl MemoryExtra {
171
175
// "__cxa_thread_atexit_impl"
172
176
// This should be all-zero, pointer-sized.
173
177
let layout = this. machine . layouts . usize ;
174
- let place = this. allocate ( layout, MiriMemoryKind :: Machine . into ( ) ) ;
178
+ let place = this. allocate ( layout, MiriMemoryKind :: ExternGlobal . into ( ) ) ;
175
179
this. write_scalar ( Scalar :: from_machine_usize ( 0 , this) , place. into ( ) ) ?;
176
180
Self :: add_extern_static ( this, "__cxa_thread_atexit_impl" , place. ptr ) ;
177
181
// "environ"
@@ -181,7 +185,7 @@ impl MemoryExtra {
181
185
// "_tls_used"
182
186
// This is some obscure hack that is part of the Windows TLS story. It's a `u8`.
183
187
let layout = this. machine . layouts . u8 ;
184
- let place = this. allocate ( layout, MiriMemoryKind :: Machine . into ( ) ) ;
188
+ let place = this. allocate ( layout, MiriMemoryKind :: ExternGlobal . into ( ) ) ;
185
189
this. write_scalar ( Scalar :: from_u8 ( 0 ) , place. into ( ) ) ?;
186
190
Self :: add_extern_static ( this, "_tls_used" , place. ptr ) ;
187
191
}
0 commit comments