Auto merge of #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 <infrandomness@gmail.com>
This commit is contained in:
bors 2022-07-02 12:57:14 +00:00
commit c17e68d9be
3 changed files with 10 additions and 2 deletions

2
ci.sh
View File

@ -60,7 +60,7 @@ case $HOST_TARGET in
MIRI_TEST_TARGET=i686-unknown-linux-gnu run_tests
MIRI_TEST_TARGET=aarch64-apple-darwin run_tests
MIRI_TEST_TARGET=i686-pc-windows-msvc run_tests
MIRI_TEST_TARGET=x86_64-unknown-freebsd run_tests_minimal hello integer vec current_dir data_race
MIRI_TEST_TARGET=x86_64-unknown-freebsd run_tests_minimal hello integer vec current_dir data_race env
MIRI_TEST_TARGET=thumbv7em-none-eabihf MIRI_NO_STD=1 run_tests_minimal no_std # no_std embedded architecture
;;
x86_64-apple-darwin)

View File

@ -442,6 +442,14 @@ impl<'mir, 'tcx> Evaluator<'mir, 'tcx> {
Self::add_extern_static(this, name, place.ptr);
}
}
"freebsd" => {
// "environ"
Self::add_extern_static(
this,
"environ",
this.machine.env_vars.environ.unwrap().ptr,
);
}
"windows" => {
// "_tls_used"
// This is some obscure hack that is part of the Windows TLS story. It's a `u8`.

View File

@ -1,6 +1,6 @@
// ignore-windows: Windows does not have a global environ list that the program can access directly
#[cfg(target_os = "linux")]
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
fn get_environ() -> *const *const u8 {
extern "C" {
static mut environ: *const *const u8;