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.
This commit is contained in:
Alex Rønne Petersen 2024-08-03 18:46:04 +02:00
parent 624fa8523a
commit d71076c982
No known key found for this signature in database

View File

@ -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);