SHA256
1
0
forked from pool/glibc

Accepting request 113387 from home:a_jaeger:my-factory-packages

Cleanup of patches.

OBS-URL: https://build.opensuse.org/request/show/113387
OBS-URL: https://build.opensuse.org/package/show/Base:System/glibc?expand=0&rev=164
This commit is contained in:
Andreas Jaeger 2012-04-13 09:37:44 +00:00 committed by Git OBS Bridge
parent 392fec9468
commit 84ce9e0d13
29 changed files with 2930 additions and 826 deletions

64
cycle-detection.patch Normal file
View File

@ -0,0 +1,64 @@
2012-01-19 Jeff Law <law@redhat.com>
* elf/dl-deps.c (_dl_map_object_deps): Fix cycle detection.
* elf/dl-fini.c (_dl_sort_fini): Likewise
Index: glibc-2.15/elf/dl-deps.c
===================================================================
--- glibc-2.15.orig/elf/dl-deps.c
+++ glibc-2.15/elf/dl-deps.c
@@ -634,7 +634,7 @@ Filters not supported with LD_TRACE_PREL
/* We can skip looking for the binary itself which is at the front
of the search list. */
i = 1;
- char seen[nlist];
+ unsigned short seen[nlist];
memset (seen, 0, nlist * sizeof (seen[0]));
while (1)
{
@@ -660,13 +660,13 @@ Filters not supported with LD_TRACE_PREL
(k - i) * sizeof (l_initfini[0]));
l_initfini[k] = thisp;
- if (seen[i + 1] > 1)
+ if (seen[i + 1] > nlist - i - 1)
{
++i;
goto next_clear;
}
- char this_seen = seen[i];
+ unsigned short this_seen = seen[i];
memmove (&seen[i], &seen[i + 1],
(k - i) * sizeof (seen[0]));
seen[k] = this_seen;
Index: glibc-2.15/elf/dl-fini.c
===================================================================
--- glibc-2.15.orig/elf/dl-fini.c
+++ glibc-2.15/elf/dl-fini.c
@@ -39,7 +39,7 @@ _dl_sort_fini (struct link_map **maps, s
/* We can skip looking for the binary itself which is at the front
of the search list for the main namespace. */
unsigned int i = ns == LM_ID_BASE;
- char seen[nmaps];
+ unsigned short seen[nmaps];
memset (seen, 0, nmaps * sizeof (seen[0]));
while (1)
{
@@ -79,13 +79,13 @@ _dl_sort_fini (struct link_map **maps, s
used[k] = here_used;
}
- if (seen[i + 1] > 1)
+ if (seen[i + 1] > nmaps - i - 1)
{
++i;
goto next_clear;
}
- char this_seen = seen[i];
+ unsigned short this_seen = seen[i];
memmove (&seen[i], &seen[i + 1], (k - i) * sizeof (seen[0]));
seen[k] = this_seen;

View File

@ -13,7 +13,19 @@ Index: sysdeps/posix/getaddrinfo.c
{ {
const struct gaih_typeproto *tp = gaih_inet_typeproto; const struct gaih_typeproto *tp = gaih_inet_typeproto;
struct gaih_servtuple *st = (struct gaih_servtuple *) &nullserv; struct gaih_servtuple *st = (struct gaih_servtuple *) &nullserv;
@@ -935,7 +935,7 @@ gaih_inet (const char *name, const struc @@ -832,7 +832,10 @@ gaih_inet (const char *name, const struc
no_data = 0;
nss_gethostbyname4_r fct4
= __nss_lookup_function (nip, "gethostbyname4_r");
- if (fct4 != NULL)
+ /* If we don't want ipv6, don't use gethostbyname4_r,
+ as it's using T_UNSPEC to libc_res_nsearch, which always
+ create T_A and T_AAAA queries. */
+ if (usable_ipv6 && fct4 != NULL)
{
int herrno;
@@ -935,7 +938,7 @@ gaih_inet (const char *name, const struc
if (fct != NULL) if (fct != NULL)
{ {
if (req->ai_family == AF_INET6 if (req->ai_family == AF_INET6
@ -22,7 +34,7 @@ Index: sysdeps/posix/getaddrinfo.c
{ {
gethosts (AF_INET6, struct in6_addr); gethosts (AF_INET6, struct in6_addr);
no_inet6_data = no_data; no_inet6_data = no_data;
@@ -2418,7 +2418,7 @@ getaddrinfo (const char *name, const cha @@ -2418,7 +2421,7 @@ getaddrinfo (const char *name, const cha
if (hints->ai_family == AF_UNSPEC || hints->ai_family == AF_INET if (hints->ai_family == AF_UNSPEC || hints->ai_family == AF_INET
|| hints->ai_family == AF_INET6) || hints->ai_family == AF_INET6)
{ {

View File

@ -1,8 +1,8 @@
Index: glibc-2.14/Versions.def Index: glibc-2.15/Versions.def
=================================================================== ===================================================================
--- glibc-2.14.orig/Versions.def --- glibc-2.15.orig/Versions.def
+++ glibc-2.14/Versions.def +++ glibc-2.15/Versions.def
@@ -41,6 +41,7 @@ libc { @@ -40,6 +40,7 @@ libc {
} }
libcrypt { libcrypt {
GLIBC_2.0 GLIBC_2.0
@ -10,10 +10,10 @@ Index: glibc-2.14/Versions.def
} }
libdl { libdl {
GLIBC_2.0 GLIBC_2.0
Index: glibc-2.14/crypt/Versions Index: glibc-2.15/crypt/Versions
=================================================================== ===================================================================
--- glibc-2.14.orig/crypt/Versions --- glibc-2.15.orig/crypt/Versions
+++ glibc-2.14/crypt/Versions +++ glibc-2.15/crypt/Versions
@@ -3,4 +3,7 @@ libcrypt { @@ -3,4 +3,7 @@ libcrypt {
crypt; crypt_r; encrypt; encrypt_r; fcrypt; setkey; setkey_r; crypt; crypt_r; encrypt; encrypt_r; fcrypt; setkey; setkey_r;
crypt_rn; crypt_ra; crypt_gensalt; crypt_gensalt_rn; crypt_gensalt_ra; crypt_rn; crypt_ra; crypt_gensalt; crypt_gensalt_rn; crypt_gensalt_ra;

View File

@ -14,10 +14,10 @@ Date: Thu Jan 26 07:45:14 2012 -0500
2012-01-25 Joseph Myers <joseph@codesourcery.com> 2012-01-25 Joseph Myers <joseph@codesourcery.com>
* elf/tst-unique3.cc (gets): Remove declaration. * elf/tst-unique3.cc (gets): Remove declaration.
diff --git a/sysdeps/x86_64/multiarch/init-arch.c b/sysdeps/x86_64/multiarch/init-arch.c Index: glibc-2.15/sysdeps/x86_64/multiarch/init-arch.c
index 65b0ee9..4fabbee 100644 ===================================================================
--- a/sysdeps/x86_64/multiarch/init-arch.c --- glibc-2.15.orig/sysdeps/x86_64/multiarch/init-arch.c
+++ b/sysdeps/x86_64/multiarch/init-arch.c +++ glibc-2.15/sysdeps/x86_64/multiarch/init-arch.c
@@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
/* Initialize CPU feature data. /* Initialize CPU feature data.
This file is part of the GNU C Library. This file is part of the GNU C Library.
@ -33,163 +33,6 @@ index 65b0ee9..4fabbee 100644
+ if (__cpu_features.cpuid[COMMON_CPUID_INDEX_1].ecx & bit_AVX) + if (__cpu_features.cpuid[COMMON_CPUID_INDEX_1].ecx & bit_AVX)
+ { + {
+ /* Reset the AVX bit in case OSXSAVE is disabled. */ + /* Reset the AVX bit in case OSXSAVE is disabled. */
+ if ((__cpu_features.cpuid[COMMON_CPUID_INDEX_1].ecx & bit_OSXSAVE) == 0
+ || ({ unsigned int xcrlow;
+ unsigned int xcrhigh;
+ asm ("xgetbv"
+ : "=a" (xcrlow), "=d" (xcrhigh) : "c" (0));
+ (xcrlow & 6) != 6; }))
+ __cpu_features.cpuid[COMMON_CPUID_INDEX_1].ecx &= ~bit_AVX;
+ }
+
__cpu_features.family = family;
__cpu_features.model = model;
atomic_write_barrier ();
diff --git a/sysdeps/x86_64/multiarch/init-arch.h b/sysdeps/x86_64/multiarch/init-arch.h
index 2a1df39..408e5ae 100644
--- a/sysdeps/x86_64/multiarch/init-arch.h
+++ b/sysdeps/x86_64/multiarch/init-arch.h
@@ -1,5 +1,5 @@
/* This file is part of the GNU C Library.
- Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+ Copyright (C) 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -27,6 +27,7 @@
#define bit_SSSE3 (1 << 9)
#define bit_SSE4_1 (1 << 19)
#define bit_SSE4_2 (1 << 20)
+#define bit_OSXSAVE (1 << 27)
#define bit_AVX (1 << 28)
#define bit_POPCOUNT (1 << 23)
#define bit_FMA (1 << 12)
commit 08cf777f9e7f6d826658a99c7d77a359f73a45bf
Author: Ulrich Drepper <drepper@gmail.com>
Date: Thu Jan 26 09:45:54 2012 -0500
Really fix AVX tests
There is no problem with strcmp, it doesn't use the YMM registers.
The math routines might since gcc perhaps generates such code.
Introduce bit_YMM_USBALE and use it in the math routines.
[BZ #13583]
* sysdeps/x86_64/multiarch/init-arch.h: Define bit_OSXSAVE.
Clean up HAS_* macros.
* sysdeps/x86_64/multiarch/init-arch.c (__init_cpu_features): If
bit_AVX is set also check OSXAVE/XCR0 and set bit_YMM_Usable if
possible.
* sysdeps/x86_64/fpu/multiarch/e_atan2.c: Use HAS_YMM_USABLE, not
HAS_AVX.
* sysdeps/x86_64/fpu/multiarch/e_exp.c: Likewise.
* sysdeps/x86_64/fpu/multiarch/e_log.c: Likewise.
* sysdeps/x86_64/fpu/multiarch/s_atan.c: Likewise.
* sysdeps/x86_64/fpu/multiarch/s_sin.c: Likewise.
* sysdeps/x86_64/fpu/multiarch/s_tan.c: Likewise.
diff --git a/sysdeps/x86_64/fpu/multiarch/e_atan2.c b/sysdeps/x86_64/fpu/multiarch/e_atan2.c
index 6867c6e..3a615fc 100644
--- a/sysdeps/x86_64/fpu/multiarch/e_atan2.c
+++ b/sysdeps/x86_64/fpu/multiarch/e_atan2.c
@@ -14,7 +14,7 @@ extern double __ieee754_atan2_fma4 (double, double);
libm_ifunc (__ieee754_atan2,
HAS_FMA4 ? __ieee754_atan2_fma4
- : (HAS_AVX ? __ieee754_atan2_avx : __ieee754_atan2_sse2));
+ : (HAS_YMM_USABLE ? __ieee754_atan2_avx : __ieee754_atan2_sse2));
strong_alias (__ieee754_atan2, __atan2_finite)
# define __ieee754_atan2 __ieee754_atan2_sse2
diff --git a/sysdeps/x86_64/fpu/multiarch/e_exp.c b/sysdeps/x86_64/fpu/multiarch/e_exp.c
index 3c65028..7b2320a 100644
--- a/sysdeps/x86_64/fpu/multiarch/e_exp.c
+++ b/sysdeps/x86_64/fpu/multiarch/e_exp.c
@@ -14,7 +14,7 @@ extern double __ieee754_exp_fma4 (double);
libm_ifunc (__ieee754_exp,
HAS_FMA4 ? __ieee754_exp_fma4
- : (HAS_AVX ? __ieee754_exp_avx : __ieee754_exp_sse2));
+ : (HAS_YMM_USABLE ? __ieee754_exp_avx : __ieee754_exp_sse2));
strong_alias (__ieee754_exp, __exp_finite)
# define __ieee754_exp __ieee754_exp_sse2
diff --git a/sysdeps/x86_64/fpu/multiarch/e_log.c b/sysdeps/x86_64/fpu/multiarch/e_log.c
index 3b468d0..ab277d6 100644
--- a/sysdeps/x86_64/fpu/multiarch/e_log.c
+++ b/sysdeps/x86_64/fpu/multiarch/e_log.c
@@ -14,7 +14,7 @@ extern double __ieee754_log_fma4 (double);
libm_ifunc (__ieee754_log,
HAS_FMA4 ? __ieee754_log_fma4
- : (HAS_AVX ? __ieee754_log_avx
+ : (HAS_YMM_USABLE ? __ieee754_log_avx
: __ieee754_log_sse2));
strong_alias (__ieee754_log, __log_finite)
diff --git a/sysdeps/x86_64/fpu/multiarch/s_atan.c b/sysdeps/x86_64/fpu/multiarch/s_atan.c
index 3160201..78c7e09 100644
--- a/sysdeps/x86_64/fpu/multiarch/s_atan.c
+++ b/sysdeps/x86_64/fpu/multiarch/s_atan.c
@@ -12,7 +12,8 @@ extern double __atan_fma4 (double);
# define __atan_fma4 ((void *) 0)
# endif
-libm_ifunc (atan, HAS_FMA4 ? __atan_fma4 : HAS_AVX ? __atan_avx : __atan_sse2);
+libm_ifunc (atan, (HAS_FMA4 ? __atan_fma4 :
+ HAS_YMM_USABLE ? __atan_avx : __atan_sse2));
# define atan __atan_sse2
#endif
diff --git a/sysdeps/x86_64/fpu/multiarch/s_sin.c b/sysdeps/x86_64/fpu/multiarch/s_sin.c
index 1ba9dbc..417acd0 100644
--- a/sysdeps/x86_64/fpu/multiarch/s_sin.c
+++ b/sysdeps/x86_64/fpu/multiarch/s_sin.c
@@ -17,10 +17,12 @@ extern double __sin_fma4 (double);
# define __sin_fma4 ((void *) 0)
# endif
-libm_ifunc (__cos, HAS_FMA4 ? __cos_fma4 : HAS_AVX ? __cos_avx : __cos_sse2);
+libm_ifunc (__cos, (HAS_FMA4 ? __cos_fma4 :
+ HAS_YMM_USABLE ? __cos_avx : __cos_sse2));
weak_alias (__cos, cos)
-libm_ifunc (__sin, HAS_FMA4 ? __sin_fma4 : HAS_AVX ? __sin_avx : __sin_sse2);
+libm_ifunc (__sin, (HAS_FMA4 ? __sin_fma4 :
+ HAS_YMM_USABLE ? __sin_avx : __sin_sse2));
weak_alias (__sin, sin)
# define __cos __cos_sse2
diff --git a/sysdeps/x86_64/fpu/multiarch/s_tan.c b/sysdeps/x86_64/fpu/multiarch/s_tan.c
index 8f6601e..3047155 100644
--- a/sysdeps/x86_64/fpu/multiarch/s_tan.c
+++ b/sysdeps/x86_64/fpu/multiarch/s_tan.c
@@ -12,7 +12,8 @@ extern double __tan_fma4 (double);
# define __tan_fma4 ((void *) 0)
# endif
-libm_ifunc (tan, HAS_FMA4 ? __tan_fma4 : HAS_AVX ? __tan_avx : __tan_sse2);
+libm_ifunc (tan, (HAS_FMA4 ? __tan_fma4 :
+ HAS_YMM_USABLE ? __tan_avx : __tan_sse2));
# define tan __tan_sse2
#endif
diff --git a/sysdeps/x86_64/multiarch/init-arch.c b/sysdeps/x86_64/multiarch/init-arch.c
index 4fabbee..76d146c 100644
--- a/sysdeps/x86_64/multiarch/init-arch.c
+++ b/sysdeps/x86_64/multiarch/init-arch.c
@@ -147,13 +147,13 @@ __init_cpu_features (void)
if (__cpu_features.cpuid[COMMON_CPUID_INDEX_1].ecx & bit_AVX)
{
/* Reset the AVX bit in case OSXSAVE is disabled. */
- if ((__cpu_features.cpuid[COMMON_CPUID_INDEX_1].ecx & bit_OSXSAVE) == 0
- || ({ unsigned int xcrlow;
- unsigned int xcrhigh;
- asm ("xgetbv"
- : "=a" (xcrlow), "=d" (xcrhigh) : "c" (0));
- (xcrlow & 6) != 6; }))
- __cpu_features.cpuid[COMMON_CPUID_INDEX_1].ecx &= ~bit_AVX;
+ if ((__cpu_features.cpuid[COMMON_CPUID_INDEX_1].ecx & bit_OSXSAVE) != 0 + if ((__cpu_features.cpuid[COMMON_CPUID_INDEX_1].ecx & bit_OSXSAVE) != 0
+ && ({ unsigned int xcrlow; + && ({ unsigned int xcrlow;
+ unsigned int xcrhigh; + unsigned int xcrhigh;
@ -197,14 +40,23 @@ index 4fabbee..76d146c 100644
+ : "=a" (xcrlow), "=d" (xcrhigh) : "c" (0)); + : "=a" (xcrlow), "=d" (xcrhigh) : "c" (0));
+ (xcrlow & 6) == 6; })) + (xcrlow & 6) == 6; }))
+ __cpu_features.feature[index_YMM_Usable] |= bit_YMM_Usable; + __cpu_features.feature[index_YMM_Usable] |= bit_YMM_Usable;
} + }
+
__cpu_features.family = family; __cpu_features.family = family;
diff --git a/sysdeps/x86_64/multiarch/init-arch.h b/sysdeps/x86_64/multiarch/init-arch.h __cpu_features.model = model;
index 408e5ae..2dc75ab 100644 atomic_write_barrier ();
--- a/sysdeps/x86_64/multiarch/init-arch.h Index: glibc-2.15/sysdeps/x86_64/multiarch/init-arch.h
+++ b/sysdeps/x86_64/multiarch/init-arch.h ===================================================================
@@ -22,6 +22,7 @@ --- glibc-2.15.orig/sysdeps/x86_64/multiarch/init-arch.h
+++ glibc-2.15/sysdeps/x86_64/multiarch/init-arch.h
@@ -1,5 +1,5 @@
/* This file is part of the GNU C Library.
- Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+ Copyright (C) 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -22,11 +22,13 @@
#define bit_Prefer_SSE_for_memop (1 << 3) #define bit_Prefer_SSE_for_memop (1 << 3)
#define bit_Fast_Unaligned_Load (1 << 4) #define bit_Fast_Unaligned_Load (1 << 4)
#define bit_Prefer_PMINUB_for_stringop (1 << 5) #define bit_Prefer_PMINUB_for_stringop (1 << 5)
@ -212,7 +64,13 @@ index 408e5ae..2dc75ab 100644
#define bit_SSE2 (1 << 26) #define bit_SSE2 (1 << 26)
#define bit_SSSE3 (1 << 9) #define bit_SSSE3 (1 << 9)
@@ -49,6 +50,7 @@ #define bit_SSE4_1 (1 << 19)
#define bit_SSE4_2 (1 << 20)
+#define bit_OSXSAVE (1 << 27)
#define bit_AVX (1 << 28)
#define bit_POPCOUNT (1 << 23)
#define bit_FMA (1 << 12)
@@ -48,6 +50,7 @@
# define index_Prefer_SSE_for_memop FEATURE_INDEX_1*FEATURE_SIZE # define index_Prefer_SSE_for_memop FEATURE_INDEX_1*FEATURE_SIZE
# define index_Fast_Unaligned_Load FEATURE_INDEX_1*FEATURE_SIZE # define index_Fast_Unaligned_Load FEATURE_INDEX_1*FEATURE_SIZE
# define index_Prefer_PMINUB_for_stringop FEATURE_INDEX_1*FEATURE_SIZE # define index_Prefer_PMINUB_for_stringop FEATURE_INDEX_1*FEATURE_SIZE
@ -220,7 +78,7 @@ index 408e5ae..2dc75ab 100644
#else /* __ASSEMBLER__ */ #else /* __ASSEMBLER__ */
@@ -93,7 +95,7 @@ extern struct cpu_features @@ -92,7 +95,7 @@ extern struct cpu_features
extern void __init_cpu_features (void) attribute_hidden; extern void __init_cpu_features (void) attribute_hidden;
@ -229,7 +87,7 @@ index 408e5ae..2dc75ab 100644
do \ do \
if (__cpu_features.kind == arch_kind_unknown) \ if (__cpu_features.kind == arch_kind_unknown) \
__init_cpu_features (); \ __init_cpu_features (); \
@@ -126,23 +128,21 @@ extern const struct cpu_features *__get_cpu_features (void) @@ -125,23 +128,21 @@ extern const struct cpu_features *__get_
# define index_Slow_BSF FEATURE_INDEX_1 # define index_Slow_BSF FEATURE_INDEX_1
# define index_Prefer_SSE_for_memop FEATURE_INDEX_1 # define index_Prefer_SSE_for_memop FEATURE_INDEX_1
# define index_Fast_Unaligned_Load FEATURE_INDEX_1 # define index_Fast_Unaligned_Load FEATURE_INDEX_1
@ -263,24 +121,77 @@ index 408e5ae..2dc75ab 100644
+# define HAS_YMM_USABLE HAS_ARCH_FEATURE (YMM_Usable) +# define HAS_YMM_USABLE HAS_ARCH_FEATURE (YMM_Usable)
#endif /* __ASSEMBLER__ */ #endif /* __ASSEMBLER__ */
Index: glibc-2.15/sysdeps/x86_64/fpu/multiarch/e_log.c
commit 73139a7628c424c82eb9297ccb5505c0bc5b65aa ===================================================================
Author: Ulrich Drepper <drepper@gmail.com> --- glibc-2.15.orig/sysdeps/x86_64/fpu/multiarch/e_log.c
Date: Sat Jan 28 11:19:06 2012 -0500 +++ glibc-2.15/sysdeps/x86_64/fpu/multiarch/e_log.c
@@ -14,8 +14,7 @@ extern double __ieee754_log_fma4 (double
Simplify use of AVX instructions in internal math macros
2012-01-28 Ulrich Drepper <drepper@gmail.com>
* sysdeps/x86_64/fpu/math_private.h: Simplify use of AVX instructions.
diff --git a/sysdeps/x86_64/fpu/math_private.h b/sysdeps/x86_64/fpu/math_private.h
index 7f52d5e..50f765f 100644
--- a/sysdeps/x86_64/fpu/math_private.h
+++ b/sysdeps/x86_64/fpu/math_private.h
@@ -21,8 +21,12 @@
#ifdef __AVX__ libm_ifunc (__ieee754_log,
HAS_FMA4 ? __ieee754_log_fma4
- : (HAS_AVX ? __ieee754_log_avx
- : __ieee754_log_sse2));
+ : (HAS_AVX ? __ieee754_log_avx : __ieee754_log_sse2));
strong_alias (__ieee754_log, __log_finite)
# define __ieee754_log __ieee754_log_sse2
Index: glibc-2.15/sysdeps/x86_64/fpu/multiarch/s_atan.c
===================================================================
--- glibc-2.15.orig/sysdeps/x86_64/fpu/multiarch/s_atan.c
+++ glibc-2.15/sysdeps/x86_64/fpu/multiarch/s_atan.c
@@ -12,7 +12,8 @@ extern double __atan_fma4 (double);
# define __atan_fma4 ((void *) 0)
# endif
-libm_ifunc (atan, HAS_FMA4 ? __atan_fma4 : HAS_AVX ? __atan_avx : __atan_sse2);
+libm_ifunc (atan, (HAS_FMA4 ? __atan_fma4 :
+ HAS_AVX ? __atan_avx : __atan_sse2));
# define atan __atan_sse2
#endif
Index: glibc-2.15/sysdeps/x86_64/fpu/multiarch/s_sin.c
===================================================================
--- glibc-2.15.orig/sysdeps/x86_64/fpu/multiarch/s_sin.c
+++ glibc-2.15/sysdeps/x86_64/fpu/multiarch/s_sin.c
@@ -17,10 +17,12 @@ extern double __sin_fma4 (double);
# define __sin_fma4 ((void *) 0)
# endif
-libm_ifunc (__cos, HAS_FMA4 ? __cos_fma4 : HAS_AVX ? __cos_avx : __cos_sse2);
+libm_ifunc (__cos, (HAS_FMA4 ? __cos_fma4 :
+ HAS_AVX ? __cos_avx : __cos_sse2));
weak_alias (__cos, cos)
-libm_ifunc (__sin, HAS_FMA4 ? __sin_fma4 : HAS_AVX ? __sin_avx : __sin_sse2);
+libm_ifunc (__sin, (HAS_FMA4 ? __sin_fma4 :
+ HAS_AVX ? __sin_avx : __sin_sse2));
weak_alias (__sin, sin)
# define __cos __cos_sse2
Index: glibc-2.15/sysdeps/x86_64/fpu/multiarch/s_tan.c
===================================================================
--- glibc-2.15.orig/sysdeps/x86_64/fpu/multiarch/s_tan.c
+++ glibc-2.15/sysdeps/x86_64/fpu/multiarch/s_tan.c
@@ -12,7 +12,8 @@ extern double __tan_fma4 (double);
# define __tan_fma4 ((void *) 0)
# endif
-libm_ifunc (tan, HAS_FMA4 ? __tan_fma4 : HAS_AVX ? __tan_avx : __tan_sse2);
+libm_ifunc (tan, (HAS_FMA4 ? __tan_fma4 :
+ HAS_AVX ? __tan_avx : __tan_sse2));
# define tan __tan_sse2
#endif
Index: glibc-2.15/sysdeps/x86_64/fpu/math_private.h
===================================================================
--- glibc-2.15.orig/sysdeps/x86_64/fpu/math_private.h
+++ glibc-2.15/sysdeps/x86_64/fpu/math_private.h
@@ -19,10 +19,14 @@
/* We can do a few things better on x86-64. */
-#ifdef __AVX__
+#if defined __AVX__ || defined SSE2AVX
# define MOVD "vmovd" # define MOVD "vmovd"
+# define STMXCSR "vstmxcsr" +# define STMXCSR "vstmxcsr"
+# define LDMXCSR "vldmxcsr" +# define LDMXCSR "vldmxcsr"
@ -291,29 +202,78 @@ index 7f52d5e..50f765f 100644
#endif #endif
/* Direct movement of float into integer register. */ /* Direct movement of float into integer register. */
@@ -173,7 +177,7 @@ @@ -86,7 +90,7 @@
#define libc_fegetround() \ ({ int __di; GET_FLOAT_WORD (__di, (float) d); \
({ \ (__di & 0x7fffffff) < 0x7f800000; })
unsigned int mxcsr; \
- asm volatile ("stmxcsr %0" : "=m" (*&mxcsr)); \
+ asm volatile (STMXCSR " %0" : "=m" (*&mxcsr)); \
(mxcsr & 0x6000) >> 3; \
})
#undef libc_fegetroundf
@@ -184,106 +188,63 @@
#define libc_fesetround(r) \
do { \
unsigned int mxcsr; \
- asm ("stmxcsr %0" : "=m" (*&mxcsr)); \
+ asm (STMXCSR " %0" : "=m" (*&mxcsr)); \
mxcsr = (mxcsr & ~0x6000) | ((r) << 3); \
- asm volatile ("ldmxcsr %0" : : "m" (*&mxcsr)); \
+ asm volatile (LDMXCSR " %0" : : "m" (*&mxcsr)); \
} while (0)
#undef libc_fesetroundf
#define libc_fesetroundf(r) libc_fesetround (r)
// #define libc_fesetroundl(r) (void) fesetround (r)
-#ifdef __AVX__
+#if defined __AVX__ || defined SSE2AVX
# define __ieee754_sqrt(d) \
({ double __res; \
asm ("vsqrtsd %1, %0, %0" : "=x" (__res) : "xm" ((double) (d))); \
@@ -112,7 +116,7 @@
#ifdef __SSE4_1__
# ifndef __rint
-# ifdef __AVX__
+# if defined __AVX__ || defined SSE2AVX
# define __rint(d) \
({ double __res; \
asm ("vroundsd $4, %1, %0, %0" : "=x" (__res) : "xm" ((double) (d))); \
@@ -125,7 +129,7 @@
# endif
# endif
# ifndef __rintf
-# ifdef __AVX__
+# if defined __AVX__ || defined SSE2AVX
# define __rintf(d) \
({ float __res; \
asm ("vroundss $4, %1, %0, %0" : "=x" (__res) : "xm" ((float) (d))); \
@@ -139,7 +143,7 @@
# endif
# ifndef __floor
-# ifdef __AVX__
+# if defined __AVX__ || defined SSE2AVX
# define __floor(d) \
({ double __res; \
asm ("vroundsd $1, %1, %0, %0" : "=x" (__res) : "xm" ((double) (d))); \
@@ -152,7 +156,7 @@
# endif
# endif
# ifndef __floorf
-# ifdef __AVX__
+# if defined __AVX__ || defined SSE2AVX
# define __floorf(d) \
({ float __res; \
asm ("vroundss $1, %1, %0, %0" : "=x" (__res) : "xm" ((float) (d))); \
@@ -169,121 +173,56 @@
/* Specialized variants of the <fenv.h> interfaces which only handle
either the FPU or the SSE unit. */
-#undef libc_fegetround
-#define libc_fegetround() \
- ({ \
- unsigned int mxcsr; \
- asm volatile ("stmxcsr %0" : "=m" (*&mxcsr)); \
- (mxcsr & 0x6000) >> 3; \
- })
-#undef libc_fegetroundf
-#define libc_fegetroundf() libc_fegetround ()
-// #define libc_fegetroundl() fegetround ()
-
-#undef libc_fesetround
-#define libc_fesetround(r) \
- do { \
- unsigned int mxcsr; \
- asm ("stmxcsr %0" : "=m" (*&mxcsr)); \
- mxcsr = (mxcsr & ~0x6000) | ((r) << 3); \
- asm volatile ("ldmxcsr %0" : : "m" (*&mxcsr)); \
- } while (0)
-#undef libc_fesetroundf
-#define libc_fesetroundf(r) libc_fesetround (r)
-// #define libc_fesetroundl(r) (void) fesetround (r)
-
#undef libc_feholdexcept #undef libc_feholdexcept
-#ifdef __AVX__ -#ifdef __AVX__
-# define libc_feholdexcept(e) \ -# define libc_feholdexcept(e) \
@ -344,25 +304,25 @@ index 7f52d5e..50f765f 100644
#undef libc_feholdexcept_setround #undef libc_feholdexcept_setround
-#ifdef __AVX__ -#ifdef __AVX__
-# define libc_feholdexcept_setround(e, r) \ -# define libc_feholdexcept_setround(e, r) \
- do { \
- unsigned int mxcsr; \
- asm ("vstmxcsr %0" : "=m" (*&mxcsr)); \
- (e)->__mxcsr = mxcsr; \
- mxcsr = ((mxcsr | 0x1f80) & ~0x603f) | ((r) << 3); \
- asm volatile ("vldmxcsr %0" : : "m" (*&mxcsr)); \
- } while (0)
-#else
-# define libc_feholdexcept_setround(e, r) \
+#define libc_feholdexcept_setround(e, r) \ +#define libc_feholdexcept_setround(e, r) \
do { \ do { \
unsigned int mxcsr; \ unsigned int mxcsr; \
- asm ("stmxcsr %0" : "=m" (*&mxcsr)); \ - asm ("vstmxcsr %0" : "=m" (*&mxcsr)); \
+ asm (STMXCSR " %0" : "=m" (*&mxcsr)); \ + asm (STMXCSR " %0" : "=m" (*&mxcsr)); \
(e)->__mxcsr = mxcsr; \ (e)->__mxcsr = mxcsr; \
mxcsr = ((mxcsr | 0x1f80) & ~0x603f) | ((r) << 3); \ mxcsr = ((mxcsr | 0x1f80) & ~0x603f) | ((r) << 3); \
- asm volatile ("ldmxcsr %0" : : "m" (*&mxcsr)); \ - asm volatile ("vldmxcsr %0" : : "m" (*&mxcsr)); \
+ asm volatile (LDMXCSR " %0" : : "m" (*&mxcsr)); \ + asm volatile (LDMXCSR " %0" : : "m" (*&mxcsr)); \
} while (0) } while (0)
-#else
-# define libc_feholdexcept_setround(e, r) \
- do { \
- unsigned int mxcsr; \
- asm ("stmxcsr %0" : "=m" (*&mxcsr)); \
- (e)->__mxcsr = mxcsr; \
- mxcsr = ((mxcsr | 0x1f80) & ~0x603f) | ((r) << 3); \
- asm volatile ("ldmxcsr %0" : : "m" (*&mxcsr)); \
- } while (0)
-#endif -#endif
#undef libc_feholdexcept_setroundf #undef libc_feholdexcept_setroundf
#define libc_feholdexcept_setroundf(e, r) libc_feholdexcept_setround (e, r) #define libc_feholdexcept_setroundf(e, r) libc_feholdexcept_setround (e, r)
@ -372,13 +332,14 @@ index 7f52d5e..50f765f 100644
-#ifdef __AVX__ -#ifdef __AVX__
-# define libc_fetestexcept(e) \ -# define libc_fetestexcept(e) \
- ({ unsigned int mxcsr; asm volatile ("vstmxcsr %0" : "=m" (*&mxcsr)); \ - ({ unsigned int mxcsr; asm volatile ("vstmxcsr %0" : "=m" (*&mxcsr)); \
- mxcsr & (e) & FE_ALL_EXCEPT; }) +#define libc_fetestexcept(e) \
+ ({ unsigned int mxcsr; \
+ asm volatile (STMXCSR " %0" : "=m" (*&mxcsr)); \
mxcsr & (e) & FE_ALL_EXCEPT; })
-#else -#else
-# define libc_fetestexcept(e) \ -# define libc_fetestexcept(e) \
- ({ unsigned int mxcsr; asm volatile ("stmxcsr %0" : "=m" (*&mxcsr)); \ - ({ unsigned int mxcsr; asm volatile ("stmxcsr %0" : "=m" (*&mxcsr)); \
+#define libc_fetestexcept(e) \ - mxcsr & (e) & FE_ALL_EXCEPT; })
+ ({ unsigned int mxcsr; asm volatile (STMXCSR " %0" : "=m" (*&mxcsr)); \
mxcsr & (e) & FE_ALL_EXCEPT; })
-#endif -#endif
#undef libc_fetestexceptf #undef libc_fetestexceptf
#define libc_fetestexceptf(e) libc_fetestexcept (e) #define libc_fetestexceptf(e) libc_fetestexcept (e)
@ -422,38 +383,11 @@ index 7f52d5e..50f765f 100644
#undef libc_feupdateenvf #undef libc_feupdateenvf
#define libc_feupdateenvf(e) libc_feupdateenv (e) #define libc_feupdateenvf(e) libc_feupdateenv (e)
// #define libc_feupdateenvl(e) (void) feupdateenv (e) // #define libc_feupdateenvl(e) (void) feupdateenv (e)
Index: glibc-2.15/config.h.in
commit 56f6f6a2403cfa7267cad722597113be35ecf70d ===================================================================
Author: Ulrich Drepper <drepper@gmail.com> --- glibc-2.15.orig/config.h.in
Date: Sat Jan 28 14:48:46 2012 -0500 +++ glibc-2.15/config.h.in
@@ -102,7 +102,7 @@
Use -msse2avx option for x86-64 libm functions
2012-01-28 Ulrich Drepper <drepper@gmail.com>
* config.h.in: Define HAVE_SSE2AVX_SUPPORT.
* math/math_private.h: Remove libc_fegetround* and
libc_fesetround*.
* sysdeps/i386/configure.in: Check for -msse2avx.
* sysdeps/x86_64/fpu/math_private.h: Use VEX-encoded instructions
also if SSE2AVX is defined.
Remove libc_fegetround* and libc_fesetround*.
* sysdeps/x86_64/fpu/multiarch/Makefile: Compile *-avx functions
if config-cflags-sse2avx is yes. Also add -DSSE2AVX to defines.
* sysdeps/x86_64/fpu/multiarch/e_atan2.c: Use HAS_AVX again instead
of HAS_YMM_USABLE.
* sysdeps/x86_64/fpu/multiarch/e_exp.c: Likewise.
* sysdeps/x86_64/fpu/multiarch/e_log.c: Likewise.
* sysdeps/x86_64/fpu/multiarch/s_atan.c: Likewise.
* sysdeps/x86_64/fpu/multiarch/s_sin.c: Likewise.
* sysdeps/x86_64/fpu/multiarch/s_tan.c: Likewise.
2012-01-19 Adhemerval Zanella <azanella@linux.vnet.ibm.com>
diff --git a/config.h.in b/config.h.in
index 50d53d4..1489476 100644
--- a/config.h.in
+++ b/config.h.in
@@ -90,7 +90,7 @@
certain registers (CR0, MQ, CTR, LR) in asm statements. */ certain registers (CR0, MQ, CTR, LR) in asm statements. */
#undef BROKEN_PPC_ASM_CR0 #undef BROKEN_PPC_ASM_CR0
@ -462,7 +396,7 @@ index 50d53d4..1489476 100644
symbol. sysdeps/sparc/sparc32/elf/configure. */ symbol. sysdeps/sparc/sparc32/elf/configure. */
#undef BROKEN_SPARC_WDISP22 #undef BROKEN_SPARC_WDISP22
@@ -106,17 +106,20 @@ @@ -118,17 +118,20 @@
/* Define if gcc supports AVX. */ /* Define if gcc supports AVX. */
#undef HAVE_AVX_SUPPORT #undef HAVE_AVX_SUPPORT
@ -485,11 +419,11 @@ index 50d53d4..1489476 100644
include/libc-symbols.h that avoid PLT slots in the shared objects. */ include/libc-symbols.h that avoid PLT slots in the shared objects. */
#undef NO_HIDDEN #undef NO_HIDDEN
diff --git a/math/math_private.h b/math/math_private.h Index: glibc-2.15/math/math_private.h
index 602a271..e4108d8 100644 ===================================================================
--- a/math/math_private.h --- glibc-2.15.orig/math/math_private.h
+++ b/math/math_private.h +++ glibc-2.15/math/math_private.h
@@ -365,14 +365,6 @@ extern void __docos (double __x, double __dx, double __v[]); @@ -365,14 +365,6 @@ extern void __docos (double __x, double
know what operations are going to be performed. Therefore we know what operations are going to be performed. Therefore we
define additional interfaces. By default they refer to the normal define additional interfaces. By default they refer to the normal
interfaces. */ interfaces. */
@ -504,10 +438,10 @@ index 602a271..e4108d8 100644
#define libc_feholdexcept(e) (void) feholdexcept (e) #define libc_feholdexcept(e) (void) feholdexcept (e)
#define libc_feholdexceptf(e) (void) feholdexcept (e) #define libc_feholdexceptf(e) (void) feholdexcept (e)
#define libc_feholdexceptl(e) (void) feholdexcept (e) #define libc_feholdexceptl(e) (void) feholdexcept (e)
diff --git a/sysdeps/i386/configure b/sysdeps/i386/configure Index: glibc-2.15/sysdeps/i386/configure
index ae494e2..bc7900e 100644 ===================================================================
--- a/sysdeps/i386/configure --- glibc-2.15.orig/sysdeps/i386/configure
+++ b/sysdeps/i386/configure +++ glibc-2.15/sysdeps/i386/configure
@@ -756,6 +756,29 @@ if test $libc_cv_cc_avx = yes; then @@ -756,6 +756,29 @@ if test $libc_cv_cc_avx = yes; then
fi fi
@ -538,10 +472,10 @@ index ae494e2..bc7900e 100644
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for FMA4 support" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for FMA4 support" >&5
$as_echo_n "checking for FMA4 support... " >&6; } $as_echo_n "checking for FMA4 support... " >&6; }
if ${libc_cv_cc_fma4+:} false; then : if ${libc_cv_cc_fma4+:} false; then :
diff --git a/sysdeps/i386/configure.in b/sysdeps/i386/configure.in Index: glibc-2.15/sysdeps/i386/configure.in
index 5a9840e..59a4cd6 100644 ===================================================================
--- a/sysdeps/i386/configure.in --- glibc-2.15.orig/sysdeps/i386/configure.in
+++ b/sysdeps/i386/configure.in +++ glibc-2.15/sysdeps/i386/configure.in
@@ -67,6 +67,17 @@ if test $libc_cv_cc_avx = yes; then @@ -67,6 +67,17 @@ if test $libc_cv_cc_avx = yes; then
AC_DEFINE(HAVE_AVX_SUPPORT) AC_DEFINE(HAVE_AVX_SUPPORT)
fi fi
@ -560,108 +494,10 @@ index 5a9840e..59a4cd6 100644
dnl Check if -mfma4 works. dnl Check if -mfma4 works.
AC_CACHE_CHECK(for FMA4 support, libc_cv_cc_fma4, [dnl AC_CACHE_CHECK(for FMA4 support, libc_cv_cc_fma4, [dnl
if AC_TRY_COMMAND([${CC-cc} -mfma4 -xc /dev/null -S -o /dev/null]); then if AC_TRY_COMMAND([${CC-cc} -mfma4 -xc /dev/null -S -o /dev/null]); then
diff --git a/sysdeps/x86_64/fpu/math_private.h b/sysdeps/x86_64/fpu/math_private.h Index: glibc-2.15/sysdeps/x86_64/fpu/multiarch/Makefile
index 50f765f..8e79718 100644 ===================================================================
--- a/sysdeps/x86_64/fpu/math_private.h --- glibc-2.15.orig/sysdeps/x86_64/fpu/multiarch/Makefile
+++ b/sysdeps/x86_64/fpu/math_private.h +++ glibc-2.15/sysdeps/x86_64/fpu/multiarch/Makefile
@@ -19,7 +19,7 @@
/* We can do a few things better on x86-64. */
-#ifdef __AVX__
+#if defined __AVX__ || defined SSE2AVX
# define MOVD "vmovd"
# define STMXCSR "vstmxcsr"
# define LDMXCSR "vldmxcsr"
@@ -90,7 +90,7 @@
({ int __di; GET_FLOAT_WORD (__di, (float) d); \
(__di & 0x7fffffff) < 0x7f800000; })
-#ifdef __AVX__
+#if defined __AVX__ || defined SSE2AVX
# define __ieee754_sqrt(d) \
({ double __res; \
asm ("vsqrtsd %1, %0, %0" : "=x" (__res) : "xm" ((double) (d))); \
@@ -116,7 +116,7 @@
#ifdef __SSE4_1__
# ifndef __rint
-# ifdef __AVX__
+# if defined __AVX__ || defined SSE2AVX
# define __rint(d) \
({ double __res; \
asm ("vroundsd $4, %1, %0, %0" : "=x" (__res) : "xm" ((double) (d))); \
@@ -129,7 +129,7 @@
# endif
# endif
# ifndef __rintf
-# ifdef __AVX__
+# if defined __AVX__ || defined SSE2AVX
# define __rintf(d) \
({ float __res; \
asm ("vroundss $4, %1, %0, %0" : "=x" (__res) : "xm" ((float) (d))); \
@@ -143,7 +143,7 @@
# endif
# ifndef __floor
-# ifdef __AVX__
+# if defined __AVX__ || defined SSE2AVX
# define __floor(d) \
({ double __res; \
asm ("vroundsd $1, %1, %0, %0" : "=x" (__res) : "xm" ((double) (d))); \
@@ -156,7 +156,7 @@
# endif
# endif
# ifndef __floorf
-# ifdef __AVX__
+# if defined __AVX__ || defined SSE2AVX
# define __floorf(d) \
({ float __res; \
asm ("vroundss $1, %1, %0, %0" : "=x" (__res) : "xm" ((float) (d))); \
@@ -173,29 +173,6 @@
/* Specialized variants of the <fenv.h> interfaces which only handle
either the FPU or the SSE unit. */
-#undef libc_fegetround
-#define libc_fegetround() \
- ({ \
- unsigned int mxcsr; \
- asm volatile (STMXCSR " %0" : "=m" (*&mxcsr)); \
- (mxcsr & 0x6000) >> 3; \
- })
-#undef libc_fegetroundf
-#define libc_fegetroundf() libc_fegetround ()
-// #define libc_fegetroundl() fegetround ()
-
-#undef libc_fesetround
-#define libc_fesetround(r) \
- do { \
- unsigned int mxcsr; \
- asm (STMXCSR " %0" : "=m" (*&mxcsr)); \
- mxcsr = (mxcsr & ~0x6000) | ((r) << 3); \
- asm volatile (LDMXCSR " %0" : : "m" (*&mxcsr)); \
- } while (0)
-#undef libc_fesetroundf
-#define libc_fesetroundf(r) libc_fesetround (r)
-// #define libc_fesetroundl(r) (void) fesetround (r)
-
#undef libc_feholdexcept
#define libc_feholdexcept(e) \
do { \
@@ -224,7 +201,8 @@
#undef libc_fetestexcept
#define libc_fetestexcept(e) \
- ({ unsigned int mxcsr; asm volatile (STMXCSR " %0" : "=m" (*&mxcsr)); \
+ ({ unsigned int mxcsr; \
+ asm volatile (STMXCSR " %0" : "=m" (*&mxcsr)); \
mxcsr & (e) & FE_ALL_EXCEPT; })
#undef libc_fetestexceptf
#define libc_fetestexceptf(e) libc_fetestexcept (e)
diff --git a/sysdeps/x86_64/fpu/multiarch/Makefile b/sysdeps/x86_64/fpu/multiarch/Makefile
index be68903..4b5c173 100644
--- a/sysdeps/x86_64/fpu/multiarch/Makefile
+++ b/sysdeps/x86_64/fpu/multiarch/Makefile
@@ -34,21 +34,21 @@ CFLAGS-s_sin-fma4.c = -mfma4 @@ -34,21 +34,21 @@ CFLAGS-s_sin-fma4.c = -mfma4
CFLAGS-s_tan-fma4.c = -mfma4 CFLAGS-s_tan-fma4.c = -mfma4
endif endif
@ -691,114 +527,14 @@ index be68903..4b5c173 100644
+CFLAGS-mplog-avx.c = -msse2avx -DSSE2AVX +CFLAGS-mplog-avx.c = -msse2avx -DSSE2AVX
+CFLAGS-s_atan-avx.c = -msse2avx -DSSE2AVX +CFLAGS-s_atan-avx.c = -msse2avx -DSSE2AVX
+CFLAGS-s_sin-avx.c = -msse2avx -DSSE2AVX +CFLAGS-s_sin-avx.c = -msse2avx -DSSE2AVX
+CFLAGS-slowexp-avx.c = -sse2mavx -DSSE2AVX +CFLAGS-slowexp-avx.c = -msse2avx -DSSE2AVX
+CFLAGS-s_tan-avx.c = -msse2avx -DSSE2AVX +CFLAGS-s_tan-avx.c = -msse2avx -DSSE2AVX
endif endif
endif endif
diff --git a/sysdeps/x86_64/fpu/multiarch/e_atan2.c b/sysdeps/x86_64/fpu/multiarch/e_atan2.c Index: glibc-2.15/config.make.in
index 3a615fc..6867c6e 100644 ===================================================================
--- a/sysdeps/x86_64/fpu/multiarch/e_atan2.c --- glibc-2.15.orig/config.make.in
+++ b/sysdeps/x86_64/fpu/multiarch/e_atan2.c +++ glibc-2.15/config.make.in
@@ -14,7 +14,7 @@ extern double __ieee754_atan2_fma4 (double, double);
libm_ifunc (__ieee754_atan2,
HAS_FMA4 ? __ieee754_atan2_fma4
- : (HAS_YMM_USABLE ? __ieee754_atan2_avx : __ieee754_atan2_sse2));
+ : (HAS_AVX ? __ieee754_atan2_avx : __ieee754_atan2_sse2));
strong_alias (__ieee754_atan2, __atan2_finite)
# define __ieee754_atan2 __ieee754_atan2_sse2
diff --git a/sysdeps/x86_64/fpu/multiarch/e_exp.c b/sysdeps/x86_64/fpu/multiarch/e_exp.c
index 7b2320a..3c65028 100644
--- a/sysdeps/x86_64/fpu/multiarch/e_exp.c
+++ b/sysdeps/x86_64/fpu/multiarch/e_exp.c
@@ -14,7 +14,7 @@ extern double __ieee754_exp_fma4 (double);
libm_ifunc (__ieee754_exp,
HAS_FMA4 ? __ieee754_exp_fma4
- : (HAS_YMM_USABLE ? __ieee754_exp_avx : __ieee754_exp_sse2));
+ : (HAS_AVX ? __ieee754_exp_avx : __ieee754_exp_sse2));
strong_alias (__ieee754_exp, __exp_finite)
# define __ieee754_exp __ieee754_exp_sse2
diff --git a/sysdeps/x86_64/fpu/multiarch/e_log.c b/sysdeps/x86_64/fpu/multiarch/e_log.c
index ab277d6..05f3668 100644
--- a/sysdeps/x86_64/fpu/multiarch/e_log.c
+++ b/sysdeps/x86_64/fpu/multiarch/e_log.c
@@ -14,8 +14,7 @@ extern double __ieee754_log_fma4 (double);
libm_ifunc (__ieee754_log,
HAS_FMA4 ? __ieee754_log_fma4
- : (HAS_YMM_USABLE ? __ieee754_log_avx
- : __ieee754_log_sse2));
+ : (HAS_AVX ? __ieee754_log_avx : __ieee754_log_sse2));
strong_alias (__ieee754_log, __log_finite)
# define __ieee754_log __ieee754_log_sse2
diff --git a/sysdeps/x86_64/fpu/multiarch/s_atan.c b/sysdeps/x86_64/fpu/multiarch/s_atan.c
index 78c7e09..ae16d7c 100644
--- a/sysdeps/x86_64/fpu/multiarch/s_atan.c
+++ b/sysdeps/x86_64/fpu/multiarch/s_atan.c
@@ -13,7 +13,7 @@ extern double __atan_fma4 (double);
# endif
libm_ifunc (atan, (HAS_FMA4 ? __atan_fma4 :
- HAS_YMM_USABLE ? __atan_avx : __atan_sse2));
+ HAS_AVX ? __atan_avx : __atan_sse2));
# define atan __atan_sse2
#endif
diff --git a/sysdeps/x86_64/fpu/multiarch/s_sin.c b/sysdeps/x86_64/fpu/multiarch/s_sin.c
index 417acd0..a0c2521 100644
--- a/sysdeps/x86_64/fpu/multiarch/s_sin.c
+++ b/sysdeps/x86_64/fpu/multiarch/s_sin.c
@@ -18,11 +18,11 @@ extern double __sin_fma4 (double);
# endif
libm_ifunc (__cos, (HAS_FMA4 ? __cos_fma4 :
- HAS_YMM_USABLE ? __cos_avx : __cos_sse2));
+ HAS_AVX ? __cos_avx : __cos_sse2));
weak_alias (__cos, cos)
libm_ifunc (__sin, (HAS_FMA4 ? __sin_fma4 :
- HAS_YMM_USABLE ? __sin_avx : __sin_sse2));
+ HAS_AVX ? __sin_avx : __sin_sse2));
weak_alias (__sin, sin)
# define __cos __cos_sse2
diff --git a/sysdeps/x86_64/fpu/multiarch/s_tan.c b/sysdeps/x86_64/fpu/multiarch/s_tan.c
index 3047155..904308f 100644
--- a/sysdeps/x86_64/fpu/multiarch/s_tan.c
+++ b/sysdeps/x86_64/fpu/multiarch/s_tan.c
@@ -13,7 +13,7 @@ extern double __tan_fma4 (double);
# endif
libm_ifunc (tan, (HAS_FMA4 ? __tan_fma4 :
- HAS_YMM_USABLE ? __tan_avx : __tan_sse2));
+ HAS_AVX ? __tan_avx : __tan_sse2));
# define tan __tan_sse2
#endif
commit 3b1004624e54cc2fefd034ff80d5dea4b6db764f
Author: Joseph Myers <joseph@codesourcery.com>
Date: Mon Jan 30 19:55:15 2012 +0000
Fix makefile/configure problems with sse2avx changes.
2012-01-30 Joseph Myers <joseph@codesourcery.com>
* configure.in (libc_cv_cc_sse2avx): AC_SUBST.
* configure: Regenerate.
* config.make.in (config-cflags-sse2avx): Define.
* sysdeps/x86_64/fpu/multiarch/Makefile (CFLAGS-slowexp-avx.c):
Fix typo.
* scripts/config.guess: Update from upstream config git repository.
diff --git a/config.make.in b/config.make.in
index d937952..75061f6 100644
--- a/config.make.in
+++ b/config.make.in
@@ -36,6 +36,7 @@ asflags-cpu = @libc_cv_cc_submachine@ @@ -36,6 +36,7 @@ asflags-cpu = @libc_cv_cc_submachine@
config-cflags-sse4 = @libc_cv_cc_sse4@ config-cflags-sse4 = @libc_cv_cc_sse4@
@ -807,11 +543,11 @@ index d937952..75061f6 100644
config-cflags-novzeroupper = @libc_cv_cc_novzeroupper@ config-cflags-novzeroupper = @libc_cv_cc_novzeroupper@
config-asflags-i686 = @libc_cv_as_i686@ config-asflags-i686 = @libc_cv_as_i686@
diff --git a/configure b/configure Index: glibc-2.15/configure
index 71e8de1..508e1bb 100755 ===================================================================
--- a/configure --- glibc-2.15.orig/configure
+++ b/configure +++ glibc-2.15/configure
@@ -620,6 +620,7 @@ use_ldconfig @@ -625,6 +625,7 @@ use_ldconfig
libc_cv_as_i686 libc_cv_as_i686
libc_cv_cc_fma4 libc_cv_cc_fma4
libc_cv_cc_novzeroupper libc_cv_cc_novzeroupper
@ -819,11 +555,11 @@ index 71e8de1..508e1bb 100755
libc_cv_cc_avx libc_cv_cc_avx
libc_cv_cc_sse4 libc_cv_cc_sse4
libc_cv_cpp_asm_debuginfo libc_cv_cpp_asm_debuginfo
diff --git a/configure.in b/configure.in Index: glibc-2.15/configure.in
index 5fd6d85..0499d3c 100644 ===================================================================
--- a/configure.in --- glibc-2.15.orig/configure.in
+++ b/configure.in +++ glibc-2.15/configure.in
@@ -2154,6 +2154,7 @@ dnl sysdeps/CPU/configure.in checks set this via arch-specific asm tests @@ -2338,6 +2338,7 @@ dnl sysdeps/CPU/configure.in checks set
AC_SUBST(libc_cv_cpp_asm_debuginfo) AC_SUBST(libc_cv_cpp_asm_debuginfo)
AC_SUBST(libc_cv_cc_sse4) AC_SUBST(libc_cv_cc_sse4)
AC_SUBST(libc_cv_cc_avx) AC_SUBST(libc_cv_cc_avx)
@ -831,16 +567,3 @@ index 5fd6d85..0499d3c 100644
AC_SUBST(libc_cv_cc_novzeroupper) AC_SUBST(libc_cv_cc_novzeroupper)
AC_SUBST(libc_cv_cc_fma4) AC_SUBST(libc_cv_cc_fma4)
AC_SUBST(libc_cv_as_i686) AC_SUBST(libc_cv_as_i686)
diff --git a/sysdeps/x86_64/fpu/multiarch/Makefile b/sysdeps/x86_64/fpu/multiarch/Makefile
index 4b5c173..2a38ffc 100644
--- a/sysdeps/x86_64/fpu/multiarch/Makefile
+++ b/sysdeps/x86_64/fpu/multiarch/Makefile
@@ -48,7 +48,7 @@ CFLAGS-mpexp-avx.c = -msse2avx -DSSE2AVX
CFLAGS-mplog-avx.c = -msse2avx -DSSE2AVX
CFLAGS-s_atan-avx.c = -msse2avx -DSSE2AVX
CFLAGS-s_sin-avx.c = -msse2avx -DSSE2AVX
-CFLAGS-slowexp-avx.c = -sse2mavx -DSSE2AVX
+CFLAGS-slowexp-avx.c = -msse2avx -DSSE2AVX
CFLAGS-s_tan-avx.c = -msse2avx -DSSE2AVX
endif
endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,33 @@
commit 7c35ffedf144417ba2787322c7b75b4db5c3cb7a
Author: Thomas Schwinge <thomas@codesourcery.com>
Date: Fri Feb 10 21:05:54 2012 +0100
Fix x86 PLT slot usage for feraiseexcept.
Then we're elf/check-localplt.out-clean again.
2012-02-10 Thomas Schwinge <thomas@codesourcery.com>
* sysdeps/i386/fpu/feupdateenv.c (__feupdateenv) Invoke __feraiseexcept
instead of feraiseexcept.
diff --git a/sysdeps/i386/fpu/feupdateenv.c b/sysdeps/i386/fpu/feupdateenv.c
index 70f9ee2..6e2ce35 100644
--- a/sysdeps/i386/fpu/feupdateenv.c
+++ b/sysdeps/i386/fpu/feupdateenv.c
@@ -1,5 +1,5 @@
/* Install given floating-point environment and raise exceptions.
- Copyright (C) 1997,99,2000,01,07,2010 Free Software Foundation, Inc.
+ Copyright (C) 1997,99,2000,01,07,2010,2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -44,7 +44,7 @@ __feupdateenv (const fenv_t *envp)
/* Raise the saved exception. Incidently for us the implementation
defined format of the values in objects of type fexcept_t is the
same as the ones specified using the FE_* constants. */
- feraiseexcept ((int) temp);
+ __feraiseexcept ((int) temp);
/* Success. */
return 0;

View File

@ -2,11 +2,11 @@ For details see:
http://sourceware.org/bugzilla/show_bug.cgi?id=5379 http://sourceware.org/bugzilla/show_bug.cgi?id=5379
Index: sunrpc/clnt_udp.c Index: glibc-2.15/sunrpc/clnt_udp.c
=================================================================== ===================================================================
--- sunrpc/clnt_udp.c.orig --- glibc-2.15.orig/sunrpc/clnt_udp.c
+++ sunrpc/clnt_udp.c +++ glibc-2.15/sunrpc/clnt_udp.c
@@ -301,6 +301,7 @@ clntudp_call (cl, proc, xargs, argsp, xr @@ -307,6 +307,7 @@ clntudp_call (cl, proc, xargs, argsp, xr
XDR *xdrs; XDR *xdrs;
int outlen = 0; int outlen = 0;
int inlen; int inlen;
@ -14,7 +14,7 @@ Index: sunrpc/clnt_udp.c
socklen_t fromlen; socklen_t fromlen;
struct pollfd fd; struct pollfd fd;
int milliseconds = (cu->cu_wait.tv_sec * 1000) + int milliseconds = (cu->cu_wait.tv_sec * 1000) +
@@ -371,37 +372,36 @@ send_again: @@ -377,37 +378,36 @@ send_again:
anyup = 0; anyup = 0;
for (;;) for (;;)
{ {

View File

@ -44,7 +44,7 @@ Index: sunrpc/bindrsvprt.c
+ if (NULL == fp) + if (NULL == fp)
+ return; + return;
+ +
+ while (!feof (fp)) + while (!feof_unlocked (fp))
+ { + {
+ unsigned long port; + unsigned long port;
+ char *tmp, *cp; + char *tmp, *cp;

View File

@ -1,8 +1,8 @@
Index: elf/rtld.c Index: glibc-2.15/elf/rtld.c
=================================================================== ===================================================================
--- elf/rtld.c.orig --- glibc-2.15.orig/elf/rtld.c
+++ elf/rtld.c +++ glibc-2.15/elf/rtld.c
@@ -1761,6 +1761,53 @@ ERROR: ld.so: object '%s' cannot be load @@ -1802,6 +1802,53 @@ ERROR: ld.so: object '%s' cannot be load
} }
} }

View File

@ -1,7 +1,7 @@
Index: localedata/locales/zh_TW Index: glibc-2.15/localedata/locales/zh_TW
=================================================================== ===================================================================
--- localedata/locales/zh_TW.orig --- glibc-2.15.orig/localedata/locales/zh_TW
+++ localedata/locales/zh_TW +++ glibc-2.15/localedata/locales/zh_TW
@@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
comment_char % comment_char %
escape_char / escape_char /

View File

@ -1,7 +1,7 @@
Index: intl/locale.alias Index: glibc-2.15/intl/locale.alias
=================================================================== ===================================================================
--- intl/locale.alias.orig --- glibc-2.15.orig/intl/locale.alias
+++ intl/locale.alias +++ glibc-2.15/intl/locale.alias
@@ -57,8 +57,6 @@ korean ko_KR.eucKR @@ -57,8 +57,6 @@ korean ko_KR.eucKR
korean.euc ko_KR.eucKR korean.euc ko_KR.eucKR
ko_KR ko_KR.eucKR ko_KR ko_KR.eucKR
@ -11,10 +11,10 @@ Index: intl/locale.alias
norwegian nb_NO.ISO-8859-1 norwegian nb_NO.ISO-8859-1
nynorsk nn_NO.ISO-8859-1 nynorsk nn_NO.ISO-8859-1
polish pl_PL.ISO-8859-2 polish pl_PL.ISO-8859-2
Index: localedata/locales/no_NO Index: glibc-2.15/localedata/locales/no_NO
=================================================================== ===================================================================
--- /dev/null --- /dev/null
+++ localedata/locales/no_NO +++ glibc-2.15/localedata/locales/no_NO
@@ -0,0 +1,69 @@ @@ -0,0 +1,69 @@
+escape_char / +escape_char /
+comment_char % +comment_char %
@ -85,11 +85,11 @@ Index: localedata/locales/no_NO
+LC_ADDRESS +LC_ADDRESS
+copy "nb_NO" +copy "nb_NO"
+END LC_ADDRESS +END LC_ADDRESS
Index: localedata/SUPPORTED Index: glibc-2.15/localedata/SUPPORTED
=================================================================== ===================================================================
--- localedata/SUPPORTED.orig --- glibc-2.15.orig/localedata/SUPPORTED
+++ localedata/SUPPORTED +++ glibc-2.15/localedata/SUPPORTED
@@ -305,6 +305,8 @@ nl_NL/ISO-8859-1 \ @@ -316,6 +316,8 @@ nl_NL/ISO-8859-1 \
nl_NL@euro/ISO-8859-15 \ nl_NL@euro/ISO-8859-15 \
nn_NO.UTF-8/UTF-8 \ nn_NO.UTF-8/UTF-8 \
nn_NO/ISO-8859-1 \ nn_NO/ISO-8859-1 \

View File

@ -6,7 +6,7 @@ Index: posix/Makefile
=================================================================== ===================================================================
--- posix/Makefile.orig --- posix/Makefile.orig
+++ posix/Makefile +++ posix/Makefile
@@ -298,8 +298,7 @@ $(inst_libexecdir)/getconf: $(inst_bindi @@ -316,8 +316,7 @@ $(inst_libexecdir)/getconf: $(inst_bindi
$(addprefix $(..)./scripts/mkinstalldirs ,\ $(addprefix $(..)./scripts/mkinstalldirs ,\
$(filter-out $(wildcard $@),$@)) $(filter-out $(wildcard $@),$@))
while read spec; do \ while read spec; do \

View File

@ -0,0 +1,32 @@
From 2d80bda39073a35af4b904d27fa1511cd309b26f Mon Sep 17 00:00:00 2001
From: Nathan Sidwell <nathan@codesourcery.com>
Date: Fri, 6 Jan 2012 20:14:44 +0000
Subject: [PATCH 696/712] Add ARM dependency of libmemusage.so on
libc_nonshared.a.
---
ChangeLog.arm | 6 ++++++
sysdeps/arm/Makefile | 5 +++++
2 files changed, 11 insertions(+), 0 deletions(-)
2012-01-05 Nathan Sidwell <nathan@codesourcery.com>
Tom de Vries <tom@codesourcery.com>
* sysdeps/arm/Makefile (libmemusage.so): Add libc_nonshared.a
dependency.
diff --git a/sysdeps/arm/Makefile b/sysdeps/arm/Makefile
--- a/glibc-ports-2.15/sysdeps/arm/Makefile
+++ b/glibc-ports-2.15/sysdeps/arm/Makefile
@@ -7,3 +7,8 @@ endif
ifeq ($(subdir),csu)
gen-as-const-headers += tlsdesc.sym
endif
+
+# to pull in __aeabi_read_tp, needed for tls
+ifeq ($(subdir),malloc)
+$(objpfx)libmemusage.so: $(common-objpfx)libc_nonshared.a
+endif
--
1.7.6.5

View File

@ -7,11 +7,11 @@
timezone/Makefile | 2 +- timezone/Makefile | 2 +-
6 files changed, 20 insertions(+), 4 deletions(-) 6 files changed, 20 insertions(+), 4 deletions(-)
Index: config.make.in Index: glibc-2.15/config.make.in
=================================================================== ===================================================================
--- config.make.in.orig --- glibc-2.15.orig/config.make.in
+++ config.make.in +++ glibc-2.15/config.make.in
@@ -99,6 +99,7 @@ add-ons = @add_ons@ @@ -100,6 +100,7 @@ add-ons = @add_ons@
add-on-subdirs = @add_on_subdirs@ add-on-subdirs = @add_on_subdirs@
sysdeps-add-ons = @sysdeps_add_ons@ sysdeps-add-ons = @sysdeps_add_ons@
cross-compiling = @cross_compiling@ cross-compiling = @cross_compiling@
@ -19,11 +19,11 @@ Index: config.make.in
force-install = @force_install@ force-install = @force_install@
# Build tools. # Build tools.
Index: configure.in Index: glibc-2.15/configure.in
=================================================================== ===================================================================
--- configure.in.orig --- glibc-2.15.orig/configure.in
+++ configure.in +++ glibc-2.15/configure.in
@@ -16,6 +16,7 @@ if test $host != $build; then @@ -15,6 +15,7 @@ if test $host != $build; then
AC_CHECK_PROGS(BUILD_CC, gcc cc) AC_CHECK_PROGS(BUILD_CC, gcc cc)
fi fi
AC_SUBST(cross_compiling) AC_SUBST(cross_compiling)
@ -31,11 +31,11 @@ Index: configure.in
AC_PROG_CPP AC_PROG_CPP
# We need the C++ compiler only for testing. # We need the C++ compiler only for testing.
AC_PROG_CXX AC_PROG_CXX
Index: configure Index: glibc-2.15/configure
=================================================================== ===================================================================
--- configure.orig --- glibc-2.15.orig/configure
+++ configure +++ glibc-2.15/configure
@@ -554,6 +554,7 @@ ac_clean_files= @@ -553,6 +553,7 @@ ac_clean_files=
ac_config_libobj_dir=. ac_config_libobj_dir=.
LIBOBJS= LIBOBJS=
cross_compiling=no cross_compiling=no
@ -83,10 +83,10 @@ Index: configure
Optional Packages: Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
Index: posix/Makefile Index: glibc-2.15/posix/Makefile
=================================================================== ===================================================================
--- posix/Makefile.orig --- glibc-2.15.orig/posix/Makefile
+++ posix/Makefile +++ glibc-2.15/posix/Makefile
@@ -320,7 +320,7 @@ $(inst_libexecdir)/getconf: $(inst_bindi @@ -320,7 +320,7 @@ $(inst_libexecdir)/getconf: $(inst_bindi
done < $(objpfx)getconf.speclist done < $(objpfx)getconf.speclist
@ -96,10 +96,10 @@ Index: posix/Makefile
LC_ALL=C GETCONF_DIR=/dev/null \ LC_ALL=C GETCONF_DIR=/dev/null \
$(run-program-prefix) $< _POSIX_V7_WIDTH_RESTRICTED_ENVS > $@.new $(run-program-prefix) $< _POSIX_V7_WIDTH_RESTRICTED_ENVS > $@.new
LC_ALL=C GETCONF_DIR=/dev/null \ LC_ALL=C GETCONF_DIR=/dev/null \
Index: sunrpc/Makefile Index: glibc-2.15/sunrpc/Makefile
=================================================================== ===================================================================
--- sunrpc/Makefile.orig --- glibc-2.15.orig/sunrpc/Makefile
+++ sunrpc/Makefile +++ glibc-2.15/sunrpc/Makefile
@@ -108,7 +108,7 @@ otherlibs += $(nssobjdir)/libnss_files.a @@ -108,7 +108,7 @@ otherlibs += $(nssobjdir)/libnss_files.a
$(resolvobjdir)/libresolv.a $(resolvobjdir)/libresolv.a
endif endif
@ -109,10 +109,10 @@ Index: sunrpc/Makefile
# We can only build this library if we can run the rpcgen we build. # We can only build this library if we can run the rpcgen we build.
headers += $(rpcsvc:%.x=rpcsvc/%.h) headers += $(rpcsvc:%.x=rpcsvc/%.h)
extra-libs := librpcsvc extra-libs := librpcsvc
Index: timezone/Makefile Index: glibc-2.15/timezone/Makefile
=================================================================== ===================================================================
--- timezone/Makefile.orig --- glibc-2.15.orig/timezone/Makefile
+++ timezone/Makefile +++ glibc-2.15/timezone/Makefile
@@ -69,7 +69,7 @@ installed-posixrules-file := $(firstword @@ -69,7 +69,7 @@ installed-posixrules-file := $(firstword
$(addprefix $(inst_zonedir)/, \ $(addprefix $(inst_zonedir)/, \
$(posixrules-file))) $(posixrules-file)))

149
glibc-fix-noload.patch Normal file
View File

@ -0,0 +1,149 @@
commit 675155e9084e060fd0e1e637b843f14e82898aa5
Author: Andreas Schwab <schwab@redhat.com>
Date: Wed Sep 22 12:06:30 2010 +0200
Fix memory leak on init/fini dependency list
2010-09-27 Andreas Schwab <schwab@redhat.com>
* include/link.h (struct link_map): Add l_free_initfini.
* elf/dl-deps.c (_dl_map_object_deps): Set it when assigning
l_initfini.
* elf/rtld.c (dl_main): Clear it on all objects loaded on startup.
* elf/dl-libc.c (free_mem): Free l_initfini if l_free_initfini is
set.
Index: glibc-2.15/elf/dl-close.c
===================================================================
--- glibc-2.15.orig/elf/dl-close.c
+++ glibc-2.15/elf/dl-close.c
@@ -1,5 +1,5 @@
/* Close a shared object opened by `_dl_open'.
- Copyright (C) 1996-2007, 2009, 2010, 2011 Free Software Foundation, Inc.
+ Copyright (C) 1996-2007, 2009, 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -119,17 +119,8 @@ _dl_close_worker (struct link_map *map)
if (map->l_direct_opencount > 0 || map->l_type != lt_loaded
|| dl_close_state != not_pending)
{
- if (map->l_direct_opencount == 0)
- {
- if (map->l_type == lt_loaded)
- dl_close_state = rerun;
- else if (map->l_type == lt_library)
- {
- struct link_map **oldp = map->l_initfini;
- map->l_initfini = map->l_orig_initfini;
- _dl_scope_free (oldp);
- }
- }
+ if (map->l_direct_opencount == 0 && map->l_type == lt_loaded)
+ dl_close_state = rerun;
/* There are still references to this object. Do nothing more. */
if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0))
Index: glibc-2.15/elf/dl-libc.c
===================================================================
--- glibc-2.15.orig/elf/dl-libc.c
+++ glibc-2.15/elf/dl-libc.c
@@ -270,13 +270,13 @@ libc_freeres_fn (free_mem)
for (Lmid_t ns = 0; ns < GL(dl_nns); ++ns)
{
- /* Remove all additional names added to the objects. */
for (l = GL(dl_ns)[ns]._ns_loaded; l != NULL; l = l->l_next)
{
struct libname_list *lnp = l->l_libname->next;
l->l_libname->next = NULL;
+ /* Remove all additional names added to the objects. */
while (lnp != NULL)
{
struct libname_list *old = lnp;
@@ -284,6 +284,10 @@ libc_freeres_fn (free_mem)
if (! old->dont_free)
free (old);
}
+
+ /* Free the initfini dependency list. */
+ if (l->l_free_initfini)
+ free (l->l_initfini);
}
if (__builtin_expect (GL(dl_ns)[ns]._ns_global_scope_alloc, 0) != 0
Index: glibc-2.15/elf/rtld.c
===================================================================
--- glibc-2.15.orig/elf/rtld.c
+++ glibc-2.15/elf/rtld.c
@@ -2323,6 +2323,7 @@ ERROR: ld.so: object '%s' cannot be load
lnp->dont_free = 1;
lnp = lnp->next;
}
+ l->l_free_initfini = 0;
if (l != &GL(dl_rtld_map))
_dl_relocate_object (l, l->l_scope, GLRO(dl_lazy) ? RTLD_LAZY : 0,
Index: glibc-2.15/include/link.h
===================================================================
--- glibc-2.15.orig/include/link.h
+++ glibc-2.15/include/link.h
@@ -1,6 +1,6 @@
/* Data structure for communication from the run-time dynamic linker for
loaded ELF shared objects.
- Copyright (C) 1995-2006, 2007, 2009, 2010, 2011 Free Software Foundation, Inc.
+ Copyright (C) 1995-2006, 2007, 2009, 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -192,6 +192,9 @@ struct link_map
during LD_TRACE_PRELINKING=1
contains any DT_SYMBOLIC
libraries. */
+ unsigned int l_free_initfini:1; /* Nonzero if l_initfini can be
+ freed, ie. not allocated with
+ the dummy malloc in ld.so. */
/* Collected information about own RPATH directories. */
struct r_search_path_struct l_rpath_dirs;
@@ -240,9 +243,6 @@ struct link_map
/* List of object in order of the init and fini calls. */
struct link_map **l_initfini;
- /* The init and fini list generated at startup, saved when the
- object is also loaded dynamically. */
- struct link_map **l_orig_initfini;
/* List of the dependencies introduced through symbol binding. */
struct link_map_reldeps
Index: glibc-2.15/elf/dl-deps.c
===================================================================
--- glibc-2.15.orig/elf/dl-deps.c
+++ glibc-2.15/elf/dl-deps.c
@@ -489,6 +489,7 @@ _dl_map_object_deps (struct link_map *ma
nneeded * sizeof needed[0]);
atomic_write_barrier ();
l->l_initfini = l_initfini;
+ l->l_free_initfini = 1;
}
/* If we have no auxiliary objects just go on to the next map. */
@@ -689,6 +690,7 @@ Filters not supported with LD_TRACE_PREL
l_initfini[nlist] = NULL;
atomic_write_barrier ();
map->l_initfini = l_initfini;
+ map->l_free_initfini = 1;
if (l_reldeps != NULL)
{
atomic_write_barrier ();
@@ -697,7 +699,7 @@ Filters not supported with LD_TRACE_PREL
_dl_scope_free (old_l_reldeps);
}
if (old_l_initfini != NULL)
- map->l_orig_initfini = old_l_initfini;
+ _dl_scope_free (old_l_initfini);
if (errno_reason)
_dl_signal_error (errno_reason == -1 ? 0 : errno_reason, objname,

View File

@ -15,10 +15,10 @@ Date: Fri Jan 27 15:05:19 2012 -0500
* elf/tst-relsort1mod1.c: New file. * elf/tst-relsort1mod1.c: New file.
* elf/tst-relsort1mod2.c: New file. * elf/tst-relsort1mod2.c: New file.
diff --git a/Makeconfig b/Makeconfig Index: glibc-2.15/Makeconfig
index 8195245..185afbb 100644 ===================================================================
--- a/Makeconfig --- glibc-2.15.orig/Makeconfig
+++ b/Makeconfig +++ glibc-2.15/Makeconfig
@@ -950,6 +950,12 @@ libdl = @@ -950,6 +950,12 @@ libdl =
endif endif
endif endif
@ -32,10 +32,10 @@ index 8195245..185afbb 100644
# These are the subdirectories containing the library source. The order # These are the subdirectories containing the library source. The order
# is more or less arbitrary. The sorting step will take care of the # is more or less arbitrary. The sorting step will take care of the
# dependencies. # dependencies.
diff --git a/elf/Makefile b/elf/Makefile Index: glibc-2.15/elf/Makefile
index 052e763..3f1772a 100644 ===================================================================
--- a/elf/Makefile --- glibc-2.15.orig/elf/Makefile
+++ b/elf/Makefile +++ glibc-2.15/elf/Makefile
@@ -124,7 +124,8 @@ distribute := rtld-Rules \ @@ -124,7 +124,8 @@ distribute := rtld-Rules \
tst-initordera1.c tst-initordera2.c tst-initorderb1.c \ tst-initordera1.c tst-initordera2.c tst-initorderb1.c \
tst-initorderb2.c tst-initordera3.c tst-initordera4.c \ tst-initorderb2.c tst-initordera3.c tst-initordera4.c \
@ -46,7 +46,7 @@ index 052e763..3f1772a 100644
CFLAGS-dl-runtime.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-dl-runtime.c = -fexceptions -fasynchronous-unwind-tables
CFLAGS-dl-lookup.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-dl-lookup.c = -fexceptions -fasynchronous-unwind-tables
@@ -227,7 +228,7 @@ tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \ @@ -230,7 +231,7 @@ tests += loadtest restest1 preloadtest l
tst-audit1 tst-audit2 \ tst-audit1 tst-audit2 \
tst-stackguard1 tst-addr1 tst-thrlock \ tst-stackguard1 tst-addr1 tst-thrlock \
tst-unique1 tst-unique2 tst-unique3 tst-unique4 \ tst-unique1 tst-unique2 tst-unique3 tst-unique4 \
@ -55,7 +55,7 @@ index 052e763..3f1772a 100644
# reldep9 # reldep9
test-srcs = tst-pathopt test-srcs = tst-pathopt
selinux-enabled := $(shell cat /selinux/enforce 2> /dev/null) selinux-enabled := $(shell cat /selinux/enforce 2> /dev/null)
@@ -290,7 +291,9 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \ @@ -293,7 +294,9 @@ modules-names = testobj1 testobj2 testob
tst-initordera1 tst-initorderb1 \ tst-initordera1 tst-initorderb1 \
tst-initordera2 tst-initorderb2 \ tst-initordera2 tst-initorderb2 \
tst-initordera3 tst-initordera4 \ tst-initordera3 tst-initordera4 \
@ -66,7 +66,7 @@ index 052e763..3f1772a 100644
ifeq (yes,$(have-initfini-array)) ifeq (yes,$(have-initfini-array))
modules-names += tst-array2dep tst-array5dep modules-names += tst-array2dep tst-array5dep
endif endif
@@ -1195,3 +1198,9 @@ CFLAGS-tst-auditmod6b.c += $(AVX-CFLAGS) @@ -1198,3 +1201,9 @@ CFLAGS-tst-auditmod6b.c += $(AVX-CFLAGS)
CFLAGS-tst-auditmod6c.c += $(AVX-CFLAGS) CFLAGS-tst-auditmod6c.c += $(AVX-CFLAGS)
CFLAGS-tst-auditmod7b.c += $(AVX-CFLAGS) CFLAGS-tst-auditmod7b.c += $(AVX-CFLAGS)
endif endif
@ -76,10 +76,10 @@ index 052e763..3f1772a 100644
+$(objpfx)tst-relsort1mod2.so: $(libm) +$(objpfx)tst-relsort1mod2.so: $(libm)
+$(objpfx)tst-relsort1.out: $(objpfx)tst-relsort1mod1.so \ +$(objpfx)tst-relsort1.out: $(objpfx)tst-relsort1mod1.so \
+ $(objpfx)tst-relsort1mod2.so + $(objpfx)tst-relsort1mod2.so
diff --git a/elf/dl-open.c b/elf/dl-open.c Index: glibc-2.15/elf/dl-open.c
index a0b5c50..a56bdc1 100644 ===================================================================
--- a/elf/dl-open.c --- glibc-2.15.orig/elf/dl-open.c
+++ b/elf/dl-open.c +++ glibc-2.15/elf/dl-open.c
@@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/* Load a shared object at runtime, relocate it, and run its initializer. /* Load a shared object at runtime, relocate it, and run its initializer.
- Copyright (C) 1996-2007, 2009, 2010, 2011 Free Software Foundation, Inc. - Copyright (C) 1996-2007, 2009, 2010, 2011 Free Software Foundation, Inc.
@ -143,6 +143,17 @@ index a0b5c50..a56bdc1 100644
- variable. If was NULL but is not NULL afterwars we must - variable. If was NULL but is not NULL afterwars we must
- start the profiling. */ - start the profiling. */
- struct link_map *old_profile_map = GL(dl_profile_map); - struct link_map *old_profile_map = GL(dl_profile_map);
-
- _dl_relocate_object (l, l->l_scope, reloc_mode | RTLD_LAZY, 1);
-
- if (old_profile_map == NULL && GL(dl_profile_map) != NULL)
- {
- /* We must prepare the profiling. */
- _dl_start_profile ();
-
- /* Prevent unloading the object. */
- GL(dl_profile_map)->l_flags_1 |= DF_1_NODELETE;
- }
+ struct link_map **runp = maps[k]->l_initfini; + struct link_map **runp = maps[k]->l_initfini;
+ if (runp != NULL) + if (runp != NULL)
+ /* Look through the dependencies of the object. */ + /* Look through the dependencies of the object. */
@ -154,26 +165,18 @@ index a0b5c50..a56bdc1 100644
+ memmove (&maps[i], &maps[i + 1], + memmove (&maps[i], &maps[i + 1],
+ (k - i) * sizeof (maps[0])); + (k - i) * sizeof (maps[0]));
+ maps[k] = thisp; + maps[k] = thisp;
+
- _dl_relocate_object (l, l->l_scope, reloc_mode | RTLD_LAZY, 1);
+ if (seen[i + 1] > 1) + if (seen[i + 1] > 1)
+ { + {
+ ++i; + ++i;
+ goto next_clear; + goto next_clear;
+ } + }
+
- if (old_profile_map == NULL && GL(dl_profile_map) != NULL)
- {
- /* We must prepare the profiling. */
- _dl_start_profile ();
+ char this_seen = seen[i]; + char this_seen = seen[i];
+ memmove (&seen[i], &seen[i + 1], + memmove (&seen[i], &seen[i + 1],
+ (k - i) * sizeof (seen[0])); + (k - i) * sizeof (seen[0]));
+ seen[k] = this_seen; + seen[k] = this_seen;
+
- /* Prevent unloading the object. */
- GL(dl_profile_map)->l_flags_1 |= DF_1_NODELETE;
- }
+ goto next; + goto next;
+ } + }
+ +
@ -204,12 +207,12 @@ index a0b5c50..a56bdc1 100644
+ variable. If it was NULL but is not NULL afterwars we must + variable. If it was NULL but is not NULL afterwars we must
+ start the profiling. */ + start the profiling. */
+ struct link_map *old_profile_map = GL(dl_profile_map); + struct link_map *old_profile_map = GL(dl_profile_map);
+
+ _dl_relocate_object (l, l->l_scope, reloc_mode | RTLD_LAZY, 1);
- if (l == new) - if (l == new)
- break; - break;
- l = l->l_prev; - l = l->l_prev;
+ _dl_relocate_object (l, l->l_scope, reloc_mode | RTLD_LAZY, 1);
+
+ if (old_profile_map == NULL && GL(dl_profile_map) != NULL) + if (old_profile_map == NULL && GL(dl_profile_map) != NULL)
+ { + {
+ /* We must prepare the profiling. */ + /* We must prepare the profiling. */
@ -225,11 +228,10 @@ index a0b5c50..a56bdc1 100644
} }
/* If the file is not loaded now as a dependency, add the search /* If the file is not loaded now as a dependency, add the search
diff --git a/elf/tst-relsort1.c b/elf/tst-relsort1.c Index: glibc-2.15/elf/tst-relsort1.c
new file mode 100644 ===================================================================
index 0000000..972100c
--- /dev/null --- /dev/null
+++ b/elf/tst-relsort1.c +++ glibc-2.15/elf/tst-relsort1.c
@@ -0,0 +1,19 @@ @@ -0,0 +1,19 @@
+#include <dlfcn.h> +#include <dlfcn.h>
+#include <stdio.h> +#include <stdio.h>
@ -250,11 +252,10 @@ index 0000000..972100c
+ +
+#define TEST_FUNCTION do_test () +#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c" +#include "../test-skeleton.c"
diff --git a/elf/tst-relsort1mod1.c b/elf/tst-relsort1mod1.c Index: glibc-2.15/elf/tst-relsort1mod1.c
new file mode 100644 ===================================================================
index 0000000..9e4a943
--- /dev/null --- /dev/null
+++ b/elf/tst-relsort1mod1.c +++ glibc-2.15/elf/tst-relsort1mod1.c
@@ -0,0 +1,7 @@ @@ -0,0 +1,7 @@
+extern int foo (double); +extern int foo (double);
+ +
@ -263,11 +264,10 @@ index 0000000..9e4a943
+{ +{
+ return foo (1.2); + return foo (1.2);
+} +}
diff --git a/elf/tst-relsort1mod2.c b/elf/tst-relsort1mod2.c Index: glibc-2.15/elf/tst-relsort1mod2.c
new file mode 100644 ===================================================================
index 0000000..a2c3e55
--- /dev/null --- /dev/null
+++ b/elf/tst-relsort1mod2.c +++ glibc-2.15/elf/tst-relsort1mod2.c
@@ -0,0 +1,7 @@ @@ -0,0 +1,7 @@
+#include <math.h> +#include <math.h>
+ +

79
glibc-ld-profile.patch Normal file
View File

@ -0,0 +1,79 @@
glibc bug #13818
2012-03-07 Jeff Law <law@redhat.com>
* elf/dl-reloc.c (_dl_relocate_object): Move code to allocate
l_reloc_result prior to calling ELF_DYNAMIC_RELOCATE.
diff -rup a/elf/dl-reloc.c b/elf/dl-reloc.c
--- a/elf/dl-reloc.c 2012-01-01 05:16:32.000000000 -0700
+++ b/elf/dl-reloc.c 2012-03-06 15:41:56.486242640 -0700
@@ -238,32 +238,9 @@ _dl_relocate_object (struct link_map *l,
/* String table object symbols. */
const char *strtab = (const void *) D_PTR (l, l_info[DT_STRTAB]);
- /* This macro is used as a callback from the ELF_DYNAMIC_RELOCATE code. */
-#define RESOLVE_MAP(ref, version, r_type) \
- (ELFW(ST_BIND) ((*ref)->st_info) != STB_LOCAL \
- ? ((__builtin_expect ((*ref) == l->l_lookup_cache.sym, 0) \
- && elf_machine_type_class (r_type) == l->l_lookup_cache.type_class) \
- ? (bump_num_cache_relocations (), \
- (*ref) = l->l_lookup_cache.ret, \
- l->l_lookup_cache.value) \
- : ({ lookup_t _lr; \
- int _tc = elf_machine_type_class (r_type); \
- l->l_lookup_cache.type_class = _tc; \
- l->l_lookup_cache.sym = (*ref); \
- const struct r_found_version *v = NULL; \
- if ((version) != NULL && (version)->hash != 0) \
- v = (version); \
- _lr = _dl_lookup_symbol_x (strtab + (*ref)->st_name, l, (ref), \
- scope, v, _tc, \
- DL_LOOKUP_ADD_DEPENDENCY, NULL); \
- l->l_lookup_cache.ret = (*ref); \
- l->l_lookup_cache.value = _lr; })) \
- : l)
-
-#include "dynamic-link.h"
-
- ELF_DYNAMIC_RELOCATE (l, lazy, consider_profiling, skip_ifunc);
-
+ /* ELF_DYNAMIC_RELOCATE may need to examine l_reloc_result
+ when handling MACHINE_IRELATIVE relocs. So we must
+ allocate l_reloc_result prior to calling ELF_DYNAMIC_RELOCATE. */
#ifndef PROF
if (__builtin_expect (consider_profiling, 0))
{
@@ -290,6 +267,32 @@ _dl_relocate_object (struct link_map *l,
}
}
#endif
+
+ /* This macro is used as a callback from the ELF_DYNAMIC_RELOCATE code. */
+#define RESOLVE_MAP(ref, version, r_type) \
+ (ELFW(ST_BIND) ((*ref)->st_info) != STB_LOCAL \
+ ? ((__builtin_expect ((*ref) == l->l_lookup_cache.sym, 0) \
+ && elf_machine_type_class (r_type) == l->l_lookup_cache.type_class) \
+ ? (bump_num_cache_relocations (), \
+ (*ref) = l->l_lookup_cache.ret, \
+ l->l_lookup_cache.value) \
+ : ({ lookup_t _lr; \
+ int _tc = elf_machine_type_class (r_type); \
+ l->l_lookup_cache.type_class = _tc; \
+ l->l_lookup_cache.sym = (*ref); \
+ const struct r_found_version *v = NULL; \
+ if ((version) != NULL && (version)->hash != 0) \
+ v = (version); \
+ _lr = _dl_lookup_symbol_x (strtab + (*ref)->st_name, l, (ref), \
+ scope, v, _tc, \
+ DL_LOOKUP_ADD_DEPENDENCY, NULL); \
+ l->l_lookup_cache.ret = (*ref); \
+ l->l_lookup_cache.value = _lr; })) \
+ : l)
+
+#include "dynamic-link.h"
+
+ ELF_DYNAMIC_RELOCATE (l, lazy, consider_profiling, skip_ifunc);
}
/* Mark the object so we know this work has been done. */

View File

@ -1,10 +1,10 @@
initfini.c is compiled to assembly and further processed and split, initfini.c is compiled to assembly and further processed and split,
we can't have unwind tables therein. we can't have unwind tables therein.
Index: csu/Makefile Index: glibc-2.15/csu/Makefile
=================================================================== ===================================================================
--- csu/Makefile.orig --- glibc-2.15.orig/csu/Makefile
+++ csu/Makefile +++ glibc-2.15/csu/Makefile
@@ -93,7 +93,7 @@ omit-deps += $(crtstuff) @@ -93,7 +93,7 @@ omit-deps += $(crtstuff)
$(crtstuff:%=$(objpfx)%.o): %.o: %.S $(objpfx)defs.h $(crtstuff:%=$(objpfx)%.o): %.o: %.S $(objpfx)defs.h
$(compile.S) -g0 $(ASFLAGS-.os) -o $@ $(compile.S) -g0 $(ASFLAGS-.os) -o $@
@ -14,11 +14,11 @@ Index: csu/Makefile
vpath initfini.c $(sysdirs) vpath initfini.c $(sysdirs)
Index: nptl/Makefile Index: glibc-2.15/nptl/Makefile
=================================================================== ===================================================================
--- nptl/Makefile.orig --- glibc-2.15.orig/nptl/Makefile
+++ nptl/Makefile +++ glibc-2.15/nptl/Makefile
@@ -339,7 +339,7 @@ endif @@ -342,7 +342,7 @@ endif
extra-objs += $(crti-objs) $(crtn-objs) extra-objs += $(crti-objs) $(crtn-objs)
omit-deps += crti crtn omit-deps += crti crtn
@ -27,10 +27,10 @@ Index: nptl/Makefile
endif endif
CFLAGS-flockfile.c = -D_IO_MTSAFE_IO CFLAGS-flockfile.c = -D_IO_MTSAFE_IO
Index: nptl/sysdeps/unix/sysv/linux/x86_64/Makefile Index: glibc-2.15/nptl/sysdeps/unix/sysv/linux/x86_64/Makefile
=================================================================== ===================================================================
--- nptl/sysdeps/unix/sysv/linux/x86_64/Makefile.orig --- glibc-2.15.orig/nptl/sysdeps/unix/sysv/linux/x86_64/Makefile
+++ nptl/sysdeps/unix/sysv/linux/x86_64/Makefile +++ glibc-2.15/nptl/sysdeps/unix/sysv/linux/x86_64/Makefile
@@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
ifeq ($(subdir),nptl) ifeq ($(subdir),nptl)
CFLAGS-pt-initfini.s = -g0 -fPIC -fno-inline-functions \ CFLAGS-pt-initfini.s = -g0 -fPIC -fno-inline-functions \

View File

@ -1,6 +1,8 @@
--- csu/Makefile.nodate 2011-12-15 17:27:21.000000000 +0100 Index: glibc-2.15/csu/Makefile
+++ csu/Makefile 2011-12-15 17:27:30.000000000 +0100 ===================================================================
@@ -234,8 +234,8 @@ --- glibc-2.15.orig/csu/Makefile
+++ glibc-2.15/csu/Makefile
@@ -234,8 +234,8 @@ $(objpfx)version-info.h: $(common-objpfx
if [ -z "$$os" ]; then \ if [ -z "$$os" ]; then \
os=Linux; \ os=Linux; \
fi; \ fi; \

View File

@ -0,0 +1,48 @@
diff -rup c/nscd/nscd_gethst_r.c d/nscd/nscd_gethst_r.c
--- c/nscd/nscd_gethst_r.c 2012-01-01 05:16:32.000000000 -0700
+++ d/nscd/nscd_gethst_r.c 2012-03-28 10:45:51.546600822 -0600
@@ -101,9 +101,27 @@ libc_freeres_fn (hst_map_free)
uint32_t
__nscd_get_nl_timestamp (void)
{
+ uint32_t retval;
if (__nss_not_use_nscd_hosts != 0)
return 0;
+ int cnt = 0;
+ /* __nscd_get_mapping can change hst_map_handle.mapped to NO_MAPPING.
+ However, __nscd_get_mapping assumes the prior value was not NO_MAPPING.
+ Thus we have to acquire the lock to prevent this thread from changing
+ hst_map_handle.mapped to NO_MAPPING while another thread is inside
+ __nscd_get_mapping. */
+ while (__builtin_expect
+ (atomic_compare_and_exchange_val_acq (&__hst_map_handle.lock,
+ 1, 0) != 0, 0))
+ {
+ // XXX Best number of rounds?
+ if (__builtin_expect (++cnt > 5, 0))
+ return 0;
+
+ atomic_delay ();
+ }
+
struct mapped_database *map = __hst_map_handle.mapped;
if (map == NULL
@@ -113,9 +131,14 @@ __nscd_get_nl_timestamp (void)
map = __nscd_get_mapping (GETFDHST, "hosts", &__hst_map_handle.mapped);
if (map == NO_MAPPING)
- return 0;
+ retval = 0;
+ else
+ retval = map->head->extra_data[NSCD_HST_IDX_CONF_TIMESTAMP];
+
+ /* Release the lock. */
+ __hst_map_handle.lock = 0;
- return map->head->extra_data[NSCD_HST_IDX_CONF_TIMESTAMP];
+ return retval;
}

View File

@ -1,8 +1,8 @@
Index: elf/Makefile Index: glibc-2.15/elf/Makefile
=================================================================== ===================================================================
--- elf/Makefile.orig --- glibc-2.15.orig/elf/Makefile
+++ elf/Makefile +++ glibc-2.15/elf/Makefile
@@ -133,6 +133,7 @@ include ../Makeconfig @@ -135,6 +135,7 @@ include ../Makeconfig
ifeq ($(unwind-find-fde),yes) ifeq ($(unwind-find-fde),yes)
routines += unwind-dw2-fde-glibc routines += unwind-dw2-fde-glibc
shared-only-routines += unwind-dw2-fde-glibc shared-only-routines += unwind-dw2-fde-glibc

29
glibc-sw13618-2.patch Normal file
View File

@ -0,0 +1,29 @@
Index: glibc-2.15/elf/dl-open.c
===================================================================
--- glibc-2.15.orig/elf/dl-open.c
+++ glibc-2.15/elf/dl-open.c
@@ -326,7 +326,7 @@ dl_open_worker (void *a)
while (l != NULL);
if (nmaps > 1)
{
- char seen[nmaps];
+ uint16_t seen[nmaps];
memset (seen, '\0', nmaps);
size_t i = 0;
while (1)
@@ -352,13 +352,13 @@ dl_open_worker (void *a)
(k - i) * sizeof (maps[0]));
maps[k] = thisp;
- if (seen[i + 1] > 1)
+ if (seen[i + 1] > nmaps - i)
{
++i;
goto next_clear;
}
- char this_seen = seen[i];
+ uint16_t this_seen = seen[i];
memmove (&seen[i], &seen[i + 1],
(k - i) * sizeof (seen[0]));
seen[k] = this_seen;

View File

@ -1,3 +1,59 @@
-------------------------------------------------------------------
Fri Apr 13 09:35:49 UTC 2012 - aj@suse.de
- Fix check-abi to succeed.
- Use feof_unlocked in glibc-2.3.90-bindresvport.blacklist.diff.
- Make x86 to be elf/check-localplt clean again
- Refresh some patches to apply without fuzz.
-------------------------------------------------------------------
Fri Apr 6 09:19:11 UTC 2012 - aj@suse.de
- Disable building with as-needed since it breaks glibc
(testsuite will fail, even if testsuite does not use as-needed)
-------------------------------------------------------------------
Thu Apr 5 18:48:06 UTC 2012 - aj@suse.de
- Another fix for dynamic linking.
-------------------------------------------------------------------
Thu Apr 5 18:22:36 UTC 2012 - aj@suse.de
- Properly fix dl_lookup_x crash (glibc-fix-noload.patch), disable
glibc-fix-lookup-crash.patch.
-------------------------------------------------------------------
Mon Apr 2 09:30:24 UTC 2012 - aj@suse.de
- Fix building on Armv5 (glibc-add-arm-dependency-libmemusage.patch)
-------------------------------------------------------------------
Thu Mar 29 07:51:43 UTC 2012 - aj@suse.de
- Fix crash when nscd is not running (bnc#741021) properly
and disable patch glibc-revert-netlink-cache.patch
-------------------------------------------------------------------
Fri Mar 23 11:07:32 UTC 2012 - aj@suse.de
- Fix path for nss_db (bnc#753657).
-------------------------------------------------------------------
Thu Mar 22 09:41:48 UTC 2012 - aj@suse.de
- Fix LD_PROFILE invocation.
-------------------------------------------------------------------
Wed Mar 21 08:45:12 UTC 2012 - aj@suse.de
- Fix cycle detection in loading of dynamic objects.
-------------------------------------------------------------------
Wed Mar 14 08:26:52 UTC 2012 - aj@suse.de
- Update getaddrinfo-ipv6-sanity.diff (bnc#684534).
------------------------------------------------------------------- -------------------------------------------------------------------
Fri Mar 2 17:01:55 UTC 2012 - aj@suse.de Fri Mar 2 17:01:55 UTC 2012 - aj@suse.de

View File

@ -16,6 +16,8 @@
# #
%bcond_with glibc_run_testsuite
%define crypt_bf_version 1.2 %define crypt_bf_version 1.2
Name: glibc Name: glibc
@ -27,7 +29,12 @@ BuildRequires: libselinux-devel
BuildRequires: libstdc++-devel BuildRequires: libstdc++-devel
%define _filter_GLIBC_PRIVATE 1 %define _filter_GLIBC_PRIVATE 1
%define build_locales 1 %define build_locales 1
# Enable testsuite runs for local builds
%if %{with glibc_run_testsuite}
%define run_testsuite 1
%else
%define run_testsuite 0 %define run_testsuite 0
%endif
%define disable_assert 0 %define disable_assert 0
%define enable_stackguard_randomization 1 %define enable_stackguard_randomization 1
%ifarch ppc ppc64 %ifarch ppc ppc64
@ -164,7 +171,7 @@ Patch46: glibc-resolv-mdnshint.diff
Patch47: glibc-nscd-hconf.diff Patch47: glibc-nscd-hconf.diff
# PATCH-MISSING-TAG -- See http://en.opensuse.org/openSUSE:Packaging_Patches_guidelines # PATCH-MISSING-TAG -- See http://en.opensuse.org/openSUSE:Packaging_Patches_guidelines
Patch49: glibc-fini-unwind.diff Patch49: glibc-fini-unwind.diff
# PATCH-FIX-OPENSUSE bnc#657627 # PATCH-FIX-OPENSUSE bnc#657627, http://sourceware.org/bugzilla/show_bug.cgi?id=12561
Patch52: glibc-elf-localscope.diff Patch52: glibc-elf-localscope.diff
# FIX-OPENSUSE compile some files with -fno-strict-aliasing # FIX-OPENSUSE compile some files with -fno-strict-aliasing
Patch58: glibc-strict-aliasing.diff Patch58: glibc-strict-aliasing.diff
@ -174,8 +181,10 @@ Patch65: glibc-fix-double-loopback.diff
Patch66: glibc2.14-revert-sunrpc-removal.patch Patch66: glibc2.14-revert-sunrpc-removal.patch
# PATCH-FIX-OPENSUSE revert seeking on fclose for now bnc#711829 matz@suse.de # PATCH-FIX-OPENSUSE revert seeking on fclose for now bnc#711829 matz@suse.de
Patch67: glibc-revert-fseek-on-fclose.diff Patch67: glibc-revert-fseek-on-fclose.diff
# PATCH-FIX-OPENSUSE Fix crash (access-after-free) in dl_lookup_x bnc#703140 matz@suse.de # PATCH-FIX-OPENSUSE Fix crash (access-after-free) in dl_lookup_x bnc#703140, bso#13579 matz@suse.de
Patch68: glibc-fix-lookup-crash.patch Patch68: glibc-fix-lookup-crash.patch
# PATCH-FIX-OPENSUSE Fix crash (access-after-free) in dl_lookup_x bnc#703140, bso#13579 matz@suse.de
Patch69: glibc-fix-noload.patch
# PATCH-FIX-OPENSUSE Do not trigger an abort when an i586 Intel CPU is running the i686 library, as valgrind does. bnc#681398 aj@suse.de # PATCH-FIX-OPENSUSE Do not trigger an abort when an i586 Intel CPU is running the i686 library, as valgrind does. bnc#681398 aj@suse.de
Patch71: x86-cpuid-level2.patch Patch71: x86-cpuid-level2.patch
# PATCH-FIX-UPSTREAM Fix assertion error in res_query.c (bso#13013) # PATCH-FIX-UPSTREAM Fix assertion error in res_query.c (bso#13013)
@ -208,6 +217,22 @@ Patch92: glibc-revert-netlink-cache.patch
Patch93: glibc-2.16-avx.patch Patch93: glibc-2.16-avx.patch
# PATCH-FIX-UPSTREAM vfprintf: validate nargs and maybe allocate from heap bnc#747768 - aj@suse.de # PATCH-FIX-UPSTREAM vfprintf: validate nargs and maybe allocate from heap bnc#747768 - aj@suse.de
Patch94: vfprintf-nargs.patch Patch94: vfprintf-nargs.patch
# PATCH-FIX-OPENSUSE Fix cycle detection - aj@suse.de
Patch95: cycle-detection.patch
# PATCH-FIX-OPENSUSE Fix LD_PROFILE (glibc bug#13818) - aj@suse.de
Patch96: glibc-ld-profile.patch
# PATCH-FIX-OPENSUSE Fix path for nss_db (bnc#753657) - aj@suse.de
Patch97: nss-db-path.patch
# PATCH-FIX-OPENSUSE Fix crash when nscd is not running (bso#135949) - aj@suse.de
Patch98: glibc-nscd-crash-bso13594.patch
# PATCH-FIX-UPSTREAM Add Arm dependency on libmemusage - bwiedemann@suse.de
Patch99: glibc-add-arm-dependency-libmemusage.patch
# PATCH-FIX-OPENSUSE Fix cycle detection (from Fedora) - aj@suse.de
Patch100: glibc-sw13618-2.patch
# PATCH-FIX-UPSTREAM Fix check abi - aj@suse.de
Patch101: glibc-2.16-fix-check-abi.patch
# PATCH-FIX-UPSTREAM Fix check-localelfplt - aj@suse.de
Patch102: glibc-2.16-fix-check-localplt.patch
%description %description
The GNU C Library provides the most important standard libraries used The GNU C Library provides the most important standard libraries used
@ -394,7 +419,7 @@ mv crypt_blowfish-%crypt_bf_version/*.[chS] crypt/
# #
%patch0 %patch0
# libNoVersion part is only active on ix86 # libNoVersion part is only active on ix86
%patch1 %patch1 -p1
%patch3 %patch3
%patch4 %patch4
%patch5 -p1 %patch5 -p1
@ -403,8 +428,8 @@ mv crypt_blowfish-%crypt_bf_version/*.[chS] crypt/
%patch8 %patch8
%patch12 %patch12
%patch14 %patch14
%patch16 %patch16 -p1
%patch20 %patch20 -p1
%patch21 -p1 %patch21 -p1
# avoid changing nscd_stat.c mtime to avoid code generation # avoid changing nscd_stat.c mtime to avoid code generation
# differences on each rebuild # differences on each rebuild
@ -414,36 +439,49 @@ touch -r nscd/nscd_stat.c nscd/s-stamp
touch -r nscd/s-stamp nscd/nscd_stat.c touch -r nscd/s-stamp nscd/nscd_stat.c
rm nscd/s-stamp rm nscd/s-stamp
%patch25 %patch25
%patch28 %patch28 -p1
%patch29 %patch29
%patch30 %patch30
%patch33 %patch33 -p1
%patch36 %patch36 -p1
%patch38 %patch38
%patch41 -p1 %patch41 -p1
%patch45 %patch45
%patch46 -p1 %patch46 -p1
%patch47 -p1 %patch47 -p1
%patch49 %patch49
# XXX: Does not pass testsuite, still there's no better solution yet
%patch52 %patch52
%patch58 %patch58 -p1
%patch65 -p1 %patch65 -p1
%patch66 -p1 %patch66 -p1
%patch67 -p1 %patch67 -p1
%patch68 -p1 # XXX Patch 69 replaces 68, remove soon
#%patch68 -p1
%patch69 -p1
%patch71 -p1 %patch71 -p1
%patch73 -p1 %patch73 -p1
%patch74 -p1 %patch74 -p1
%patch75 -p1 %patch75 -p1
%patch84 %patch84 -p1
%patch87 -p0 %patch87 -p1
%patch88 -p1 -R %patch88 -p1 -R
%patch89 -p1 %patch89 -p1
%patch90 -p1 %patch90 -p1
%patch91 -p1 %patch91 -p1
%patch92 -p1 -R # XXX Should be fixed properly now, remove soon
#%patch92 -p1 -R
%patch93 -p1 %patch93 -p1
%patch94 -p1 %patch94 -p1
%patch95 -p1
# XXX Disable, it breaks the testsuite, test elf/tst-audit2
# %patch96 -p1
%patch97 -p1
%patch98 -p1
%patch99 -p1
%patch100 -p1
%patch101 -p1
%patch102 -p1
# #
# Inconsistency detected by ld.so: dl-close.c: 719: _dl_close: Assertion `map->l_init_called' failed! # Inconsistency detected by ld.so: dl-close.c: 719: _dl_close: Assertion `map->l_init_called' failed!
@ -472,6 +510,9 @@ find . -name configure | xargs touch
####################################################################### #######################################################################
%build %build
%if %{with glibc_run_testsuite}
echo glibc_run_testsuite is set
%endif
if [ -x /bin/uname.bin ]; then if [ -x /bin/uname.bin ]; then
/bin/uname.bin -a /bin/uname.bin -a
else else
@ -488,6 +529,10 @@ nice
%else %else
%define target %{_target_cpu}-suse-linux %define target %{_target_cpu}-suse-linux
%endif %endif
# Don't use as-needed, it breaks glibc assumptions
# Before enabling it, run the testsuite and verify that it
# passes completely
export SUSE_ASNEEDED=0
# Adjust glibc version.h # Adjust glibc version.h
echo "#define CONFHOST \"%{target}\"" >> version.h echo "#define CONFHOST \"%{target}\"" >> version.h
echo "#define CVSDATE \"`date -r ChangeLog +%Y%m%d`\"" >> version.h echo "#define CVSDATE \"`date -r ChangeLog +%Y%m%d`\"" >> version.h
@ -566,6 +611,7 @@ configure_and_build_glibc() {
%else %else
conf_cflags="$cflags" conf_cflags="$cflags"
%endif %endif
CFLAGS="$conf_cflags" CC="$BuildCC" CXX="$BuildCCplus" ../configure \ CFLAGS="$conf_cflags" CC="$BuildCC" CXX="$BuildCCplus" ../configure \
--prefix=%{_prefix} \ --prefix=%{_prefix} \
--libexecdir=%{_libdir} --infodir=%{_infodir} \ --libexecdir=%{_libdir} --infodir=%{_infodir} \
@ -669,6 +715,8 @@ popd
####################################################################### #######################################################################
%check %check
# The testsuite will fail if asneeded is used
export SUSE_ASNEEDED=0
%if %{run_testsuite} %if %{run_testsuite}
# Increase timeout # Increase timeout
export TIMEOUTFACTOR=16 export TIMEOUTFACTOR=16
@ -682,7 +730,11 @@ popd
make -C cc-base check make -C cc-base check
%endif %endif
%endif %endif
make -C cc-base check-abi || echo check-abi failed # File was not created as empty file by patch 101
touch abilist/libnss_dns.abilist abilist/libnss_db.abilist
# XXX This has to pass
#make -C cc-base check-abi || echo check-abi failed
make -C cc-base check-abi
####################################################################### #######################################################################
### ###
@ -1065,7 +1117,7 @@ exit 0
%{_libdir}/getconf/* %{_libdir}/getconf/*
%{_sbindir}/glibc_post_upgrade %{_sbindir}/glibc_post_upgrade
%{_sbindir}/iconvconfig %{_sbindir}/iconvconfig
%dir /var/db #%dir /var/db
%ifarch %ix86 %ifarch %ix86
@ -1189,6 +1241,6 @@ exit 0
%files extra %files extra
%defattr(-,root,root) %defattr(-,root,root)
%{_bindir}/makedb %{_bindir}/makedb
/var/db/Makefile /var/lib/misc/Makefile
%changelog %changelog

View File

@ -1,7 +1,7 @@
Index: glibc-2.14/nis/Makefile Index: glibc-2.15/nis/Makefile
=================================================================== ===================================================================
--- glibc-2.14.orig/nis/Makefile --- glibc-2.15.orig/nis/Makefile
+++ glibc-2.14/nis/Makefile +++ glibc-2.15/nis/Makefile
@@ -23,9 +23,9 @@ subdir := nis @@ -23,9 +23,9 @@ subdir := nis
aux := nis_hash aux := nis_hash
@ -14,11 +14,11 @@ Index: glibc-2.14/nis/Makefile
# These are the databases available for the nis (and perhaps later nisplus) # These are the databases available for the nis (and perhaps later nisplus)
# service. This must be a superset of the services in nss. # service. This must be a superset of the services in nss.
Index: glibc-2.14/NEWS Index: glibc-2.15/NEWS
=================================================================== ===================================================================
--- glibc-2.14.orig/NEWS --- glibc-2.15.orig/NEWS
+++ glibc-2.14/NEWS +++ glibc-2.15/NEWS
@@ -20,16 +20,6 @@ Version 2.14 @@ -84,16 +84,6 @@ Version 2.14
12724, 12734, 12738, 12746, 12766, 12775, 12777, 12782, 12788, 12792, 12724, 12734, 12738, 12746, 12766, 12775, 12777, 12782, 12788, 12792,
12795, 12811, 12813, 12814, 12841 12795, 12811, 12813, 12814, 12841
@ -35,11 +35,11 @@ Index: glibc-2.14/NEWS
* New Linux interfaces: clock_adjtime, name_to_handle_at, open_by_handle_at, * New Linux interfaces: clock_adjtime, name_to_handle_at, open_by_handle_at,
syncfs, setns, sendmmsg syncfs, setns, sendmmsg
Index: glibc-2.14/include/libc-symbols.h Index: glibc-2.15/include/libc-symbols.h
=================================================================== ===================================================================
--- glibc-2.14.orig/include/libc-symbols.h --- glibc-2.15.orig/include/libc-symbols.h
+++ glibc-2.14/include/libc-symbols.h +++ glibc-2.15/include/libc-symbols.h
@@ -635,7 +635,7 @@ for linking") @@ -626,7 +626,7 @@ for linking")
# define libc_hidden_proto(name, attrs...) hidden_proto (name, ##attrs) # define libc_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
# define libc_hidden_def(name) hidden_def (name) # define libc_hidden_def(name) hidden_def (name)
# define libc_hidden_weak(name) hidden_weak (name) # define libc_hidden_weak(name) hidden_weak (name)
@ -48,10 +48,10 @@ Index: glibc-2.14/include/libc-symbols.h
# define libc_hidden_ver(local, name) hidden_ver (local, name) # define libc_hidden_ver(local, name) hidden_ver (local, name)
# define libc_hidden_data_def(name) hidden_data_def (name) # define libc_hidden_data_def(name) hidden_data_def (name)
# define libc_hidden_data_weak(name) hidden_data_weak (name) # define libc_hidden_data_weak(name) hidden_data_weak (name)
Index: glibc-2.14/sunrpc/Makefile Index: glibc-2.15/sunrpc/Makefile
=================================================================== ===================================================================
--- glibc-2.14.orig/sunrpc/Makefile --- glibc-2.15.orig/sunrpc/Makefile
+++ glibc-2.14/sunrpc/Makefile +++ glibc-2.15/sunrpc/Makefile
@@ -53,7 +53,7 @@ headers-in-tirpc = $(addprefix rpc/,auth @@ -53,7 +53,7 @@ headers-in-tirpc = $(addprefix rpc/,auth
des_crypt.h) des_crypt.h)
headers-not-in-tirpc = $(addprefix rpc/,key_prot.h rpc_des.h) \ headers-not-in-tirpc = $(addprefix rpc/,key_prot.h rpc_des.h) \

View File

@ -1,6 +1,8 @@
--- nscd/connections.c Index: glibc-2.15/nscd/connections.c
+++ nscd/connections.c ===================================================================
@@ -1717,6 +1717,8 @@ --- glibc-2.15.orig/nscd/connections.c
+++ glibc-2.15/nscd/connections.c
@@ -1805,6 +1805,8 @@ handle_request: request received (Versio
++nready; ++nready;
} }
/* NOTREACHED */ /* NOTREACHED */

41
nss-db-path.patch Normal file
View File

@ -0,0 +1,41 @@
Use /var/db for nss_db
Index: glibc-2.15/nss/db-Makefile
===================================================================
--- glibc-2.15.orig/nss/db-Makefile
+++ glibc-2.15/nss/db-Makefile
@@ -23,7 +23,7 @@ DATABASES = $(wildcard /etc/passwd /etc/
/etc/rpc /etc/services /etc/shadow /etc/gshadow \
/etc/netgroup)
-VAR_DB = /var/db
+VAR_DB = /var/lib/misc
AWK = awk
MAKEDB = makedb --quiet
Index: glibc-2.15/sysdeps/unix/sysv/linux/paths.h
===================================================================
--- glibc-2.15.orig/sysdeps/unix/sysv/linux/paths.h
+++ glibc-2.15/sysdeps/unix/sysv/linux/paths.h
@@ -68,7 +68,7 @@
/* Provide trailing slash, since mostly used for building pathnames. */
#define _PATH_DEV "/dev/"
#define _PATH_TMP "/tmp/"
-#define _PATH_VARDB "/var/db/"
+#define _PATH_VARDB "/var/lib/misc/"
#define _PATH_VARRUN "/var/run/"
#define _PATH_VARTMP "/var/tmp/"
Index: glibc-2.15/Makeconfig
===================================================================
--- glibc-2.15.orig/Makeconfig
+++ glibc-2.15/Makeconfig
@@ -293,7 +293,7 @@ inst_sysconfdir = $(install_root)$(sysco
# Directory for the database files and Makefile for nss_db.
ifndef vardbdir
-vardbdir = /var/db
+vardbdir = /var/lib/misc
endif
inst_vardbdir = $(install_root)$(vardbdir)

View File

@ -26,182 +26,176 @@ This version disables the useless test on non-32-bit platforms.
* stdio-common/bug-vfprintf-nargs.c: New file. * stdio-common/bug-vfprintf-nargs.c: New file.
* stdio-common/Makefile (tests): Add nargs overflow test. * stdio-common/Makefile (tests): Add nargs overflow test.
diff --git a/stdio-common/Makefile b/stdio-common/Makefile Index: glibc-2.15/stdio-common/Makefile
index a847b28..080badc 100644 ===================================================================
--- a/stdio-common/Makefile --- glibc-2.15.orig/stdio-common/Makefile
+++ b/stdio-common/Makefile +++ glibc-2.15/stdio-common/Makefile
@@ -59,7 +59,8 @@ tests := tstscanf test_rdwr test-popen tstgetln test-fseek \ @@ -60,7 +60,8 @@ tests := tstscanf test_rdwr test-popen t
tst-popen tst-unlockedio tst-fmemopen2 tst-put-error tst-fgets \ tst-popen tst-unlockedio tst-fmemopen2 tst-put-error tst-fgets \
tst-fwrite bug16 bug17 tst-swscanf tst-sprintf2 bug18 bug18a \ tst-fwrite bug16 bug17 tst-swscanf tst-sprintf2 bug18 bug18a \
bug19 bug19a tst-popen2 scanf13 scanf14 scanf15 bug20 bug21 bug22 \ bug19 bug19a tst-popen2 scanf13 scanf14 scanf15 bug20 bug21 bug22 \
- scanf16 scanf17 tst-setvbuf1 tst-grouping bug23 bug24 - scanf16 scanf17 tst-setvbuf1 tst-grouping bug23 bug24
+ scanf16 scanf17 tst-setvbuf1 tst-grouping bug23 bug24 \ + scanf16 scanf17 tst-setvbuf1 tst-grouping bug23 bug24 \
+ bug-vfprintf-nargs + bug-vfprintf-nargs
test-srcs = tst-unbputc tst-printf test-srcs = tst-unbputc tst-printf
diff --git a/stdio-common/bug-vfprintf-nargs.c b/stdio-common/bug-vfprintf-nargs.c Index: glibc-2.15/stdio-common/bug-vfprintf-nargs.c
new file mode 100644 ===================================================================
index 0000000..13c66c0 --- /dev/null
--- /dev/null +++ glibc-2.15/stdio-common/bug-vfprintf-nargs.c
+++ b/stdio-common/bug-vfprintf-nargs.c @@ -0,0 +1,78 @@
@@ -0,0 +1,78 @@ +/* Test for vfprintf nargs allocation overflow (BZ #13656).
+/* Test for vfprintf nargs allocation overflow (BZ #13656). + Copyright (C) 2012 Free Software Foundation, Inc.
+ Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library.
+ This file is part of the GNU C Library. + Contributed by Kees Cook <keescook@chromium.org>, 2012.
+ Contributed by Kees Cook <keescook@chromium.org>, 2012. +
+ + The GNU C Library is free software; you can redistribute it and/or
+ The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public
+ modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either
+ License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version.
+ version 2.1 of the License, or (at your option) any later version. +
+ + The GNU C Library is distributed in the hope that it will be useful,
+ The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of
+ but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details.
+ Lesser General Public License for more details. +
+ + You should have received a copy of the GNU Lesser General Public
+ You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free
+ License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */
+ 02111-1307 USA. */ +
+ +#include <stdio.h>
+#include <stdio.h> +#include <stdlib.h>
+#include <stdlib.h> +#include <stdint.h>
+#include <stdint.h> +#include <unistd.h>
+#include <unistd.h> +#include <inttypes.h>
+#include <inttypes.h> +#include <string.h>
+#include <string.h> +#include <signal.h>
+#include <signal.h> +
+ +static int
+static int +format_failed (const char *fmt, const char *expected)
+format_failed (const char *fmt, const char *expected) +{
+{ + char output[80];
+ char output[80]; +
+ + printf ("%s : ", fmt);
+ printf ("%s : ", fmt); +
+ + memset (output, 0, sizeof output);
+ memset (output, 0, sizeof output); + /* Having sprintf itself detect a failure is good. */
+ /* Having sprintf itself detect a failure is good. */ + if (sprintf (output, fmt, 1, 2, 3, "test") > 0
+ if (sprintf (output, fmt, 1, 2, 3, "test") > 0 + && strcmp (output, expected) != 0)
+ && strcmp (output, expected) != 0) + {
+ { + printf ("FAIL (output '%s' != expected '%s')\n", output, expected);
+ printf ("FAIL (output '%s' != expected '%s')\n", output, expected); + return 1;
+ return 1; + }
+ } + puts ("ok");
+ puts ("ok"); + return 0;
+ return 0; +}
+} +
+ +static int
+static int +do_test (void)
+do_test (void) +{
+{ + int rc = 0;
+ int rc = 0; + char buf[64];
+ char buf[64]; +
+ + /* Regular positionals work. */
+ /* Regular positionals work. */ + if (format_failed ("%1$d", "1") != 0)
+ if (format_failed ("%1$d", "1") != 0) + rc = 1;
+ rc = 1; +
+ + /* Regular width positionals work. */
+ /* Regular width positionals work. */ + if (format_failed ("%1$*2$d", " 1") != 0)
+ if (format_failed ("%1$*2$d", " 1") != 0) + rc = 1;
+ rc = 1; +
+ + /* Positional arguments are constructed via read_int, so nargs can only
+ /* Positional arguments are constructed via read_int, so nargs can only + overflow on 32-bit systems. On 64-bit systems, it will attempt to
+ overflow on 32-bit systems. On 64-bit systems, it will attempt to + allocate a giant amount of memory and possibly crash, which is the
+ allocate a giant amount of memory and possibly crash, which is the + expected situation. Since the 64-bit behavior is arch-specific, only
+ expected situation. Since the 64-bit behavior is arch-specific, only + test this on 32-bit systems. */
+ test this on 32-bit systems. */ + if (sizeof (long int) == 4)
+ if (sizeof (long int) == 4) + {
+ { + sprintf (buf, "%%1$d %%%" PRIdPTR "$d", UINT32_MAX / sizeof (int));
+ sprintf (buf, "%%1$d %%%" PRIdPTR "$d", UINT32_MAX / sizeof (int)); + if (format_failed (buf, "1 %$d") != 0)
+ if (format_failed (buf, "1 %$d") != 0) + rc = 1;
+ rc = 1; + }
+ } +
+ + return rc;
+ return rc; +}
+} +
+ +#define TEST_FUNCTION do_test ()
+#define TEST_FUNCTION do_test () +#include "../test-skeleton.c"
+#include "../test-skeleton.c" Index: glibc-2.15/stdio-common/vfprintf.c
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c ===================================================================
index 863cd5d..022e72b 100644 --- glibc-2.15.orig/stdio-common/vfprintf.c
--- a/stdio-common/vfprintf.c +++ glibc-2.15/stdio-common/vfprintf.c
+++ b/stdio-common/vfprintf.c @@ -236,6 +236,9 @@ vfprintf (FILE *s, const CHAR_T *format,
@@ -235,6 +235,9 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap) 0 if unknown. */
0 if unknown. */ int readonly_format = 0;
int readonly_format = 0;
+ /* For the argument descriptions, which may be allocated on the heap. */
+ /* For the argument descriptions, which may be allocated on the heap. */ + void *args_malloced = NULL;
+ void *args_malloced = NULL; +
+ /* This table maps a character into a number representing a
/* This table maps a character into a number representing a class. In each step there is a destination label for each
class. In each step there is a destination label for each class. */
class. */ @@ -1648,9 +1651,10 @@ do_positional:
@@ -1647,9 +1650,10 @@ do_positional: determine the size of the array needed to store the argument
determine the size of the array needed to store the argument attributes. */
attributes. */ size_t nargs = 0;
size_t nargs = 0; - int *args_type;
- int *args_type; - union printf_arg *args_value = NULL;
- union printf_arg *args_value = NULL; + size_t bytes_per_arg;
+ size_t bytes_per_arg; + union printf_arg *args_value;
+ union printf_arg *args_value; int *args_size;
int *args_size; + int *args_type;
+ int *args_type;
/* Positional parameters refer to arguments directly. This could
/* Positional parameters refer to arguments directly. This could also determine the maximum number of arguments. Track the
also determine the maximum number of arguments. Track the @@ -1699,13 +1703,33 @@ do_positional:
@@ -1698,13 +1702,33 @@ do_positional:
/* Determine the number of arguments the format string consumes. */
/* Determine the number of arguments the format string consumes. */ nargs = MAX (nargs, max_ref_arg);
nargs = MAX (nargs, max_ref_arg); + bytes_per_arg = sizeof (*args_value) + sizeof (*args_size)
+ bytes_per_arg = sizeof (*args_value) + sizeof (*args_size) + + sizeof (*args_type);
+ + sizeof (*args_type); +
+ + /* Check for potential integer overflow. */
+ /* Check for potential integer overflow. */ + if (nargs > SIZE_MAX / bytes_per_arg)
+ if (nargs > SIZE_MAX / bytes_per_arg) + {
+ { + done = -1;
+ done = -1; + goto all_done;
+ goto all_done; + }
+ }
/* Allocate memory for the argument descriptions. */
/* Allocate memory for the argument descriptions. */ - args_type = alloca (nargs * sizeof (int));
- args_type = alloca (nargs * sizeof (int)); + if (__libc_use_alloca (nargs * bytes_per_arg))
+ if (__libc_use_alloca (nargs * bytes_per_arg)) + args_value = alloca (nargs * bytes_per_arg);
+ args_value = alloca (nargs * bytes_per_arg); + else
+ else + {
+ { + args_value = args_malloced = malloc (nargs * bytes_per_arg);
+ args_value = args_malloced = malloc (nargs * bytes_per_arg); + if (args_value == NULL)
+ if (args_value == NULL) + {
+ { + done = -1;
+ done = -1; + goto all_done;
+ goto all_done; + }
+ } + }
+ } +
+ + args_size = &args_value[nargs].pa_int;
+ args_size = &args_value[nargs].pa_int; + args_type = &args_size[nargs];
+ args_type = &args_size[nargs]; memset (args_type, s->_flags2 & _IO_FLAGS2_FORTIFY ? '\xff' : '\0',
memset (args_type, s->_flags2 & _IO_FLAGS2_FORTIFY ? '\xff' : '\0', - nargs * sizeof (int));
- nargs * sizeof (int)); - args_value = alloca (nargs * sizeof (union printf_arg));
- args_value = alloca (nargs * sizeof (union printf_arg)); - args_size = alloca (nargs * sizeof (int));
- args_size = alloca (nargs * sizeof (int)); + nargs * sizeof (*args_type));
+ nargs * sizeof (*args_type));
/* XXX Could do sanity check here: If any element in ARGS_TYPE is
/* XXX Could do sanity check here: If any element in ARGS_TYPE is still zero after this loop, format is invalid. For now we
still zero after this loop, format is invalid. For now we @@ -1974,8 +1998,8 @@ do_positional:
@@ -1973,8 +1997,8 @@ do_positional: }
}
all_done:
all_done: - if (__builtin_expect (workstart != NULL, 0))
- if (__builtin_expect (workstart != NULL, 0)) - free (workstart);
- free (workstart); + free (args_malloced);
+ free (args_malloced); + free (workstart);
+ free (workstart); /* Unlock the stream. */
/* Unlock the stream. */ _IO_funlockfile (s);
_IO_funlockfile (s); _IO_cleanup_region_end (0);
_IO_cleanup_region_end (0);
--
1.7.5.4
--
Kees Cook @outflux.net

View File

@ -8,9 +8,11 @@ http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=584748
sysdeps/x86_64/cacheinfo.c | 8 +++++++- sysdeps/x86_64/cacheinfo.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-) 1 file changed, 7 insertions(+), 1 deletion(-)
--- a/sysdeps/x86_64/cacheinfo.c Index: glibc-2.15/sysdeps/x86_64/cacheinfo.c
+++ b/sysdeps/x86_64/cacheinfo.c ===================================================================
@@ -254,7 +254,13 @@ --- glibc-2.15.orig/sysdeps/x86_64/cacheinfo.c
+++ glibc-2.15/sysdeps/x86_64/cacheinfo.c
@@ -305,7 +305,13 @@ intel_check_word (int name, unsigned int
static long int __attribute__ ((noinline)) static long int __attribute__ ((noinline))
handle_intel (int name, unsigned int maxidx) handle_intel (int name, unsigned int maxidx)
{ {