From d71076c9826ddd66bfcc04b9a6ded9dbf540d239 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20R=C3=B8nne=20Petersen?= Date: Sat, 3 Aug 2024 18:46:04 +0200 Subject: [PATCH] std.os.linux: Replace `@hasDecl()` with `!= void` check for VDSO. If there is a VDSO, it will have clock_gettime(). The main thing we're concerned about is architectures that don't have a VDSO at all, of which there are a few. --- lib/std/os/linux.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/std/os/linux.zig b/lib/std/os/linux.zig index 198481c373..7eb0fdba69 100644 --- a/lib/std/os/linux.zig +++ b/lib/std/os/linux.zig @@ -1399,7 +1399,7 @@ const VdsoClockGettime = *align(1) const fn (clockid_t, *timespec) callconv(.C) var vdso_clock_gettime: ?VdsoClockGettime = &init_vdso_clock_gettime; pub fn clock_gettime(clk_id: clockid_t, tp: *timespec) usize { - if (@hasDecl(VDSO, "CGT_SYM")) { + if (VDSO != void) { const ptr = @atomicLoad(?VdsoClockGettime, &vdso_clock_gettime, .unordered); if (ptr) |f| { const rc = f(clk_id, tp);