rustup; stub support for some extern statics used for weak symbols
This commit is contained in:
parent
0949cd36c3
commit
d800d1e2cb
@ -1 +1 @@
|
|||||||
5bc98076f37dd8c1476de4bbe0515c55a65332b7
|
686e313a9aa14107c8631ffe48fa09110a7692db
|
||||||
|
@ -228,18 +228,22 @@ impl MemoryExtra {
|
|||||||
) -> InterpResult<'tcx> {
|
) -> InterpResult<'tcx> {
|
||||||
match this.tcx.sess.target.os.as_str() {
|
match this.tcx.sess.target.os.as_str() {
|
||||||
"linux" => {
|
"linux" => {
|
||||||
// "__cxa_thread_atexit_impl"
|
|
||||||
// This should be all-zero, pointer-sized.
|
|
||||||
let layout = this.machine.layouts.usize;
|
|
||||||
let place = this.allocate(layout, MiriMemoryKind::ExternStatic.into())?;
|
|
||||||
this.write_scalar(Scalar::from_machine_usize(0, this), &place.into())?;
|
|
||||||
Self::add_extern_static(this, "__cxa_thread_atexit_impl", place.ptr);
|
|
||||||
// "environ"
|
// "environ"
|
||||||
Self::add_extern_static(
|
Self::add_extern_static(
|
||||||
this,
|
this,
|
||||||
"environ",
|
"environ",
|
||||||
this.machine.env_vars.environ.unwrap().ptr,
|
this.machine.env_vars.environ.unwrap().ptr,
|
||||||
);
|
);
|
||||||
|
// A couple zero-initialized pointer-sized extern statics.
|
||||||
|
// Most of them are for weak symbols, which we all set to null (indicating that the
|
||||||
|
// symbol is not supported, and triggering fallback code which ends up calling a
|
||||||
|
// syscall that we do support).
|
||||||
|
for name in &["__cxa_thread_atexit_impl", "getrandom", "statx"] {
|
||||||
|
let layout = this.machine.layouts.usize;
|
||||||
|
let place = this.allocate(layout, MiriMemoryKind::ExternStatic.into())?;
|
||||||
|
this.write_scalar(Scalar::from_machine_usize(0, this), &place.into())?;
|
||||||
|
Self::add_extern_static(this, name, place.ptr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
"windows" => {
|
"windows" => {
|
||||||
// "_tls_used"
|
// "_tls_used"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user