summaryrefslogtreecommitdiff
path: root/include/arch/x86_64/asm/vdso.h
diff options
context:
space:
mode:
authorKacper <kacper@mail.openlinux.dev>2025-12-22 23:27:56 +0100
committerKacper <kacper@mail.openlinux.dev>2025-12-22 23:30:32 +0100
commit0f30d227497418c6d3bef7d52244407e30454504 (patch)
tree0e1ac19623d3268380cf74328cdf643648a2f43c /include/arch/x86_64/asm/vdso.h
parent90dad97fc07f049383903a166631e2c257f9b8c1 (diff)
Added c11 threads, fixed some locks and add *_unlocked functions
Diffstat (limited to 'include/arch/x86_64/asm/vdso.h')
-rw-r--r--include/arch/x86_64/asm/vdso.h29
1 files changed, 21 insertions, 8 deletions
diff --git a/include/arch/x86_64/asm/vdso.h b/include/arch/x86_64/asm/vdso.h
index 7f0ea2aa..2fb34473 100644
--- a/include/arch/x86_64/asm/vdso.h
+++ b/include/arch/x86_64/asm/vdso.h
@@ -1,22 +1,35 @@
#ifndef __ASM_VDSO_H
#define __ASM_VDSO_H
+/*
+ * vDSO support interface.
+ *
+ * IMPORTANT:
+ * Do not define storage in this header. This header is included by multiple
+ * translation units; defining `static` variables here causes each TU to get its
+ * own copy, which makes initialization inconsistent and prevents dead-stripping.
+ *
+ * The actual storage/definitions must live in a single .c file (e.g.
+ * `lib/libc/internal/init/vdso.c`), and this header should only declare them.
+ */
+
struct timespec;
#define __VDSO_CLOCK_GETTIME
#define __VDSO_GETCPU
#define __VDSO_TIME
-static int (*__vdso_clock_gettime)(int, struct timespec *) = 0;
-static int (*__vdso_getcpu)(unsigned *, unsigned *, void *) = 0;
-static int (*__vdso_time)(long *) = 0;
+/* Resolved vDSO entry points (set by __init_vdso). */
+extern int (*__vdso_clock_gettime)(int, struct timespec *);
+extern int (*__vdso_getcpu)(unsigned *, unsigned *, void *);
+extern int (*__vdso_time)(long *);
-struct {
+/* Symbol table used by __init_vdso to locate vDSO functions. */
+struct __vdso_sym {
const char *name;
void *func;
-} __vdso_symtab[] = { { "__vdso_clock_gettime", (void *)&__vdso_clock_gettime },
- { "__vdso_getcpu", (void *)&__vdso_getcpu },
- { "__vdso_time", (void *)&__vdso_time },
- { 0, 0 } };
+};
+
+extern struct __vdso_sym __vdso_symtab[];
#endif