|
|
2e9afc |
commit 736c304a1ab4cee36a2f3343f1698bc0abae4608
|
|
|
2e9afc |
Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com>
|
|
|
2e9afc |
Date: Thu Jan 16 06:53:18 2014 -0600
|
|
|
2e9afc |
|
|
|
2e9afc |
PowerPC: Fix ftime gettimeofday internal call returning bogus data
|
|
|
2e9afc |
|
|
|
2e9afc |
This patches fixes BZ#16430 by setting a different symbol for internal
|
|
|
2e9afc |
GLIBC calls that points to ifunc resolvers. For PPC32, if the symbol
|
|
|
2e9afc |
is defined as hidden (which is the case for gettimeofday and time) the
|
|
|
2e9afc |
compiler will create local branches (symbol@local) and linker will not
|
|
|
2e9afc |
create PLT calls (required for IFUNC). This will leads to internal symbol
|
|
|
2e9afc |
calling the IFUNC resolver instead of the resolved symbol.
|
|
|
2e9afc |
For PPC64 this behavior does not occur because a call to a function in
|
|
|
2e9afc |
another translation unit might use a different toc pointer thus requiring
|
|
|
2e9afc |
a PLT call.
|
|
|
2e9afc |
|
|
|
12745e |
diff --git glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c
|
|
|
2e9afc |
index 29a5e08..2085b68 100644
|
|
|
12745e |
--- glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c
|
|
|
12745e |
+++ glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c
|
|
|
2e9afc |
@@ -44,8 +44,24 @@ asm (".type __gettimeofday, %gnu_indirect_function");
|
|
|
2e9afc |
/* This is doing "libc_hidden_def (__gettimeofday)" but the compiler won't
|
|
|
2e9afc |
let us do it in C because it doesn't know we're defining __gettimeofday
|
|
|
2e9afc |
here in this file. */
|
|
|
2e9afc |
-asm (".globl __GI___gettimeofday\n"
|
|
|
2e9afc |
- "__GI___gettimeofday = __gettimeofday");
|
|
|
2e9afc |
+asm (".globl __GI___gettimeofday");
|
|
|
2e9afc |
+
|
|
|
2e9afc |
+/* __GI___gettimeofday is defined as hidden and for ppc32 it enables the
|
|
|
2e9afc |
+ compiler make a local call (symbol@local) for internal GLIBC usage. It
|
|
|
2e9afc |
+ means the PLT won't be used and the ifunc resolver will be called directly.
|
|
|
2e9afc |
+ For ppc64 a call to a function in another translation unit might use a
|
|
|
2e9afc |
+ different toc pointer thus disallowing direct branchess and making internal
|
|
|
2e9afc |
+ ifuncs calls safe. */
|
|
|
2e9afc |
+#ifdef __powerpc64__
|
|
|
2e9afc |
+asm ("__GI___gettimeofday = __gettimeofday");
|
|
|
2e9afc |
+#else
|
|
|
2e9afc |
+int
|
|
|
2e9afc |
+__gettimeofday_vsyscall (struct timeval *tv, struct timezone *tz)
|
|
|
2e9afc |
+{
|
|
|
2e9afc |
+ return INLINE_VSYSCALL (gettimeofday, 2, tv, tz);
|
|
|
2e9afc |
+}
|
|
|
2e9afc |
+asm ("__GI___gettimeofday = __gettimeofday_vsyscall");
|
|
|
2e9afc |
+#endif
|
|
|
2e9afc |
|
|
|
2e9afc |
#else
|
|
|
2e9afc |
|
|
|
12745e |
diff --git glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/time.c glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/time.c
|
|
|
2e9afc |
index 089d0b6..023bc02 100644
|
|
|
12745e |
--- glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/time.c
|
|
|
12745e |
+++ glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/time.c
|
|
|
2e9afc |
@@ -54,8 +54,24 @@ asm (".type time, %gnu_indirect_function");
|
|
|
2e9afc |
/* This is doing "libc_hidden_def (time)" but the compiler won't
|
|
|
2e9afc |
* let us do it in C because it doesn't know we're defining time
|
|
|
2e9afc |
* here in this file. */
|
|
|
2e9afc |
-asm (".globl __GI_time\n"
|
|
|
2e9afc |
- "__GI_time = time");
|
|
|
2e9afc |
+asm (".globl __GI_time");
|
|
|
2e9afc |
+
|
|
|
2e9afc |
+/* __GI_time is defined as hidden and for ppc32 it enables the
|
|
|
2e9afc |
+ compiler make a local call (symbol@local) for internal GLIBC usage. It
|
|
|
2e9afc |
+ means the PLT won't be used and the ifunc resolver will be called directly.
|
|
|
2e9afc |
+ For ppc64 a call to a function in another translation unit might use a
|
|
|
2e9afc |
+ different toc pointer thus disallowing direct branchess and making internal
|
|
|
2e9afc |
+ ifuncs calls safe. */
|
|
|
2e9afc |
+#ifdef __powerpc64__
|
|
|
2e9afc |
+asm ("__GI_time = time");
|
|
|
2e9afc |
+#else
|
|
|
2e9afc |
+time_t
|
|
|
2e9afc |
+__time_vsyscall (time_t *t)
|
|
|
2e9afc |
+{
|
|
|
2e9afc |
+ return INLINE_VSYSCALL (time, 1, t);
|
|
|
2e9afc |
+}
|
|
|
2e9afc |
+asm ("__GI_time = __time_vsyscall");
|
|
|
2e9afc |
+#endif
|
|
|
2e9afc |
|
|
|
2e9afc |
#else
|
|
|
2e9afc |
|