]> git.ipfire.org Git - ipfire-2.x.git/blob - src/patches/glibc/glibc-rh1099025.patch
dhcpcd: fix delay after dhcp down.
[ipfire-2.x.git] / src / patches / glibc / glibc-rh1099025.patch
1 commit 736c304a1ab4cee36a2f3343f1698bc0abae4608
2 Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com>
3 Date: Thu Jan 16 06:53:18 2014 -0600
4
5 PowerPC: Fix ftime gettimeofday internal call returning bogus data
6
7 This patches fixes BZ#16430 by setting a different symbol for internal
8 GLIBC calls that points to ifunc resolvers. For PPC32, if the symbol
9 is defined as hidden (which is the case for gettimeofday and time) the
10 compiler will create local branches (symbol@local) and linker will not
11 create PLT calls (required for IFUNC). This will leads to internal symbol
12 calling the IFUNC resolver instead of the resolved symbol.
13 For PPC64 this behavior does not occur because a call to a function in
14 another translation unit might use a different toc pointer thus requiring
15 a PLT call.
16
17 diff --git a/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c b/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c
18 index 29a5e08..2085b68 100644
19 --- a/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c
20 +++ b/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c
21 @@ -44,8 +44,24 @@ asm (".type __gettimeofday, %gnu_indirect_function");
22 /* This is doing "libc_hidden_def (__gettimeofday)" but the compiler won't
23 let us do it in C because it doesn't know we're defining __gettimeofday
24 here in this file. */
25 -asm (".globl __GI___gettimeofday\n"
26 - "__GI___gettimeofday = __gettimeofday");
27 +asm (".globl __GI___gettimeofday");
28 +
29 +/* __GI___gettimeofday is defined as hidden and for ppc32 it enables the
30 + compiler make a local call (symbol@local) for internal GLIBC usage. It
31 + means the PLT won't be used and the ifunc resolver will be called directly.
32 + For ppc64 a call to a function in another translation unit might use a
33 + different toc pointer thus disallowing direct branchess and making internal
34 + ifuncs calls safe. */
35 +#ifdef __powerpc64__
36 +asm ("__GI___gettimeofday = __gettimeofday");
37 +#else
38 +int
39 +__gettimeofday_vsyscall (struct timeval *tv, struct timezone *tz)
40 +{
41 + return INLINE_VSYSCALL (gettimeofday, 2, tv, tz);
42 +}
43 +asm ("__GI___gettimeofday = __gettimeofday_vsyscall");
44 +#endif
45
46 #else
47