1 |
vapier 10/08/19 23:42:37 |
2 |
|
3 |
Modified: README.history |
4 |
Added: 0055_all_glibc-2.12-static-shared-getpagesize.patch |
5 |
0060_all_glibc-2.12-sse4-x86-static-strspn.patch |
6 |
Log: |
7 |
push out static fixes from upstream/me #332927 |
8 |
|
9 |
Revision Changes Path |
10 |
1.3 src/patchsets/glibc/2.12.1/README.history |
11 |
|
12 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.12.1/README.history?rev=1.3&view=markup |
13 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.12.1/README.history?rev=1.3&content-type=text/plain |
14 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.12.1/README.history?r1=1.2&r2=1.3 |
15 |
|
16 |
Index: README.history |
17 |
=================================================================== |
18 |
RCS file: /var/cvsroot/gentoo/src/patchsets/glibc/2.12.1/README.history,v |
19 |
retrieving revision 1.2 |
20 |
retrieving revision 1.3 |
21 |
diff -u -r1.2 -r1.3 |
22 |
--- README.history 14 Aug 2010 04:23:33 -0000 1.2 |
23 |
+++ README.history 19 Aug 2010 23:42:37 -0000 1.3 |
24 |
@@ -1,5 +1,7 @@ |
25 |
-2 [pending] |
26 |
+2 19.08.2010 |
27 |
+ 0010_all_glibc-locale-output-quote.patch |
28 |
+ + 0055_all_glibc-2.12-static-shared-getpagesize.patch |
29 |
+ + 0060_all_glibc-2.12-sse4-x86-static-strspn.patch |
30 |
|
31 |
1 05.08.2010 |
32 |
+ 0020_all_glibc-tweak-rfc1918-lookup.patch |
33 |
|
34 |
|
35 |
|
36 |
1.1 src/patchsets/glibc/2.12.1/0055_all_glibc-2.12-static-shared-getpagesize.patch |
37 |
|
38 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.12.1/0055_all_glibc-2.12-static-shared-getpagesize.patch?rev=1.1&view=markup |
39 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.12.1/0055_all_glibc-2.12-static-shared-getpagesize.patch?rev=1.1&content-type=text/plain |
40 |
|
41 |
Index: 0055_all_glibc-2.12-static-shared-getpagesize.patch |
42 |
=================================================================== |
43 |
http://thread.gmane.org/gmane.comp.lib.glibc.user/579 |
44 |
http://sources.redhat.com/bugzilla/show_bug.cgi?id=11929 |
45 |
http://bugs.gentoo.org/332927 |
46 |
|
47 |
a simple statically linked app fails with glibc-2.12: |
48 |
$ cat test.c |
49 |
main(){getpwnam("root");} |
50 |
$ gcc -static test.c |
51 |
$ ./a.out |
52 |
a.out: ../sysdeps/unix/sysv/linux/getpagesize.c:32: __getpagesize: |
53 |
Assertion `_rtld_global_ro._dl_pagesize != 0' failed. |
54 |
Aborted (core dumped) |
55 |
|
56 |
the crux of the matter seems to be the fact that static apps with |
57 |
glibc will dynamically load nss shared libraries when necessary. the |
58 |
static code will initialize GLRO(dl_pagesize) just fine from the |
59 |
kernel auxv, but this being the static code paths, GLRO(dl_pagesize) |
60 |
expands into _dl_pagesize. when the nss shared libraries are loaded |
61 |
up, the ldso is also mapped in, but it doesnt process the kernel auxv |
62 |
(_dl_sysdep_start() is not called). so the shared library |
63 |
GLRO(dl_pagesize) expands into _rtld_global_ro._dl_pagesize and that |
64 |
field stays at 0. |
65 |
|
66 |
then when the nss shared libs process the request and gets to the |
67 |
standard "passwd" database, it calls the shared lib versions of |
68 |
malloc/stdio which rely on the __getpagesize() function. but this |
69 |
being in the shared library, it reads the shared GLRO(dl_pagesize) |
70 |
which is 0, and the assert() is triggered. |
71 |
|
72 |
i think running nscd makes things work because its nss module that |
73 |
talks to the nscd daemon doesnt call any routines that implicitly rely |
74 |
on __getpagesize(). |
75 |
|
76 |
this all started happening after this commit: |
77 |
From 8f4a5048eea6536ee85c0f2670adbb97d71e427d Mon Sep 17 00:00:00 2001 |
78 |
From: Ulrich Drepper <drepper@××××××.com> |
79 |
Date: Sat, 27 Mar 2010 06:19:50 -0700 |
80 |
Subject: [PATCH] Optimize __getpagesize a bit. |
81 |
|
82 |
if we look at the ia64 port, we see that it has had similar logic for |
83 |
its __getpagesize function forever. so take its DL_STATIC_INIT code |
84 |
and move it up to the common linux tree. |
85 |
|
86 |
2010-08-18 Mike Frysinger <vapier@g.o> |
87 |
|
88 |
* sysdeps/unix/sysv/linux/ia64/Makefile: Move dl-static addition to |
89 |
sysdep vars for subdir==elf to ... |
90 |
* sysdeps/unix/sysv/linux/Makefile: ... here. |
91 |
* sysdeps/unix/sysv/linux/ia64/dl-static.c: Move file to ... |
92 |
* sysdeps/unix/sysv/linux/dl-static.c: ... here. |
93 |
* sysdeps/unix/sysv/linux/ia64/ldsodefs.h: Delete, and move the |
94 |
DL_STATIC_INIT defines to ... |
95 |
* sysdeps/unix/sysv/linux/ldsodefs.h: ... here. |
96 |
* sysdeps/unix/sysv/linux/ia64/getpagesize.c: Delete. |
97 |
|
98 |
diff --git a/sysdeps/unix/sysv/linux/ia64/Makefile b/sysdeps/unix/sysv/linux/ia64/Makefile |
99 |
index d9a35a7..3bb1ce0 100644 |
100 |
--- a/sysdeps/unix/sysv/linux/ia64/Makefile |
101 |
+++ b/sysdeps/unix/sysv/linux/ia64/Makefile |
102 |
@@ -12,12 +12,6 @@ sysdep_headers += sys/io.h |
103 |
sysdep_routines += ioperm clone2 |
104 |
endif |
105 |
|
106 |
-ifeq ($(subdir),elf) |
107 |
-sysdep-dl-routines += dl-static |
108 |
-sysdep_routines += $(sysdep-dl-routines) |
109 |
-sysdep-rtld-routines += $(sysdep-dl-routines) |
110 |
-endif |
111 |
- |
112 |
ifeq ($(subdir),rt) |
113 |
librt-routines += rt-sysdep |
114 |
endif |
115 |
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile |
116 |
index 4302bd3..37c56a3 100644 |
117 |
--- a/sysdeps/unix/sysv/linux/Makefile |
118 |
+++ b/sysdeps/unix/sysv/linux/Makefile |
119 |
@@ -147,7 +147,9 @@ sysdep_routines += xstatconv internal_statvfs internal_statvfs64 \ |
120 |
endif |
121 |
|
122 |
ifeq ($(subdir),elf) |
123 |
-sysdep-rtld-routines += dl-brk dl-sbrk |
124 |
+sysdep-dl-routines += dl-static |
125 |
+sysdep_routines += dl-static |
126 |
+sysdep-rtld-routines += dl-brk dl-sbrk dl-static |
127 |
|
128 |
CPPFLAGS-lddlibc4 += -DNOT_IN_libc |
129 |
endif |
130 |
diff --git a/sysdeps/unix/sysv/linux/ia64/dl-static.c b/sysdeps/unix/sysv/linux/ia64/dl-static.c |
131 |
deleted file mode 100644 |
132 |
index 4efc077..0000000 |
133 |
--- a/sysdeps/unix/sysv/linux/ia64/dl-static.c |
134 |
+++ /dev/null |
135 |
@@ -1,69 +0,0 @@ |
136 |
-/* Variable initialization. IA-64 version. |
137 |
- Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. |
138 |
- This file is part of the GNU C Library. |
139 |
- |
140 |
- The GNU C Library is free software; you can redistribute it and/or |
141 |
- modify it under the terms of the GNU Lesser General Public |
142 |
- License as published by the Free Software Foundation; either |
143 |
- version 2.1 of the License, or (at your option) any later version. |
144 |
- |
145 |
- The GNU C Library is distributed in the hope that it will be useful, |
146 |
- but WITHOUT ANY WARRANTY; without even the implied warranty of |
147 |
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
148 |
- Lesser General Public License for more details. |
149 |
- |
150 |
- You should have received a copy of the GNU Lesser General Public |
151 |
- License along with the GNU C Library; if not, write to the Free |
152 |
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
153 |
- 02111-1307 USA. */ |
154 |
- |
155 |
-#include <ldsodefs.h> |
156 |
- |
157 |
-#ifdef SHARED |
158 |
- |
159 |
-void |
160 |
-_dl_var_init (void *array[]) |
161 |
-{ |
162 |
- /* It has to match "variables" below. */ |
163 |
- enum |
164 |
- { |
165 |
- DL_PAGESIZE = 0, |
166 |
- DL_CLKTCK |
167 |
- }; |
168 |
- |
169 |
- GLRO(dl_pagesize) = *((size_t *) array[DL_PAGESIZE]); |
170 |
- GLRO(dl_clktck) = *((int *) array[DL_CLKTCK]); |
171 |
-} |
172 |
- |
173 |
-#else |
174 |
-#include <bits/libc-lock.h> |
175 |
- |
176 |
-__libc_lock_define_initialized_recursive (static, _dl_static_lock) |
177 |
- |
178 |
-static void *variables[] = |
179 |
-{ |
180 |
- &GLRO(dl_pagesize), |
181 |
- &GLRO(dl_clktck) |
182 |
-}; |
183 |
- |
184 |
-void |
185 |
-_dl_static_init (struct link_map *map) |
186 |
-{ |
187 |
- const ElfW(Sym) *ref = NULL; |
188 |
- lookup_t loadbase; |
189 |
- void (*f) (void *[]); |
190 |
- |
191 |
- __libc_lock_lock_recursive (_dl_static_lock); |
192 |
- |
193 |
- loadbase = _dl_lookup_symbol_x ("_dl_var_init", map, &ref, |
194 |
- map->l_local_scope, NULL, 0, 1, NULL); |
195 |
- if (ref != NULL) |
196 |
- { |
197 |
- f = (void (*) (void *[])) DL_SYMBOL_ADDRESS (loadbase, ref); |
198 |
- f (variables); |
199 |
- } |
200 |
- |
201 |
- __libc_lock_unlock_recursive (_dl_static_lock); |
202 |
-} |
203 |
- |
204 |
-#endif |
205 |
diff --git a/sysdeps/unix/sysv/linux/dl-static.c b/sysdeps/unix/sysv/linux/dl-static.c |
206 |
new file mode 100644 |
207 |
index 0000000..fa70811 |
208 |
--- /dev/null |
209 |
+++ b/sysdeps/unix/sysv/linux/dl-static.c |
210 |
@@ -0,0 +1,69 @@ |
211 |
+/* Variable initialization. |
212 |
+ Copyright (C) 2001, 2002, 2003, 2004, 2010 Free Software Foundation, Inc. |
213 |
+ This file is part of the GNU C Library. |
214 |
+ |
215 |
+ The GNU C Library is free software; you can redistribute it and/or |
216 |
+ modify it under the terms of the GNU Lesser General Public |
217 |
+ License as published by the Free Software Foundation; either |
218 |
+ version 2.1 of the License, or (at your option) any later version. |
219 |
+ |
220 |
+ The GNU C Library is distributed in the hope that it will be useful, |
221 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of |
222 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
223 |
+ Lesser General Public License for more details. |
224 |
+ |
225 |
+ You should have received a copy of the GNU Lesser General Public |
226 |
+ License along with the GNU C Library; if not, write to the Free |
227 |
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
228 |
+ 02111-1307 USA. */ |
229 |
+ |
230 |
+#include <ldsodefs.h> |
231 |
+ |
232 |
+#ifdef SHARED |
233 |
+ |
234 |
+void |
235 |
+_dl_var_init (void *array[]) |
236 |
+{ |
237 |
+ /* It has to match "variables" below. */ |
238 |
+ enum |
239 |
+ { |
240 |
+ DL_PAGESIZE = 0, |
241 |
+ DL_CLKTCK |
242 |
+ }; |
243 |
+ |
244 |
+ GLRO(dl_pagesize) = *((size_t *) array[DL_PAGESIZE]); |
245 |
+ GLRO(dl_clktck) = *((int *) array[DL_CLKTCK]); |
246 |
+} |
247 |
+ |
248 |
+#else |
249 |
+#include <bits/libc-lock.h> |
250 |
+ |
251 |
+__libc_lock_define_initialized_recursive (static, _dl_static_lock) |
252 |
+ |
253 |
+static void *variables[] = |
254 |
+{ |
255 |
+ &GLRO(dl_pagesize), |
256 |
+ &GLRO(dl_clktck) |
257 |
+}; |
258 |
+ |
259 |
+void |
260 |
+_dl_static_init (struct link_map *map) |
261 |
+{ |
262 |
+ const ElfW(Sym) *ref = NULL; |
263 |
+ lookup_t loadbase; |
264 |
+ void (*f) (void *[]); |
265 |
+ |
266 |
+ __libc_lock_lock_recursive (_dl_static_lock); |
267 |
+ |
268 |
+ loadbase = _dl_lookup_symbol_x ("_dl_var_init", map, &ref, |
269 |
+ map->l_local_scope, NULL, 0, 1, NULL); |
270 |
+ if (ref != NULL) |
271 |
+ { |
272 |
+ f = (void (*) (void *[])) DL_SYMBOL_ADDRESS (loadbase, ref); |
273 |
+ f (variables); |
274 |
+ } |
275 |
+ |
276 |
+ __libc_lock_unlock_recursive (_dl_static_lock); |
277 |
+} |
278 |
+ |
279 |
+#endif |
280 |
diff --git a/sysdeps/unix/sysv/linux/ia64/ldsodefs.h b/sysdeps/unix/sysv/linux/ia64/ldsodefs.h |
281 |
deleted file mode 100644 |
282 |
index 31af624..0000000 |
283 |
--- a/sysdeps/unix/sysv/linux/ia64/ldsodefs.h |
284 |
+++ /dev/null |
285 |
@@ -1,33 +0,0 @@ |
286 |
-/* Run-time dynamic linker data structures for loaded ELF shared objects. IA64. |
287 |
- Copyright (C) 2001 Free Software Foundation, Inc. |
288 |
- This file is part of the GNU C Library. |
289 |
- |
290 |
- The GNU C Library is free software; you can redistribute it and/or |
291 |
- modify it under the terms of the GNU Lesser General Public |
292 |
- License as published by the Free Software Foundation; either |
293 |
- version 2.1 of the License, or (at your option) any later version. |
294 |
- |
295 |
- The GNU C Library is distributed in the hope that it will be useful, |
296 |
- but WITHOUT ANY WARRANTY; without even the implied warranty of |
297 |
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
298 |
- Lesser General Public License for more details. |
299 |
- |
300 |
- You should have received a copy of the GNU Lesser General Public |
301 |
- License along with the GNU C Library; if not, write to the Free |
302 |
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
303 |
- 02111-1307 USA. */ |
304 |
- |
305 |
-#ifndef _LDSODEFS_H |
306 |
- |
307 |
-/* Get the real definitions. */ |
308 |
-#include_next <ldsodefs.h> |
309 |
- |
310 |
-/* Now define our stuff. */ |
311 |
- |
312 |
-/* We need special support to initialize DSO loaded for statically linked |
313 |
- binaries. */ |
314 |
-extern void _dl_static_init (struct link_map *map); |
315 |
-#undef DL_STATIC_INIT |
316 |
-#define DL_STATIC_INIT(map) _dl_static_init (map) |
317 |
- |
318 |
-#endif /* ldsodefs.h */ |
319 |
diff --git a/sysdeps/unix/sysv/linux/ldsodefs.h b/sysdeps/unix/sysv/linux/ldsodefs.h |
320 |
index 5d5b1b4..ecb5d4f 100644 |
321 |
--- a/sysdeps/unix/sysv/linux/ldsodefs.h |
322 |
+++ b/sysdeps/unix/sysv/linux/ldsodefs.h |
323 |
@@ -36,6 +36,12 @@ extern void _dl_aux_init (ElfW(auxv_t) *av) internal_function; |
324 |
/* Initialization which is normally done by the dynamic linker. */ |
325 |
extern void _dl_non_dynamic_init (void) internal_function; |
326 |
|
327 |
+/* We need special support to initialize DSO loaded for statically linked |
328 |
+ binaries. */ |
329 |
+extern void _dl_static_init (struct link_map *map); |
330 |
+#undef DL_STATIC_INIT |
331 |
+#define DL_STATIC_INIT(map) _dl_static_init (map) |
332 |
+ |
333 |
/* We can assume that the kernel always provides the AT_UID, AT_EUID, |
334 |
AT_GID, and AT_EGID values in the auxiliary vector from 2.4.0 or so on. */ |
335 |
#if __ASSUME_AT_XID |
336 |
diff --git a/sysdeps/unix/sysv/linux/ia64/getpagesize.c b/sysdeps/unix/sysv/linux/ia64/getpagesize.c |
337 |
deleted file mode 100644 |
338 |
index 1155dfd..0000000 |
339 |
--- a/sysdeps/unix/sysv/linux/ia64/getpagesize.c |
340 |
+++ /dev/null |
341 |
@@ -1,39 +0,0 @@ |
342 |
-/* Copyright (C) 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc. |
343 |
- This file is part of the GNU C Library. |
344 |
- |
345 |
- The GNU C Library is free software; you can redistribute it and/or |
346 |
- modify it under the terms of the GNU Lesser General Public |
347 |
- License as published by the Free Software Foundation; either |
348 |
- version 2.1 of the License, or (at your option) any later version. |
349 |
- |
350 |
- The GNU C Library is distributed in the hope that it will be useful, |
351 |
- but WITHOUT ANY WARRANTY; without even the implied warranty of |
352 |
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
353 |
- Lesser General Public License for more details. |
354 |
- |
355 |
- You should have received a copy of the GNU Lesser General Public |
356 |
- License along with the GNU C Library; if not, write to the Free |
357 |
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
358 |
- 02111-1307 USA. */ |
359 |
- |
360 |
-#include <assert.h> |
361 |
-#include <unistd.h> |
362 |
-#include <sys/param.h> |
363 |
- |
364 |
-#include <ldsodefs.h> |
365 |
-#include <sysdep.h> |
366 |
-#include <sys/syscall.h> |
367 |
- |
368 |
-/* Return the system page size. The return value will depend on how |
369 |
- the kernel is configured. A program must use this call to |
370 |
- determine the page size to ensure proper alignment for calls such |
371 |
- as mmap and friends. --davidm 99/11/30 */ |
372 |
- |
373 |
-int |
374 |
-__getpagesize () |
375 |
-{ |
376 |
- assert (GLRO(dl_pagesize) != 0); |
377 |
- return GLRO(dl_pagesize); |
378 |
-} |
379 |
-libc_hidden_def (__getpagesize) |
380 |
-weak_alias (__getpagesize, getpagesize) |
381 |
|
382 |
|
383 |
|
384 |
1.1 src/patchsets/glibc/2.12.1/0060_all_glibc-2.12-sse4-x86-static-strspn.patch |
385 |
|
386 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.12.1/0060_all_glibc-2.12-sse4-x86-static-strspn.patch?rev=1.1&view=markup |
387 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.12.1/0060_all_glibc-2.12-sse4-x86-static-strspn.patch?rev=1.1&content-type=text/plain |
388 |
|
389 |
Index: 0060_all_glibc-2.12-sse4-x86-static-strspn.patch |
390 |
=================================================================== |
391 |
From fdae8096fe71e65f7c13575c990eb2652a328122 Mon Sep 17 00:00:00 2001 |
392 |
From: Andreas Schwab <schwab@××××××××××.org> |
393 |
Date: Thu, 19 Aug 2010 07:42:16 -0700 |
394 |
Subject: [PATCH] Fix ifunc thunk for strspn on x86 in static libc |
395 |
(cherry picked from commit bdaa77bc20bbaf5a78da541b993cfead8b8c1b1c) |
396 |
|
397 |
--- |
398 |
ChangeLog | 4 ++++ |
399 |
sysdeps/i386/i686/multiarch/strspn.S | 4 ++-- |
400 |
2 files changed, 6 insertions(+), 2 deletions(-) |
401 |
|
402 |
2010-08-19 Andreas Schwab <schwab@××××××.com> |
403 |
|
404 |
* sysdeps/i386/i686/multiarch/strspn.S [!SHARED]: Fix SSE4.2 check. |
405 |
|
406 |
diff --git a/sysdeps/i386/i686/multiarch/strspn.S b/sysdeps/i386/i686/multiarch/strspn.S |
407 |
index 7fe6f97..dbdf1af 100644 |
408 |
--- a/sysdeps/i386/i686/multiarch/strspn.S |
409 |
+++ b/sysdeps/i386/i686/multiarch/strspn.S |
410 |
@@ -1,5 +1,5 @@ |
411 |
/* Multiple versions of strspn |
412 |
- Copyright (C) 2009 Free Software Foundation, Inc. |
413 |
+ Copyright (C) 2009,2010 Free Software Foundation, Inc. |
414 |
Contributed by Intel Corporation. |
415 |
This file is part of the GNU C Library. |
416 |
|
417 |
@@ -65,7 +65,7 @@ ENTRY(strspn) |
418 |
jne 1f |
419 |
call __init_cpu_features |
420 |
1: leal __strspn_ia32, %eax |
421 |
- testl $index_SSE2, CPUID_OFFSET+index_SSE4_2+__cpu_features |
422 |
+ testl $bit_SSE4_2, CPUID_OFFSET+index_SSE4_2+__cpu_features |
423 |
jz 2f |
424 |
leal __strspn_sse42, %eax |
425 |
2: ret |
426 |
-- |
427 |
1.7.2 |