/[packages]/cauldron/glibc/current/SOURCES/glibc-2.20-i586-hptiming.patch
ViewVC logotype

Contents of /cauldron/glibc/current/SOURCES/glibc-2.20-i586-hptiming.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 673660 - (show annotations) (download)
Mon Sep 8 16:41:37 2014 UTC (9 years, 7 months ago) by tmb
File size: 4917 byte(s)
- rebase some patches so they apply
- dont use conditional patching for mips build
- drop old powerpc fix
- nptl is not an addon anymore, adjust build accordingly


1 2011-2014 Thomas Backlund <tmb@mageia.org>
2
3 * Rebased / adapted for new glibc
4
5 2006-05-17 Gwenole Beauchesne <gbeauchesne@mandriva.com>
6
7 * Update and simplify for glibc 2.4.90.
8
9 2002-12-07 Gwenole Beauchesne <gbeauchesne@mandrakesoft.com>
10
11 Let an i586 rtld load i686 libraries (especially libpthread)
12
13 * elf/rtld.c (HP_TIMING_AVAIL): Redefine to HP_TIMING_HWCAP_AVAIL
14 since early statistics require high-precision timers.
15 * sysdeps/generic/ldsodefs.h (rtld_global): Declare
16 _dl_cpuclock_offset if HP_TIMING_HWCAP_AVAIL is defined too.
17
18 * sysdeps/unix/sysv/linux/i386/i586/Makefile: New file.
19 * sysdeps/unix/sysv/linux/i386/i586/hp-timing.c: New file.
20 * sysdeps/unix/sysv/linux/i386/i586/hp-timing.h: New file.
21 ---
22 elf/rtld.c | 12 ++++++++++-
23 sysdeps/generic/ldsodefs.h | 2 -
24 sysdeps/i386/i586/Makefile | 4 +++
25 sysdeps/i386/i586/hp-timing.c | 2 +
26 sysdeps/i386/i586/hp-timing.h | 43 ++++++++++++++++++++++++++++++++++++++++++
27
28 diff -Nurp glibc-2.20.orig/elf/rtld.c glibc-2.20/elf/rtld.c
29 --- glibc-2.20.orig/elf/rtld.c 2014-09-07 11:09:09.000000000 +0300
30 +++ glibc-2.20/elf/rtld.c 2014-09-08 18:12:17.640928030 +0300
31 @@ -16,6 +16,9 @@
32 License along with the GNU C Library; if not, see
33 <http://www.gnu.org/licenses/>. */
34
35 +/* Early statistics require high-precision timing. */
36 +#define NEED_HP_TIMING_HWCAP_AVAIL 1
37 +
38 #include <errno.h>
39 #include <dlfcn.h>
40 #include <fcntl.h>
41 @@ -195,6 +198,12 @@ static void dl_main (const ElfW(Phdr) *p
42 static struct libname_list _dl_rtld_libname;
43 static struct libname_list _dl_rtld_libname2;
44
45 +/* Run-time detect availability of high-precision timer? */
46 +#ifdef HP_TIMING_HWCAP_AVAIL
47 +# undef HP_SMALL_TIMING_AVAIL
48 +# define HP_SMALL_TIMING_AVAIL HP_TIMING_HWCAP_AVAIL
49 +#endif
50 +
51 /* Variable for statistics. */
52 #ifndef HP_TIMING_NONAVAIL
53 static hp_timing_t relocate_time;
54 @@ -296,7 +305,8 @@ _dl_start_final (void *arg, struct dl_st
55 # endif
56 #endif
57
58 - HP_TIMING_NOW (GL(dl_cpuclock_offset));
59 + if (HP_SMALL_TIMING_AVAIL)
60 + HP_TIMING_NOW (GL(dl_cpuclock_offset));
61
62 /* Initialize the stack end variable. */
63 __libc_stack_end = __builtin_frame_address (0);
64 diff -Nurp glibc-2.20.orig/sysdeps/generic/ldsodefs.h glibc-2.20/sysdeps/generic/ldsodefs.h
65 --- glibc-2.20.orig/sysdeps/generic/ldsodefs.h 2014-09-07 11:09:09.000000000 +0300
66 +++ glibc-2.20/sysdeps/generic/ldsodefs.h 2014-09-08 18:17:19.655631175 +0300
67 @@ -319,7 +319,7 @@ struct rtld_global
68 /* The object to be initialized first. */
69 EXTERN struct link_map *_dl_initfirst;
70
71 -#if HP_SMALL_TIMING_AVAIL
72 +#if HP_SMALL_TIMING_AVAIL || defined HP_TIMING_HWCAP_AVAIL
73 /* Start time on CPU clock. */
74 EXTERN hp_timing_t _dl_cpuclock_offset;
75 #endif
76 diff -Nurp glibc-2.20.orig/sysdeps/i386/i586/hp-timing.c glibc-2.20/sysdeps/i386/i586/hp-timing.c
77 --- glibc-2.20.orig/sysdeps/i386/i586/hp-timing.c 1970-01-01 02:00:00.000000000 +0200
78 +++ glibc-2.20/sysdeps/i386/i586/hp-timing.c 2014-09-08 18:07:38.466353624 +0300
79 @@ -0,0 +1,2 @@
80 +/* We can use the i686 implementation without changes. */
81 +#include <sysdeps/i386/i686/hp-timing.c>
82 diff -Nurp glibc-2.20.orig/sysdeps/i386/i586/hp-timing.h glibc-2.20/sysdeps/i386/i586/hp-timing.h
83 --- glibc-2.20.orig/sysdeps/i386/i586/hp-timing.h 1970-01-01 02:00:00.000000000 +0200
84 +++ glibc-2.20/sysdeps/i386/i586/hp-timing.h 2014-09-08 18:07:38.466353624 +0300
85 @@ -0,0 +1,43 @@
86 +#ifndef _HP_HWCAP_TIMING_H
87 +#define _HP_HWCAP_TIMING_H 1
88 +
89 +/* We can use the i686 implementation with slight changes. */
90 +#include <sysdeps/i386/i686/hp-timing.h>
91 +
92 +/* We need the definition of HWCAP_I386_TSC. */
93 +#include <sysdeps/i386/dl-hwcapinfo.h>
94 +
95 +/* We need to perform a runtime check for the timestamp register. */
96 +#undef HP_SMALL_TIMING_AVAIL
97 +#define HP_SMALL_TIMING_AVAIL (0)
98 +
99 +/* HP_TIMING_HWCAP_AVAIL: this macro performs a run-time check for the
100 + capability. */
101 +#define HP_TIMING_HWCAP_AVAIL (_dl_hp_timing_avail())
102 +
103 +/* Perform the TSC check. */
104 +#ifdef NEED_HP_TIMING_HWCAP_AVAIL
105 +static inline
106 +unsigned int
107 +_dl_cpuid_edx (unsigned int op)
108 +{
109 + unsigned int edx;
110 + __asm__ __volatile__("push %%ebx ; cpuid ; pop %%ebx"
111 + : "=d" (edx) : "a" (op) : "ecx");
112 + return edx;
113 +}
114 +
115 +static int
116 +internal_function
117 +_dl_hp_timing_avail (void)
118 +{
119 + static int has_tsc = -1;
120 +
121 + if (__builtin_expect (has_tsc == -1, 0))
122 + has_tsc = (_dl_cpuid_edx(1) & HWCAP_I386_TSC) == HWCAP_I386_TSC;
123 +
124 + return has_tsc;
125 +}
126 +#endif
127 +
128 +#endif /* hp-timing.h */
129 diff -Nurp glibc-2.20.orig/sysdeps/i386/i586/Makefile glibc-2.20/sysdeps/i386/i586/Makefile
130 --- glibc-2.20.orig/sysdeps/i386/i586/Makefile 1970-01-01 02:00:00.000000000 +0200
131 +++ glibc-2.20/sysdeps/i386/i586/Makefile 2014-09-08 18:07:38.466353624 +0300
132 @@ -0,0 +1,4 @@
133 +ifeq ($(subdir),csu)
134 +sysdep_routines += hp-timing
135 +static-only-routines += hp-timing
136 +endif

  ViewVC Help
Powered by ViewVC 1.1.30