Skip to content

Commit

Permalink
Auto merge of #1926 - RalfJung:rustup, r=RalfJung
Browse files Browse the repository at this point in the history
rustup; stub support for some extern statics used for weak symbols
  • Loading branch information
bors committed Nov 27, 2021
2 parents 0949cd3 + d800d1e commit e62924e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5bc98076f37dd8c1476de4bbe0515c55a65332b7
686e313a9aa14107c8631ffe48fa09110a7692db
16 changes: 10 additions & 6 deletions src/machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,18 +228,22 @@ impl MemoryExtra {
) -> InterpResult<'tcx> {
match this.tcx.sess.target.os.as_str() {
"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"
Self::add_extern_static(
this,
"environ",
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" => {
// "_tls_used"
Expand Down

0 comments on commit e62924e

Please sign in to comment.