Skip to content

Commit 3b94ae9

Browse files
committed
Merge from rustc
2 parents 253be8d + 25accbd commit 3b94ae9

File tree

3 files changed

+8
-13
lines changed

3 files changed

+8
-13
lines changed

src/shims/extern_static.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//! Provides the `extern static` that this platform expects.
22
3-
use rustc_symbol_mangling::mangle_internal_symbol;
4-
53
use crate::*;
64

75
impl<'tcx> MiriMachine<'tcx> {
@@ -45,15 +43,6 @@ impl<'tcx> MiriMachine<'tcx> {
4543

4644
/// Sets up the "extern statics" for this machine.
4745
pub fn init_extern_statics(ecx: &mut MiriInterpCx<'tcx>) -> InterpResult<'tcx> {
48-
// "__rust_alloc_error_handler_should_panic"
49-
let val = ecx.tcx.sess.opts.unstable_opts.oom.should_panic();
50-
let val = ImmTy::from_int(val, ecx.machine.layouts.u8);
51-
Self::alloc_extern_static(
52-
ecx,
53-
&mangle_internal_symbol(*ecx.tcx, "__rust_alloc_error_handler_should_panic"),
54-
val,
55-
)?;
56-
5746
if ecx.target_os_is_unix() {
5847
// "environ" is mandated by POSIX.
5948
let environ = ecx.machine.env_vars.unix().environ();

src/shims/foreign_items.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,12 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
615615
// This is a no-op shim that only exists to prevent making the allocator shims instantly stable.
616616
let [] = this.check_shim(abi, CanonAbi::Rust, link_name, args)?;
617617
}
618+
name if name == this.mangle_internal_symbol("__rust_alloc_error_handler_should_panic_v2") => {
619+
// Gets the value of the `oom` option.
620+
let [] = this.check_shim(abi, CanonAbi::Rust, link_name, args)?;
621+
let val = this.tcx.sess.opts.unstable_opts.oom.should_panic();
622+
this.write_int(val, dest)?;
623+
}
618624

619625
// C memory handling functions
620626
"memcmp" => {

tests/pass/alloc-access-tracking.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#![no_std]
22
#![no_main]
3-
//@compile-flags: -Zmiri-track-alloc-id=21 -Zmiri-track-alloc-accesses -Cpanic=abort
4-
//@normalize-stderr-test: "id 21" -> "id $$ALLOC"
3+
//@compile-flags: -Zmiri-track-alloc-id=20 -Zmiri-track-alloc-accesses -Cpanic=abort
4+
//@normalize-stderr-test: "id 20" -> "id $$ALLOC"
55
//@only-target: linux # alloc IDs differ between OSes (due to extern static allocations)
66

77
extern "Rust" {

0 commit comments

Comments
 (0)