OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1101 lines
36 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: package/.../glibc/glibc-2.16.0-0000-upstream-fixes.patch
  5. # Copyright (C) 2013 The OpenSDE Project
  6. #
  7. # More information can be found in the files COPYING and README.
  8. #
  9. # This patch file is dual-licensed. It is available under the license the
  10. # patched project is licensed under, as long as it is an OpenSource license
  11. # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
  12. # of the GNU General Public License as published by the Free Software
  13. # Foundation; either version 2 of the License, or (at your option) any later
  14. # version.
  15. # --- SDE-COPYRIGHT-NOTE-END ---
  16. From 33c9f2211ca7b23299e016ee246e2d2c6cc6e831 Mon Sep 17 00:00:00 2001
  17. From: Mike Frysinger <vapier@gentoo.org>
  18. Date: Tue, 3 Jul 2012 15:22:05 -0400
  19. Subject: [PATCH] sunrpc: fix rpc bootstrap builds
  20. If you build & install glibc w/rpc disabled, you no longer have headers in
  21. /usr/include/rpc/ (this is expected). But if you try to build glibc w/rpc
  22. enabled, this gets into a bad state due to the new rpc helpers that get
  23. cross-compiled:
  24. $ make
  25. ...
  26. x86_64-pc-linux-gnu-gcc -m32 -D_RPC_THREAD_SAFE_ -D_GNU_SOURCE -DIS_IN_build \
  27. -include $objdir/config.h rpc_clntout.c -o $objdir/sunrpc/cross-rpc_clntout.o \
  28. -MMD -MP -MF $objdir/sunrpc/cross-rpc_clntout.o.dt -MT $objdir/sunrpc/cross-rpc_clntout.o -c
  29. rpc_clntout.c:34:23: fatal error: rpc/types.h: No such file or directory
  30. compilation terminated.
  31. make: *** [$objdir/sunrpc/cross-rpc_clntout.o] Error 1
  32. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
  33. (cherry picked from commit fb21f89b75d0152aa42efb6b620843799a4cd76b)
  34. ---
  35. sunrpc/rpc_clntout.c | 2 +-
  36. 1 files changed, 1 insertions(+), 1 deletions(-)
  37. diff --git a/sunrpc/rpc_clntout.c b/sunrpc/rpc_clntout.c
  38. index ec040c7..ce4d2a4 100644
  39. --- a/sunrpc/rpc_clntout.c
  40. +++ b/sunrpc/rpc_clntout.c
  41. @@ -31,7 +31,7 @@
  42. */
  43. #include <stdio.h>
  44. #include <string.h>
  45. -#include <rpc/types.h>
  46. +#include "rpc/types.h"
  47. #include "rpc_parse.h"
  48. #include "rpc_util.h"
  49. #include "proto.h"
  50. --
  51. 1.7.2.3
  52. From 76adf226534522267a38cf4b7d293706279d5cd2 Mon Sep 17 00:00:00 2001
  53. From: Liubov Dmitrieva <liubov.dmitrieva@gmail.com>
  54. Date: Wed, 15 Aug 2012 21:06:55 +0200
  55. Subject: [PATCH] Fix segmentation fault in strncasecmp for i686
  56. 2012-08-15 Liubov Dmitrieva <liubov.dmitrieva@gmail.com>
  57. [BZ #14195]
  58. * sysdeps/i386/i686/multiarch/strcmp-sssse3.S: Fix
  59. segmentation fault for a case of two empty input strings.
  60. * string/test-strncasecmp.c (check1): Renamed to...
  61. (bz12205): ...this.
  62. (bz14195): Add new testcase for two empty input strings and N > 0.
  63. (test_main): Call new testcase, adapt for renamed function.
  64. (cherry picked from commit b3f479a85a3e191befbe821d787d7f71c0f64e79)
  65. ---
  66. string/test-strncasecmp.c | 18 ++++++++++++++----
  67. sysdeps/i386/i686/multiarch/strcmp-ssse3.S | 2 +-
  68. 2 files changed, 15 insertions(+), 5 deletions(-)
  69. diff --git a/string/test-strncasecmp.c b/string/test-strncasecmp.c
  70. index 6c17530..acfe668 100644
  71. --- a/string/test-strncasecmp.c
  72. +++ b/string/test-strncasecmp.c
  73. @@ -1,5 +1,5 @@
  74. /* Test and measure strncasecmp functions.
  75. - Copyright (C) 1999, 2002, 2003, 2005, 2010 Free Software Foundation, Inc.
  76. + Copyright (C) 1999-2012 Free Software Foundation, Inc.
  77. This file is part of the GNU C Library.
  78. Written by Jakub Jelinek <jakub@redhat.com>, 1999.
  79. @@ -251,9 +251,9 @@ do_random_tests (void)
  80. }
  81. }
  82. -
  83. +/* Regression test for BZ #12205 */
  84. static void
  85. -check1 (void)
  86. +bz12205 (void)
  87. {
  88. static char cp [4096+16] __attribute__ ((aligned(4096)));
  89. static char gotrel[4096] __attribute__ ((aligned(4096)));
  90. @@ -270,6 +270,15 @@ check1 (void)
  91. check_result (impl, s1, s2, n, exp_result);
  92. }
  93. +/* Regression test for BZ #14195 */
  94. +static void
  95. +bz14195 (void)
  96. +{
  97. + const char *empty_string = "";
  98. + FOR_EACH_IMPL (impl, 0)
  99. + check_result (impl, empty_string, "", 5, 0);
  100. +}
  101. +
  102. int
  103. test_main (void)
  104. {
  105. @@ -277,7 +286,8 @@ test_main (void)
  106. test_init ();
  107. - check1 ();
  108. + bz12205 ();
  109. + bz14195 ();
  110. printf ("%23s", "");
  111. FOR_EACH_IMPL (impl, 0)
  112. diff --git a/sysdeps/i386/i686/multiarch/strcmp-ssse3.S b/sysdeps/i386/i686/multiarch/strcmp-ssse3.S
  113. index 5e6321e..9735ad0 100644
  114. --- a/sysdeps/i386/i686/multiarch/strcmp-ssse3.S
  115. +++ b/sysdeps/i386/i686/multiarch/strcmp-ssse3.S
  116. @@ -2445,7 +2445,7 @@ L(less16bytes_sncmp):
  117. # endif
  118. jne L(neq_sncmp)
  119. test %cl, %cl
  120. - je L(eq)
  121. + je L(eq_sncmp)
  122. cmp $1, REM
  123. je L(eq_sncmp)
  124. --
  125. 1.7.2.3
  126. From a01a14d518c2b32cdb0d21942b2d34da33692409 Mon Sep 17 00:00:00 2001
  127. From: Joseph Myers <joseph@codesourcery.com>
  128. Date: Mon, 27 Aug 2012 15:59:24 +0000
  129. Subject: [PATCH] Fix strtod integer/buffer overflow (bug 14459).
  130. (cherry picked from commit d6e70f4368533224e66d10b7f2126b899a3fd5e4)
  131. ---
  132. stdlib/Makefile | 3 +-
  133. stdlib/strtod_l.c | 142 ++++++++++++++++++++++++++++++++---------
  134. stdlib/tst-strtod-overflow.c | 48 ++++++++++++++
  135. 3 files changed, 161 insertions(+), 32 deletions(-)
  136. create mode 100644 stdlib/tst-strtod-overflow.c
  137. diff --git a/stdlib/Makefile b/stdlib/Makefile
  138. index f7811c5..79c9acb 100644
  139. --- a/stdlib/Makefile
  140. +++ b/stdlib/Makefile
  141. @@ -68,7 +68,8 @@ tests := tst-strtol tst-strtod testmb testrand testsort testdiv \
  142. tst-atof1 tst-atof2 tst-strtod2 tst-strtod3 tst-rand48-2 \
  143. tst-makecontext tst-strtod4 tst-strtod5 tst-qsort2 \
  144. tst-makecontext2 tst-strtod6 tst-unsetenv1 \
  145. - tst-makecontext3 bug-getcontext bug-fmtmsg1
  146. + tst-makecontext3 bug-getcontext bug-fmtmsg1 \
  147. + tst-strtod-overflow
  148. include ../Makeconfig
  149. diff --git a/stdlib/strtod_l.c b/stdlib/strtod_l.c
  150. index 2166a08..a8a7ea8 100644
  151. --- a/stdlib/strtod_l.c
  152. +++ b/stdlib/strtod_l.c
  153. @@ -60,6 +60,7 @@ extern unsigned long long int ____strtoull_l_internal (const char *, char **,
  154. #include <math.h>
  155. #include <stdlib.h>
  156. #include <string.h>
  157. +#include <stdint.h>
  158. /* The gmp headers need some configuration frobs. */
  159. #define HAVE_ALLOCA 1
  160. @@ -72,7 +73,6 @@ extern unsigned long long int ____strtoull_l_internal (const char *, char **,
  161. #include "longlong.h"
  162. #include "fpioconst.h"
  163. -#define NDEBUG 1
  164. #include <assert.h>
  165. @@ -174,19 +174,19 @@ extern const mp_limb_t _tens_in_limb[MAX_DIG_PER_LIMB + 1];
  166. /* Return a floating point number of the needed type according to the given
  167. multi-precision number after possible rounding. */
  168. static FLOAT
  169. -round_and_return (mp_limb_t *retval, int exponent, int negative,
  170. +round_and_return (mp_limb_t *retval, intmax_t exponent, int negative,
  171. mp_limb_t round_limb, mp_size_t round_bit, int more_bits)
  172. {
  173. if (exponent < MIN_EXP - 1)
  174. {
  175. - mp_size_t shift = MIN_EXP - 1 - exponent;
  176. -
  177. - if (shift > MANT_DIG)
  178. + if (exponent < MIN_EXP - 1 - MANT_DIG)
  179. {
  180. __set_errno (ERANGE);
  181. return 0.0;
  182. }
  183. + mp_size_t shift = MIN_EXP - 1 - exponent;
  184. +
  185. more_bits |= (round_limb & ((((mp_limb_t) 1) << round_bit) - 1)) != 0;
  186. if (shift == MANT_DIG)
  187. /* This is a special case to handle the very seldom case where
  188. @@ -233,6 +233,9 @@ round_and_return (mp_limb_t *retval, int exponent, int negative,
  189. __set_errno (ERANGE);
  190. }
  191. + if (exponent > MAX_EXP)
  192. + goto overflow;
  193. +
  194. if ((round_limb & (((mp_limb_t) 1) << round_bit)) != 0
  195. && (more_bits || (retval[0] & 1) != 0
  196. || (round_limb & ((((mp_limb_t) 1) << round_bit) - 1)) != 0))
  197. @@ -258,6 +261,7 @@ round_and_return (mp_limb_t *retval, int exponent, int negative,
  198. }
  199. if (exponent > MAX_EXP)
  200. + overflow:
  201. return negative ? -FLOAT_HUGE_VAL : FLOAT_HUGE_VAL;
  202. return MPN2FLOAT (retval, exponent, negative);
  203. @@ -271,7 +275,7 @@ round_and_return (mp_limb_t *retval, int exponent, int negative,
  204. factor for the resulting number (see code) multiply by it. */
  205. static const STRING_TYPE *
  206. str_to_mpn (const STRING_TYPE *str, int digcnt, mp_limb_t *n, mp_size_t *nsize,
  207. - int *exponent
  208. + intmax_t *exponent
  209. #ifndef USE_WIDE_CHAR
  210. , const char *decimal, size_t decimal_len, const char *thousands
  211. #endif
  212. @@ -301,6 +305,7 @@ str_to_mpn (const STRING_TYPE *str, int digcnt, mp_limb_t *n, mp_size_t *nsize,
  213. cy += __mpn_add_1 (n, n, *nsize, low);
  214. if (cy != 0)
  215. {
  216. + assert (*nsize < MPNSIZE);
  217. n[*nsize] = cy;
  218. ++(*nsize);
  219. }
  220. @@ -335,7 +340,7 @@ str_to_mpn (const STRING_TYPE *str, int digcnt, mp_limb_t *n, mp_size_t *nsize,
  221. }
  222. while (--digcnt > 0);
  223. - if (*exponent > 0 && cnt + *exponent <= MAX_DIG_PER_LIMB)
  224. + if (*exponent > 0 && *exponent <= MAX_DIG_PER_LIMB - cnt)
  225. {
  226. low *= _tens_in_limb[*exponent];
  227. start = _tens_in_limb[cnt + *exponent];
  228. @@ -355,7 +360,10 @@ str_to_mpn (const STRING_TYPE *str, int digcnt, mp_limb_t *n, mp_size_t *nsize,
  229. cy = __mpn_mul_1 (n, n, *nsize, start);
  230. cy += __mpn_add_1 (n, n, *nsize, low);
  231. if (cy != 0)
  232. - n[(*nsize)++] = cy;
  233. + {
  234. + assert (*nsize < MPNSIZE);
  235. + n[(*nsize)++] = cy;
  236. + }
  237. }
  238. return str;
  239. @@ -413,7 +421,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
  240. {
  241. int negative; /* The sign of the number. */
  242. MPN_VAR (num); /* MP representation of the number. */
  243. - int exponent; /* Exponent of the number. */
  244. + intmax_t exponent; /* Exponent of the number. */
  245. /* Numbers starting `0X' or `0x' have to be processed with base 16. */
  246. int base = 10;
  247. @@ -435,7 +443,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
  248. /* Points at the character following the integer and fractional digits. */
  249. const STRING_TYPE *expp;
  250. /* Total number of digit and number of digits in integer part. */
  251. - int dig_no, int_no, lead_zero;
  252. + size_t dig_no, int_no, lead_zero;
  253. /* Contains the last character read. */
  254. CHAR_TYPE c;
  255. @@ -767,7 +775,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
  256. are all or any is really a fractional digit will be decided
  257. later. */
  258. int_no = dig_no;
  259. - lead_zero = int_no == 0 ? -1 : 0;
  260. + lead_zero = int_no == 0 ? (size_t) -1 : 0;
  261. /* Read the fractional digits. A special case are the 'american
  262. style' numbers like `16.' i.e. with decimal point but without
  263. @@ -789,12 +797,13 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
  264. (base == 16 && ({ CHAR_TYPE lo = TOLOWER (c);
  265. lo >= L_('a') && lo <= L_('f'); })))
  266. {
  267. - if (c != L_('0') && lead_zero == -1)
  268. + if (c != L_('0') && lead_zero == (size_t) -1)
  269. lead_zero = dig_no - int_no;
  270. ++dig_no;
  271. c = *++cp;
  272. }
  273. }
  274. + assert (dig_no <= (uintmax_t) INTMAX_MAX);
  275. /* Remember start of exponent (if any). */
  276. expp = cp;
  277. @@ -817,24 +826,80 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
  278. if (c >= L_('0') && c <= L_('9'))
  279. {
  280. - int exp_limit;
  281. + intmax_t exp_limit;
  282. /* Get the exponent limit. */
  283. if (base == 16)
  284. - exp_limit = (exp_negative ?
  285. - -MIN_EXP + MANT_DIG + 4 * int_no :
  286. - MAX_EXP - 4 * int_no + 4 * lead_zero + 3);
  287. + {
  288. + if (exp_negative)
  289. + {
  290. + assert (int_no <= (uintmax_t) (INTMAX_MAX
  291. + + MIN_EXP - MANT_DIG) / 4);
  292. + exp_limit = -MIN_EXP + MANT_DIG + 4 * (intmax_t) int_no;
  293. + }
  294. + else
  295. + {
  296. + if (int_no)
  297. + {
  298. + assert (lead_zero == 0
  299. + && int_no <= (uintmax_t) INTMAX_MAX / 4);
  300. + exp_limit = MAX_EXP - 4 * (intmax_t) int_no + 3;
  301. + }
  302. + else if (lead_zero == (size_t) -1)
  303. + {
  304. + /* The number is zero and this limit is
  305. + arbitrary. */
  306. + exp_limit = MAX_EXP + 3;
  307. + }
  308. + else
  309. + {
  310. + assert (lead_zero
  311. + <= (uintmax_t) (INTMAX_MAX - MAX_EXP - 3) / 4);
  312. + exp_limit = (MAX_EXP
  313. + + 4 * (intmax_t) lead_zero
  314. + + 3);
  315. + }
  316. + }
  317. + }
  318. else
  319. - exp_limit = (exp_negative ?
  320. - -MIN_10_EXP + MANT_DIG + int_no :
  321. - MAX_10_EXP - int_no + lead_zero + 1);
  322. + {
  323. + if (exp_negative)
  324. + {
  325. + assert (int_no
  326. + <= (uintmax_t) (INTMAX_MAX + MIN_10_EXP - MANT_DIG));
  327. + exp_limit = -MIN_10_EXP + MANT_DIG + (intmax_t) int_no;
  328. + }
  329. + else
  330. + {
  331. + if (int_no)
  332. + {
  333. + assert (lead_zero == 0
  334. + && int_no <= (uintmax_t) INTMAX_MAX);
  335. + exp_limit = MAX_10_EXP - (intmax_t) int_no + 1;
  336. + }
  337. + else if (lead_zero == (size_t) -1)
  338. + {
  339. + /* The number is zero and this limit is
  340. + arbitrary. */
  341. + exp_limit = MAX_10_EXP + 1;
  342. + }
  343. + else
  344. + {
  345. + assert (lead_zero
  346. + <= (uintmax_t) (INTMAX_MAX - MAX_10_EXP - 1));
  347. + exp_limit = MAX_10_EXP + (intmax_t) lead_zero + 1;
  348. + }
  349. + }
  350. + }
  351. +
  352. + if (exp_limit < 0)
  353. + exp_limit = 0;
  354. do
  355. {
  356. - exponent *= 10;
  357. - exponent += c - L_('0');
  358. -
  359. - if (__builtin_expect (exponent > exp_limit, 0))
  360. + if (__builtin_expect ((exponent > exp_limit / 10
  361. + || (exponent == exp_limit / 10
  362. + && c - L_('0') > exp_limit % 10)), 0))
  363. /* The exponent is too large/small to represent a valid
  364. number. */
  365. {
  366. @@ -843,7 +908,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
  367. /* We have to take care for special situation: a joker
  368. might have written "0.0e100000" which is in fact
  369. zero. */
  370. - if (lead_zero == -1)
  371. + if (lead_zero == (size_t) -1)
  372. result = negative ? -0.0 : 0.0;
  373. else
  374. {
  375. @@ -862,6 +927,9 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
  376. /* NOTREACHED */
  377. }
  378. + exponent *= 10;
  379. + exponent += c - L_('0');
  380. +
  381. c = *++cp;
  382. }
  383. while (c >= L_('0') && c <= L_('9'));
  384. @@ -930,7 +998,14 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
  385. }
  386. #endif
  387. startp += lead_zero + decimal_len;
  388. - exponent -= base == 16 ? 4 * lead_zero : lead_zero;
  389. + assert (lead_zero <= (base == 16
  390. + ? (uintmax_t) INTMAX_MAX / 4
  391. + : (uintmax_t) INTMAX_MAX));
  392. + assert (lead_zero <= (base == 16
  393. + ? ((uintmax_t) exponent
  394. + - (uintmax_t) INTMAX_MIN) / 4
  395. + : ((uintmax_t) exponent - (uintmax_t) INTMAX_MIN)));
  396. + exponent -= base == 16 ? 4 * (intmax_t) lead_zero : (intmax_t) lead_zero;
  397. dig_no -= lead_zero;
  398. }
  399. @@ -972,7 +1047,10 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
  400. }
  401. /* Adjust the exponent for the bits we are shifting in. */
  402. - exponent += bits - 1 + (int_no - 1) * 4;
  403. + assert (int_no <= (uintmax_t) (exponent < 0
  404. + ? (INTMAX_MAX - bits + 1) / 4
  405. + : (INTMAX_MAX - exponent - bits + 1) / 4));
  406. + exponent += bits - 1 + ((intmax_t) int_no - 1) * 4;
  407. while (--dig_no > 0 && idx >= 0)
  408. {
  409. @@ -1024,13 +1102,15 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
  410. really integer digits or belong to the fractional part; i.e. we normalize
  411. 123e-2 to 1.23. */
  412. {
  413. - register int incr = (exponent < 0 ? MAX (-int_no, exponent)
  414. - : MIN (dig_no - int_no, exponent));
  415. + register intmax_t incr = (exponent < 0
  416. + ? MAX (-(intmax_t) int_no, exponent)
  417. + : MIN ((intmax_t) dig_no - (intmax_t) int_no,
  418. + exponent));
  419. int_no += incr;
  420. exponent -= incr;
  421. }
  422. - if (__builtin_expect (int_no + exponent > MAX_10_EXP + 1, 0))
  423. + if (__builtin_expect (exponent > MAX_10_EXP + 1 - (intmax_t) int_no, 0))
  424. {
  425. __set_errno (ERANGE);
  426. return negative ? -FLOAT_HUGE_VAL : FLOAT_HUGE_VAL;
  427. @@ -1215,7 +1295,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
  428. digits we should have enough bits for the result. The remaining
  429. decimal digits give us the information that more bits are following.
  430. This can be used while rounding. (Two added as a safety margin.) */
  431. - if (dig_no - int_no > (MANT_DIG - bits + 2) / 3 + 2)
  432. + if ((intmax_t) dig_no > (intmax_t) int_no + (MANT_DIG - bits + 2) / 3 + 2)
  433. {
  434. dig_no = int_no + (MANT_DIG - bits + 2) / 3 + 2;
  435. more_bits = 1;
  436. @@ -1223,7 +1303,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
  437. else
  438. more_bits = 0;
  439. - neg_exp = dig_no - int_no - exponent;
  440. + neg_exp = (intmax_t) dig_no - (intmax_t) int_no - exponent;
  441. /* Construct the denominator. */
  442. densize = 0;
  443. diff --git a/stdlib/tst-strtod-overflow.c b/stdlib/tst-strtod-overflow.c
  444. new file mode 100644
  445. index 0000000..668d55b
  446. --- /dev/null
  447. +++ b/stdlib/tst-strtod-overflow.c
  448. @@ -0,0 +1,48 @@
  449. +/* Test for integer/buffer overflow in strtod.
  450. + Copyright (C) 2012 Free Software Foundation, Inc.
  451. + This file is part of the GNU C Library.
  452. +
  453. + The GNU C Library is free software; you can redistribute it and/or
  454. + modify it under the terms of the GNU Lesser General Public
  455. + License as published by the Free Software Foundation; either
  456. + version 2.1 of the License, or (at your option) any later version.
  457. +
  458. + The GNU C Library is distributed in the hope that it will be useful,
  459. + but WITHOUT ANY WARRANTY; without even the implied warranty of
  460. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  461. + Lesser General Public License for more details.
  462. +
  463. + You should have received a copy of the GNU Lesser General Public
  464. + License along with the GNU C Library; if not, see
  465. + <http://www.gnu.org/licenses/>. */
  466. +
  467. +#include <stdio.h>
  468. +#include <stdlib.h>
  469. +#include <string.h>
  470. +
  471. +#define EXPONENT "e-2147483649"
  472. +#define SIZE 214748364
  473. +
  474. +static int
  475. +do_test (void)
  476. +{
  477. + char *p = malloc (1 + SIZE + sizeof (EXPONENT));
  478. + if (p == NULL)
  479. + {
  480. + puts ("malloc failed, cannot test for overflow");
  481. + return 0;
  482. + }
  483. + p[0] = '1';
  484. + memset (p + 1, '0', SIZE);
  485. + memcpy (p + 1 + SIZE, EXPONENT, sizeof (EXPONENT));
  486. + double d = strtod (p, NULL);
  487. + if (d != 0)
  488. + {
  489. + printf ("strtod returned wrong value: %a\n", d);
  490. + return 1;
  491. + }
  492. + return 0;
  493. +}
  494. +
  495. +#define TEST_FUNCTION do_test ()
  496. +#include "../test-skeleton.c"
  497. --
  498. 1.7.2.3
  499. From 39086d7f713d8e54f70362d662a161d783ccd5e6 Mon Sep 17 00:00:00 2001
  500. From: H.J. Lu <hjl.tools@gmail.com>
  501. Date: Wed, 29 Aug 2012 06:45:37 -0700
  502. Subject: [PATCH] Use LD_SO to set $ld_so_name/$ld_so_version
  503. cherry-pick d22e28b070d3d1572d39a463d711c6f223078552
  504. ---
  505. Makefile | 2 +-
  506. scripts/test-installation.pl | 7 +++++++
  507. 2 files changed, 8 insertions(+), 1 deletions(-)
  508. diff --git a/Makefile b/Makefile
  509. index 89588c1..f993c91 100644
  510. --- a/Makefile
  511. +++ b/Makefile
  512. @@ -111,7 +111,7 @@ install:
  513. ifneq (no,$(PERL))
  514. ifeq (/usr,$(prefix))
  515. ifeq (,$(install_root))
  516. - CC="$(CC)" $(PERL) scripts/test-installation.pl $(common-objpfx)
  517. + LD_SO=$(ld.so-version) CC="$(CC)" $(PERL) scripts/test-installation.pl $(common-objpfx)
  518. endif
  519. endif
  520. endif
  521. diff --git a/scripts/test-installation.pl b/scripts/test-installation.pl
  522. index 1b22086..0700770 100755
  523. --- a/scripts/test-installation.pl
  524. +++ b/scripts/test-installation.pl
  525. @@ -25,6 +25,11 @@ if ($ENV{CC}) {
  526. } else {
  527. $CC= "gcc";
  528. }
  529. +if ($ENV{LD_SO}) {
  530. + $LD_SO = $ENV{LD_SO};
  531. +} else {
  532. + $LD_SO = "";
  533. +}
  534. sub usage {
  535. print "Usage: test-installation [soversions.mk]\n";
  536. @@ -112,6 +117,8 @@ while (<SOVERSIONS>) {
  537. $link_libs .= " -l$name";
  538. $versions{$name} = $version;
  539. }
  540. + } elsif ($LD_SO ne "") {
  541. + ($ld_so_name, $ld_so_version) = split ('\.so\.', $LD_SO);
  542. } else {
  543. if (/^ld\.so/) {
  544. ($ld_so_name, $ld_so_version)= /=(.*)\.so\.(.*)$/;
  545. --
  546. 1.7.2.3
  547. From ec0f78d65ce08fb4158cc31624c4872c0df9b545 Mon Sep 17 00:00:00 2001
  548. From: H.J. Lu <hjl.tools@gmail.com>
  549. Date: Mon, 24 Sep 2012 08:58:04 -0700
  550. Subject: [PATCH] Properly handle fencepost with MALLOC_ALIGN_MASK
  551. Cherry-pick commit ced6f16ee919d12725840d43d007f1cfd67118df.
  552. ---
  553. malloc/arena.c | 10 +++++++---
  554. 1 files changed, 7 insertions(+), 3 deletions(-)
  555. diff --git a/malloc/arena.c b/malloc/arena.c
  556. index 33c4ff3..71a0dee 100644
  557. --- a/malloc/arena.c
  558. +++ b/malloc/arena.c
  559. @@ -652,15 +652,19 @@ heap_trim(heap_info *heap, size_t pad)
  560. unsigned long pagesz = GLRO(dl_pagesize);
  561. mchunkptr top_chunk = top(ar_ptr), p, bck, fwd;
  562. heap_info *prev_heap;
  563. - long new_size, top_size, extra;
  564. + long new_size, top_size, extra, prev_size, misalign;
  565. /* Can this heap go away completely? */
  566. while(top_chunk == chunk_at_offset(heap, sizeof(*heap))) {
  567. prev_heap = heap->prev;
  568. - p = chunk_at_offset(prev_heap, prev_heap->size - (MINSIZE-2*SIZE_SZ));
  569. + prev_size = prev_heap->size - (MINSIZE-2*SIZE_SZ);
  570. + p = chunk_at_offset(prev_heap, prev_size);
  571. + /* fencepost must be properly aligned. */
  572. + misalign = ((long) p) & MALLOC_ALIGN_MASK;
  573. + p = chunk_at_offset(prev_heap, prev_size - misalign);
  574. assert(p->size == (0|PREV_INUSE)); /* must be fencepost */
  575. p = prev_chunk(p);
  576. - new_size = chunksize(p) + (MINSIZE-2*SIZE_SZ);
  577. + new_size = chunksize(p) + (MINSIZE-2*SIZE_SZ) + misalign;
  578. assert(new_size>0 && new_size<(long)(2*MINSIZE));
  579. if(!prev_inuse(p))
  580. new_size += p->prev_size;
  581. --
  582. 1.7.2.3
  583. From d22cf229673050abfdb3be5124bd58eb2fc2b965 Mon Sep 17 00:00:00 2001
  584. From: Joseph Myers <joseph@codesourcery.com>
  585. Date: Tue, 25 Sep 2012 19:38:15 +0000
  586. Subject: [PATCH] Use size_t instead of int for internal variables in glob (bug 14621).
  587. (cherry picked from commit b87c4b24d97321ef2f2da357f8fcf11f1f61e3dc)
  588. ---
  589. posix/glob.c | 10 +++++-----
  590. 1 files changed, 5 insertions(+), 5 deletions(-)
  591. diff --git a/posix/glob.c b/posix/glob.c
  592. index 68ea205..87d4f1b 100644
  593. --- a/posix/glob.c
  594. +++ b/posix/glob.c
  595. @@ -217,7 +217,7 @@ static int collated_compare (const void *, const void *) __THROW;
  596. static const char *
  597. next_brace_sub (const char *cp, int flags)
  598. {
  599. - unsigned int depth = 0;
  600. + size_t depth = 0;
  601. while (*cp != '\0')
  602. if ((flags & GLOB_NOESCAPE) == 0 && *cp == '\\')
  603. {
  604. @@ -960,7 +960,7 @@ glob (pattern, flags, errfunc, pglob)
  605. && S_ISDIR (st.st_mode))
  606. : (__stat64 (dirname, &st64) == 0 && S_ISDIR (st64.st_mode)))))
  607. {
  608. - int newcount = pglob->gl_pathc + pglob->gl_offs;
  609. + size_t newcount = pglob->gl_pathc + pglob->gl_offs;
  610. char **new_gl_pathv;
  611. if (newcount > UINTPTR_MAX - (1 + 1)
  612. @@ -1059,7 +1059,7 @@ glob (pattern, flags, errfunc, pglob)
  613. appending the results to PGLOB. */
  614. for (i = 0; i < dirs.gl_pathc; ++i)
  615. {
  616. - int old_pathc;
  617. + size_t old_pathc;
  618. #ifdef SHELL
  619. {
  620. @@ -1114,7 +1114,7 @@ glob (pattern, flags, errfunc, pglob)
  621. /* No matches. */
  622. if (flags & GLOB_NOCHECK)
  623. {
  624. - int newcount = pglob->gl_pathc + pglob->gl_offs;
  625. + size_t newcount = pglob->gl_pathc + pglob->gl_offs;
  626. char **new_gl_pathv;
  627. if (newcount > UINTPTR_MAX - 2
  628. @@ -1158,7 +1158,7 @@ glob (pattern, flags, errfunc, pglob)
  629. }
  630. else
  631. {
  632. - int old_pathc = pglob->gl_pathc;
  633. + size_t old_pathc = pglob->gl_pathc;
  634. int orig_flags = flags;
  635. if (meta & 2)
  636. --
  637. 1.7.2.3
  638. From 2a9afa3d1bd0aacf4df9106342d973e368e315d5 Mon Sep 17 00:00:00 2001
  639. From: Jeff Law <law@redhat.com>
  640. Date: Fri, 28 Sep 2012 12:48:42 -0600
  641. Subject: [PATCH] Don't parse %s format argument as multibyte string
  642. (cherry picked from commit 715a900c9085907fa749589bf738b192b1a2bda5)
  643. 2012-09-28 Andreas Schwab <schwab@linux-m68k.org>
  644. [BZ #6530]
  645. * stdio-common/vfprintf.c (process_string_arg): Revert
  646. 2000-07-22 change.
  647. 2011-09-28 Jonathan Nieder <jrnieder@gmail.com>
  648. * stdio-common/Makefile (tst-sprintf-ENV): Set environment
  649. for testcase.
  650. * stdio-common/tst-sprintf.c: Include <locale.h>
  651. (main): Test sprintf's handling of incomplete multibyte
  652. characters.
  653. ---
  654. stdio-common/Makefile | 1 +
  655. stdio-common/tst-sprintf.c | 13 +++++++++++++
  656. stdio-common/vfprintf.c | 39 +++------------------------------------
  657. 3 files changed, 17 insertions(+), 36 deletions(-)
  658. diff --git a/stdio-common/Makefile b/stdio-common/Makefile
  659. index a29924b..42e45dc 100644
  660. --- a/stdio-common/Makefile
  661. +++ b/stdio-common/Makefile
  662. @@ -116,6 +116,7 @@ CFLAGS-scanf17.c = -I../libio -I../stdlib -I../wcsmbs -I../time -I../string \
  663. # We know the test has a format string problem.
  664. CFLAGS-tst-sprintf.c = -Wno-format
  665. +tst-sprintf-ENV = LOCPATH=$(common-objpfx)localedata
  666. tst-sscanf-ENV = LOCPATH=$(common-objpfx)localedata
  667. tst-swprintf-ENV = LOCPATH=$(common-objpfx)localedata
  668. test-vfprintf-ENV = LOCPATH=$(common-objpfx)localedata
  669. diff --git a/stdio-common/tst-sprintf.c b/stdio-common/tst-sprintf.c
  670. index c04fef1..c4e911f 100644
  671. --- a/stdio-common/tst-sprintf.c
  672. +++ b/stdio-common/tst-sprintf.c
  673. @@ -1,5 +1,6 @@
  674. #include <stdio.h>
  675. #include <stdlib.h>
  676. +#include <locale.h>
  677. #include <string.h>
  678. @@ -58,5 +59,17 @@ main (void)
  679. result = 1;
  680. }
  681. + if (setlocale (LC_ALL, "de_DE.UTF-8") == NULL)
  682. + {
  683. + puts ("cannot set locale");
  684. + result = 1;
  685. + }
  686. + else if (sprintf (buf, "%.8s\n", "Foo: \277") != 7
  687. + || strcmp (buf, "Foo: \277\n") != 0)
  688. + {
  689. + printf ("sprintf (buf, \"%%.8s\\n\", \"Foo: \\277\") produced '%s' output\n", buf);
  690. + result = 1;
  691. + }
  692. +
  693. return result;
  694. }
  695. diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
  696. index d569034..17d3f42 100644
  697. --- a/stdio-common/vfprintf.c
  698. +++ b/stdio-common/vfprintf.c
  699. @@ -1168,42 +1168,9 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
  700. else if (!is_long && spec != L_('S')) \
  701. { \
  702. if (prec != -1) \
  703. - { \
  704. - /* Search for the end of the string, but don't search past \
  705. - the length (in bytes) specified by the precision. Also \
  706. - don't use incomplete characters. */ \
  707. - if (_NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MB_CUR_MAX) == 1) \
  708. - len = __strnlen (string, prec); \
  709. - else \
  710. - { \
  711. - /* In case we have a multibyte character set the \
  712. - situation is more complicated. We must not copy \
  713. - bytes at the end which form an incomplete character. */\
  714. - size_t ignore_size = (unsigned) prec > 1024 ? 1024 : prec;\
  715. - wchar_t ignore[ignore_size]; \
  716. - const char *str2 = string; \
  717. - const char *strend = string + prec; \
  718. - if (strend < string) \
  719. - strend = (const char *) UINTPTR_MAX; \
  720. - \
  721. - mbstate_t ps; \
  722. - memset (&ps, '\0', sizeof (ps)); \
  723. - \
  724. - while (str2 != NULL && str2 < strend) \
  725. - if (__mbsnrtowcs (ignore, &str2, strend - str2, \
  726. - ignore_size, &ps) == (size_t) -1) \
  727. - { \
  728. - /* Conversion function has set errno. */ \
  729. - done = -1; \
  730. - goto all_done; \
  731. - } \
  732. - \
  733. - if (str2 == NULL) \
  734. - len = strlen (string); \
  735. - else \
  736. - len = str2 - string - (ps.__count & 7); \
  737. - } \
  738. - } \
  739. + /* Search for the end of the string, but don't search past \
  740. + the length (in bytes) specified by the precision. */ \
  741. + len = __strnlen (string, prec); \
  742. else \
  743. len = strlen (string); \
  744. } \
  745. --
  746. 1.7.2.3
  747. From 59fca14adeaebea87b8171e35ab41bb8e93008bf Mon Sep 17 00:00:00 2001
  748. From: H.J. Lu <hjl.tools@gmail.com>
  749. Date: Tue, 2 Oct 2012 05:05:17 -0700
  750. Subject: [PATCH] Define HAS_FMA with bit_FMA_Usable
  751. cherry-pick 0569936773c861c791f10bba5e2f4cac5fbb4e78
  752. ---
  753. sysdeps/x86_64/multiarch/init-arch.c | 3 +++
  754. sysdeps/x86_64/multiarch/init-arch.h | 9 +++++++--
  755. 2 files changed, 10 insertions(+), 2 deletions(-)
  756. diff --git a/sysdeps/x86_64/multiarch/init-arch.c b/sysdeps/x86_64/multiarch/init-arch.c
  757. index fb44dcf..fed5ab8 100644
  758. --- a/sysdeps/x86_64/multiarch/init-arch.c
  759. +++ b/sysdeps/x86_64/multiarch/init-arch.c
  760. @@ -156,6 +156,9 @@ __init_cpu_features (void)
  761. /* Determine if AVX is usable. */
  762. if (CPUID_AVX)
  763. __cpu_features.feature[index_AVX_Usable] |= bit_AVX_Usable;
  764. + /* Determine if FMA is usable. */
  765. + if (CPUID_FMA)
  766. + __cpu_features.feature[index_FMA_Usable] |= bit_FMA_Usable;
  767. /* Determine if FMA4 is usable. */
  768. if (CPUID_FMA4)
  769. __cpu_features.feature[index_FMA4_Usable] |= bit_FMA4_Usable;
  770. diff --git a/sysdeps/x86_64/multiarch/init-arch.h b/sysdeps/x86_64/multiarch/init-arch.h
  771. index 45e2651..f33f1c8 100644
  772. --- a/sysdeps/x86_64/multiarch/init-arch.h
  773. +++ b/sysdeps/x86_64/multiarch/init-arch.h
  774. @@ -22,7 +22,8 @@
  775. #define bit_Fast_Unaligned_Load (1 << 4)
  776. #define bit_Prefer_PMINUB_for_stringop (1 << 5)
  777. #define bit_AVX_Usable (1 << 6)
  778. -#define bit_FMA4_Usable (1 << 7)
  779. +#define bit_FMA_Usable (1 << 7)
  780. +#define bit_FMA4_Usable (1 << 8)
  781. /* CPUID Feature flags. */
  782. #define bit_SSE2 (1 << 26)
  783. @@ -56,6 +57,7 @@
  784. # define index_Fast_Unaligned_Load FEATURE_INDEX_1*FEATURE_SIZE
  785. # define index_Prefer_PMINUB_for_stringop FEATURE_INDEX_1*FEATURE_SIZE
  786. # define index_AVX_Usable FEATURE_INDEX_1*FEATURE_SIZE
  787. +# define index_FMA_Usable FEATURE_INDEX_1*FEATURE_SIZE
  788. # define index_FMA4_Usable FEATURE_INDEX_1*FEATURE_SIZE
  789. #else /* __ASSEMBLER__ */
  790. @@ -131,6 +133,8 @@ extern const struct cpu_features *__get_cpu_features (void)
  791. HAS_CPUID_FLAG (COMMON_CPUID_INDEX_1, ecx, bit_OSXSAVE)
  792. # define CPUID_AVX \
  793. HAS_CPUID_FLAG (COMMON_CPUID_INDEX_1, ecx, bit_AVX)
  794. +# define CPUID_FMA \
  795. + HAS_CPUID_FLAG (COMMON_CPUID_INDEX_1, ecx, bit_FMA)
  796. # define CPUID_FMA4 \
  797. HAS_CPUID_FLAG (COMMON_CPUID_INDEX_80000001, ecx, bit_FMA4)
  798. @@ -140,7 +144,6 @@ extern const struct cpu_features *__get_cpu_features (void)
  799. # define HAS_SSSE3 HAS_CPU_FEATURE (COMMON_CPUID_INDEX_1, ecx, bit_SSSE3)
  800. # define HAS_SSE4_1 HAS_CPU_FEATURE (COMMON_CPUID_INDEX_1, ecx, bit_SSE4_1)
  801. # define HAS_SSE4_2 HAS_CPU_FEATURE (COMMON_CPUID_INDEX_1, ecx, bit_SSE4_2)
  802. -# define HAS_FMA HAS_CPU_FEATURE (COMMON_CPUID_INDEX_1, ecx, bit_FMA)
  803. # define index_Fast_Rep_String FEATURE_INDEX_1
  804. # define index_Fast_Copy_Backward FEATURE_INDEX_1
  805. @@ -148,6 +151,7 @@ extern const struct cpu_features *__get_cpu_features (void)
  806. # define index_Prefer_SSE_for_memop FEATURE_INDEX_1
  807. # define index_Fast_Unaligned_Load FEATURE_INDEX_1
  808. # define index_AVX_Usable FEATURE_INDEX_1
  809. +# define index_FMA_Usable FEATURE_INDEX_1
  810. # define index_FMA4_Usable FEATURE_INDEX_1
  811. # define HAS_ARCH_FEATURE(name) \
  812. @@ -159,6 +163,7 @@ extern const struct cpu_features *__get_cpu_features (void)
  813. # define HAS_PREFER_SSE_FOR_MEMOP HAS_ARCH_FEATURE (Prefer_SSE_for_memop)
  814. # define HAS_FAST_UNALIGNED_LOAD HAS_ARCH_FEATURE (Fast_Unaligned_Load)
  815. # define HAS_AVX HAS_ARCH_FEATURE (AVX_Usable)
  816. +# define HAS_FMA HAS_ARCH_FEATURE (FMA_Usable)
  817. # define HAS_FMA4 HAS_ARCH_FEATURE (FMA4_Usable)
  818. #endif /* __ASSEMBLER__ */
  819. --
  820. 1.7.2.3
  821. From fc81079f382590db35d158ae455cadadbbe0bde3 Mon Sep 17 00:00:00 2001
  822. From: Andreas Schwab <schwab@linux-m68k.org>
  823. Date: Tue, 1 May 2012 17:10:10 +0200
  824. Subject: [PATCH] Fix missing _mcount@GLIBC_2.0 on powerpc32
  825. (cherry picked from commit 261f485936b283f4327fc1f2fc8fd1705d805c12)
  826. ---
  827. sysdeps/powerpc/powerpc32/Makefile | 3 ++-
  828. sysdeps/powerpc/powerpc32/compat-ppc-mcount.S | 11 +++++++++++
  829. sysdeps/powerpc/powerpc32/ppc-mcount.S | 6 +++++-
  830. 3 files changed, 18 insertions(+), 2 deletions(-)
  831. create mode 100644 sysdeps/powerpc/powerpc32/compat-ppc-mcount.S
  832. diff --git a/sysdeps/powerpc/powerpc32/Makefile b/sysdeps/powerpc/powerpc32/Makefile
  833. index aa2d0b9..64f7900 100644
  834. --- a/sysdeps/powerpc/powerpc32/Makefile
  835. +++ b/sysdeps/powerpc/powerpc32/Makefile
  836. @@ -6,8 +6,9 @@ sysdep-LDFLAGS += -msoft-float
  837. endif
  838. ifeq ($(subdir),gmon)
  839. -sysdep_routines += ppc-mcount
  840. +sysdep_routines += ppc-mcount compat-ppc-mcount
  841. static-only-routines += ppc-mcount
  842. +shared-only-routines += compat-ppc-mcount
  843. endif
  844. ifeq ($(subdir),misc)
  845. diff --git a/sysdeps/powerpc/powerpc32/compat-ppc-mcount.S b/sysdeps/powerpc/powerpc32/compat-ppc-mcount.S
  846. new file mode 100644
  847. index 0000000..2a9cb24
  848. --- /dev/null
  849. +++ b/sysdeps/powerpc/powerpc32/compat-ppc-mcount.S
  850. @@ -0,0 +1,11 @@
  851. +#include <shlib-compat.h>
  852. +
  853. +#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_15)
  854. +
  855. + compat_text_section
  856. +# define _mcount __compat_mcount
  857. +# include "ppc-mcount.S"
  858. +# undef _mcount
  859. +
  860. +compat_symbol (libc, __compat_mcount, _mcount, GLIBC_2_0)
  861. +#endif
  862. diff --git a/sysdeps/powerpc/powerpc32/ppc-mcount.S b/sysdeps/powerpc/powerpc32/ppc-mcount.S
  863. index 9a3c041..911638b 100644
  864. --- a/sysdeps/powerpc/powerpc32/ppc-mcount.S
  865. +++ b/sysdeps/powerpc/powerpc32/ppc-mcount.S
  866. @@ -1,5 +1,5 @@
  867. /* PowerPC-specific implementation of profiling support.
  868. - Copyright (C) 1997, 1999, 2005, 2006 Free Software Foundation, Inc.
  869. + Copyright (C) 1997-2012 Free Software Foundation, Inc.
  870. This file is part of the GNU C Library.
  871. The GNU C Library is free software; you can redistribute it and/or
  872. @@ -57,7 +57,11 @@ ENTRY(_mcount)
  873. stw r4, 44(r1)
  874. cfi_offset (lr, -4)
  875. stw r5, 8(r1)
  876. +#ifndef SHARED
  877. bl JUMPTARGET(__mcount_internal)
  878. +#else
  879. + bl __mcount_internal@local
  880. +#endif
  881. /* Restore the registers... */
  882. lwz r6, 8(r1)
  883. lwz r0, 44(r1)
  884. --
  885. 1.7.2.3
  886. From d126b22311ff50e933ac24560a5bee116468d6b3 Mon Sep 17 00:00:00 2001
  887. From: H.J. Lu <hjl.tools@gmail.com>
  888. Date: Wed, 14 Nov 2012 15:44:40 -0800
  889. Subject: [PATCH] Skip audit if l_reloc_result is NULL
  890. Cherry-pick commit 2e64d2659d3edaebc792ac596a9863f1626e5c25
  891. ---
  892. elf/Makefile | 6 +++++-
  893. elf/dl-runtime.c | 22 +++++++++++++++++++++-
  894. elf/tst-audit8.c | 1 +
  895. 3 files changed, 27 insertions(+), 2 deletions(-)
  896. create mode 100644 elf/tst-audit8.c
  897. diff --git a/elf/Makefile b/elf/Makefile
  898. index 0c26ce5..a621a1c 100644
  899. --- a/elf/Makefile
  900. +++ b/elf/Makefile
  901. @@ -138,7 +138,7 @@ tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \
  902. tst-dlmodcount tst-dlopenrpath tst-deep1 \
  903. tst-dlmopen1 tst-dlmopen2 tst-dlmopen3 \
  904. unload3 unload4 unload5 unload6 unload7 unload8 tst-global1 order2 \
  905. - tst-audit1 tst-audit2 \
  906. + tst-audit1 tst-audit2 tst-audit8 \
  907. tst-stackguard1 tst-addr1 tst-thrlock \
  908. tst-unique1 tst-unique2 tst-unique3 tst-unique4 \
  909. tst-initorder tst-initorder2 tst-relsort1
  910. @@ -1024,6 +1024,10 @@ $(objpfx)tst-audit7: $(objpfx)tst-auditmod7a.so
  911. $(objpfx)tst-audit7.out: $(objpfx)tst-auditmod7b.so
  912. tst-audit7-ENV = LD_AUDIT=$(objpfx)tst-auditmod7b.so
  913. +$(objpfx)tst-audit8: $(common-objpfx)math/libm.so
  914. +$(objpfx)tst-audit8.out: $(objpfx)tst-auditmod1.so
  915. +tst-audit8-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
  916. +
  917. $(objpfx)tst-global1: $(libdl)
  918. $(objpfx)tst-global1.out: $(objpfx)testobj6.so $(objpfx)testobj2.so
  919. diff --git a/elf/dl-runtime.c b/elf/dl-runtime.c
  920. index fdaa364..009d366 100644
  921. --- a/elf/dl-runtime.c
  922. +++ b/elf/dl-runtime.c
  923. @@ -1,5 +1,5 @@
  924. /* On-demand PLT fixup for shared objects.
  925. - Copyright (C) 1995-2009, 2010, 2011 Free Software Foundation, Inc.
  926. + Copyright (C) 1995-2012 Free Software Foundation, Inc.
  927. This file is part of the GNU C Library.
  928. The GNU C Library is free software; you can redistribute it and/or
  929. @@ -168,6 +168,26 @@ _dl_profile_fixup (
  930. {
  931. void (*mcount_fct) (ElfW(Addr), ElfW(Addr)) = INTUSE(_dl_mcount);
  932. + if (l->l_reloc_result == NULL)
  933. + {
  934. + /* BZ #14843: ELF_DYNAMIC_RELOCATE is called before l_reloc_result
  935. + is allocated. We will get here if ELF_DYNAMIC_RELOCATE calls a
  936. + resolver function to resolve an IRELATIVE relocation and that
  937. + resolver calls a function that is not yet resolved (lazy). For
  938. + example, the resolver in x86-64 libm.so calls __get_cpu_features
  939. + defined in libc.so. Skip audit and resolve the external function
  940. + in this case. */
  941. + *framesizep = -1;
  942. + return _dl_fixup (
  943. +# ifdef ELF_MACHINE_RUNTIME_FIXUP_ARGS
  944. +# ifndef ELF_MACHINE_RUNTIME_FIXUP_PARAMS
  945. +# error Please define ELF_MACHINE_RUNTIME_FIXUP_PARAMS.
  946. +# endif
  947. + ELF_MACHINE_RUNTIME_FIXUP_PARAMS,
  948. +# endif
  949. + l, reloc_arg);
  950. + }
  951. +
  952. /* This is the address in the array where we store the result of previous
  953. relocations. */
  954. struct reloc_result *reloc_result = &l->l_reloc_result[reloc_index];
  955. diff --git a/elf/tst-audit8.c b/elf/tst-audit8.c
  956. new file mode 100644
  957. index 0000000..63656b4
  958. --- /dev/null
  959. +++ b/elf/tst-audit8.c
  960. @@ -0,0 +1 @@
  961. +#include "../io/pwd.c"
  962. --
  963. 1.7.2.3
  964. From 914950f767030cf62da1672b9a117b59f5c1da6f Mon Sep 17 00:00:00 2001
  965. From: Thomas Schwinge <thomas@codesourcery.com>
  966. Date: Tue, 20 Nov 2012 19:29:23 +0100
  967. Subject: [PATCH] sysdeps/sh/dl-machine.h: Define ELF_MACHINE_RUNTIME_FIXUP_PARAMS.
  968. Cherry-pick commit d072f3f7724d85ceaf230806660235f0cf2f9c3b
  969. ---
  970. sysdeps/sh/dl-machine.h | 4 ++--
  971. 1 files changed, 2 insertions(+), 2 deletions(-)
  972. diff --git a/sysdeps/sh/dl-machine.h b/sysdeps/sh/dl-machine.h
  973. index 53656af..1bb5d15 100644
  974. --- a/sysdeps/sh/dl-machine.h
  975. +++ b/sysdeps/sh/dl-machine.h
  976. @@ -1,6 +1,5 @@
  977. /* Machine-dependent ELF dynamic relocation inline functions. SH version.
  978. - Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2011
  979. - Free Software Foundation, Inc.
  980. + Copyright (C) 1999-2012 Free Software Foundation, Inc.
  981. This file is part of the GNU C Library.
  982. The GNU C Library is free software; you can redistribute it and/or
  983. @@ -116,6 +115,7 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
  984. }
  985. #define ELF_MACHINE_RUNTIME_FIXUP_ARGS int plt_type
  986. +#define ELF_MACHINE_RUNTIME_FIXUP_PARAMS plt_type
  987. /* Mask identifying addresses reserved for the user program,
  988. where the dynamic linker should not map anything. */
  989. --
  990. 1.7.2.3