Merge pull request #20922 from alexrp/vdso

`std.os.linux`: Fix VDSO for mips, add VDSO for riscv
This commit is contained in:
Andrew Kelley 2024-08-07 01:18:35 -07:00 committed by GitHub
commit 75f78bfb77
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 13 additions and 7 deletions

View File

@ -1397,7 +1397,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);

View File

@ -242,8 +242,8 @@ pub const F = struct {
pub const MMAP2_UNIT = 4096;
pub const VDSO = struct {
pub const CGT_SYM = "__kernel_clock_gettime";
pub const CGT_VER = "LINUX_2.6.39";
pub const CGT_SYM = "__vdso_clock_gettime";
pub const CGT_VER = "LINUX_2.6";
};
pub const Flock = extern struct {

View File

@ -227,8 +227,8 @@ pub const F = struct {
pub const MMAP2_UNIT = 4096;
pub const VDSO = struct {
pub const CGT_SYM = "__kernel_clock_gettime";
pub const CGT_VER = "LINUX_2.6.39";
pub const CGT_SYM = "__vdso_clock_gettime";
pub const CGT_VER = "LINUX_2.6";
};
pub const Flock = extern struct {

View File

@ -188,7 +188,10 @@ pub const Elf_Symndx = u32;
pub const MMAP2_UNIT = 4096;
pub const VDSO = struct {};
pub const VDSO = struct {
pub const CGT_SYM = "__vdso_clock_gettime";
pub const CGT_VER = "LINUX_4.15";
};
/// TODO
pub const ucontext_t = void;

View File

@ -215,7 +215,10 @@ pub const Stat = extern struct {
pub const Elf_Symndx = u32;
pub const VDSO = struct {};
pub const VDSO = struct {
pub const CGT_SYM = "__vdso_clock_gettime";
pub const CGT_VER = "LINUX_4.15";
};
/// TODO
pub const ucontext_t = void;