Skip to content

Commit 7083a45

Browse files
committed
adding environ global to extern static operations.
1 parent 96c28e9 commit 7083a45

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/shims/extern_static.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ impl<'mir, 'tcx> MiriMachine<'mir, 'tcx> {
7676
Self::null_ptr_extern_statics(this, &["bsd_signal"])?;
7777
Self::weak_symbol_extern_statics(this, &["signal"])?;
7878
}
79+
"solaris" | "illumos" => {
80+
let environ = this.machine.env_vars.unix().environ();
81+
Self::add_extern_static(this, "environ", environ);
82+
}
7983
"windows" => {
8084
// "_tls_used"
8185
// This is some obscure hack that is part of the Windows TLS story. It's a `u8`.

tests/fail/environ-gets-deallocated.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//@ignore-target-windows: Windows does not have a global environ list that the program can access directly
22

3-
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
3+
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "solaris", target_os = "illumos"))]
44
fn get_environ() -> *const *const u8 {
55
extern "C" {
66
static mut environ: *const *const u8;

0 commit comments

Comments
 (0)