diff options
Diffstat (limited to 'include/arch/x86_64/asm/vdso.h')
| -rw-r--r-- | include/arch/x86_64/asm/vdso.h | 29 |
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 |
