Skip to content

Commit

Permalink
adding environ global to extern static operations.
Browse files Browse the repository at this point in the history
  • Loading branch information
devnexen committed May 12, 2024
1 parent 96c28e9 commit 7083a45
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/shims/extern_static.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ impl<'mir, 'tcx> MiriMachine<'mir, 'tcx> {
Self::null_ptr_extern_statics(this, &["bsd_signal"])?;
Self::weak_symbol_extern_statics(this, &["signal"])?;
}
"solaris" | "illumos" => {
let environ = this.machine.env_vars.unix().environ();
Self::add_extern_static(this, "environ", environ);
}
"windows" => {
// "_tls_used"
// This is some obscure hack that is part of the Windows TLS story. It's a `u8`.
Expand Down
2 changes: 1 addition & 1 deletion tests/fail/environ-gets-deallocated.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//@ignore-target-windows: Windows does not have a global environ list that the program can access directly

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

0 comments on commit 7083a45

Please sign in to comment.