about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2023-10-25 10:03:09 +0200
committerRalf Jung <post@ralfj.de>2023-10-25 10:03:09 +0200
commit19c4fa60eaddb0ea47130644a01127fc4f516452 (patch)
tree4b1bfefdc879e86993dc12a68e1dd6da8ab8cbb5
parent3751fb09c36c54daecd743106314430cfb469265 (diff)
downloadrust-19c4fa60eaddb0ea47130644a01127fc4f516452.tar.gz
rust-19c4fa60eaddb0ea47130644a01127fc4f516452.zip
CLOCK_UPTIME_RAW exists on all macos targets, not just the ARM ones
-rw-r--r--src/tools/miri/src/shims/time.rs12
-rw-r--r--src/tools/miri/tests/pass-dep/shims/libc-misc.rs2
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 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
             "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 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
         } 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);