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