From 19c4fa60eaddb0ea47130644a01127fc4f516452 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Wed, 25 Oct 2023 10:03:09 +0200 Subject: [PATCH] CLOCK_UPTIME_RAW exists on all macos targets, not just the ARM ones --- src/tools/miri/src/shims/time.rs | 12 ++++-------- src/tools/miri/tests/pass-dep/shims/libc-misc.rs | 2 +- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/tools/miri/src/shims/time.rs b/src/tools/miri/src/shims/time.rs index d6d0483f5e3..4918698c6b2 100644 --- a/src/tools/miri/src/shims/time.rs +++ b/src/tools/miri/src/shims/time.rs @@ -51,13 +51,10 @@ fn clock_gettime( "macos" => { absolute_clocks = vec![this.eval_libc_i32("CLOCK_REALTIME")]; relative_clocks = vec![this.eval_libc_i32("CLOCK_MONOTONIC")]; - // Some clocks only seem to exist in the aarch64 version of the target. - if this.tcx.sess.target.arch == "aarch64" { - // `CLOCK_UPTIME_RAW` supposed to not increment while the system is asleep... but - // that's not really something a program running inside Miri can tell, anyway. - // We need to support it because std uses it. - relative_clocks.push(this.eval_libc_i32("CLOCK_UPTIME_RAW")); - } + // `CLOCK_UPTIME_RAW` supposed to not increment while the system is asleep... but + // that's not really something a program running inside Miri can tell, anyway. + // We need to support it because std uses it. + relative_clocks.push(this.eval_libc_i32("CLOCK_UPTIME_RAW")); } target => throw_unsup_format!("`clock_gettime` is not supported on target OS {target}"), } @@ -68,7 +65,6 @@ fn clock_gettime( } else if relative_clocks.contains(&clk_id) { this.machine.clock.now().duration_since(this.machine.clock.anchor()) } else { - // Unsupported clock. let einval = this.eval_libc("EINVAL"); this.set_last_error(einval)?; return Ok(Scalar::from_i32(-1)); diff --git a/src/tools/miri/tests/pass-dep/shims/libc-misc.rs b/src/tools/miri/tests/pass-dep/shims/libc-misc.rs index 82c49cfb17c..40d3fa19e53 100644 --- a/src/tools/miri/tests/pass-dep/shims/libc-misc.rs +++ b/src/tools/miri/tests/pass-dep/shims/libc-misc.rs @@ -186,7 +186,7 @@ fn test_clocks() { unsafe { libc::clock_gettime(libc::CLOCK_MONOTONIC_COARSE, tp.as_mut_ptr()) }; assert_eq!(is_error, 0); } - #[cfg(all(target_os = "macos", target_arch = "aarch64"))] + #[cfg(target_os = "macos")] { let is_error = unsafe { libc::clock_gettime(libc::CLOCK_UPTIME_RAW, tp.as_mut_ptr()) }; assert_eq!(is_error, 0);