You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
2.3 KiB

#
# commit d98720e07f67fbeec00f9e1347840404240d3c48
# Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com>
# Date: Mon Jan 20 12:29:51 2014 -0600
#
# PowerPC: Fix gettimeofday ifunc selection
#
# The IFUNC selector for gettimeofday runs before _libc_vdso_platform_setup where
# __vdso_gettimeofday is set. The selector then sets __gettimeofday (the internal
# version used within GLIBC) to use the system call version instead of the vDSO one.
# This patch changes the check if vDSO is available to get its value directly
# instead of rely on __vdso_gettimeofday.
#
# This patch changes it by getting the vDSO value directly.
#
# It fixes BZ#16431.
#
diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c
--- glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c 2015-01-15 16:07:59.167420456 -0500
+++ glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c 2015-01-15 16:07:41.408969001 -0500
@@ -34,9 +34,12 @@
void *
gettimeofday_ifunc (void)
{
+ PREPARE_VERSION (linux2615, "LINUX_2.6.15", 123718565);
+
/* If the vDSO is not available we fall back syscall. */
- return (__vdso_gettimeofday ? VDSO_IFUNC_RET (__vdso_gettimeofday)
- : __gettimeofday_syscall);
+ void *vdso_gettimeofday = _dl_vdso_vsym ("__kernel_gettimeofday", &linux2615);
+ return (vdso_gettimeofday ? VDSO_IFUNC_RET (vdso_gettimeofday)
+ : (void*)__gettimeofday_syscall);
}
asm (".type __gettimeofday, %gnu_indirect_function");
diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/time.c glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/time.c
--- glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/time.c 2015-01-15 16:07:59.168420425 -0500
+++ glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/time.c 2015-01-15 16:07:41.408969001 -0500
@@ -45,9 +45,12 @@
void *
time_ifunc (void)
{
+ PREPARE_VERSION (linux2615, "LINUX_2.6.15", 123718565);
+
/* If the vDSO is not available we fall back to the syscall. */
- return (__vdso_time ? VDSO_IFUNC_RET (__vdso_time)
- : time_syscall);
+ void *vdso_time = _dl_vdso_vsym ("__kernel_time", &linux2615);
+ return (vdso_time ? VDSO_IFUNC_RET (vdso_time)
+ : (void*)time_syscall);
}
asm (".type time, %gnu_indirect_function");