Auto merge of #3570 - devnexen:solaris_build_fix, r=RalfJung
Solaris: make pre-main code work Fixes https://github.com/rust-lang/miri/issues/3566
This commit is contained in:
commit
e43458cf06
5 changed files with 27 additions and 8 deletions
|
|
@ -227,7 +227,7 @@ degree documented below):
|
|||
- We have unofficial support (not maintained by the Miri team itself) for some further operating systems.
|
||||
- `freebsd`: **maintainer wanted**. Supports `std::env` and parts of `std::{thread, fs}`, but not `std::sync`.
|
||||
- `android`: **maintainer wanted**. Support very incomplete, but a basic "hello world" works.
|
||||
- `illumos`: maintained by @devnexen. Support very incomplete, but a basic "hello world" works.
|
||||
- `solaris` / `illumos`: maintained by @devnexen. Support very incomplete, but a basic "hello world" works.
|
||||
- `wasm`: **maintainer wanted**. Support very incomplete, not even standard output works, but an empty `main` function works.
|
||||
- For targets on other operating systems, Miri might fail before even reaching the `main` function.
|
||||
|
||||
|
|
|
|||
|
|
@ -146,8 +146,7 @@ case $HOST_TARGET in
|
|||
MIRI_TEST_TARGET=x86_64-unknown-freebsd run_tests_minimal $BASIC panic/panic concurrency/simple atomic threadname libc-misc libc-random libc-time fs env num_cpus
|
||||
MIRI_TEST_TARGET=i686-unknown-freebsd run_tests_minimal $BASIC panic/panic concurrency/simple atomic threadname libc-misc libc-random libc-time fs env num_cpus
|
||||
MIRI_TEST_TARGET=x86_64-unknown-illumos run_tests_minimal $VERY_BASIC hello panic/panic concurrency/simple pthread-sync libc-misc libc-random
|
||||
# TODO fix solaris stack guard
|
||||
# MIRI_TEST_TARGET=x86_64-pc-solaris run_tests_minimal $VERY_BASIC hello panic/panic pthread-sync
|
||||
MIRI_TEST_TARGET=x86_64-pc-solaris run_tests_minimal $VERY_BASIC hello panic/panic concurrency/simple pthread-sync libc-misc libc-random
|
||||
MIRI_TEST_TARGET=aarch64-linux-android run_tests_minimal $VERY_BASIC hello panic/panic
|
||||
MIRI_TEST_TARGET=wasm32-wasi run_tests_minimal $VERY_BASIC wasm
|
||||
MIRI_TEST_TARGET=wasm32-unknown-unknown run_tests_minimal $VERY_BASIC wasm
|
||||
|
|
|
|||
|
|
@ -42,9 +42,12 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
|
|||
let map_shared = this.eval_libc_i32("MAP_SHARED");
|
||||
let map_fixed = this.eval_libc_i32("MAP_FIXED");
|
||||
|
||||
// This is a horrible hack, but on MacOS the guard page mechanism uses mmap
|
||||
// This is a horrible hack, but on MacOS and Solaris the guard page mechanism uses mmap
|
||||
// in a way we do not support. We just give it the return value it expects.
|
||||
if this.frame_in_std() && this.tcx.sess.target.os == "macos" && (flags & map_fixed) != 0 {
|
||||
if this.frame_in_std()
|
||||
&& matches!(&*this.tcx.sess.target.os, "macos" | "solaris")
|
||||
&& (flags & map_fixed) != 0
|
||||
{
|
||||
return Ok(Scalar::from_maybe_pointer(Pointer::from_addr_invalid(addr), this));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ use rustc_span::Symbol;
|
|||
use rustc_target::spec::abi::Abi;
|
||||
|
||||
use crate::*;
|
||||
use shims::EmulateItemResult;
|
||||
|
||||
pub fn is_dyn_sym(_name: &str) -> bool {
|
||||
false
|
||||
|
|
@ -26,6 +25,24 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
|
|||
this.write_scalar(errno_place.to_ref(this).to_scalar(), dest)?;
|
||||
}
|
||||
|
||||
"stack_getbounds" => {
|
||||
let [stack] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
|
||||
let stack = this.deref_pointer_as(stack, this.libc_ty_layout("stack_t"))?;
|
||||
|
||||
this.write_int_fields_named(
|
||||
&[
|
||||
("ss_sp", this.machine.stack_addr.into()),
|
||||
("ss_size", this.machine.stack_size.into()),
|
||||
// field set to 0 means not in an alternate signal stack
|
||||
// https://docs.oracle.com/cd/E86824_01/html/E54766/stack-getbounds-3c.html
|
||||
("ss_flags", 0),
|
||||
],
|
||||
&stack,
|
||||
)?;
|
||||
|
||||
this.write_null(dest)?;
|
||||
}
|
||||
|
||||
_ => return Ok(EmulateItemResult::NotSupported),
|
||||
}
|
||||
Ok(EmulateItemResult::NeedsJumping)
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ fn test_dlsym() {
|
|||
assert_eq!(errno, libc::EBADF);
|
||||
}
|
||||
|
||||
#[cfg(not(any(target_os = "macos", target_os = "illumos")))]
|
||||
#[cfg(not(any(target_os = "macos", target_os = "illumos", target_os = "solaris")))]
|
||||
fn test_reallocarray() {
|
||||
unsafe {
|
||||
let mut p = libc::reallocarray(std::ptr::null_mut(), 4096, 2);
|
||||
|
|
@ -234,7 +234,7 @@ fn main() {
|
|||
test_strcpy();
|
||||
|
||||
test_memalign();
|
||||
#[cfg(not(any(target_os = "macos", target_os = "illumos")))]
|
||||
#[cfg(not(any(target_os = "macos", target_os = "illumos", target_os = "solaris")))]
|
||||
test_reallocarray();
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue