This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
PATCH: Use __vdso_xxxx instead of xxxx for x86-64
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: GNU C Library <libc-alpha at sourceware dot org>
- Date: Sat, 3 Mar 2012 09:41:47 -0800
- Subject: PATCH: Use __vdso_xxxx instead of xxxx for x86-64
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
Hi,
x86-64 defines both __vdso_xxxx and xxxx. x86-64 uses
void *p = _dl_vdso_vsym ("xxxx", &linux26);
We are adding x32:
https://sites.google.com/site/x32abi/
to Linux kernel 3.4. x32 vDSO only defines __vdso_xxxx, not xxxx:
http://git.kernel.org/?p=linux/kernel/git/next/linux-next.git;a=commit;h=862ae3132dc393ab6ea750b9ee9e0e1c276b9abb
This patch replaces __vdso_xxxx instead of xxxx for x86-64. Tested on
Linux/x86-64.
Thanks.
H.J.
---
2012-03-03 H.J. Lu <hongjiu.lu@intel.com>
* sysdeps/unix/sysv/linux/x86_64/gettimeofday.c (gettimeofday_ifunc):
Replace gettimeofday with __vdso_gettimeofday.
* sysdeps/unix/sysv/linux/x86_64/init-first.c (_libc_vdso_platform_setup):
Replace clock_gettime and getcpu with __vdso_clock_gettime and
__vdso_getcpu.
* sysdeps/unix/sysv/linux/x86_64/time.c (time_ifunc): Replace
time with __vdso_time.
diff --git a/sysdeps/unix/sysv/linux/x86_64/gettimeofday.c b/sysdeps/unix/sysv/linux/x86_64/gettimeofday.c
index a13948b..e41fddb 100644
--- a/sysdeps/unix/sysv/linux/x86_64/gettimeofday.c
+++ b/sysdeps/unix/sysv/linux/x86_64/gettimeofday.c
@@ -30,7 +30,7 @@ gettimeofday_ifunc (void)
PREPARE_VERSION (linux26, "LINUX_2.6", 61765110);
/* If the vDSO is not available we fall back on the old vsyscall. */
- return (_dl_vdso_vsym ("gettimeofday", &linux26)
+ return (_dl_vdso_vsym ("__vdso_gettimeofday", &linux26)
?: (void *) VSYSCALL_ADDR_vgettimeofday);
}
__asm (".type __gettimeofday, %gnu_indirect_function");
diff --git a/sysdeps/unix/sysv/linux/x86_64/init-first.c b/sysdeps/unix/sysv/linux/x86_64/init-first.c
index 0a9948b..e8b52ea 100644
--- a/sysdeps/unix/sysv/linux/x86_64/init-first.c
+++ b/sysdeps/unix/sysv/linux/x86_64/init-first.c
@@ -36,13 +36,13 @@ _libc_vdso_platform_setup (void)
{
PREPARE_VERSION (linux26, "LINUX_2.6", 61765110);
- void *p = _dl_vdso_vsym ("clock_gettime", &linux26);
+ void *p = _dl_vdso_vsym ("__vdso_clock_gettime", &linux26);
if (p == NULL)
p = __syscall_clock_gettime;
PTR_MANGLE (p);
__GI___vdso_clock_gettime = p;
- p = _dl_vdso_vsym ("getcpu", &linux26);
+ p = _dl_vdso_vsym ("__vdso_getcpu", &linux26);
/* If the vDSO is not available we fall back on the old vsyscall. */
#define VSYSCALL_ADDR_vgetcpu 0xffffffffff600800
if (p == NULL)
diff --git a/sysdeps/unix/sysv/linux/x86_64/time.c b/sysdeps/unix/sysv/linux/x86_64/time.c
index 67afff3..0e05ddd 100644
--- a/sysdeps/unix/sysv/linux/x86_64/time.c
+++ b/sysdeps/unix/sysv/linux/x86_64/time.c
@@ -28,7 +28,7 @@ time_ifunc (void)
PREPARE_VERSION (linux26, "LINUX_2.6", 61765110);
/* If the vDSO is not available we fall back on the old vsyscall. */
- return _dl_vdso_vsym ("time", &linux26) ?: (void *) VSYSCALL_ADDR_vtime;
+ return _dl_vdso_vsym ("__vdso_time", &linux26) ?: (void *) VSYSCALL_ADDR_vtime;
}
__asm (".type time, %gnu_indirect_function");