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