Accepting request 114164 from Base:System

Lots of fixes for glibc and cleanup of spec file. (forwarded request 114163 from a_jaeger)

OBS-URL: https://build.opensuse.org/request/show/114164
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/glibc?expand=0&rev=105
This commit is contained in:
Stephan Kulow 2012-04-18 10:34:21 +00:00 committed by Git OBS Bridge
commit 2c72e4b07f
32 changed files with 3086 additions and 1676 deletions

10
armhf-ld-so.patch Normal file
View File

@ -0,0 +1,10 @@
diff --git a/sysdeps/arm/shlib-versions b/sysdeps/arm/shlib-versions
index 491dd0a..5464959 100644
--- a/glibc-ports-2.15/sysdeps/arm/shlib-versions
+++ b/glibc-ports-2.15/sysdeps/arm/shlib-versions
@@ -1,4 +1,4 @@
arm.*-.*-linux-gnueabi.* DEFAULT GLIBC_2.4
-arm.*-.*-linux-gnueabi.* ld=ld-linux.so.3
+arm.*-.*-linux-gnueabi.* ld=ld-linux-armhf.so.3
arm.*-.*-linux.* ld=ld-linux.so.2

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;
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 (req->ai_family == AF_INET6
@ -22,7 +34,7 @@ Index: sysdeps/posix/getaddrinfo.c
{
gethosts (AF_INET6, struct in6_addr);
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
|| 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.14/Versions.def
@@ -41,6 +41,7 @@ libc {
--- glibc-2.15.orig/Versions.def
+++ glibc-2.15/Versions.def
@@ -40,6 +40,7 @@ libc {
}
libcrypt {
GLIBC_2.0
@ -10,10 +10,10 @@ Index: glibc-2.14/Versions.def
}
libdl {
GLIBC_2.0
Index: glibc-2.14/crypt/Versions
Index: glibc-2.15/crypt/Versions
===================================================================
--- glibc-2.14.orig/crypt/Versions
+++ glibc-2.14/crypt/Versions
--- glibc-2.15.orig/crypt/Versions
+++ glibc-2.15/crypt/Versions
@@ -3,4 +3,7 @@ libcrypt {
crypt; crypt_r; encrypt; encrypt_r; fcrypt; setkey; setkey_r;
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>
* 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 65b0ee9..4fabbee 100644
--- 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
===================================================================
--- glibc-2.15.orig/sysdeps/x86_64/multiarch/init-arch.c
+++ glibc-2.15/sysdeps/x86_64/multiarch/init-arch.c
@@ -1,6 +1,6 @@
/* Initialize CPU feature data.
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)
+ {
+ /* 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
+ && ({ unsigned int xcrlow;
+ unsigned int xcrhigh;
@ -197,14 +40,23 @@ index 4fabbee..76d146c 100644
+ : "=a" (xcrlow), "=d" (xcrhigh) : "c" (0));
+ (xcrlow & 6) == 6; }))
+ __cpu_features.feature[index_YMM_Usable] |= bit_YMM_Usable;
}
+ }
+
__cpu_features.family = family;
diff --git a/sysdeps/x86_64/multiarch/init-arch.h b/sysdeps/x86_64/multiarch/init-arch.h
index 408e5ae..2dc75ab 100644
--- a/sysdeps/x86_64/multiarch/init-arch.h
+++ b/sysdeps/x86_64/multiarch/init-arch.h
@@ -22,6 +22,7 @@
__cpu_features.model = model;
atomic_write_barrier ();
Index: glibc-2.15/sysdeps/x86_64/multiarch/init-arch.h
===================================================================
--- 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_Fast_Unaligned_Load (1 << 4)
#define bit_Prefer_PMINUB_for_stringop (1 << 5)
@ -212,7 +64,13 @@ index 408e5ae..2dc75ab 100644
#define bit_SSE2 (1 << 26)
#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_Fast_Unaligned_Load 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__ */
@@ -93,7 +95,7 @@ extern struct cpu_features
@@ -92,7 +95,7 @@ extern struct cpu_features
extern void __init_cpu_features (void) attribute_hidden;
@ -229,7 +87,7 @@ index 408e5ae..2dc75ab 100644
do \
if (__cpu_features.kind == arch_kind_unknown) \
__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_Prefer_SSE_for_memop 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)
#endif /* __ASSEMBLER__ */
Index: glibc-2.15/sysdeps/x86_64/fpu/multiarch/e_log.c
===================================================================
--- glibc-2.15.orig/sysdeps/x86_64/fpu/multiarch/e_log.c
+++ glibc-2.15/sysdeps/x86_64/fpu/multiarch/e_log.c
@@ -14,8 +14,7 @@ extern double __ieee754_log_fma4 (double
commit 73139a7628c424c82eb9297ccb5505c0bc5b65aa
Author: Ulrich Drepper <drepper@gmail.com>
Date: Sat Jan 28 11:19:06 2012 -0500
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)
Simplify use of AVX instructions in internal math macros
# 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
2012-01-28 Ulrich Drepper <drepper@gmail.com>
-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));
* sysdeps/x86_64/fpu/math_private.h: Simplify use of AVX instructions.
# 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
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 @@
-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)
#ifdef __AVX__
-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 STMXCSR "vstmxcsr"
+# define LDMXCSR "vldmxcsr"
@ -291,29 +202,78 @@ index 7f52d5e..50f765f 100644
#endif
/* Direct movement of float into integer register. */
@@ -173,7 +177,7 @@
#define libc_fegetround() \
({ \
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)
@@ -86,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))); \
@@ -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
-#ifdef __AVX__
-# define libc_feholdexcept(e) \
@ -344,25 +304,25 @@ index 7f52d5e..50f765f 100644
#undef libc_feholdexcept_setround
-#ifdef __AVX__
-# 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) \
do { \
unsigned int mxcsr; \
- asm ("stmxcsr %0" : "=m" (*&mxcsr)); \
- asm ("vstmxcsr %0" : "=m" (*&mxcsr)); \
+ asm (STMXCSR " %0" : "=m" (*&mxcsr)); \
(e)->__mxcsr = mxcsr; \
mxcsr = ((mxcsr | 0x1f80) & ~0x603f) | ((r) << 3); \
- asm volatile ("ldmxcsr %0" : : "m" (*&mxcsr)); \
- asm volatile ("vldmxcsr %0" : : "m" (*&mxcsr)); \
+ asm volatile (LDMXCSR " %0" : : "m" (*&mxcsr)); \
} 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
#undef libc_feholdexcept_setroundf
#define libc_feholdexcept_setroundf(e, r) libc_feholdexcept_setround (e, r)
@ -372,13 +332,14 @@ index 7f52d5e..50f765f 100644
-#ifdef __AVX__
-# define libc_fetestexcept(e) \
- ({ 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
-# define libc_fetestexcept(e) \
- ({ unsigned int mxcsr; asm volatile ("stmxcsr %0" : "=m" (*&mxcsr)); \
+#define libc_fetestexcept(e) \
+ ({ unsigned int mxcsr; asm volatile (STMXCSR " %0" : "=m" (*&mxcsr)); \
mxcsr & (e) & FE_ALL_EXCEPT; })
- mxcsr & (e) & FE_ALL_EXCEPT; })
-#endif
#undef libc_fetestexceptf
#define libc_fetestexceptf(e) libc_fetestexcept (e)
@ -422,38 +383,11 @@ index 7f52d5e..50f765f 100644
#undef libc_feupdateenvf
#define libc_feupdateenvf(e) libc_feupdateenv (e)
// #define libc_feupdateenvl(e) (void) feupdateenv (e)
commit 56f6f6a2403cfa7267cad722597113be35ecf70d
Author: Ulrich Drepper <drepper@gmail.com>
Date: Sat Jan 28 14:48:46 2012 -0500
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 @@
Index: glibc-2.15/config.h.in
===================================================================
--- glibc-2.15.orig/config.h.in
+++ glibc-2.15/config.h.in
@@ -102,7 +102,7 @@
certain registers (CR0, MQ, CTR, LR) in asm statements. */
#undef BROKEN_PPC_ASM_CR0
@ -462,7 +396,7 @@ index 50d53d4..1489476 100644
symbol. sysdeps/sparc/sparc32/elf/configure. */
#undef BROKEN_SPARC_WDISP22
@@ -106,17 +106,20 @@
@@ -118,17 +118,20 @@
/* Define if gcc supports AVX. */
#undef HAVE_AVX_SUPPORT
@ -485,11 +419,11 @@ index 50d53d4..1489476 100644
include/libc-symbols.h that avoid PLT slots in the shared objects. */
#undef NO_HIDDEN
diff --git a/math/math_private.h b/math/math_private.h
index 602a271..e4108d8 100644
--- a/math/math_private.h
+++ b/math/math_private.h
@@ -365,14 +365,6 @@ extern void __docos (double __x, double __dx, double __v[]);
Index: glibc-2.15/math/math_private.h
===================================================================
--- glibc-2.15.orig/math/math_private.h
+++ glibc-2.15/math/math_private.h
@@ -365,14 +365,6 @@ extern void __docos (double __x, double
know what operations are going to be performed. Therefore we
define additional interfaces. By default they refer to the normal
interfaces. */
@ -504,10 +438,10 @@ index 602a271..e4108d8 100644
#define libc_feholdexcept(e) (void) feholdexcept (e)
#define libc_feholdexceptf(e) (void) feholdexcept (e)
#define libc_feholdexceptl(e) (void) feholdexcept (e)
diff --git a/sysdeps/i386/configure b/sysdeps/i386/configure
index ae494e2..bc7900e 100644
--- a/sysdeps/i386/configure
+++ b/sysdeps/i386/configure
Index: glibc-2.15/sysdeps/i386/configure
===================================================================
--- glibc-2.15.orig/sysdeps/i386/configure
+++ glibc-2.15/sysdeps/i386/configure
@@ -756,6 +756,29 @@ if test $libc_cv_cc_avx = yes; then
fi
@ -538,10 +472,10 @@ index ae494e2..bc7900e 100644
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for FMA4 support" >&5
$as_echo_n "checking for FMA4 support... " >&6; }
if ${libc_cv_cc_fma4+:} false; then :
diff --git a/sysdeps/i386/configure.in b/sysdeps/i386/configure.in
index 5a9840e..59a4cd6 100644
--- a/sysdeps/i386/configure.in
+++ b/sysdeps/i386/configure.in
Index: glibc-2.15/sysdeps/i386/configure.in
===================================================================
--- glibc-2.15.orig/sysdeps/i386/configure.in
+++ glibc-2.15/sysdeps/i386/configure.in
@@ -67,6 +67,17 @@ if test $libc_cv_cc_avx = yes; then
AC_DEFINE(HAVE_AVX_SUPPORT)
fi
@ -560,108 +494,10 @@ index 5a9840e..59a4cd6 100644
dnl Check if -mfma4 works.
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
diff --git a/sysdeps/x86_64/fpu/math_private.h b/sysdeps/x86_64/fpu/math_private.h
index 50f765f..8e79718 100644
--- a/sysdeps/x86_64/fpu/math_private.h
+++ b/sysdeps/x86_64/fpu/math_private.h
@@ -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
Index: glibc-2.15/sysdeps/x86_64/fpu/multiarch/Makefile
===================================================================
--- glibc-2.15.orig/sysdeps/x86_64/fpu/multiarch/Makefile
+++ glibc-2.15/sysdeps/x86_64/fpu/multiarch/Makefile
@@ -34,21 +34,21 @@ CFLAGS-s_sin-fma4.c = -mfma4
CFLAGS-s_tan-fma4.c = -mfma4
endif
@ -691,114 +527,14 @@ index be68903..4b5c173 100644
+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
diff --git a/sysdeps/x86_64/fpu/multiarch/e_atan2.c b/sysdeps/x86_64/fpu/multiarch/e_atan2.c
index 3a615fc..6867c6e 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_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
Index: glibc-2.15/config.make.in
===================================================================
--- glibc-2.15.orig/config.make.in
+++ glibc-2.15/config.make.in
@@ -36,6 +36,7 @@ asflags-cpu = @libc_cv_cc_submachine@
config-cflags-sse4 = @libc_cv_cc_sse4@
@ -807,11 +543,11 @@ index d937952..75061f6 100644
config-cflags-novzeroupper = @libc_cv_cc_novzeroupper@
config-asflags-i686 = @libc_cv_as_i686@
diff --git a/configure b/configure
index 71e8de1..508e1bb 100755
--- a/configure
+++ b/configure
@@ -620,6 +620,7 @@ use_ldconfig
Index: glibc-2.15/configure
===================================================================
--- glibc-2.15.orig/configure
+++ glibc-2.15/configure
@@ -625,6 +625,7 @@ use_ldconfig
libc_cv_as_i686
libc_cv_cc_fma4
libc_cv_cc_novzeroupper
@ -819,11 +555,11 @@ index 71e8de1..508e1bb 100755
libc_cv_cc_avx
libc_cv_cc_sse4
libc_cv_cpp_asm_debuginfo
diff --git a/configure.in b/configure.in
index 5fd6d85..0499d3c 100644
--- a/configure.in
+++ b/configure.in
@@ -2154,6 +2154,7 @@ dnl sysdeps/CPU/configure.in checks set this via arch-specific asm tests
Index: glibc-2.15/configure.in
===================================================================
--- glibc-2.15.orig/configure.in
+++ glibc-2.15/configure.in
@@ -2338,6 +2338,7 @@ dnl sysdeps/CPU/configure.in checks set
AC_SUBST(libc_cv_cpp_asm_debuginfo)
AC_SUBST(libc_cv_cc_sse4)
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_fma4)
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
Index: sunrpc/clnt_udp.c
Index: glibc-2.15/sunrpc/clnt_udp.c
===================================================================
--- sunrpc/clnt_udp.c.orig
+++ sunrpc/clnt_udp.c
@@ -301,6 +301,7 @@ clntudp_call (cl, proc, xargs, argsp, xr
--- glibc-2.15.orig/sunrpc/clnt_udp.c
+++ glibc-2.15/sunrpc/clnt_udp.c
@@ -307,6 +307,7 @@ clntudp_call (cl, proc, xargs, argsp, xr
XDR *xdrs;
int outlen = 0;
int inlen;
@ -14,7 +14,7 @@ Index: sunrpc/clnt_udp.c
socklen_t fromlen;
struct pollfd fd;
int milliseconds = (cu->cu_wait.tv_sec * 1000) +
@@ -371,37 +372,36 @@ send_again:
@@ -377,37 +378,36 @@ send_again:
anyup = 0;
for (;;)
{

View File

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

View File

@ -1,8 +1,8 @@
Index: elf/rtld.c
Index: glibc-2.15/elf/rtld.c
===================================================================
--- elf/rtld.c.orig
+++ elf/rtld.c
@@ -1761,6 +1761,53 @@ ERROR: ld.so: object '%s' cannot be load
--- glibc-2.15.orig/elf/rtld.c
+++ glibc-2.15/elf/rtld.c
@@ -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
+++ localedata/locales/zh_TW
--- glibc-2.15.orig/localedata/locales/zh_TW
+++ glibc-2.15/localedata/locales/zh_TW
@@ -1,7 +1,7 @@
comment_char %
escape_char /

View File

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

View File

@ -6,7 +6,7 @@ Index: posix/Makefile
===================================================================
--- posix/Makefile.orig
+++ posix/Makefile
@@ -298,8 +298,7 @@ $(inst_libexecdir)/getconf: $(inst_bindi
@@ -316,8 +316,7 @@ $(inst_libexecdir)/getconf: $(inst_bindi
$(addprefix $(..)./scripts/mkinstalldirs ,\
$(filter-out $(wildcard $@),$@))
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 +-
6 files changed, 20 insertions(+), 4 deletions(-)
Index: config.make.in
Index: glibc-2.15/config.make.in
===================================================================
--- config.make.in.orig
+++ config.make.in
@@ -99,6 +99,7 @@ add-ons = @add_ons@
--- glibc-2.15.orig/config.make.in
+++ glibc-2.15/config.make.in
@@ -100,6 +100,7 @@ add-ons = @add_ons@
add-on-subdirs = @add_on_subdirs@
sysdeps-add-ons = @sysdeps_add_ons@
cross-compiling = @cross_compiling@
@ -19,11 +19,11 @@ Index: config.make.in
force-install = @force_install@
# Build tools.
Index: configure.in
Index: glibc-2.15/configure.in
===================================================================
--- configure.in.orig
+++ configure.in
@@ -16,6 +16,7 @@ if test $host != $build; then
--- glibc-2.15.orig/configure.in
+++ glibc-2.15/configure.in
@@ -15,6 +15,7 @@ if test $host != $build; then
AC_CHECK_PROGS(BUILD_CC, gcc cc)
fi
AC_SUBST(cross_compiling)
@ -31,11 +31,11 @@ Index: configure.in
AC_PROG_CPP
# We need the C++ compiler only for testing.
AC_PROG_CXX
Index: configure
Index: glibc-2.15/configure
===================================================================
--- configure.orig
+++ configure
@@ -554,6 +554,7 @@ ac_clean_files=
--- glibc-2.15.orig/configure
+++ glibc-2.15/configure
@@ -553,6 +553,7 @@ ac_clean_files=
ac_config_libobj_dir=.
LIBOBJS=
cross_compiling=no
@ -83,10 +83,10 @@ Index: configure
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
Index: posix/Makefile
Index: glibc-2.15/posix/Makefile
===================================================================
--- posix/Makefile.orig
+++ posix/Makefile
--- glibc-2.15.orig/posix/Makefile
+++ glibc-2.15/posix/Makefile
@@ -320,7 +320,7 @@ $(inst_libexecdir)/getconf: $(inst_bindi
done < $(objpfx)getconf.speclist
@ -96,10 +96,10 @@ Index: posix/Makefile
LC_ALL=C GETCONF_DIR=/dev/null \
$(run-program-prefix) $< _POSIX_V7_WIDTH_RESTRICTED_ENVS > $@.new
LC_ALL=C GETCONF_DIR=/dev/null \
Index: sunrpc/Makefile
Index: glibc-2.15/sunrpc/Makefile
===================================================================
--- sunrpc/Makefile.orig
+++ sunrpc/Makefile
--- glibc-2.15.orig/sunrpc/Makefile
+++ glibc-2.15/sunrpc/Makefile
@@ -108,7 +108,7 @@ otherlibs += $(nssobjdir)/libnss_files.a
$(resolvobjdir)/libresolv.a
endif
@ -109,10 +109,10 @@ Index: sunrpc/Makefile
# We can only build this library if we can run the rpcgen we build.
headers += $(rpcsvc:%.x=rpcsvc/%.h)
extra-libs := librpcsvc
Index: timezone/Makefile
Index: glibc-2.15/timezone/Makefile
===================================================================
--- timezone/Makefile.orig
+++ timezone/Makefile
--- glibc-2.15.orig/timezone/Makefile
+++ glibc-2.15/timezone/Makefile
@@ -69,7 +69,7 @@ installed-posixrules-file := $(firstword
$(addprefix $(inst_zonedir)/, \
$(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-relsort1mod2.c: New file.
diff --git a/Makeconfig b/Makeconfig
index 8195245..185afbb 100644
--- a/Makeconfig
+++ b/Makeconfig
Index: glibc-2.15/Makeconfig
===================================================================
--- glibc-2.15.orig/Makeconfig
+++ glibc-2.15/Makeconfig
@@ -950,6 +950,12 @@ libdl =
endif
endif
@ -32,10 +32,10 @@ index 8195245..185afbb 100644
# These are the subdirectories containing the library source. The order
# is more or less arbitrary. The sorting step will take care of the
# dependencies.
diff --git a/elf/Makefile b/elf/Makefile
index 052e763..3f1772a 100644
--- a/elf/Makefile
+++ b/elf/Makefile
Index: glibc-2.15/elf/Makefile
===================================================================
--- glibc-2.15.orig/elf/Makefile
+++ glibc-2.15/elf/Makefile
@@ -124,7 +124,8 @@ distribute := rtld-Rules \
tst-initordera1.c tst-initordera2.c tst-initorderb1.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-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-stackguard1 tst-addr1 tst-thrlock \
tst-unique1 tst-unique2 tst-unique3 tst-unique4 \
@ -55,7 +55,7 @@ index 052e763..3f1772a 100644
# reldep9
test-srcs = tst-pathopt
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-initordera2 tst-initorderb2 \
tst-initordera3 tst-initordera4 \
@ -66,7 +66,7 @@ index 052e763..3f1772a 100644
ifeq (yes,$(have-initfini-array))
modules-names += tst-array2dep tst-array5dep
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-auditmod7b.c += $(AVX-CFLAGS)
endif
@ -76,10 +76,10 @@ index 052e763..3f1772a 100644
+$(objpfx)tst-relsort1mod2.so: $(libm)
+$(objpfx)tst-relsort1.out: $(objpfx)tst-relsort1mod1.so \
+ $(objpfx)tst-relsort1mod2.so
diff --git a/elf/dl-open.c b/elf/dl-open.c
index a0b5c50..a56bdc1 100644
--- a/elf/dl-open.c
+++ b/elf/dl-open.c
Index: glibc-2.15/elf/dl-open.c
===================================================================
--- glibc-2.15.orig/elf/dl-open.c
+++ glibc-2.15/elf/dl-open.c
@@ -1,5 +1,5 @@
/* Load a shared object at runtime, relocate it, and run its initializer.
- 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
- start the profiling. */
- 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;
+ if (runp != NULL)
+ /* Look through the dependencies of the object. */
@ -154,26 +165,18 @@ index a0b5c50..a56bdc1 100644
+ memmove (&maps[i], &maps[i + 1],
+ (k - i) * sizeof (maps[0]));
+ maps[k] = thisp;
- _dl_relocate_object (l, l->l_scope, reloc_mode | RTLD_LAZY, 1);
+
+ if (seen[i + 1] > 1)
+ {
+ ++i;
+ 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];
+ memmove (&seen[i], &seen[i + 1],
+ (k - i) * sizeof (seen[0]));
+ seen[k] = this_seen;
- /* Prevent unloading the object. */
- GL(dl_profile_map)->l_flags_1 |= DF_1_NODELETE;
- }
+
+ goto next;
+ }
+
@ -204,12 +207,12 @@ index a0b5c50..a56bdc1 100644
+ variable. If it was NULL but is not NULL afterwars we must
+ start the profiling. */
+ 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)
- break;
- 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)
+ {
+ /* 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
diff --git a/elf/tst-relsort1.c b/elf/tst-relsort1.c
new file mode 100644
index 0000000..972100c
Index: glibc-2.15/elf/tst-relsort1.c
===================================================================
--- /dev/null
+++ b/elf/tst-relsort1.c
+++ glibc-2.15/elf/tst-relsort1.c
@@ -0,0 +1,19 @@
+#include <dlfcn.h>
+#include <stdio.h>
@ -250,11 +252,10 @@ index 0000000..972100c
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/elf/tst-relsort1mod1.c b/elf/tst-relsort1mod1.c
new file mode 100644
index 0000000..9e4a943
Index: glibc-2.15/elf/tst-relsort1mod1.c
===================================================================
--- /dev/null
+++ b/elf/tst-relsort1mod1.c
+++ glibc-2.15/elf/tst-relsort1mod1.c
@@ -0,0 +1,7 @@
+extern int foo (double);
+
@ -263,11 +264,10 @@ index 0000000..9e4a943
+{
+ return foo (1.2);
+}
diff --git a/elf/tst-relsort1mod2.c b/elf/tst-relsort1mod2.c
new file mode 100644
index 0000000..a2c3e55
Index: glibc-2.15/elf/tst-relsort1mod2.c
===================================================================
--- /dev/null
+++ b/elf/tst-relsort1mod2.c
+++ glibc-2.15/elf/tst-relsort1mod2.c
@@ -0,0 +1,7 @@
+#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,
we can't have unwind tables therein.
Index: csu/Makefile
Index: glibc-2.15/csu/Makefile
===================================================================
--- csu/Makefile.orig
+++ csu/Makefile
--- glibc-2.15.orig/csu/Makefile
+++ glibc-2.15/csu/Makefile
@@ -93,7 +93,7 @@ omit-deps += $(crtstuff)
$(crtstuff:%=$(objpfx)%.o): %.o: %.S $(objpfx)defs.h
$(compile.S) -g0 $(ASFLAGS-.os) -o $@
@ -14,11 +14,11 @@ Index: csu/Makefile
vpath initfini.c $(sysdirs)
Index: nptl/Makefile
Index: glibc-2.15/nptl/Makefile
===================================================================
--- nptl/Makefile.orig
+++ nptl/Makefile
@@ -339,7 +339,7 @@ endif
--- glibc-2.15.orig/nptl/Makefile
+++ glibc-2.15/nptl/Makefile
@@ -342,7 +342,7 @@ endif
extra-objs += $(crti-objs) $(crtn-objs)
omit-deps += crti crtn
@ -27,10 +27,10 @@ Index: nptl/Makefile
endif
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
+++ nptl/sysdeps/unix/sysv/linux/x86_64/Makefile
--- glibc-2.15.orig/nptl/sysdeps/unix/sysv/linux/x86_64/Makefile
+++ glibc-2.15/nptl/sysdeps/unix/sysv/linux/x86_64/Makefile
@@ -1,4 +1,4 @@
ifeq ($(subdir),nptl)
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
+++ csu/Makefile 2011-12-15 17:27:30.000000000 +0100
@@ -234,8 +234,8 @@
Index: glibc-2.15/csu/Makefile
===================================================================
--- 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 \
os=Linux; \
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,801 +0,0 @@
commit 432d41ceecf5df8cfbc5a1db0cee9190f07ec1ca
Author: Ulrich Drepper <drepper@gmail.com>
Date: Tue Nov 1 08:43:33 2011 -0400
Use kernel headers for netlink definitions
2011-11-01 Ulrich Drepper <drepper@gmail.com>
* nscd/connections.c: Use kernel headers instead of <netlink/netlink.h>.
diff --git a/nscd/connections.c b/nscd/connections.c
index 1b8a9bd..c741996 100644
--- a/nscd/connections.c
+++ b/nscd/connections.c
@@ -34,7 +34,8 @@
#include <unistd.h>
#include <arpa/inet.h>
#ifdef HAVE_NETLINK
-# include <netlink/netlink.h>
+# include <linux/netlink.h>
+# include <linux/rtnetlink.h>
#endif
#ifdef HAVE_EPOLL
# include <sys/epoll.h>
commit a501a01e069619676990454abd43c4d2bf4527f4
Author: Ulrich Drepper <drepper@gmail.com>
Date: Tue Nov 15 07:18:15 2011 -0500
Pretty printing
diff --git a/sysdeps/unix/sysv/linux/check_pf.c b/sysdeps/unix/sysv/linux/check_pf.c
index 895dc2a..0738a70 100644
--- a/sysdeps/unix/sysv/linux/check_pf.c
+++ b/sysdeps/unix/sysv/linux/check_pf.c
@@ -273,7 +273,7 @@ make_request (int fd, pid_t pid)
}
else
{
- atomic_add(&noai6ai_cached.usecnt, 2);
+ atomic_add (&noai6ai_cached.usecnt, 2);
noai6ai_cached.seen_ipv4 = seen_ipv4;
noai6ai_cached.seen_ipv6 = seen_ipv6;
result = &noai6ai_cached;
commit 09f93bd3d6b1c41370432e6b7a3c88d0fc482881
Author: Andreas Schwab <schwab@redhat.com>
Date: Tue Nov 15 10:32:18 2011 +0100
Fix reference counting in network interface information cache
2011-11-15 Andreas Schwab <schwab@redhat.com>
* sysdeps/unix/sysv/linux/check_pf.c (make_request): Properly
count references to noai6ai_cached.
diff --git a/sysdeps/unix/sysv/linux/check_pf.c b/sysdeps/unix/sysv/linux/check_pf.c
index 1f66684..895dc2a 100644
--- a/sysdeps/unix/sysv/linux/check_pf.c
+++ b/sysdeps/unix/sysv/linux/check_pf.c
@@ -58,7 +58,7 @@ struct cached_data
static struct cached_data noai6ai_cached =
{
- .usecnt = 3, /* Make sure we never try to delete this entry. */
+ .usecnt = 1, /* Make sure we never try to delete this entry. */
.in6ailen = 0
};
@@ -273,6 +273,7 @@ make_request (int fd, pid_t pid)
}
else
{
+ atomic_add(&noai6ai_cached.usecnt, 2);
noai6ai_cached.seen_ipv4 = seen_ipv4;
noai6ai_cached.seen_ipv6 = seen_ipv6;
result = &noai6ai_cached;
commit 3a2c02424d9824f5cdea4ebd32ff929b2b1f49c6
Author: Ulrich Drepper <drepper@gmail.com>
Date: Mon Oct 31 01:51:16 2011 -0400
Cache network interface information
Whenever getaddrinfo needed network interface information it used the
netlink interface to read the information every single time. The
problem is that this information can change at any time.
The patch implements monitoring of the network interfaces through
nscd. If no change is detected the previously read information can
be reused (which is the norm). This timestamp information is also
made available to other processes using the shared memory segment
between nscd and those processes.
2011-10-31 Ulrich Drepper <drepper@gmail.com>
* include/ifaddrs.h: Declare __free_in6ai and __bump_nl_timestamp.
* inet/check_pf.c: Provide dummy versions of __free_in6ai and
__bump_nl_timestamp.
* nscd/connections (nscd_init): When host database is served open
netlink socket and request notification about configuration changes.
(main_loop_poll): Track netlink file descriptor and bump timestamp
in case data becomes available.
(main_loop_epoll): Likewise.
* nscd/nscd-client.h (DB_VERSION): Bump to 2.
(database_pers_head): Add extra_data fileds.
Declare __nscd_get_mapping and __nscd_get_nl_timestamp.
* nscd/nscd_gethst_r.c (__nscd_get_nl_timestamp): New function.
* nscd/nscd_helper.c (__nscd_get_mapping): Renamed from get_mapping.
Adjust caller.
* sysdeps/posix/getaddrinfo.c (getaddrinfo): Don't call free on
in6ai data, call __free_in6ai.
* sysdeps/unix/sysv/linux/Makefile [subdir=nscd] (sysdep-CFLAGS):
Add -DHAVE_NETLINK.
* sysdeps/unix/sysv/linux/check_pf.c: Major rewrite. Cache the
interface information. Reuse previous data if netlink timestamp
is not changed.
(__bump_nl_timestamp): New function.
(__free_in6ai): New function.
* sysdeps/unix/sysv/linux/check_pf.c (make_request): Don't call
diff --git a/include/ifaddrs.h b/include/ifaddrs.h
index 50e4c48..e1c6cac 100644
--- a/include/ifaddrs.h
+++ b/include/ifaddrs.h
@@ -21,8 +21,13 @@ struct in6addrinfo
extern void __check_pf (bool *seen_ipv4, bool *seen_ipv6,
struct in6addrinfo **in6ai, size_t *in6ailen)
attribute_hidden;
+extern void __free_in6ai (struct in6addrinfo *in6ai) attribute_hidden;
extern void __check_native (uint32_t a1_index, int *a1_native,
uint32_t a2_index, int *a2_native)
attribute_hidden;
+#ifdef IS_IN_nscd
+extern uint32_t __bump_nl_timestamp (void) attribute_hidden;
+#endif
+
#endif /* ifaddrs.h */
diff --git a/inet/check_pf.c b/inet/check_pf.c
index b015432..0fa34cc 100644
--- a/inet/check_pf.c
+++ b/inet/check_pf.c
@@ -1,5 +1,5 @@
/* Determine protocol families for which interfaces exist. Generic version.
- Copyright (C) 2003, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2006, 2011 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
@@ -54,3 +54,19 @@ __check_pf (bool *seen_ipv4, bool *seen_ipv6,
(void) freeifaddrs (ifa);
}
+
+
+void
+__free_in6ai (struct in6addrinfo *in6ai)
+{
+ /* Nothing to do. */
+}
+
+
+#ifdef IS_IN_nscd
+uint32_t
+__bump_nl_timestamp (void)
+{
+ return 0;
+}
+#endif
diff --git a/nscd/connections.c b/nscd/connections.c
index 2b5c7ef..1b8a9bd 100644
--- a/nscd/connections.c
+++ b/nscd/connections.c
@@ -24,6 +24,7 @@
#include <errno.h>
#include <fcntl.h>
#include <grp.h>
+#include <ifaddrs.h>
#include <libintl.h>
#include <pthread.h>
#include <pwd.h>
@@ -32,6 +33,9 @@
#include <stdlib.h>
#include <unistd.h>
#include <arpa/inet.h>
+#ifdef HAVE_NETLINK
+# include <netlink/netlink.h>
+#endif
#ifdef HAVE_EPOLL
# include <sys/epoll.h>
#endif
@@ -247,6 +251,11 @@ static int sock;
int inotify_fd = -1;
#endif
+#ifdef HAVE_NETLINK
+/* Descriptor for netlink status updates. */
+static int nl_status_fd = -1;
+#endif
+
#ifndef __ASSUME_SOCK_CLOEXEC
/* Negative if SOCK_CLOEXEC is not supported, positive if it is, zero
before be know the result. */
@@ -903,6 +912,65 @@ cannot set socket to close on exec: %s; disabling paranoia mode"),
exit (1);
}
+#ifdef HAVE_NETLINK
+ if (dbs[hstdb].enabled)
+ {
+ /* Try to open netlink socket to monitor network setting changes. */
+ nl_status_fd = socket (AF_NETLINK,
+ SOCK_RAW | SOCK_CLOEXEC | SOCK_NONBLOCK,
+ NETLINK_ROUTE);
+ if (nl_status_fd != -1)
+ {
+ struct sockaddr_nl snl;
+ memset (&snl, '\0', sizeof (snl));
+ snl.nl_family = AF_NETLINK;
+ /* XXX Is this the best set to use? */
+ snl.nl_groups = (RTMGRP_IPV4_IFADDR | RTMGRP_TC | RTMGRP_IPV4_MROUTE
+ | RTMGRP_IPV4_ROUTE | RTMGRP_IPV4_RULE
+ | RTMGRP_IPV6_IFADDR | RTMGRP_IPV6_MROUTE
+ | RTMGRP_IPV6_ROUTE | RTMGRP_IPV6_IFINFO
+ | RTMGRP_IPV6_PREFIX);
+
+ if (bind (nl_status_fd, (struct sockaddr *) &snl, sizeof (snl)) != 0)
+ {
+ close (nl_status_fd);
+ nl_status_fd = -1;
+ }
+ else
+ {
+ /* Start the timestamp process. */
+ dbs[hstdb].head->extra_data[NSCD_HST_IDX_CONF_TIMESTAMP]
+ = __bump_nl_timestamp ();
+
+# ifndef __ASSUME_SOCK_CLOEXEC
+ if (have_sock_cloexec < 0)
+ {
+ /* We don't want to get stuck on accept. */
+ int fl = fcntl (nl_status_fd, F_GETFL);
+ if (fl == -1
+ || fcntl (nl_status_fd, F_SETFL, fl | O_NONBLOCK) == -1)
+ {
+ dbg_log (_("\
+cannot change socket to nonblocking mode: %s"),
+ strerror (errno));
+ exit (1);
+ }
+
+ /* The descriptor needs to be closed on exec. */
+ if (paranoia
+ && fcntl (nl_status_fd, F_SETFD, FD_CLOEXEC) == -1)
+ {
+ dbg_log (_("cannot set socket to close on exec: %s"),
+ strerror (errno));
+ exit (1);
+ }
+ }
+# endif
+ }
+ }
+ }
+#endif
+
/* Change to unprivileged uid/gid/groups if specified in config file */
if (server_user != NULL)
finish_drop_privileges ();
@@ -1826,6 +1894,18 @@ main_loop_poll (void)
}
#endif
+#ifdef HAVE_NETLINK
+ size_t idx_nl_status_fd = 0;
+ if (nl_status_fd != -1)
+ {
+ idx_nl_status_fd = nused;
+ conns[nused].fd = nl_status_fd;
+ conns[nused].events = POLLRDNORM;
+ ++nused;
+ firstfree = nused;
+ }
+#endif
+
while (1)
{
/* Wait for any event. We wait at most a couple of seconds so
@@ -1968,6 +2048,20 @@ disabled inotify after read error %d"),
}
#endif
+#ifdef HAVE_NETLINK
+ if (idx_nl_status_fd != 0 && conns[idx_nl_status_fd].revents != 0)
+ {
+ char buf[4096];
+ /* Read all the data. We do not interpret it here. */
+ while (TEMP_FAILURE_RETRY (read (nl_status_fd, buf,
+ sizeof (buf))) != -1)
+ ;
+
+ dbs[hstdb].head->extra_data[NSCD_HST_IDX_CONF_TIMESTAMP]
+ = __bump_nl_timestamp ();
+ }
+#endif
+
for (size_t cnt = first; cnt < nused && n > 0; ++cnt)
if (conns[cnt].revents != 0)
{
@@ -2046,6 +2140,17 @@ main_loop_epoll (int efd)
}
# endif
+# ifdef HAVE_NETLINK
+ if (nl_status_fd != -1)
+ {
+ ev.events = EPOLLRDNORM;
+ ev.data.fd = nl_status_fd;
+ if (epoll_ctl (efd, EPOLL_CTL_ADD, nl_status_fd, &ev) == -1)
+ /* We cannot use epoll. */
+ return;
+ }
+# endif
+
while (1)
{
struct epoll_event revs[100];
@@ -2162,6 +2267,18 @@ main_loop_epoll (int efd)
}
}
# endif
+# ifdef HAVE_NETLINK
+ else if (revs[cnt].data.fd == nl_status_fd)
+ {
+ char buf[4096];
+ /* Read all the data. We do not interpret it here. */
+ while (TEMP_FAILURE_RETRY (read (nl_status_fd, buf,
+ sizeof (buf))) != -1)
+ ;
+
+ __bump_nl_timestamp ();
+ }
+# endif
else
{
/* Remove the descriptor from the epoll descriptor. */
@@ -2185,6 +2302,7 @@ main_loop_epoll (int efd)
time_t laststart = now - ACCEPT_TIMEOUT;
assert (starttime[sock] == 0);
assert (inotify_fd == -1 || starttime[inotify_fd] == 0);
+ assert (nl_status_fd == -1 || starttime[nl_status_fd] == 0);
for (int cnt = highest; cnt > STDERR_FILENO; --cnt)
if (starttime[cnt] != 0 && starttime[cnt] < laststart)
{
diff --git a/nscd/nscd-client.h b/nscd/nscd-client.h
index caad26a..b5cd2d2 100644
--- a/nscd/nscd-client.h
+++ b/nscd/nscd-client.h
@@ -260,12 +260,17 @@ struct hashentry
/* Current persistent database version. */
-#define DB_VERSION 1
+#define DB_VERSION 2
/* Maximum time allowed between updates of the timestamp. */
#define MAPPING_TIMEOUT (5 * 60)
+/* Used indices for the EXTRA_DATA element of 'database_pers_head'.
+ Each database has its own indices. */
+#define NSCD_HST_IDX_CONF_TIMESTAMP 0
+
+
/* Header of persistent database file. */
struct database_pers_head
{
@@ -274,6 +279,8 @@ struct database_pers_head
volatile int32_t gc_cycle;
volatile int32_t nscd_certainly_running;
volatile nscd_time_t timestamp;
+ /* Room for extensions. */
+ volatile uint32_t extra_data[4];
nscd_ssize_t module;
nscd_ssize_t data_size;
@@ -322,6 +329,12 @@ extern int __nscd_open_socket (const char *key, size_t keylen,
request_type type, void *response,
size_t responselen) attribute_hidden;
+/* Try to get a file descriptor for the shared meory segment
+ containing the database. */
+extern struct mapped_database *__nscd_get_mapping (request_type type,
+ const char *key,
+ struct mapped_database **mappedp) attribute_hidden;
+
/* Get reference of mapping. */
extern struct mapped_database *__nscd_get_map_ref (request_type type,
const char *name,
@@ -371,4 +384,7 @@ extern ssize_t writeall (int fd, const void *buf, size_t len)
extern ssize_t sendfileall (int tofd, int fromfd, off_t off, size_t len)
attribute_hidden;
+/* Get netlink timestamp counter from mapped area or zero. */
+extern uint32_t __nscd_get_nl_timestamp (void);
+
#endif /* nscd.h */
diff --git a/nscd/nscd_gethst_r.c b/nscd/nscd_gethst_r.c
index 70631fa..6ee142d 100644
--- a/nscd/nscd_gethst_r.c
+++ b/nscd/nscd_gethst_r.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2005, 2006, 2007, 2008, 2009
+/* Copyright (C) 1998-2005, 2006, 2007, 2008, 2009, 2011
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -98,6 +98,27 @@ libc_freeres_fn (hst_map_free)
}
+uint32_t
+__nscd_get_nl_timestamp (void)
+{
+ if (__nss_not_use_nscd_hosts != 0)
+ return 0;
+
+ struct mapped_database *map = __hst_map_handle.mapped;
+
+ if (map == NULL
+ || (map != NO_MAPPING
+ && map->head->nscd_certainly_running == 0
+ && map->head->timestamp + MAPPING_TIMEOUT < time (NULL)))
+ map = __nscd_get_mapping (GETFDHST, "hosts", &__hst_map_handle.mapped);
+
+ if (map == NO_MAPPING)
+ return 0;
+
+ return map->head->extra_data[NSCD_HST_IDX_CONF_TIMESTAMP];
+}
+
+
int __nss_have_localdomain attribute_hidden;
static int
diff --git a/nscd/nscd_helper.c b/nscd/nscd_helper.c
index fe63f9a..365b599 100644
--- a/nscd/nscd_helper.c
+++ b/nscd/nscd_helper.c
@@ -277,9 +277,9 @@ __nscd_unmap (struct mapped_database *mapped)
/* Try to get a file descriptor for the shared meory segment
containing the database. */
-static struct mapped_database *
-get_mapping (request_type type, const char *key,
- struct mapped_database **mappedp)
+struct mapped_database *
+__nscd_get_mapping (request_type type, const char *key,
+ struct mapped_database **mappedp)
{
struct mapped_database *result = NO_MAPPING;
#ifdef SCM_RIGHTS
@@ -449,8 +449,8 @@ __nscd_get_map_ref (request_type type, const char *name,
|| (cur->head->nscd_certainly_running == 0
&& cur->head->timestamp + MAPPING_TIMEOUT < time (NULL))
|| cur->head->data_size > cur->datasize)
- cur = get_mapping (type, name,
- (struct mapped_database **) &mapptr->mapped);
+ cur = __nscd_get_mapping (type, name,
+ (struct mapped_database **) &mapptr->mapped);
if (__builtin_expect (cur != NO_MAPPING, 1))
{
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index a5aafe9..216c9cc 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -2386,7 +2386,7 @@ getaddrinfo (const char *name, const char *service,
|| (hints->ai_family == PF_INET6 && ! seen_ipv6))
{
/* We cannot possibly return a valid answer. */
- free (in6ai);
+ __free_in6ai (in6ai);
return EAI_NONAME;
}
}
@@ -2400,7 +2400,7 @@ getaddrinfo (const char *name, const char *service,
{
if (hints->ai_flags & AI_NUMERICSERV)
{
- free (in6ai);
+ __free_in6ai (in6ai);
return EAI_NONAME;
}
@@ -2422,7 +2422,7 @@ getaddrinfo (const char *name, const char *service,
if (last_i != 0)
{
freeaddrinfo (p);
- free (in6ai);
+ __free_in6ai (in6ai);
return -(last_i & GAIH_EAI);
}
@@ -2434,7 +2434,7 @@ getaddrinfo (const char *name, const char *service,
}
else
{
- free (in6ai);
+ __free_in6ai (in6ai);
return EAI_FAMILY;
}
@@ -2622,7 +2622,7 @@ getaddrinfo (const char *name, const char *service,
p->ai_canonname = canonname;
}
- free (in6ai);
+ __free_in6ai (in6ai);
if (p)
{
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index af53f70..3032026 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -161,6 +161,6 @@ CFLAGS-mq_receive.c += -fexceptions
endif
ifeq ($(subdir),nscd)
-sysdep-CFLAGS += -DHAVE_EPOLL -DHAVE_SENDFILE -DHAVE_INOTIFY
+sysdep-CFLAGS += -DHAVE_EPOLL -DHAVE_SENDFILE -DHAVE_INOTIFY -DHAVE_NETLINK
CFLAGS-gai.c += -DNEED_NETLINK
endif
diff --git a/sysdeps/unix/sysv/linux/check_pf.c b/sysdeps/unix/sysv/linux/check_pf.c
index d5ad7ea..1f66684 100644
--- a/sysdeps/unix/sysv/linux/check_pf.c
+++ b/sysdeps/unix/sysv/linux/check_pf.c
@@ -1,5 +1,5 @@
/* Determine protocol families for which interfaces exist. Linux version.
- Copyright (C) 2003, 2006, 2007, 2008, 2010, 2011 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2006-2008, 2010, 2011 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
@@ -33,6 +33,9 @@
#include <not-cancel.h>
#include <kernel-features.h>
+#include <bits/libc-lock.h>
+#include <atomic.h>
+#include <nscd/nscd-client.h>
#ifndef IFA_F_HOMEADDRESS
@@ -43,9 +46,42 @@
#endif
-static int
-make_request (int fd, pid_t pid, bool *seen_ipv4, bool *seen_ipv6,
- struct in6addrinfo **in6ai, size_t *in6ailen)
+struct cached_data
+{
+ uint32_t timestamp;
+ uint32_t usecnt;
+ bool seen_ipv4;
+ bool seen_ipv6;
+ size_t in6ailen;
+ struct in6addrinfo in6ai[0];
+};
+
+static struct cached_data noai6ai_cached =
+ {
+ .usecnt = 3, /* Make sure we never try to delete this entry. */
+ .in6ailen = 0
+ };
+
+static struct cached_data *cache;
+__libc_lock_define_initialized (static, lock);
+
+
+#ifdef IS_IN_nscd
+static uint32_t nl_timestamp;
+
+uint32_t
+__bump_nl_timestamp (void)
+{
+ if (atomic_increment_val (&nl_timestamp) == 0)
+ atomic_increment (&nl_timestamp);
+
+ return nl_timestamp;
+}
+#endif
+
+
+static struct cached_data *
+make_request (int fd, pid_t pid)
{
struct req
{
@@ -99,9 +135,6 @@ make_request (int fd, pid_t pid, bool *seen_ipv4, bool *seen_ipv6,
sizeof (nladdr))) < 0)
goto out_fail;
- *seen_ipv4 = false;
- *seen_ipv6 = false;
-
bool done = false;
struct in6ailist
{
@@ -109,6 +142,8 @@ make_request (int fd, pid_t pid, bool *seen_ipv4, bool *seen_ipv6,
struct in6ailist *next;
} *in6ailist = NULL;
size_t in6ailistlen = 0;
+ bool seen_ipv4 = false;
+ bool seen_ipv6 = false;
do
{
@@ -172,12 +207,12 @@ make_request (int fd, pid_t pid, bool *seen_ipv4, bool *seen_ipv6,
{
if (*(const in_addr_t *) address
!= htonl (INADDR_LOOPBACK))
- *seen_ipv4 = true;
+ seen_ipv4 = true;
}
else
{
if (!IN6_IS_ADDR_LOOPBACK (address))
- *seen_ipv6 = true;
+ seen_ipv6 = true;
}
}
@@ -211,30 +246,46 @@ make_request (int fd, pid_t pid, bool *seen_ipv4, bool *seen_ipv6,
}
while (! done);
- if (*seen_ipv6 && in6ailist != NULL)
+ struct cached_data *result;
+ if (seen_ipv6 && in6ailist != NULL)
{
- *in6ai = malloc (in6ailistlen * sizeof (**in6ai));
- if (*in6ai == NULL)
+ result = malloc (sizeof (*result)
+ + in6ailistlen * sizeof (struct in6addrinfo));
+ if (result == NULL)
goto out_fail;
- *in6ailen = in6ailistlen;
+#ifdef IS_IN_nscd
+ result->timestamp = nl_timestamp;
+#else
+ result->timestamp = __nscd_get_nl_timestamp ();
+#endif
+ result->usecnt = 2;
+ result->seen_ipv4 = seen_ipv4;
+ result->seen_ipv6 = true;
+ result->in6ailen = in6ailistlen;
do
{
- (*in6ai)[--in6ailistlen] = in6ailist->info;
+ result->in6ai[--in6ailistlen] = in6ailist->info;
in6ailist = in6ailist->next;
}
while (in6ailist != NULL);
}
+ else
+ {
+ noai6ai_cached.seen_ipv4 = seen_ipv4;
+ noai6ai_cached.seen_ipv6 = seen_ipv6;
+ result = &noai6ai_cached;
+ }
if (use_malloc)
free (buf);
- return 0;
+ return result;
out_fail:
if (use_malloc)
free (buf);
- return -1;
+ return NULL;
}
@@ -258,28 +309,65 @@ __check_pf (bool *seen_ipv4, bool *seen_ipv6,
if (! __no_netlink_support)
{
- int fd = __socket (PF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
+ struct cached_data *olddata = NULL;
+ struct cached_data *data = NULL;
+
+ __libc_lock_lock (lock);
- if (__builtin_expect (fd >= 0, 1))
+#ifdef IS_IN_nscd
+# define cache_valid() nl_timestamp != 0 && cache->timestamp == nl_timestamp
+#else
+# define cache_valid() \
+ ({ uint32_t val = __nscd_get_nl_timestamp (); \
+ val != 0 && cache->timestamp == val; })
+#endif
+ if (cache != NULL && cache_valid ())
+ {
+ data = cache;
+ atomic_increment (&cache->usecnt);
+ }
+ else
{
- struct sockaddr_nl nladdr;
- memset (&nladdr, '\0', sizeof (nladdr));
- nladdr.nl_family = AF_NETLINK;
+ int fd = __socket (PF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
+
+ if (__builtin_expect (fd >= 0, 1))
+ {
+ struct sockaddr_nl nladdr;
+ memset (&nladdr, '\0', sizeof (nladdr));
+ nladdr.nl_family = AF_NETLINK;
+
+ socklen_t addr_len = sizeof (nladdr);
+
+ if(__bind (fd, (struct sockaddr *) &nladdr, sizeof (nladdr)) == 0
+ && __getsockname (fd, (struct sockaddr *) &nladdr,
+ &addr_len) == 0)
+ data = make_request (fd, nladdr.nl_pid);
+
+ close_not_cancel_no_status (fd);
+ }
+
+ if (data != NULL)
+ {
+ olddata = cache;
+ cache = data;
+ }
+ }
- socklen_t addr_len = sizeof (nladdr);
+ __libc_lock_unlock (lock);
- bool success
- = (__bind (fd, (struct sockaddr *) &nladdr, sizeof (nladdr)) == 0
- && __getsockname (fd, (struct sockaddr *) &nladdr,
- &addr_len) == 0
- && make_request (fd, nladdr.nl_pid, seen_ipv4, seen_ipv6,
- in6ai, in6ailen) == 0);
+ if (data != NULL)
+ {
+ /* It worked. */
+ *seen_ipv4 = data->seen_ipv4;
+ *seen_ipv6 = data->seen_ipv6;
+ *in6ailen = data->in6ailen;
+ *in6ai = data->in6ai;
- close_not_cancel_no_status (fd);
+ if (olddata != NULL && olddata->usecnt > 0
+ && atomic_add_zero (&olddata->usecnt, -1))
+ free (olddata);
- if (success)
- /* It worked. */
- return;
+ return;
}
#if __ASSUME_NETLINK_SUPPORT == 0
@@ -318,3 +406,26 @@ __check_pf (bool *seen_ipv4, bool *seen_ipv6,
(void) freeifaddrs (ifa);
#endif
}
+
+
+void
+__free_in6ai (struct in6addrinfo *ai)
+{
+ if (ai != NULL)
+ {
+ struct cached_data *data =
+ (struct cached_data *) ((char *) ai
+ - offsetof (struct cached_data, in6ai));
+
+ if (atomic_add_zero (&data->usecnt, -1))
+ {
+ __libc_lock_lock (lock);
+
+ if (data->usecnt == 0)
+ /* Still unused. */
+ free (data);
+
+ __libc_lock_unlock (lock);
+ }
+ }
+}

View File

@ -1,8 +1,8 @@
Index: elf/Makefile
Index: glibc-2.15/elf/Makefile
===================================================================
--- elf/Makefile.orig
+++ elf/Makefile
@@ -133,6 +133,7 @@ include ../Makeconfig
--- glibc-2.15.orig/elf/Makefile
+++ glibc-2.15/elf/Makefile
@@ -135,6 +135,7 @@ include ../Makeconfig
ifeq ($(unwind-find-fde),yes)
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,73 @@
-------------------------------------------------------------------
Tue Apr 17 08:29:21 UTC 2012 - aj@suse.de
- Build for power4 only, don't support power3 anymore.
- Add option to build glibc a bit more quickly for testing purposes.
- Remove disabled patch glibc-revert-netlink-cache.patch.
- Start renumbering patches.
-------------------------------------------------------------------
Mon Apr 16 14:31:38 UTC 2012 - aj@suse.de
- Do not build locales and profile for i686 since we only ship
the base and glibc-devel packages.
-------------------------------------------------------------------
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

View File

@ -14,3 +14,5 @@ addFilter(".*permissions-missing-postin missing %set_permissions /usr/.*pt_chown
addFilter("glibc\..*: permissions-missing-requires")
# We will not rename glibc to follow the shlib policy
addFilter("shlib-policy-missing-suffix")
# The dynamic linker and libnsl call exit - this is fine
addFilter(".*shared-lib-calls-exit.*")

View File

@ -16,6 +16,13 @@
#
# The full testsuite is only run with osc --with=glibc_run_testsuite
%bcond_with glibc_run_testsuite
# Run with osc --with=fast_build to have a shorter turnaround
# It will avoid building some parts of glibc and will not run the
# testsuite
%bcond_with fast_build
%define crypt_bf_version 1.2
Name: glibc
@ -25,23 +32,50 @@ Group: System/Libraries
BuildRequires: gcc-c++
BuildRequires: libselinux-devel
BuildRequires: libstdc++-devel
%define _filter_GLIBC_PRIVATE 1
%if %_target_cpu == "i686"
# For i686 we ship only glibc and glibc-devel, so
# let's not build everything
%define build_profile 0
%define build_locales 0
%define build_html 0
%else
%if %{with fast_build}
%define build_profile 0
%define build_locales 0
%define build_html 0
%else
# Default:
%define build_profile 1
%define build_locales 1
%define build_html 1
%endif
%endif
# Enable testsuite runs for local builds
%if %{with fast_build}
%define run_testsuite 0
%else
%if %{with glibc_run_testsuite}
%define run_testsuite 1
%else
%define run_testsuite 0
%endif
%endif
%define disable_assert 0
%define enable_stackguard_randomization 1
%ifarch ppc ppc64
%define optimize_power 1
%ifarch ppc
%define powerpc_optimize_base power3
%define powerpc_optimize_tune power3
%define powerpc_optimize_cpu_power4 1
%define powerpc_optimize_base power4
%define powerpc_optimize_tune power4
%else
%define powerpc_optimize_base power4
%define powerpc_optimize_tune power5
%define powerpc_optimize_cpu_power4 0
%endif
# We are not building Power CPU specific optimizations for openSUSE.
%define powerpc_optimize_cpu_power4 0
%define powerpc_optimize_cpu_power6 0
%define powerpc_optimize_cpu_power7 0
%define powerpc_optimize_cpu_cell 0
@ -110,6 +144,17 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-build
NoSource: 0
%endif
#
###
# Patches are ordered as:
# Patches that we will never upstream or which have not been looked at: 0000-0999
# Patches taken from upstream: 1000-2000
# Patches that are going upstream, waiting approval: 2000-3000
###
###
# Patches that upstream will not accept
###
# PATCH-FIX-OPENSUSE remove lfs test from testsuite aj@suse.de
Patch0: glibc-testsuite.patch
# PATCH-FIX-OPENSUSE handle glibc binaries
@ -148,14 +193,12 @@ Patch28: glibc-2.2-sunrpc.diff
Patch29: glibc-2.8-getconf.diff
# PATCH-FIX-OPENSUSE only use ipv6 if real ipv6 address exists bnc#361697, bnc#684534
Patch30: getaddrinfo-ipv6-sanity.diff
# PATCH-MISSING-TAG -- See http://en.opensuse.org/openSUSE:Packaging_Patches_guidelines
# PATCH-FIX-OPENSUSE add option --enable-runbinaries to disable running of compiled binaries
Patch33: glibc-compiled-binaries.diff
# PATCH-MISSING-TAG -- See http://en.opensuse.org/openSUSE:Packaging_Patches_guidelines
Patch36: glibc-no-unwind-tables.diff
# PATCH-FEATURE-SLE increase cpusetsize to 4096, needs to be kept for compatibility kukuk@suse.de
Patch38: glibc-cpusetsize.diff
# PATCH-FIX-OPENSUSE - Allow compilation with -altivec aj@suse.de
Patch41: glibc-uio-cell.diff
# PATCH-MISSING-TAG -- See http://en.opensuse.org/openSUSE:Packaging_Patches_guidelines
Patch45: glibc-gai-private4.diff
# PATCH-MISSING-TAG -- See http://en.opensuse.org/openSUSE:Packaging_Patches_guidelines
@ -164,7 +207,7 @@ Patch46: glibc-resolv-mdnshint.diff
Patch47: glibc-nscd-hconf.diff
# PATCH-MISSING-TAG -- See http://en.opensuse.org/openSUSE:Packaging_Patches_guidelines
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
# FIX-OPENSUSE compile some files with -fno-strict-aliasing
Patch58: glibc-strict-aliasing.diff
@ -174,16 +217,14 @@ Patch65: glibc-fix-double-loopback.diff
Patch66: glibc2.14-revert-sunrpc-removal.patch
# PATCH-FIX-OPENSUSE revert seeking on fclose for now bnc#711829 matz@suse.de
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
# 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
Patch71: x86-cpuid-level2.patch
# PATCH-FIX-UPSTREAM Fix assertion error in res_query.c (bso#13013)
Patch73: glibc-resolv-assert.diff
# PATCH-FIX-OPENSUSE Run ctors (bnc#717671) aj@suse.de
Patch74: glibc-2.14-fix-ctors.patch
# PATCH-FIX-OPENSUSE Fix missing declarations
Patch75: glibc-2.15-nss_db-declarations.patch
# PATCH-FEATURE-OPENSUSE -- add sha support to crypt_blowfish lnussel@suse.de
Patch80: crypt_blowfish-1.2-sha.diff
# PATCH-FEATURE-OPENSUSE -- use separate symbol version for Owl extensions - lnussel@suse.de
@ -196,18 +237,48 @@ Patch84: nscd-avoid-gcc-warning.diff
Patch87: glibc-nodate.patch
# PATCH-FIX-OPENSUSE revert pthread-cond-wait change since it causes hangs - aj@suse.de
Patch88: pthread-cond-wait-revert.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 cycle detection 2 (from Fedora) - aj@suse.de
Patch100: glibc-sw13618-2.patch
###
# Patches from upstream
###
# PATCH-FIX-UPSTREAM Fix missing declarations
Patch1000: glibc-2.15-nss_db-declarations.patch
# PATCH-FIX-UPSTREAM Fix realloc usage in vfscanf - aj@suse.de
Patch89: glibc-2.16-scanf.patch
Patch1001: glibc-2.16-scanf.patch
# PATCH-FIX-UPSTREAM Fix getcontext on 32-bit powerpc - aj@suse.de
Patch90: glibc-ppc-getcontext.patch
Patch1002: glibc-ppc-getcontext.patch
# PATCH-FIX-UPSTREAM Fix ifunc relocations (bnc#740109) - aj@suse.de
Patch91: glibc-ifunc-2.16.patch
# PATCH-FIX-OPENSUSE Remove netlink optimization (bnc#741021) - aj@suse.de
Patch92: glibc-revert-netlink-cache.patch
Patch1003: glibc-ifunc-2.16.patch
# PATCH-FIX-UPSTREAM Fix tests for AVX features - aj@suse.de
Patch93: glibc-2.16-avx.patch
Patch1004: glibc-2.16-avx.patch
# PATCH-FIX-UPSTREAM vfprintf: validate nargs and maybe allocate from heap bnc#747768 - aj@suse.de
Patch94: vfprintf-nargs.patch
Patch1005: vfprintf-nargs.patch
# PATCH-FIX-UPSTREAM Add Arm dependency on libmemusage - bwiedemann@suse.de
Patch1006: glibc-add-arm-dependency-libmemusage.patch
# PATCH-FIX-UPSTREAM Fix check abi - aj@suse.de
Patch1007: glibc-2.16-fix-check-abi.patch
# PATCH-FIX-UPSTREAM Fix check-localelfplt - aj@suse.de
Patch1008: glibc-2.16-fix-check-localplt.patch
# PATCH-FIX-UPSTREAM - Allow compilation with -altivec aj@suse.de
Patch1009: glibc-uio-cell.diff
###
# Patches awaiting upstream approval
###
# PATCH-FIX-UPSTREAM Fix assertion error in res_query.c (bso#13013)
Patch2001: glibc-resolv-assert.diff
# PATCH-FIX-UPSTREAM Use new common path for ARMv7 hardware float linker - aj@suse.de
Patch2002: armhf-ld-so.patch
# PATCH-FIX-UPSTREAM Fix crash when nscd is not running (bso#135949) - aj@suse.de
Patch2003: glibc-nscd-crash-bso13594.patch
%description
The GNU C Library provides the most important standard libraries used
@ -228,6 +299,7 @@ This package contains the documentation for the GNU C library stored as
info files. Due to a lack of resources, this documentation is not
complete and is partially out of date.
%if %{build_html}
%package html
Summary: HTML Documentation for the GNU C Library
License: GFDL-1.1
@ -238,6 +310,7 @@ BuildArch: noarch
This package contains the HTML documentation for the GNU C library. Due
to a lack of resources, this documentation is not complete and is
partially out of date.
%endif
%package i18ndata
Summary: Database Sources for 'locale'
@ -283,6 +356,7 @@ Requires(postun): %insserv_prereq
Nscd caches name service lookups and can dramatically improve
performance with NIS, NIS+, and LDAP.
%if %{build_profile}
%package profile
Summary: Libc Profiling and Debugging Versions
License: LGPL-2.1+ and SUSE-LGPL-2.1+-with-GCC-exception and GPL-2.0+
@ -299,6 +373,7 @@ Obsoletes: glibc-profile-32bit
%description profile
This package contains special versions of the GNU C library which are
necessary for profiling and debugging.
%endif
%package devel
Summary: Include Files and Libraries Mandatory for Development
@ -394,7 +469,7 @@ mv crypt_blowfish-%crypt_bf_version/*.[chS] crypt/
#
%patch0
# libNoVersion part is only active on ix86
%patch1
%patch1 -p1
%patch3
%patch4
%patch5 -p1
@ -403,8 +478,8 @@ mv crypt_blowfish-%crypt_bf_version/*.[chS] crypt/
%patch8
%patch12
%patch14
%patch16
%patch20
%patch16 -p1
%patch20 -p1
%patch21 -p1
# avoid changing nscd_stat.c mtime to avoid code generation
# differences on each rebuild
@ -414,36 +489,51 @@ touch -r nscd/nscd_stat.c nscd/s-stamp
touch -r nscd/s-stamp nscd/nscd_stat.c
rm nscd/s-stamp
%patch25
%patch28
%patch28 -p1
%patch29
%patch30
%patch33
%patch36
%patch33 -p1
%patch36 -p1
%patch38
%patch41 -p1
%patch1009 -p1
%patch45
%patch46 -p1
%patch47 -p1
%patch49
# XXX: Does not pass testsuite, still there's no better solution yet
%patch52
%patch58
%patch58 -p1
%patch65 -p1
%patch66 -p1
%patch67 -p1
%patch68 -p1
# XXX Patch 69 replaces 68, remove soon
#%patch68 -p1
%patch69 -p1
%patch71 -p1
%patch73 -p1
%patch2001 -p1
%patch74 -p1
%patch75 -p1
%patch84
%patch87 -p0
%patch1000 -p1
%patch84 -p1
%patch87 -p1
%patch88 -p1 -R
%patch89 -p1
%patch90 -p1
%patch91 -p1
%patch92 -p1 -R
%patch93 -p1
%patch94 -p1
%patch1001 -p1
%patch1002 -p1
%patch1003 -p1
%patch1004 -p1
%patch1005 -p1
%patch95 -p1
# XXX Disable, it breaks the testsuite, test elf/tst-audit2
# %patch96 -p1
%patch97 -p1
%patch2003 -p1
%patch1006 -p1
%patch100 -p1
%patch1007 -p1
%patch1008 -p1
%ifarch armv7l
# Disable for now
#%patch2002 -p1
%endif
#
# Inconsistency detected by ld.so: dl-close.c: 719: _dl_close: Assertion `map->l_init_called' failed!
@ -472,6 +562,9 @@ find . -name configure | xargs touch
#######################################################################
%build
%if %{with glibc_run_testsuite}
echo glibc_run_testsuite is set
%endif
if [ -x /bin/uname.bin ]; then
/bin/uname.bin -a
else
@ -488,6 +581,10 @@ nice
%else
%define target %{_target_cpu}-suse-linux
%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
echo "#define CONFHOST \"%{target}\"" >> version.h
echo "#define CVSDATE \"`date -r ChangeLog +%Y%m%d`\"" >> version.h
@ -566,10 +663,14 @@ configure_and_build_glibc() {
%else
conf_cflags="$cflags"
%endif
CFLAGS="$conf_cflags" CC="$BuildCC" CXX="$BuildCCplus" ../configure \
--prefix=%{_prefix} \
--libexecdir=%{_libdir} --infodir=%{_infodir} \
--enable-add-ons=nptl$addons --enable-profile \
--enable-add-ons=nptl$addons \
%if %{build_profile}
--enable-profile \
%endif
"$@" \
%if %{enable_stackguard_randomization}
--enable-stackguard-randomization \
@ -633,7 +734,9 @@ configure_and_build_glibc() {
#
# Build html documentation
#
%if %{build_html}
make -C cc-base html
%endif
#
# Build glibc_post_upgrade binary
@ -669,6 +772,8 @@ popd
#######################################################################
%check
# The testsuite will fail if asneeded is used
export SUSE_ASNEEDED=0
%if %{run_testsuite}
# Increase timeout
export TIMEOUTFACTOR=16
@ -682,7 +787,17 @@ popd
make -C cc-base check
%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
# This has to pass on x86 and x86-64
# Exceptions:
# ARM: There's no check-abi data for arm at all
# s390, s390x, ppc, ppc64: Outdated check-abi data
%ifnarch %arm s390 s390x ppc ppc64
make -C cc-base check-abi
#%else
#make -C cc-base check-abi || echo check-abi failed
%endif
#######################################################################
###
@ -812,8 +927,10 @@ mkdir -p %{buildroot}%{_includedir}/resolv
install -m 0644 resolv/mapv4v6addr.h %{buildroot}%{_includedir}/resolv/
install -m 0644 resolv/mapv4v6hostent.h %{buildroot}%{_includedir}/resolv/
%if %{build_html}
mkdir -p %{buildroot}%{_datadir}/doc/glibc
cp -p manual/libc/*.html %{buildroot}%{_datadir}/doc/glibc
%endif
cd manpages; make install_root=%{buildroot} install; cd ..
@ -879,6 +996,11 @@ mkdir -p %{buildroot}/lib/systemd/system
install -m 644 %{SOURCE21} %{buildroot}/lib/systemd/system
install -m 644 %{SOURCE22} %{buildroot}/lib/systemd/system
%ifarch armv7l
# Provide compatibility link
# XXX ln -s ld-%{version}.so %{buildroot}/lib/ld-linux.so.3
%endif
#######################################################################
###
### ...
@ -951,30 +1073,37 @@ exit 0
%doc %{_mandir}/man1/localedef.1.gz
%doc %{_mandir}/man5/*
/%{_lib}/ld-%{version}.so
%ifarch ppc s390 mips hppa
/%{_lib}/ld.so.1
# Each architecture has a different name for the dynamic linker:
%ifarch %arm
%ifarch armv7l
#XXX /%{_lib}/ld-linux-armhf.so.3
# Keep compatibility link
/%{_lib}/ld-linux.so.3
%else
%ifarch ia64
/%{_lib}/ld-linux-ia64.so.2
%else
%ifarch s390x ppc64
/%{_lib}/ld64.so.1
%ifarch s390x
/lib/ld64.so.1
%endif
%else
%ifarch x86_64
/%{_lib}/ld-linux-x86-64.so.2
%else
%ifarch %arm
/%{_lib}/ld-linux.so.3
%else
/%{_lib}/ld-linux.so.2
%endif
%endif
%endif
%endif
/%{_lib}/ld-linux.so.2
%endif
%endif
%ifarch ia64
/%{_lib}/ld-linux-ia64.so.2
%endif
%ifarch ppc s390 mips hppa
/%{_lib}/ld.so.1
%endif
%ifarch ppc64
/%{_lib}/ld64.so.1
%endif
%ifarch s390x
/lib/ld64.so.1
/%{_lib}/ld64.so.1
%endif
%ifarch x86_64
/%{_lib}/ld-linux-x86-64.so.2
%endif
%ifarch %ix86
/%{_lib}/ld-linux.so.2
%endif
/%{_lib}/libBrokenLocale-%{version}.so
/%{_lib}/libBrokenLocale.so.1
/%{_lib}/libSegFault.so
@ -1065,7 +1194,7 @@ exit 0
%{_libdir}/getconf/*
%{_sbindir}/glibc_post_upgrade
%{_sbindir}/iconvconfig
%dir /var/db
#%dir /var/db
%ifarch %ix86
@ -1131,9 +1260,11 @@ exit 0
%doc %{_infodir}/libc.info-?.gz
%doc %{_infodir}/libc.info-??.gz
%if %{build_html}
%files html
%defattr(-,root,root)
%doc %{_prefix}/share/doc/glibc
%endif
%files i18ndata
%defattr(-,root,root)
@ -1156,6 +1287,7 @@ exit 0
%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/run/nscd/group
%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/run/nscd/hosts
%if %{build_profile}
%files profile
%defattr(-,root,root)
%{_libdir}/libc_p.a
@ -1170,6 +1302,7 @@ exit 0
%{_libdir}/librpcsvc_p.a
%{_libdir}/libutil_p.a
%{_libdir}/libdl_p.a
%endif
%files utils
%defattr(-,root,root)
@ -1189,6 +1322,6 @@ exit 0
%files extra
%defattr(-,root,root)
%{_bindir}/makedb
/var/db/Makefile
/var/lib/misc/Makefile
%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.14/nis/Makefile
--- glibc-2.15.orig/nis/Makefile
+++ glibc-2.15/nis/Makefile
@@ -23,9 +23,9 @@ subdir := nis
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)
# 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.14/NEWS
@@ -20,16 +20,6 @@ Version 2.14
--- glibc-2.15.orig/NEWS
+++ glibc-2.15/NEWS
@@ -84,16 +84,6 @@ Version 2.14
12724, 12734, 12738, 12746, 12766, 12775, 12777, 12782, 12788, 12792,
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,
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.14/include/libc-symbols.h
@@ -635,7 +635,7 @@ for linking")
--- glibc-2.15.orig/include/libc-symbols.h
+++ glibc-2.15/include/libc-symbols.h
@@ -626,7 +626,7 @@ for linking")
# define libc_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
# define libc_hidden_def(name) hidden_def (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_data_def(name) hidden_data_def (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.14/sunrpc/Makefile
--- glibc-2.15.orig/sunrpc/Makefile
+++ glibc-2.15/sunrpc/Makefile
@@ -53,7 +53,7 @@ headers-in-tirpc = $(addprefix rpc/,auth
des_crypt.h)
headers-not-in-tirpc = $(addprefix rpc/,key_prot.h rpc_des.h) \

View File

@ -1,6 +1,8 @@
--- nscd/connections.c
+++ nscd/connections.c
@@ -1717,6 +1717,8 @@
Index: glibc-2.15/nscd/connections.c
===================================================================
--- glibc-2.15.orig/nscd/connections.c
+++ glibc-2.15/nscd/connections.c
@@ -1805,6 +1805,8 @@ handle_request: request received (Versio
++nready;
}
/* 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,11 +26,11 @@ This version disables the useless test on non-32-bit platforms.
* stdio-common/bug-vfprintf-nargs.c: New file.
* stdio-common/Makefile (tests): Add nargs overflow test.
diff --git a/stdio-common/Makefile b/stdio-common/Makefile
index a847b28..080badc 100644
--- a/stdio-common/Makefile
+++ b/stdio-common/Makefile
@@ -59,7 +59,8 @@ tests := tstscanf test_rdwr test-popen tstgetln test-fseek \
Index: glibc-2.15/stdio-common/Makefile
===================================================================
--- glibc-2.15.orig/stdio-common/Makefile
+++ glibc-2.15/stdio-common/Makefile
@@ -60,7 +60,8 @@ tests := tstscanf test_rdwr test-popen t
tst-popen tst-unlockedio tst-fmemopen2 tst-put-error tst-fgets \
tst-fwrite bug16 bug17 tst-swscanf tst-sprintf2 bug18 bug18a \
bug19 bug19a tst-popen2 scanf13 scanf14 scanf15 bug20 bug21 bug22 \
@ -40,11 +40,10 @@ index a847b28..080badc 100644
test-srcs = tst-unbputc tst-printf
diff --git a/stdio-common/bug-vfprintf-nargs.c b/stdio-common/bug-vfprintf-nargs.c
new file mode 100644
index 0000000..13c66c0
Index: glibc-2.15/stdio-common/bug-vfprintf-nargs.c
===================================================================
--- /dev/null
+++ b/stdio-common/bug-vfprintf-nargs.c
+++ glibc-2.15/stdio-common/bug-vfprintf-nargs.c
@@ -0,0 +1,78 @@
+/* Test for vfprintf nargs allocation overflow (BZ #13656).
+ Copyright (C) 2012 Free Software Foundation, Inc.
@ -124,11 +123,11 @@ index 0000000..13c66c0
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
index 863cd5d..022e72b 100644
--- a/stdio-common/vfprintf.c
+++ b/stdio-common/vfprintf.c
@@ -235,6 +235,9 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
Index: glibc-2.15/stdio-common/vfprintf.c
===================================================================
--- glibc-2.15.orig/stdio-common/vfprintf.c
+++ glibc-2.15/stdio-common/vfprintf.c
@@ -236,6 +236,9 @@ vfprintf (FILE *s, const CHAR_T *format,
0 if unknown. */
int readonly_format = 0;
@ -138,7 +137,7 @@ index 863cd5d..022e72b 100644
/* This table maps a character into a number representing a
class. In each step there is a destination label for each
class. */
@@ -1647,9 +1650,10 @@ do_positional:
@@ -1648,9 +1651,10 @@ do_positional:
determine the size of the array needed to store the argument
attributes. */
size_t nargs = 0;
@ -151,7 +150,7 @@ index 863cd5d..022e72b 100644
/* Positional parameters refer to arguments directly. This could
also determine the maximum number of arguments. Track the
@@ -1698,13 +1702,33 @@ do_positional:
@@ -1699,13 +1703,33 @@ do_positional:
/* Determine the number of arguments the format string consumes. */
nargs = MAX (nargs, max_ref_arg);
@ -189,7 +188,7 @@ index 863cd5d..022e72b 100644
/* XXX Could do sanity check here: If any element in ARGS_TYPE is
still zero after this loop, format is invalid. For now we
@@ -1973,8 +1997,8 @@ do_positional:
@@ -1974,8 +1998,8 @@ do_positional:
}
all_done:
@ -200,8 +199,3 @@ index 863cd5d..022e72b 100644
/* Unlock the stream. */
_IO_funlockfile (s);
_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 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
--- a/sysdeps/x86_64/cacheinfo.c
+++ b/sysdeps/x86_64/cacheinfo.c
@@ -254,7 +254,13 @@
Index: glibc-2.15/sysdeps/x86_64/cacheinfo.c
===================================================================
--- 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))
handle_intel (int name, unsigned int maxidx)
{