Skip to content

Commit c17e68d

Browse files
committed
Auto merge of rust-lang#2300 - InfRandomness:freebsd-environ-extern-impl, r=RalfJung
Extend `environ` linux extern implementation to freebsd This fixes the `env` test on freebsd, and enables the CI test Signed-off-by: InfRandomness <[email protected]>
2 parents 24c5eaf + a26be7e commit c17e68d

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

ci.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ case $HOST_TARGET in
6060
MIRI_TEST_TARGET=i686-unknown-linux-gnu run_tests
6161
MIRI_TEST_TARGET=aarch64-apple-darwin run_tests
6262
MIRI_TEST_TARGET=i686-pc-windows-msvc run_tests
63-
MIRI_TEST_TARGET=x86_64-unknown-freebsd run_tests_minimal hello integer vec current_dir data_race
63+
MIRI_TEST_TARGET=x86_64-unknown-freebsd run_tests_minimal hello integer vec current_dir data_race env
6464
MIRI_TEST_TARGET=thumbv7em-none-eabihf MIRI_NO_STD=1 run_tests_minimal no_std # no_std embedded architecture
6565
;;
6666
x86_64-apple-darwin)

src/machine.rs

+8
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,14 @@ impl<'mir, 'tcx> Evaluator<'mir, 'tcx> {
442442
Self::add_extern_static(this, name, place.ptr);
443443
}
444444
}
445+
"freebsd" => {
446+
// "environ"
447+
Self::add_extern_static(
448+
this,
449+
"environ",
450+
this.machine.env_vars.environ.unwrap().ptr,
451+
);
452+
}
445453
"windows" => {
446454
// "_tls_used"
447455
// This is some obscure hack that is part of the Windows TLS story. It's a `u8`.

tests/fail/environ-gets-deallocated.rs

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

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

0 commit comments

Comments
 (0)