Gentoo Archives: gentoo-commits

From: "Mike Frysinger (vapier)" <vapier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo commit in src/patchsets/glibc/2.13: 0045_all_glibc-2.13-canonical-getaddrinfo.patch 0046_all_glibc-2.13-dso-init-fini-order.patch 6145_all_powerpc64-glibc-2.13-syscall.patch 6146_all_ppc-glibc-2.13-vsx-toc-O3.patch README.history
Date: Sat, 28 May 2011 19:54:24
Message-Id: 20110528195410.E537A20054@flycatcher.gentoo.org
1 vapier 11/05/28 19:54:10
2
3 Modified: README.history
4 Added: 0045_all_glibc-2.13-canonical-getaddrinfo.patch
5 0046_all_glibc-2.13-dso-init-fini-order.patch
6 6145_all_powerpc64-glibc-2.13-syscall.patch
7 6146_all_ppc-glibc-2.13-vsx-toc-O3.patch
8 Log:
9 add some fixes from upstream 2.13 branch
10
11 Revision Changes Path
12 1.21 src/patchsets/glibc/2.13/README.history
13
14 file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.13/README.history?rev=1.21&view=markup
15 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.13/README.history?rev=1.21&content-type=text/plain
16 diff : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.13/README.history?r1=1.20&r2=1.21
17
18 Index: README.history
19 ===================================================================
20 RCS file: /var/cvsroot/gentoo/src/patchsets/glibc/2.13/README.history,v
21 retrieving revision 1.20
22 retrieving revision 1.21
23 diff -u -r1.20 -r1.21
24 --- README.history 28 May 2011 18:56:10 -0000 1.20
25 +++ README.history 28 May 2011 19:54:10 -0000 1.21
26 @@ -1,6 +1,10 @@
27 7 [pending]
28 + 0043_all_glibc-2.12-broken-tls-init.patch
29 + + 0045_all_glibc-2.13-canonical-getaddrinfo.patch
30 + + 0046_all_glibc-2.13-dso-init-fini-order.patch
31 U 0050_all_glibc-2.13-ldso-prelink-segv.patch
32 + + 6145_all_powerpc64-glibc-2.13-syscall.patch
33 + + 6146_all_ppc-glibc-2.13-vsx-toc-O3.patch
34
35 6 10.04.2011
36 + 1508_all_glibc-2.13-hppa-DEFAULT_STACK_PERMS.patch
37
38
39
40 1.1 src/patchsets/glibc/2.13/0045_all_glibc-2.13-canonical-getaddrinfo.patch
41
42 file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.13/0045_all_glibc-2.13-canonical-getaddrinfo.patch?rev=1.1&view=markup
43 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.13/0045_all_glibc-2.13-canonical-getaddrinfo.patch?rev=1.1&content-type=text/plain
44
45 Index: 0045_all_glibc-2.13-canonical-getaddrinfo.patch
46 ===================================================================
47 From 86e9235918a715095a1f5bb1c1db28fae7fca22b Mon Sep 17 00:00:00 2001
48 From: Ulrich Drepper <drepper@×××××.com>
49 Date: Wed, 19 Jan 2011 15:50:05 -0500
50 Subject: [PATCH] Fix decoding of canonical name in getaddrinfo.
51
52 ---
53 ChangeLog | 5 +++++
54 sysdeps/posix/getaddrinfo.c | 1 +
55 2 files changed, 6 insertions(+), 0 deletions(-)
56
57 2010-10-01 Andreas Schwab <schwab@××××××.com>
58
59 * sysdeps/posix/getaddrinfo.c (gaih_inet): Don't discard result of
60 decoding ACE if AI_CANONIDN.
61
62 diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
63 index 126a09e..c61c72a 100644
64 --- a/sysdeps/posix/getaddrinfo.c
65 +++ b/sysdeps/posix/getaddrinfo.c
66 @@ -965,6 +965,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
67 make a copy. */
68 if (out == canon)
69 goto make_copy;
70 + canon = out;
71 }
72 else
73 #endif
74 --
75 1.7.5.rc3
76
77
78
79
80 1.1 src/patchsets/glibc/2.13/0046_all_glibc-2.13-dso-init-fini-order.patch
81
82 file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.13/0046_all_glibc-2.13-dso-init-fini-order.patch?rev=1.1&view=markup
83 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.13/0046_all_glibc-2.13-dso-init-fini-order.patch?rev=1.1&content-type=text/plain
84
85 Index: 0046_all_glibc-2.13-dso-init-fini-order.patch
86 ===================================================================
87 From 968dad0ab1f367a087ff4ad503b511dd0c565adc Mon Sep 17 00:00:00 2001
88 From: Ulrich Drepper <drepper@×××××.com>
89 Date: Wed, 19 Jan 2011 15:32:35 -0500
90 Subject: [PATCH] Fix ordering of DSO constructors and destructors.
91
92 ---
93 ChangeLog | 27 +++++++++
94 elf/Makefile | 24 +++++++-
95 elf/dl-deps.c | 86 ++++++++++++++++------------
96 elf/dl-fini.c | 151 ++++++++++++++++++++++++-------------------------
97 elf/tst-initorder.c | 7 ++
98 elf/tst-initorder.exp | 13 ++++
99 elf/tst-initordera1.c | 16 +++++
100 elf/tst-initordera2.c | 16 +++++
101 elf/tst-initordera3.c | 16 +++++
102 elf/tst-initordera4.c | 16 +++++
103 elf/tst-initorderb1.c | 16 +++++
104 elf/tst-initorderb2.c | 16 +++++
105 elf/tst-order-a1.c | 16 +++++
106 elf/tst-order-a2.c | 16 +++++
107 elf/tst-order-a3.c | 16 +++++
108 elf/tst-order-a4.c | 16 +++++
109 elf/tst-order-b1.c | 16 +++++
110 elf/tst-order-b2.c | 16 +++++
111 elf/tst-order-main.c | 10 +++
112 19 files changed, 394 insertions(+), 116 deletions(-)
113 create mode 100644 elf/tst-initorder.c
114 create mode 100644 elf/tst-initorder.exp
115 create mode 100644 elf/tst-initordera1.c
116 create mode 100644 elf/tst-initordera2.c
117 create mode 100644 elf/tst-initordera3.c
118 create mode 100644 elf/tst-initordera4.c
119 create mode 100644 elf/tst-initorderb1.c
120 create mode 100644 elf/tst-initorderb2.c
121 create mode 100644 elf/tst-order-a1.c
122 create mode 100644 elf/tst-order-a2.c
123 create mode 100644 elf/tst-order-a3.c
124 create mode 100644 elf/tst-order-a4.c
125 create mode 100644 elf/tst-order-b1.c
126 create mode 100644 elf/tst-order-b2.c
127 create mode 100644 elf/tst-order-main.c
128
129 2011-01-19 Ulrich Drepper <drepper@×××××.com>
130
131 [BZ #11724]
132 * elf/dl-deps.c (_dl_map_object_deps): Rewrite sorting determining order
133 of constructors.
134 * elf/dl-fini.c (_dl_sort_fini): Rewrite sorting determining order
135 of destructors.
136 (_dl_fini): Don't call _dl_sort_fini if there is only one object.
137
138 [BZ #11724]
139 * elf/Makefile: Add rules to build and run new test.
140 * elf/tst-initorder.c: New file.
141 * elf/tst-initorder.exp: New file.
142 * elf/tst-initordera1.c: New file.
143 * elf/tst-initordera2.c: New file.
144 * elf/tst-initordera3.c: New file.
145 * elf/tst-initordera4.c: New file.
146 * elf/tst-initorderb1.c: New file.
147 * elf/tst-initorderb2.c: New file.
148 * elf/tst-order-a1.c: New file.
149 * elf/tst-order-a2.c: New file.
150 * elf/tst-order-a3.c: New file.
151 * elf/tst-order-a4.c: New file.
152 * elf/tst-order-b1.c: New file.
153 * elf/tst-order-b2.c: New file.
154 * elf/tst-order-main.c: New file.
155 New test case by George Gensure <werkt0@×××××.com>.
156
157 diff --git a/elf/Makefile b/elf/Makefile
158 index 3c79fcf..0f37804 100644
159 --- a/elf/Makefile
160 +++ b/elf/Makefile
161 @@ -118,7 +118,10 @@ distribute := rtld-Rules \
162 ifuncmain7.c ifuncmain7pic.c ifuncmain7picstatic.c \
163 ifuncmain7pie.c ifuncmain7static.c \
164 tst-unique1.c tst-unique1mod1.c tst-unique1mod2.c \
165 - tst-unique2.c tst-unique2mod1.c tst-unique2mod2.c
166 + tst-unique2.c tst-unique2mod1.c tst-unique2mod2.c \
167 + tst-initordera1.c tst-initordera2.c tst-initorderb1.c \
168 + tst-initorderb2.c tst-initordera3.c tst-initordera4.c \
169 + tst-initorder.c
170
171 CFLAGS-dl-runtime.c = -fexceptions -fasynchronous-unwind-tables
172 CFLAGS-dl-lookup.c = -fexceptions -fasynchronous-unwind-tables
173 @@ -198,7 +201,8 @@ tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \
174 unload3 unload4 unload5 unload6 unload7 tst-global1 order2 \
175 tst-audit1 tst-audit2 \
176 tst-stackguard1 tst-addr1 tst-thrlock \
177 - tst-unique1 tst-unique2
178 + tst-unique1 tst-unique2 \
179 + tst-initorder
180 # reldep9
181 test-srcs = tst-pathopt
182 tests-execstack-yes = tst-execstack tst-execstack-needed tst-execstack-prog
183 @@ -250,7 +254,10 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
184 unload7mod1 unload7mod2 \
185 order2mod1 order2mod2 order2mod3 order2mod4 \
186 tst-unique1mod1 tst-unique1mod2 \
187 - tst-unique2mod1 tst-unique2mod2
188 + tst-unique2mod1 tst-unique2mod2 \
189 + tst-initordera1 tst-initorderb1 \
190 + tst-initordera2 tst-initorderb2 \
191 + tst-initordera3 tst-initordera4
192 ifeq (yes,$(have-initfini-array))
193 modules-names += tst-array2dep tst-array5dep
194 endif
195 @@ -531,6 +538,11 @@ $(objpfx)unload6mod2.so: $(libdl)
196 $(objpfx)unload6mod3.so: $(libdl)
197 $(objpfx)unload7mod1.so: $(libdl)
198 $(objpfx)unload7mod2.so: $(objpfx)unload7mod1.so
199 +$(objpfx)tst-initordera2.so: $(objpfx)tst-initordera1.so
200 +$(objpfx)tst-initorderb2.so: $(objpfx)tst-initorderb1.so $(objpfx)tst-initordera2.so
201 +$(objpfx)tst-initordera3.so: $(objpfx)tst-initorderb2.so $(objpfx)tst-initorderb1.so
202 +$(objpfx)tst-initordera4.so: $(objpfx)tst-initordera3.so
203 +$(objpfx)tst-initorder: $(objpfx)tst-initordera4.so $(objpfx)tst-initordera1.so $(objpfx)tst-initorderb2.so
204
205 LDFLAGS-tst-tlsmod5.so = -nostdlib
206 LDFLAGS-tst-tlsmod6.so = -nostdlib
207 @@ -1162,6 +1174,12 @@ $(objpfx)tst-unique1.out: $(objpfx)tst-unique1mod1.so \
208 $(objpfx)tst-unique2: $(libdl) $(objpfx)tst-unique2mod1.so
209 $(objpfx)tst-unique2.out: $(objpfx)tst-unique2mod2.so
210
211 +$(objpfx)tst-initorder.out: $(objpfx)tst-initorder
212 + $(elf-objpfx)${rtld-installed-name} \
213 + --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
214 + $< > $@
215 + cmp $@ tst-initorder.exp > /dev/null
216 +
217 ifeq (yes,$(config-cflags-avx))
218 CFLAGS-tst-audit4.c += -mavx
219 CFLAGS-tst-auditmod4a.c += -mavx
220 diff --git a/elf/dl-deps.c b/elf/dl-deps.c
221 index a51fb6e..440fb56 100644
222 --- a/elf/dl-deps.c
223 +++ b/elf/dl-deps.c
224 @@ -1,5 +1,5 @@
225 /* Load the dependencies of a mapped object.
226 - Copyright (C) 1996-2003, 2004, 2005, 2006, 2007, 2010
227 + Copyright (C) 1996-2003, 2004, 2005, 2006, 2007, 2010, 2011
228 Free Software Foundation, Inc.
229 This file is part of the GNU C Library.
230
231 @@ -591,7 +591,7 @@ Filters not supported with LD_TRACE_PRELINKING"));
232 /* Need to allocate new array of relocation dependencies. */
233 struct link_map_reldeps *l_reldeps;
234 l_reldeps = malloc (sizeof (*l_reldeps)
235 - + map->l_reldepsmax
236 + + map->l_reldepsmax
237 * sizeof (struct link_map *));
238 if (l_reldeps == NULL)
239 /* Bad luck, keep the reldeps duplicated between
240 @@ -616,48 +616,60 @@ Filters not supported with LD_TRACE_PRELINKING"));
241 /* Now determine the order in which the initialization has to happen. */
242 memcpy (l_initfini, map->l_searchlist.r_list,
243 nlist * sizeof (struct link_map *));
244 +
245 /* We can skip looking for the binary itself which is at the front
246 - of the search list. Look through the list backward so that circular
247 - dependencies are not changing the order. */
248 - for (i = 1; i < nlist; ++i)
249 + of the search list. */
250 + assert (nlist > 1);
251 + i = 1;
252 + bool seen[nlist];
253 + memset (seen, false, nlist * sizeof (seen[0]));
254 + while (1)
255 {
256 - struct link_map *l = map->l_searchlist.r_list[i];
257 - unsigned int j;
258 - unsigned int k;
259 -
260 - /* Find the place in the initfini list where the map is currently
261 - located. */
262 - for (j = 1; l_initfini[j] != l; ++j)
263 - ;
264 -
265 - /* Find all object for which the current one is a dependency and
266 - move the found object (if necessary) in front. */
267 - for (k = j + 1; k < nlist; ++k)
268 + /* Keep track of which object we looked at this round. */
269 + seen[i] = true;
270 + struct link_map *thisp = l_initfini[i];
271 +
272 + /* Find the last object in the list for which the current one is
273 + a dependency and move the current object behind the object
274 + with the dependency. */
275 + unsigned int k = nlist - 1;
276 + while (k > i)
277 {
278 - struct link_map **runp;
279 -
280 - runp = l_initfini[k]->l_initfini;
281 + struct link_map **runp = l_initfini[k]->l_initfini;
282 if (runp != NULL)
283 - {
284 - while (*runp != NULL)
285 - if (__builtin_expect (*runp++ == l, 0))
286 - {
287 - struct link_map *here = l_initfini[k];
288 -
289 - /* Move it now. */
290 - memmove (&l_initfini[j] + 1, &l_initfini[j],
291 - (k - j) * sizeof (struct link_map *));
292 - l_initfini[j] = here;
293 + /* Look through the dependencies of the object. */
294 + while (*runp != NULL)
295 + if (__builtin_expect (*runp++ == thisp, 0))
296 + {
297 + /* Move the current object to the back past the last
298 + object with it as the dependency. */
299 + memmove (&l_initfini[i], &l_initfini[i + 1],
300 + (k - i) * sizeof (l_initfini[0]));
301 + l_initfini[k] = thisp;
302 +
303 + if (seen[i + 1])
304 + {
305 + ++i;
306 + goto next_clear;
307 + }
308 +
309 + memmove (&seen[i], &seen[i + 1], (k - i) * sizeof (seen[0]));
310 + seen[k] = true;
311 +
312 + goto next;
313 + }
314 +
315 + --k;
316 + }
317
318 - /* Don't insert further matches before the last
319 - entry moved to the front. */
320 - ++j;
321 + if (++i == nlist)
322 + break;
323 + next_clear:
324 + memset (&seen[i], false, (nlist - i) * sizeof (seen[0]));
325
326 - break;
327 - }
328 - }
329 - }
330 + next:;
331 }
332 +
333 /* Terminate the list of dependencies. */
334 l_initfini[nlist] = NULL;
335 atomic_write_barrier ();
336 diff --git a/elf/dl-fini.c b/elf/dl-fini.c
337 index ff4c33e..ba6c62a 100644
338 --- a/elf/dl-fini.c
339 +++ b/elf/dl-fini.c
340 @@ -1,5 +1,6 @@
341 /* Call the termination functions of loaded shared objects.
342 - Copyright (C) 1995,96,1998-2002,2004-2005,2009 Free Software Foundation, Inc.
343 + Copyright (C) 1995,96,1998-2002,2004-2005,2009,2011
344 + Free Software Foundation, Inc.
345 This file is part of the GNU C Library.
346
347 The GNU C Library is free software; you can redistribute it and/or
348 @@ -32,86 +33,84 @@ internal_function
349 _dl_sort_fini (struct link_map *l, struct link_map **maps, size_t nmaps,
350 char *used, Lmid_t ns)
351 {
352 - if (ns == LM_ID_BASE)
353 - /* The main executable always comes first. */
354 - l = l->l_next;
355 -
356 - for (; l != NULL; l = l->l_next)
357 - /* Do not handle ld.so in secondary namespaces and object which
358 - are not removed. */
359 - if (l == l->l_real && l->l_idx != -1)
360 - {
361 - /* Find the place in the 'maps' array. */
362 - unsigned int j;
363 - for (j = ns == LM_ID_BASE ? 1 : 0; maps[j] != l; ++j)
364 - assert (j < nmaps);
365 -
366 - /* Find all object for which the current one is a dependency
367 - and move the found object (if necessary) in front. */
368 - for (unsigned int k = j + 1; k < nmaps; ++k)
369 - {
370 - struct link_map **runp = maps[k]->l_initfini;
371 - if (runp != NULL)
372 - {
373 - while (*runp != NULL)
374 - if (*runp == l)
375 + /* We can skip looking for the binary itself which is at the front
376 + of the search list for the main namespace. */
377 + assert (nmaps > 1);
378 + unsigned int i = ns == LM_ID_BASE;
379 + bool seen[nmaps];
380 + memset (seen, false, nmaps * sizeof (seen[0]));
381 + while (1)
382 + {
383 + /* Keep track of which object we looked at this round. */
384 + seen[i] = true;
385 + struct link_map *thisp = maps[i];
386 +
387 + /* Do not handle ld.so in secondary namespaces and object which
388 + are not removed. */
389 + if (thisp != thisp->l_real || thisp->l_idx == -1)
390 + goto skip;
391 +
392 + /* Find the last object in the list for which the current one is
393 + a dependency and move the current object behind the object
394 + with the dependency. */
395 + unsigned int k = nmaps - 1;
396 + while (k > i)
397 + {
398 + struct link_map **runp = maps[k]->l_initfini;
399 + if (runp != NULL)
400 + /* Look through the dependencies of the object. */
401 + while (*runp != NULL)
402 + if (__builtin_expect (*runp++ == thisp, 0))
403 + {
404 + move:
405 + /* Move the current object to the back past the last
406 + object with it as the dependency. */
407 + memmove (&maps[i], &maps[i + 1],
408 + (k - i) * sizeof (maps[0]));
409 + maps[k] = thisp;
410 +
411 + if (used != NULL)
412 {
413 - struct link_map *here = maps[k];
414 + char here_used = used[i];
415 + memmove (&used[i], &used[i + 1],
416 + (k - i) * sizeof (used[0]));
417 + used[k] = here_used;
418 + }
419
420 - /* Move it now. */
421 - memmove (&maps[j] + 1,
422 - &maps[j], (k - j) * sizeof (struct link_map *));
423 - maps[j] = here;
424 + if (seen[i + 1])
425 + {
426 + ++i;
427 + goto next_clear;
428 + }
429
430 - if (used != NULL)
431 - {
432 - char here_used = used[k];
433 + memmove (&seen[i], &seen[i + 1], (k - i) * sizeof (seen[0]));
434 + seen[k] = true;
435
436 - memmove (&used[j] + 1,
437 - &used[j], (k - j) * sizeof (char));
438 - used[j] = here_used;
439 - }
440 + goto next;
441 + }
442
443 - ++j;
444 + if (__builtin_expect (maps[k]->l_reldeps != NULL, 0))
445 + {
446 + unsigned int m = maps[k]->l_reldeps->act;
447 + struct link_map **relmaps = &maps[k]->l_reldeps->list[0];
448
449 - break;
450 - }
451 - else
452 - ++runp;
453 - }
454 -
455 - if (__builtin_expect (maps[k]->l_reldeps != NULL, 0))
456 - {
457 - unsigned int m = maps[k]->l_reldeps->act;
458 - struct link_map **relmaps = &maps[k]->l_reldeps->list[0];
459 -
460 - while (m-- > 0)
461 - {
462 - if (relmaps[m] == l)
463 - {
464 - struct link_map *here = maps[k];
465 -
466 - /* Move it now. */
467 - memmove (&maps[j] + 1,
468 - &maps[j],
469 - (k - j) * sizeof (struct link_map *));
470 - maps[j] = here;
471 -
472 - if (used != NULL)
473 - {
474 - char here_used = used[k];
475 -
476 - memmove (&used[j] + 1,
477 - &used[j], (k - j) * sizeof (char));
478 - used[j] = here_used;
479 - }
480 -
481 - break;
482 - }
483 - }
484 - }
485 - }
486 - }
487 + /* Look through the relocation dependencies of the object. */
488 + while (m-- > 0)
489 + if (__builtin_expect (relmaps[m] == thisp, 0))
490 + goto move;
491 + }
492 +
493 + --k;
494 + }
495 +
496 + skip:
497 + if (++i == nmaps)
498 + break;
499 + next_clear:
500 + memset (&seen[i], false, (nmaps - i) * sizeof (seen[0]));
501 +
502 + next:;
503 + }
504 }
505
506
507 @@ -196,7 +195,7 @@ _dl_fini (void)
508 assert (ns == LM_ID_BASE || i == nloaded || i == nloaded - 1);
509 nmaps = i;
510
511 - if (nmaps != 0)
512 + if (nmaps > 1)
513 /* Now we have to do the sorting. */
514 _dl_sort_fini (GL(dl_ns)[ns]._ns_loaded, maps, nmaps, NULL, ns);
515
516 diff --git a/elf/tst-initorder.c b/elf/tst-initorder.c
517 new file mode 100644
518 index 0000000..9638382
519 --- /dev/null
520 +++ b/elf/tst-initorder.c
521 @@ -0,0 +1,7 @@
522 +#include <stdio.h>
523 +
524 +int
525 +main( int argc, char *argv[] )
526 +{
527 + printf( "main\n" );
528 +}
529 diff --git a/elf/tst-initorder.exp b/elf/tst-initorder.exp
530 new file mode 100644
531 index 0000000..8718f65
532 --- /dev/null
533 +++ b/elf/tst-initorder.exp
534 @@ -0,0 +1,13 @@
535 +start_a1
536 +start_a2
537 +start_b1
538 +start_b2
539 +start_a3
540 +start_a4
541 +main
542 +finish_a4
543 +finish_a3
544 +finish_b2
545 +finish_b1
546 +finish_a2
547 +finish_a1
548 diff --git a/elf/tst-initordera1.c b/elf/tst-initordera1.c
549 new file mode 100644
550 index 0000000..f161257
551 --- /dev/null
552 +++ b/elf/tst-initordera1.c
553 @@ -0,0 +1,16 @@
554 +#include <stdio.h>
555 +
556 +extern void start_a1( void ) __attribute__((constructor));
557 +extern void finish_a1( void ) __attribute__((destructor));
558 +
559 +void
560 +start_a1( void )
561 +{
562 + printf( "start_a1\n" );
563 +}
564 +
565 +void
566 +finish_a1( void )
567 +{
568 + printf( "finish_a1\n" );
569 +}
570 diff --git a/elf/tst-initordera2.c b/elf/tst-initordera2.c
571 new file mode 100644
572 index 0000000..a5a9b42
573 --- /dev/null
574 +++ b/elf/tst-initordera2.c
575 @@ -0,0 +1,16 @@
576 +#include <stdio.h>
577 +
578 +extern void start_a2( void ) __attribute__((constructor));
579 +extern void finish_a2( void ) __attribute__((destructor));
580 +
581 +void
582 +start_a2( void )
583 +{
584 + printf( "start_a2\n" );
585 +}
586 +
587 +void
588 +finish_a2( void )
589 +{
590 + printf( "finish_a2\n" );
591 +}
592 diff --git a/elf/tst-initordera3.c b/elf/tst-initordera3.c
593 new file mode 100644
594 index 0000000..1c7f496
595 --- /dev/null
596 +++ b/elf/tst-initordera3.c
597 @@ -0,0 +1,16 @@
598 +#include <stdio.h>
599 +
600 +extern void start_a3( void ) __attribute__((constructor));
601 +extern void finish_a3( void ) __attribute__((destructor));
602 +
603 +void
604 +start_a3( void )
605 +{
606 + printf( "start_a3\n" );
607 +}
608 +
609 +void
610 +finish_a3( void )
611 +{
612 + printf( "finish_a3\n" );
613 +}
614 diff --git a/elf/tst-initordera4.c b/elf/tst-initordera4.c
615 new file mode 100644
616 index 0000000..70b9f5e
617 --- /dev/null
618 +++ b/elf/tst-initordera4.c
619 @@ -0,0 +1,16 @@
620 +#include <stdio.h>
621 +
622 +extern void start_a4( void ) __attribute__((constructor));
623 +extern void finish_a4( void ) __attribute__((destructor));
624 +
625 +void
626 +start_a4( void )
627 +{
628 + printf( "start_a4\n" );
629 +}
630 +
631 +void
632 +finish_a4( void )
633 +{
634 + printf( "finish_a4\n" );
635 +}
636 diff --git a/elf/tst-initorderb1.c b/elf/tst-initorderb1.c
637 new file mode 100644
638 index 0000000..993ea3f
639 --- /dev/null
640 +++ b/elf/tst-initorderb1.c
641 @@ -0,0 +1,16 @@
642 +#include <stdio.h>
643 +
644 +extern void start_b1( void ) __attribute__((constructor));
645 +extern void finish_b1( void ) __attribute__((destructor));
646 +
647 +void
648 +start_b1( void )
649 +{
650 + printf( "start_b1\n" );
651 +}
652 +
653 +void
654 +finish_b1( void )
655 +{
656 + printf( "finish_b1\n" );
657 +}
658 diff --git a/elf/tst-initorderb2.c b/elf/tst-initorderb2.c
659 new file mode 100644
660 index 0000000..3334dda
661 --- /dev/null
662 +++ b/elf/tst-initorderb2.c
663 @@ -0,0 +1,16 @@
664 +#include <stdio.h>
665 +
666 +extern void start_b2( void ) __attribute__((constructor));
667 +extern void finish_b2( void ) __attribute__((destructor));
668 +
669 +void
670 +start_b2( void )
671 +{
672 + printf( "start_b2\n" );
673 +}
674 +
675 +void
676 +finish_b2( void )
677 +{
678 + printf( "finish_b2\n" );
679 +}
680 diff --git a/elf/tst-order-a1.c b/elf/tst-order-a1.c
681 new file mode 100644
682 index 0000000..f161257
683 --- /dev/null
684 +++ b/elf/tst-order-a1.c
685 @@ -0,0 +1,16 @@
686 +#include <stdio.h>
687 +
688 +extern void start_a1( void ) __attribute__((constructor));
689 +extern void finish_a1( void ) __attribute__((destructor));
690 +
691 +void
692 +start_a1( void )
693 +{
694 + printf( "start_a1\n" );
695 +}
696 +
697 +void
698 +finish_a1( void )
699 +{
700 + printf( "finish_a1\n" );
701 +}
702 diff --git a/elf/tst-order-a2.c b/elf/tst-order-a2.c
703 new file mode 100644
704 index 0000000..a5a9b42
705 --- /dev/null
706 +++ b/elf/tst-order-a2.c
707 @@ -0,0 +1,16 @@
708 +#include <stdio.h>
709 +
710 +extern void start_a2( void ) __attribute__((constructor));
711 +extern void finish_a2( void ) __attribute__((destructor));
712 +
713 +void
714 +start_a2( void )
715 +{
716 + printf( "start_a2\n" );
717 +}
718 +
719 +void
720 +finish_a2( void )
721 +{
722 + printf( "finish_a2\n" );
723 +}
724 diff --git a/elf/tst-order-a3.c b/elf/tst-order-a3.c
725 new file mode 100644
726 index 0000000..1c7f496
727 --- /dev/null
728 +++ b/elf/tst-order-a3.c
729 @@ -0,0 +1,16 @@
730 +#include <stdio.h>
731 +
732 +extern void start_a3( void ) __attribute__((constructor));
733 +extern void finish_a3( void ) __attribute__((destructor));
734 +
735 +void
736 +start_a3( void )
737 +{
738 + printf( "start_a3\n" );
739 +}
740 +
741 +void
742 +finish_a3( void )
743 +{
744 + printf( "finish_a3\n" );
745 +}
746 diff --git a/elf/tst-order-a4.c b/elf/tst-order-a4.c
747 new file mode 100644
748 index 0000000..70b9f5e
749 --- /dev/null
750 +++ b/elf/tst-order-a4.c
751 @@ -0,0 +1,16 @@
752 +#include <stdio.h>
753 +
754 +extern void start_a4( void ) __attribute__((constructor));
755 +extern void finish_a4( void ) __attribute__((destructor));
756 +
757 +void
758 +start_a4( void )
759 +{
760 + printf( "start_a4\n" );
761 +}
762 +
763 +void
764 +finish_a4( void )
765 +{
766 + printf( "finish_a4\n" );
767 +}
768 diff --git a/elf/tst-order-b1.c b/elf/tst-order-b1.c
769 new file mode 100644
770 index 0000000..993ea3f
771 --- /dev/null
772 +++ b/elf/tst-order-b1.c
773 @@ -0,0 +1,16 @@
774 +#include <stdio.h>
775 +
776 +extern void start_b1( void ) __attribute__((constructor));
777 +extern void finish_b1( void ) __attribute__((destructor));
778 +
779 +void
780 +start_b1( void )
781 +{
782 + printf( "start_b1\n" );
783 +}
784 +
785 +void
786 +finish_b1( void )
787 +{
788 + printf( "finish_b1\n" );
789 +}
790 diff --git a/elf/tst-order-b2.c b/elf/tst-order-b2.c
791 new file mode 100644
792 index 0000000..3334dda
793 --- /dev/null
794 +++ b/elf/tst-order-b2.c
795 @@ -0,0 +1,16 @@
796 +#include <stdio.h>
797 +
798 +extern void start_b2( void ) __attribute__((constructor));
799 +extern void finish_b2( void ) __attribute__((destructor));
800 +
801 +void
802 +start_b2( void )
803 +{
804 + printf( "start_b2\n" );
805 +}
806 +
807 +void
808 +finish_b2( void )
809 +{
810 + printf( "finish_b2\n" );
811 +}
812 diff --git a/elf/tst-order-main.c b/elf/tst-order-main.c
813 new file mode 100644
814 index 0000000..80f4f6b
815 --- /dev/null
816 +++ b/elf/tst-order-main.c
817 @@ -0,0 +1,10 @@
818 +#include <stdio.h>
819 +#include <unistd.h>
820 +#include <stdlib.h>
821 +
822 +int
823 +main( int argc, char *argv[] )
824 +{
825 + printf( "main\n" );
826 + exit(EXIT_SUCCESS);
827 +}
828 --
829 1.7.5.rc3
830
831
832
833
834 1.1 src/patchsets/glibc/2.13/6145_all_powerpc64-glibc-2.13-syscall.patch
835
836 file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.13/6145_all_powerpc64-glibc-2.13-syscall.patch?rev=1.1&view=markup
837 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.13/6145_all_powerpc64-glibc-2.13-syscall.patch?rev=1.1&content-type=text/plain
838
839 Index: 6145_all_powerpc64-glibc-2.13-syscall.patch
840 ===================================================================
841 From fbd64d7ff21658ab754db8faa796f5ce5d388e7c Mon Sep 17 00:00:00 2001
842 From: Ryan S. Arnold <rsa@××××××.com>
843 Date: Thu, 17 Feb 2011 01:21:08 -0500
844 Subject: [PATCH] Fix INTERNAL_[V]SYSCALL_NCS macros to not cast return val to
845 int. (cherry picked from commit
846 d55fd7a5573ea7c7c14af95bc37618469cde8a5f)
847
848 ---
849 ChangeLog | 9 ++
850 sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h | 4 +-
851 sysdeps/wordsize-64/Makefile | 6 +
852 sysdeps/wordsize-64/tst-writev.c | 107 ++++++++++++++++++++
853 4 files changed, 124 insertions(+), 2 deletions(-)
854 create mode 100644 sysdeps/wordsize-64/Makefile
855 create mode 100644 sysdeps/wordsize-64/tst-writev.c
856
857 2011-02-16 Ryan S. Arnold <rsa@××××××.com>
858
859 * sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h:
860 (INTERNAL_VSYSCALL_NCS INTERNAL_SYSCALL_NCS): Remove erroneous (int)
861 cast from r3.
862 * sysdeps/wordsize-64/Makefile: New file. Add tst-writev to
863 'tests' variable.
864 * sysdeps/wordsize-64/tst-writev.c: New file.
865
866 diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
867 index aab4b72..e714c4c 100644
868 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
869 +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
870 @@ -172,7 +172,7 @@
871 : "r9", "r10", "r11", "r12", \
872 "cr0", "ctr", "lr", "memory"); \
873 err = (long int) r0; \
874 - (int) r3; \
875 + r3; \
876 })
877
878 #undef INLINE_SYSCALL
879 @@ -219,7 +219,7 @@
880 : "r9", "r10", "r11", "r12", \
881 "cr0", "ctr", "memory"); \
882 err = r0; \
883 - (int) r3; \
884 + r3; \
885 })
886 #define INTERNAL_SYSCALL(name, err, nr, args...) \
887 INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, args)
888 diff --git a/sysdeps/wordsize-64/Makefile b/sysdeps/wordsize-64/Makefile
889 new file mode 100644
890 index 0000000..9903f51
891 --- /dev/null
892 +++ b/sysdeps/wordsize-64/Makefile
893 @@ -0,0 +1,6 @@
894 +ifeq ($(subdir),misc)
895 +tests += tst-writev
896 +
897 +# Time enough for a large writev syscall to complete.
898 +tst-writev-ENV = TIMEOUTFACTOR="10"
899 +endif
900 diff --git a/sysdeps/wordsize-64/tst-writev.c b/sysdeps/wordsize-64/tst-writev.c
901 new file mode 100644
902 index 0000000..6e47886
903 --- /dev/null
904 +++ b/sysdeps/wordsize-64/tst-writev.c
905 @@ -0,0 +1,107 @@
906 +/* Copyright (C) 2011 Free Software Foundation, Inc.
907 + This file is part of the GNU C Library.
908 + Contributed by Ryan S. Arnold <rsa@××××××.com>, 2011.
909 +
910 + The GNU C Library is free software; you can redistribute it and/or
911 + modify it under the terms of the GNU Lesser General Public
912 + License as published by the Free Software Foundation; either
913 + version 2.1 of the License, or (at your option) any later version.
914 +
915 + The GNU C Library is distributed in the hope that it will be useful,
916 + but WITHOUT ANY WARRANTY; without even the implied warranty of
917 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
918 + Lesser General Public License for more details.
919 +
920 + You should have received a copy of the GNU Lesser General Public
921 + License along with the GNU C Library; if not, write to the Free
922 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
923 + 02111-1307 USA. */
924 +
925 +#include <fcntl.h>
926 +#include <paths.h>
927 +#include <stdio.h>
928 +#include <stdlib.h>
929 +#include <unistd.h>
930 +#include <sys/uio.h>
931 +
932 +
933 +/* The purpose of this test is to verify that the INTERNAL_[V]SYSCALL_NCS
934 + macros on 64-bit platforms don't cast the return type to (int) which would
935 + erroneously sign extend the return value should the high bit of the bottom
936 + half of the word be '1'. */
937 +
938 +#if 0
939 +/* Used to test the non power-of-2 code path. */
940 +#undef IOV_MAX
941 +#define IOV_MAX 1000
942 +#endif
943 +
944 +/* writev() should report that it has written EXPECTED number of bytes. */
945 +#define EXPECTED ((size_t) INT32_MAX + 1)
946 +
947 +static int
948 +do_test (void)
949 +{
950 + struct iovec iv[IOV_MAX];
951 + /* POSIX doesn't guarantee that IOV_MAX is pow of 2 but we're optimistic. */
952 + size_t bufsz = EXPECTED / IOV_MAX;
953 + size_t bufrem = EXPECTED % IOV_MAX;
954 +
955 + /* If there's a remainder then IOV_MAX probably isn't a power of 2 and we
956 + need to make bufsz bigger so that the last iovec, iv[IOV_MAX-1], is free
957 + for the remainder. */
958 + if (bufrem)
959 + {
960 + bufsz = bufsz + 1;
961 + bufrem = EXPECTED - (bufsz * (IOV_MAX - 1));
962 + }
963 +
964 + /* We writev to /dev/null since we're just testing writev's return value. */
965 + int fd = open (_PATH_DEVNULL, O_WRONLY);
966 + if (fd == -1)
967 + {
968 + printf ("Unable to open /dev/null for writing.\n");
969 + return -1;
970 + }
971 +
972 + iv[0].iov_base = malloc (bufsz);
973 + if (iv[0].iov_base == NULL)
974 + {
975 + printf ("malloc (%zu) failed.\n", bufsz);
976 + close (fd);
977 + return -1;
978 + }
979 + iv[0].iov_len = bufsz;
980 +
981 + /* We optimistically presume that there isn't a remainder and set all iovec
982 + instances to the same base and len as the first instance. */
983 + for (int i = 1; i < IOV_MAX; i++)
984 + {
985 + /* We don't care what the data is so reuse the allocation from iv[0]; */
986 + iv[i].iov_base = iv[0].iov_base;
987 + iv[i].iov_len = iv[0].iov_len;
988 + }
989 +
990 + /* If there is a remainder then we correct the last iov_len. */
991 + if (bufrem)
992 + iv[IOV_MAX - 1].iov_len = bufrem;
993 +
994 + /* Write junk to /dev/null with the writev syscall in order to get a return
995 + of INT32_MAX+1 bytes to verify that the INTERNAL_SYSCALL wrappers aren't
996 + mangling the result if the signbit of a 32-bit number is set. */
997 + ssize_t ret = writev (fd, iv, IOV_MAX);
998 +
999 + free (iv[0].iov_base);
1000 + close (fd);
1001 +
1002 + if (ret != (ssize_t) EXPECTED)
1003 + {
1004 + printf ("writev() return value: %zd != EXPECTED: %zd\n", ret, EXPECTED);
1005 + return 1;
1006 + }
1007 +
1008 + return 0;
1009 +}
1010 +
1011 +#define TEST_FUNCTION do_test ()
1012 +#include "../test-skeleton.c"
1013 --
1014 1.7.5.rc3
1015
1016
1017
1018
1019 1.1 src/patchsets/glibc/2.13/6146_all_ppc-glibc-2.13-vsx-toc-O3.patch
1020
1021 file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.13/6146_all_ppc-glibc-2.13-vsx-toc-O3.patch?rev=1.1&view=markup
1022 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.13/6146_all_ppc-glibc-2.13-vsx-toc-O3.patch?rev=1.1&content-type=text/plain
1023
1024 Index: 6146_all_ppc-glibc-2.13-vsx-toc-O3.patch
1025 ===================================================================
1026 From 21afa712db5ecfc4d847fc36d0eedf173212a15a Mon Sep 17 00:00:00 2001
1027 From: Ryan S. Arnold <rsa@××××××.com>
1028 Date: Thu, 17 Feb 2011 00:59:15 -0500
1029 Subject: [PATCH] Disable VSX usage in rtld.c to prevent TOC ref before relocs
1030 are resolved. (cherry picked from commit
1031 2206397e1c46f69fb20eeb3de1920d3a7014c325)
1032
1033 ---
1034 ChangeLog | 7 +++++++
1035 sysdeps/powerpc/powerpc64/power7/Makefile | 5 +++++
1036 2 files changed, 12 insertions(+), 0 deletions(-)
1037 create mode 100644 sysdeps/powerpc/powerpc64/power7/Makefile
1038
1039 2011-02-15 Ryan S. Arnold <rsa@××××××.com>
1040
1041 * sysdeps/powerpc/powerpc64/power7/Makefile: New file which adds
1042 -mno-vsx to the CFLAGS-rtld.c variable to avoid using VSX registers and
1043 insns in _dl_start to prevent a TOC reference before relocs are
1044 resolved.
1045
1046 diff --git a/sysdeps/powerpc/powerpc64/power7/Makefile b/sysdeps/powerpc/powerpc64/power7/Makefile
1047 new file mode 100644
1048 index 0000000..b0f4520
1049 --- /dev/null
1050 +++ b/sysdeps/powerpc/powerpc64/power7/Makefile
1051 @@ -0,0 +1,5 @@
1052 +ifeq ($(subdir),elf)
1053 +# Prevent the use of VSX registers and insns in _dl_start, which under -O3
1054 +# optimization may require a TOC reference before relocations are resolved.
1055 +CFLAGS-rtld.c += -mno-vsx
1056 +endif
1057 --
1058 1.7.5.rc3