core/glibc to 2.15-5

This commit is contained in:
Kevin Mihelich 2012-02-05 18:00:41 -05:00
parent 7e2b0274c1
commit 9d6126ea36
8 changed files with 50350 additions and 190 deletions

View file

@ -15,7 +15,7 @@ noautobuild=1
pkgname=glibc
pkgver=2.15
pkgrel=3
pkgrel=5
_glibcdate=20111227
pkgdesc="GNU C Library"
arch=('i686' 'x86_64')
@ -39,9 +39,14 @@ source=(ftp://ftp.archlinux.org/other/glibc/${pkgname}-${pkgver}_${_glibcdate}.t
glibc-2.14-revert-4768ae77.patch
glibc-2.14-reexport-rpc-interface.patch
glibc-2.14-reinstall-nis-rpc-headers.patch
glibc-2.15-regex.patch
glibc-2.15-lddebug-scopes.patch
glibc-2.15-revert-c5a0802a.patch
glibc-2.15-math64crash.patch
glibc-2.15-scanf.patch
glibc-2.15-ifunc.patch
glibc-2.15-avx.patch
glibc-2.15-gb18030.patch
glibc-2.15-revert-netlink-cache.patch
nscd
locale.gen.txt
locale-gen)
@ -55,9 +60,14 @@ md5sums=('6ffdf5832192b92f98bdd125317c0dfc'
'7da8c554a3b591c7401d7023b1928afc'
'c5de2a946215d647c8af5432ec4b0da0'
'55febbb72139ac7b65757df085024b83'
'b3526cbd5e29773560dba725db99af5a'
'3c219ddfb619b6df903cac4cc42c611d'
'7ae3e426251ae33e73dbad71f9c91378'
'dc7550e659ddd685bd78a930d15a01f2'
'39353f53168f4a7509ba5fe0d9f218b8'
'136eb969f5d6bb6f5155f72a1a7cf23e'
'41ae047ac88e8f6f547c70b0a0bc3b72'
'c4cd34f20ccd37817f6c1374bd4ee68e'
'6771b0b2bb8aa3870a259fd2f46c424f'
'b587ee3a70c9b3713099295609afde49'
'07ac979b6ab5eeb778d55f041529d623'
'476e9113489f93b348b21e144b6a8fcf')
@ -108,6 +118,10 @@ build() {
# http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=bdd816a3 (only fedora branch...)
patch -Np1 -i ${srcdir}/glibc-2.14-reinstall-nis-rpc-headers.patch
# Fix up regcomp/regexec
# http://sourceware.org/git/?p=glibc.git;a=commit;h=2ba92745
patch -Np1 -i ${srcdir}/glibc-2.15-regex.patch
# propriety nvidia crash - https://bugzilla.redhat.com/show_bug.cgi?id=737223
# http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=0c95ab64 (only fedora branch...)
patch -Np1 -i ${srcdir}/glibc-2.15-lddebug-scopes.patch
@ -116,9 +130,29 @@ build() {
# https://bugzilla.redhat.com/show_bug.cgi?id=769421
patch -Np1 -i ${srcdir}/glibc-2.15-revert-c5a0802a.patch
# revert optimized math routines that can cause crashes (FS#27736, FS#27743)
# obviously not a real fix...
patch -Np1 -i ${srcdir}/glibc-2.15-math64crash.patch
# fix realloc usage in vfscanf
# http://sourceware.org/git/?p=glibc.git;a=commit;h=20b38e03
patch -Np1 -i ${srcdir}/glibc-2.15-scanf.patch
# fix ifunc relocations
# http://sourceware.org/git/?p=glibc.git;a=commit;h=6ee65ed6
patch -Np1 -i ${srcdir}/glibc-2.15-ifunc.patch
# fix AVX detection
# http://sourceware.org/git/?p=glibc.git;a=commit;h=afc5ed09
# http://sourceware.org/git/?p=glibc.git;a=commit;h=08cf777f
patch -Np1 -i ${srcdir}/glibc-2.15-avx.patch
# fix GB18030 charmap
# http://sourceware.org/bugzilla/show_bug.cgi?id=11837
# http://sourceware.org/git/?p=glibc.git;a=commit;h=2a57bd79 (fedora branch)
# http://sourceware.org/git/?p=glibc.git;a=commit;h=3d828a61 (fedora branch)
patch -Np1 -i ${srcdir}/glibc-2.15-gb18030.patch
# fix crash in __nscd_get_mapping if nscd not running
# http://sourceware.org/bugzilla/show_bug.cgi?id=13594
# reverts commit 3a2c0242 and other necessary following changes...
patch -Np1 -i ${srcdir}/glibc-2.15-revert-netlink-cache.patch
install -dm755 ${pkgdir}/etc
touch ${pkgdir}/etc/ld.so.conf

View file

@ -0,0 +1,196 @@
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 65b0ee9..76d146c 100644
--- a/sysdeps/x86_64/multiarch/init-arch.c
+++ b/sysdeps/x86_64/multiarch/init-arch.c
@@ -1,6 +1,6 @@
/* Initialize CPU feature data.
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.
Contributed by Ulrich Drepper <drepper@redhat.com>.
The GNU C Library is free software; you can redistribute it and/or
@@ -144,6 +144,18 @@ __init_cpu_features (void)
else
kind = arch_kind_other;
+ 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.feature[index_YMM_Usable] |= bit_YMM_Usable;
+ }
+
__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..2dc75ab 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
@@ -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)
+#define bit_YMM_Usable (1 << 6)
#define bit_SSE2 (1 << 26)
#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)
@@ -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
+# define index_YMM_Usable FEATURE_INDEX_1*FEATURE_SIZE
#else /* __ASSEMBLER__ */
@@ -92,7 +95,7 @@ extern struct cpu_features
extern void __init_cpu_features (void) attribute_hidden;
-#define INIT_ARCH()\
+# define INIT_ARCH() \
do \
if (__cpu_features.kind == arch_kind_unknown) \
__init_cpu_features (); \
@@ -125,23 +128,21 @@ extern const struct cpu_features *__get_cpu_features (void)
# define index_Slow_BSF FEATURE_INDEX_1
# define index_Prefer_SSE_for_memop FEATURE_INDEX_1
# define index_Fast_Unaligned_Load FEATURE_INDEX_1
+# define index_YMM_Usable FEATURE_INDEX_1
-#define HAS_ARCH_FEATURE(idx, bit) \
- ((__get_cpu_features ()->feature[idx] & (bit)) != 0)
+# define HAS_ARCH_FEATURE(name) \
+ ((__get_cpu_features ()->feature[index_##name] & (bit_##name)) != 0)
-#define HAS_FAST_REP_STRING \
- HAS_ARCH_FEATURE (index_Fast_Rep_String, bit_Fast_Rep_String)
+# define HAS_FAST_REP_STRING HAS_ARCH_FEATURE (Fast_Rep_String)
-#define HAS_FAST_COPY_BACKWARD \
- HAS_ARCH_FEATURE (index_Fast_Copy_Backward, bit_Fast_Copy_Backward)
+# define HAS_FAST_COPY_BACKWARD HAS_ARCH_FEATURE (Fast_Copy_Backward)
-#define HAS_SLOW_BSF \
- HAS_ARCH_FEATURE (index_Slow_BSF, bit_Slow_BSF)
+# define HAS_SLOW_BSF HAS_ARCH_FEATURE (Slow_BSF)
-#define HAS_PREFER_SSE_FOR_MEMOP \
- HAS_ARCH_FEATURE (index_Prefer_SSE_for_memop, bit_Prefer_SSE_for_memop)
+# define HAS_PREFER_SSE_FOR_MEMOP HAS_ARCH_FEATURE (Prefer_SSE_for_memop)
-#define HAS_FAST_UNALIGNED_LOAD \
- HAS_ARCH_FEATURE (index_Fast_Unaligned_Load, bit_Fast_Unaligned_Load)
+# define HAS_FAST_UNALIGNED_LOAD HAS_ARCH_FEATURE (Fast_Unaligned_Load)
+
+# define HAS_YMM_USABLE HAS_ARCH_FEATURE (YMM_Usable)
#endif /* __ASSEMBLER__ */
--
1.7.9

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,285 @@
From 6ee65ed6ddbf04402fad0bec6aa9c73b9d982ae4 Mon Sep 17 00:00:00 2001
From: Ulrich Drepper <drepper@gmail.com>
Date: Fri, 27 Jan 2012 15:05:19 -0500
Subject: [PATCH] Sort objects before relocations
---
ChangeLog | 11 ++++
Makeconfig | 6 ++
NEWS | 4 +-
elf/Makefile | 15 +++++-
elf/dl-open.c | 128 ++++++++++++++++++++++++++++++++++++------------
elf/tst-relsort1.c | 19 +++++++
elf/tst-relsort1mod1.c | 7 +++
elf/tst-relsort1mod2.c | 7 +++
8 files changed, 160 insertions(+), 37 deletions(-)
create mode 100644 elf/tst-relsort1.c
create mode 100644 elf/tst-relsort1mod1.c
create mode 100644 elf/tst-relsort1mod2.c
diff --git a/Makeconfig b/Makeconfig
index 2db2821..68547b2 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -900,6 +900,12 @@ else
libdl = $(common-objpfx)dlfcn/libdl.a
endif
+ifeq ($(build-shared),yes)
+libm = $(common-objpfx)math/libm.so$(libm.so-version)
+else
+libm = $(common-objpfx)math/libm.a
+endif
+
# 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
@@ -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 \
tst-initorder.c \
- tst-initorder2.c
+ tst-initorder2.c \
+ tst-relsort1.c tst-relsort1mod1.c tst-relsort1mod2.c
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 \
tst-audit1 tst-audit2 \
tst-stackguard1 tst-addr1 tst-thrlock \
tst-unique1 tst-unique2 tst-unique3 tst-unique4 \
- tst-initorder tst-initorder2
+ tst-initorder tst-initorder2 tst-relsort1
# 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 \
tst-initordera1 tst-initorderb1 \
tst-initordera2 tst-initorderb2 \
tst-initordera3 tst-initordera4 \
- tst-initorder2a tst-initorder2b tst-initorder2c tst-initorder2d
+ tst-initorder2a tst-initorder2b tst-initorder2c \
+ tst-initorder2d \
+ tst-relsort1mod1 tst-relsort1mod2
ifeq (yes,$(have-initfini-array))
modules-names += tst-array2dep tst-array5dep
endif
@@ -1195,3 +1198,9 @@ CFLAGS-tst-auditmod6b.c += $(AVX-CFLAGS)
CFLAGS-tst-auditmod6c.c += $(AVX-CFLAGS)
CFLAGS-tst-auditmod7b.c += $(AVX-CFLAGS)
endif
+
+$(objpfx)tst-relsort1: $(libdl)
+$(objpfx)tst-relsort1mod1.so: $(libm) $(objpfx)tst-relsort1mod2.so
+$(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
@@ -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.
+ Copyright (C) 1996-2007, 2009, 2010, 2011, 2012 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
@@ -302,45 +302,109 @@ dl_open_worker (void *a)
if (GLRO(dl_lazy))
reloc_mode |= mode & RTLD_LAZY;
- /* Relocate the objects loaded. We do this in reverse order so that copy
- relocs of earlier objects overwrite the data written by later objects. */
-
+ /* Sort the objects by dependency for the relocation process. This
+ allows IFUNC relocations to work and it also means copy
+ relocation of dependencies are if necessary overwritten. */
+ size_t nmaps = 0;
struct link_map *l = new;
- while (l->l_next)
- l = l->l_next;
- while (1)
+ do
+ {
+ if (! l->l_real->l_relocated)
+ ++nmaps;
+ l = l->l_next;
+ }
+ while (l != NULL);
+ struct link_map *maps[nmaps];
+ nmaps = 0;
+ l = new;
+ do
{
if (! l->l_real->l_relocated)
+ maps[nmaps++] = l;
+ l = l->l_next;
+ }
+ while (l != NULL);
+ if (nmaps > 1)
+ {
+ char seen[nmaps];
+ memset (seen, '\0', nmaps);
+ size_t i = 0;
+ while (1)
{
-#ifdef SHARED
- if (__builtin_expect (GLRO(dl_profile) != NULL, 0))
+ ++seen[i];
+ struct link_map *thisp = maps[i];
+
+ /* Find the last object in the list for which the current one is
+ a dependency and move the current object behind the object
+ with the dependency. */
+ size_t k = nmaps - 1;
+ while (k > i)
{
- /* If this here is the shared object which we want to profile
- make sure the profile is started. We can find out whether
- this is necessary or not by observing the `_dl_profile_map'
- variable. If was NULL but is not NULL afterwars we must
- start the profiling. */
- struct link_map *old_profile_map = GL(dl_profile_map);
+ struct link_map **runp = maps[k]->l_initfini;
+ if (runp != NULL)
+ /* Look through the dependencies of the object. */
+ while (*runp != NULL)
+ if (__builtin_expect (*runp++ == thisp, 0))
+ {
+ /* Move the current object to the back past the last
+ object with it as the dependency. */
+ memmove (&maps[i], &maps[i + 1],
+ (k - i) * sizeof (maps[0]));
+ maps[k] = thisp;
+
+ if (seen[i + 1] > 1)
+ {
+ ++i;
+ goto next_clear;
+ }
+
+ char this_seen = seen[i];
+ memmove (&seen[i], &seen[i + 1],
+ (k - i) * sizeof (seen[0]));
+ seen[k] = this_seen;
+
+ goto next;
+ }
+
+ --k;
+ }
- _dl_relocate_object (l, l->l_scope, reloc_mode | RTLD_LAZY, 1);
+ if (++i == nmaps)
+ break;
+ next_clear:
+ memset (&seen[i], 0, (nmaps - i) * sizeof (seen[0]));
+ next:;
+ }
+ }
- if (old_profile_map == NULL && GL(dl_profile_map) != NULL)
- {
- /* We must prepare the profiling. */
- _dl_start_profile ();
+ for (size_t i = nmaps; i-- > 0; )
+ {
+ l = maps[i];
- /* Prevent unloading the object. */
- GL(dl_profile_map)->l_flags_1 |= DF_1_NODELETE;
- }
+#ifdef SHARED
+ if (__builtin_expect (GLRO(dl_profile) != NULL, 0))
+ {
+ /* If this here is the shared object which we want to profile
+ make sure the profile is started. We can find out whether
+ this is necessary or not by observing the `_dl_profile_map'
+ 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 (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;
}
- else
-#endif
- _dl_relocate_object (l, l->l_scope, reloc_mode, 0);
}
-
- if (l == new)
- break;
- l = l->l_prev;
+ else
+#endif
+ _dl_relocate_object (l, l->l_scope, reloc_mode, 0);
}
/* 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
--- /dev/null
+++ b/elf/tst-relsort1.c
@@ -0,0 +1,19 @@
+#include <dlfcn.h>
+#include <stdio.h>
+
+
+static int
+do_test ()
+{
+ const char lib[] = "$ORIGIN/tst-relsort1mod1.so";
+ void *h = dlopen (lib, RTLD_NOW);
+ if (h == NULL)
+ {
+ puts (dlerror ());
+ return 1;
+ }
+ return 0;
+}
+
+#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
--- /dev/null
+++ b/elf/tst-relsort1mod1.c
@@ -0,0 +1,7 @@
+extern int foo (double);
+
+int
+bar (void)
+{
+ return foo (1.2);
+}
diff --git a/elf/tst-relsort1mod2.c b/elf/tst-relsort1mod2.c
new file mode 100644
index 0000000..a2c3e55
--- /dev/null
+++ b/elf/tst-relsort1mod2.c
@@ -0,0 +1,7 @@
+#include <math.h>
+
+int
+foo (double d)
+{
+ return floor (d) != 0.0;
+}
--
1.7.3.4

View file

@ -1,184 +0,0 @@
diff --git a/sysdeps/x86_64/fpu/multiarch/Makefile b/sysdeps/x86_64/fpu/multiarch/Makefile
index be68903..a032da8 100644
--- a/sysdeps/x86_64/fpu/multiarch/Makefile
+++ b/sysdeps/x86_64/fpu/multiarch/Makefile
@@ -1,5 +1,5 @@
ifeq ($(subdir),math)
-libm-sysdep_routines += s_floor-c s_ceil-c s_floorf-c s_ceilf-c \
+libm-sysdep_routines += s_floorf-c s_ceilf-c \
s_rint-c s_rintf-c s_nearbyint-c s_nearbyintf-c
ifeq ($(have-mfma4),yes)
diff --git a/sysdeps/x86_64/fpu/multiarch/s_ceil-c.c b/sysdeps/x86_64/fpu/multiarch/s_ceil-c.c
deleted file mode 100644
index 6a5ea3f..0000000
--- a/sysdeps/x86_64/fpu/multiarch/s_ceil-c.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define __ceil __ceil_c
-#include <sysdeps/ieee754/dbl-64/wordsize-64/s_ceil.c>
diff --git a/sysdeps/x86_64/fpu/multiarch/s_ceil.S b/sysdeps/x86_64/fpu/multiarch/s_ceil.S
deleted file mode 100644
index d0f8da3..0000000
--- a/sysdeps/x86_64/fpu/multiarch/s_ceil.S
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright (C) 2011 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@gmail.come>, 2011.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <machine/asm.h>
-#include <init-arch.h>
-
-
-ENTRY(__ceil)
- .type __ceil, @gnu_indirect_function
- call __get_cpu_features@plt
- movq %rax, %rdx
- leaq __ceil_sse41(%rip), %rax
- testl $bit_SSE4_1, CPUID_OFFSET+index_SSE4_1(%rdx)
- jnz 2f
- leaq __ceil_c(%rip), %rax
-2: ret
-END(__ceil)
-weak_alias (__ceil, ceil)
-
-
-ENTRY(__ceil_sse41)
- roundsd $2, %xmm0, %xmm0
- ret
-END(__ceil_sse41)
diff --git a/sysdeps/x86_64/fpu/multiarch/s_floor-c.c b/sysdeps/x86_64/fpu/multiarch/s_floor-c.c
deleted file mode 100644
index 68733b6..0000000
--- a/sysdeps/x86_64/fpu/multiarch/s_floor-c.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#undef __floor
-#define __floor __floor_c
-#include <sysdeps/ieee754/dbl-64/wordsize-64/s_floor.c>
diff --git a/sysdeps/x86_64/fpu/multiarch/s_floor.S b/sysdeps/x86_64/fpu/multiarch/s_floor.S
deleted file mode 100644
index 514ea95..0000000
--- a/sysdeps/x86_64/fpu/multiarch/s_floor.S
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright (C) 2011 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@gmail.come>, 2011.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <machine/asm.h>
-#include <init-arch.h>
-
-
-ENTRY(__floor)
- .type __floor, @gnu_indirect_function
- call __get_cpu_features@plt
- movq %rax, %rdx
- leaq __floor_sse41(%rip), %rax
- testl $bit_SSE4_1, CPUID_OFFSET+index_SSE4_1(%rdx)
- jnz 2f
- leaq __floor_c(%rip), %rax
-2: ret
-END(__floor)
-weak_alias (__floor, floor)
-
-
-ENTRY(__floor_sse41)
- roundsd $1, %xmm0, %xmm0
- ret
-END(__floor_sse41)
diff --git a/sysdeps/x86_64/fpu/multiarch/s_sin.c b/sysdeps/x86_64/fpu/multiarch/s_sin.c
deleted file mode 100644
index 1ba9dbc..0000000
--- a/sysdeps/x86_64/fpu/multiarch/s_sin.c
+++ /dev/null
@@ -1,31 +0,0 @@
-#if defined HAVE_FMA4_SUPPORT || defined HAVE_AVX_SUPPORT
-# include <init-arch.h>
-# include <math.h>
-# undef NAN
-
-extern double __cos_sse2 (double);
-extern double __sin_sse2 (double);
-extern double __cos_avx (double);
-extern double __sin_avx (double);
-# ifdef HAVE_FMA4_SUPPORT
-extern double __cos_fma4 (double);
-extern double __sin_fma4 (double);
-# else
-# undef HAS_FMA4
-# define HAS_FMA4 0
-# define __cos_fma4 ((void *) 0)
-# define __sin_fma4 ((void *) 0)
-# endif
-
-libm_ifunc (__cos, HAS_FMA4 ? __cos_fma4 : HAS_AVX ? __cos_avx : __cos_sse2);
-weak_alias (__cos, cos)
-
-libm_ifunc (__sin, HAS_FMA4 ? __sin_fma4 : HAS_AVX ? __sin_avx : __sin_sse2);
-weak_alias (__sin, sin)
-
-# define __cos __cos_sse2
-# define __sin __sin_sse2
-#endif
-
-
-#include <sysdeps/ieee754/dbl-64/s_sin.c>
diff --git a/sysdeps/x86_64/fpu/multiarch/s_tan.c b/sysdeps/x86_64/fpu/multiarch/s_tan.c
deleted file mode 100644
index 8f6601e..0000000
--- a/sysdeps/x86_64/fpu/multiarch/s_tan.c
+++ /dev/null
@@ -1,21 +0,0 @@
-#if defined HAVE_FMA4_SUPPORT || defined HAVE_AVX_SUPPORT
-# include <init-arch.h>
-# include <math.h>
-
-extern double __tan_sse2 (double);
-extern double __tan_avx (double);
-# ifdef HAVE_FMA4_SUPPORT
-extern double __tan_fma4 (double);
-# else
-# undef HAS_FMA4
-# define HAS_FMA4 0
-# define __tan_fma4 ((void *) 0)
-# endif
-
-libm_ifunc (tan, HAS_FMA4 ? __tan_fma4 : HAS_AVX ? __tan_avx : __tan_sse2);
-
-# define tan __tan_sse2
-#endif
-
-
-#include <sysdeps/ieee754/dbl-64/s_tan.c>

View file

@ -0,0 +1,16 @@
diff --git a/posix/regex_internal.c b/posix/regex_internal.c
index bc19243..124f8cc 100644
--- a/posix/regex_internal.c
+++ b/posix/regex_internal.c
@@ -868,7 +868,7 @@ re_string_peek_byte_case (const re_string_t *pstr, int idx)
}
static unsigned char
-internal_function __attribute ((pure))
+internal_function
re_string_fetch_byte_case (re_string_t *pstr)
{
if (BE (!pstr->mbs_allocated, 1))
--
1.7.3.4

View file

@ -0,0 +1,700 @@
From 2a3a38c03b6e376a9bc8a1937641e5dee979bcbf Mon Sep 17 00:00:00 2001
From: Allan McRae <allan@archlinux.org>
Date: Sat, 4 Feb 2012 15:28:54 +1000
Subject: [PATCH] revert stuff
---
include/ifaddrs.h | 5 -
inet/check_pf.c | 18 +----
nscd/connections.c | 119 ------------------------
nscd/nscd-client.h | 18 +----
nscd/nscd_gethst_r.c | 23 +-----
nscd/nscd_helper.c | 10 +-
sysdeps/posix/getaddrinfo.c | 10 +-
sysdeps/unix/sysv/linux/Makefile | 2 +-
sysdeps/unix/sysv/linux/check_pf.c | 176 +++++++-----------------------------
9 files changed, 46 insertions(+), 335 deletions(-)
diff --git a/include/ifaddrs.h b/include/ifaddrs.h
index e1c6cac..50e4c48 100644
--- a/include/ifaddrs.h
+++ b/include/ifaddrs.h
@@ -21,13 +21,8 @@ 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 0fa34cc..b015432 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, 2011 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2006 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,19 +54,3 @@ __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 c741996..2b5c7ef 100644
--- a/nscd/connections.c
+++ b/nscd/connections.c
@@ -24,7 +24,6 @@
#include <errno.h>
#include <fcntl.h>
#include <grp.h>
-#include <ifaddrs.h>
#include <libintl.h>
#include <pthread.h>
#include <pwd.h>
@@ -33,10 +32,6 @@
#include <stdlib.h>
#include <unistd.h>
#include <arpa/inet.h>
-#ifdef HAVE_NETLINK
-# include <linux/netlink.h>
-# include <linux/rtnetlink.h>
-#endif
#ifdef HAVE_EPOLL
# include <sys/epoll.h>
#endif
@@ -252,11 +247,6 @@ 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. */
@@ -913,65 +903,6 @@ 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 ();
@@ -1895,18 +1826,6 @@ 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
@@ -2049,20 +1968,6 @@ 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)
{
@@ -2141,17 +2046,6 @@ 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];
@@ -2268,18 +2162,6 @@ 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. */
@@ -2303,7 +2185,6 @@ 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 b5cd2d2..caad26a 100644
--- a/nscd/nscd-client.h
+++ b/nscd/nscd-client.h
@@ -260,17 +260,12 @@ struct hashentry
/* Current persistent database version. */
-#define DB_VERSION 2
+#define DB_VERSION 1
/* 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
{
@@ -279,8 +274,6 @@ 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;
@@ -329,12 +322,6 @@ 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,
@@ -384,7 +371,4 @@ 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 6ee142d..70631fa 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, 2011
+/* Copyright (C) 1998-2005, 2006, 2007, 2008, 2009
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -98,27 +98,6 @@ 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 365b599..fe63f9a 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. */
-struct mapped_database *
-__nscd_get_mapping (request_type type, const char *key,
- struct mapped_database **mappedp)
+static struct mapped_database *
+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 = __nscd_get_mapping (type, name,
- (struct mapped_database **) &mapptr->mapped);
+ cur = 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 1a023f9..4979805 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 (in6ai);
+ free (in6ai);
return EAI_NONAME;
}
}
@@ -2400,7 +2400,7 @@ getaddrinfo (const char *name, const char *service,
{
if (hints->ai_flags & AI_NUMERICSERV)
{
- __free_in6ai (in6ai);
+ free (in6ai);
return EAI_NONAME;
}
@@ -2422,7 +2422,7 @@ getaddrinfo (const char *name, const char *service,
if (last_i != 0)
{
freeaddrinfo (p);
- __free_in6ai (in6ai);
+ free (in6ai);
return -(last_i & GAIH_EAI);
}
@@ -2434,7 +2434,7 @@ getaddrinfo (const char *name, const char *service,
}
else
{
- __free_in6ai (in6ai);
+ free (in6ai);
return EAI_FAMILY;
}
@@ -2622,7 +2622,7 @@ getaddrinfo (const char *name, const char *service,
p->ai_canonname = canonname;
}
- __free_in6ai (in6ai);
+ free (in6ai);
if (p)
{
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index e684b16..c907af4 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -173,6 +173,6 @@ CFLAGS-mq_receive.c += -fexceptions
endif
ifeq ($(subdir),nscd)
-sysdep-CFLAGS += -DHAVE_EPOLL -DHAVE_SENDFILE -DHAVE_INOTIFY -DHAVE_NETLINK
+sysdep-CFLAGS += -DHAVE_EPOLL -DHAVE_SENDFILE -DHAVE_INOTIFY
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 0738a70..d5ad7ea 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-2008, 2010, 2011 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2006, 2007, 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,9 +33,6 @@
#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
@@ -46,42 +43,9 @@
#endif
-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 = 1, /* 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)
+static int
+make_request (int fd, pid_t pid, bool *seen_ipv4, bool *seen_ipv6,
+ struct in6addrinfo **in6ai, size_t *in6ailen)
{
struct req
{
@@ -135,6 +99,9 @@ make_request (int fd, pid_t pid)
sizeof (nladdr))) < 0)
goto out_fail;
+ *seen_ipv4 = false;
+ *seen_ipv6 = false;
+
bool done = false;
struct in6ailist
{
@@ -142,8 +109,6 @@ make_request (int fd, pid_t pid)
struct in6ailist *next;
} *in6ailist = NULL;
size_t in6ailistlen = 0;
- bool seen_ipv4 = false;
- bool seen_ipv6 = false;
do
{
@@ -207,12 +172,12 @@ make_request (int fd, pid_t pid)
{
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;
}
}
@@ -246,47 +211,30 @@ make_request (int fd, pid_t pid)
}
while (! done);
- struct cached_data *result;
- if (seen_ipv6 && in6ailist != NULL)
+ if (*seen_ipv6 && in6ailist != NULL)
{
- result = malloc (sizeof (*result)
- + in6ailistlen * sizeof (struct in6addrinfo));
- if (result == NULL)
+ *in6ai = malloc (in6ailistlen * sizeof (**in6ai));
+ if (*in6ai == NULL)
goto out_fail;
-#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;
+ *in6ailen = in6ailistlen;
do
{
- result->in6ai[--in6ailistlen] = in6ailist->info;
+ (*in6ai)[--in6ailistlen] = in6ailist->info;
in6ailist = in6ailist->next;
}
while (in6ailist != NULL);
}
- else
- {
- atomic_add (&noai6ai_cached.usecnt, 2);
- noai6ai_cached.seen_ipv4 = seen_ipv4;
- noai6ai_cached.seen_ipv6 = seen_ipv6;
- result = &noai6ai_cached;
- }
if (use_malloc)
free (buf);
- return result;
+ return 0;
out_fail:
if (use_malloc)
free (buf);
- return NULL;
+ return -1;
}
@@ -310,65 +258,28 @@ __check_pf (bool *seen_ipv4, bool *seen_ipv6,
if (! __no_netlink_support)
{
- struct cached_data *olddata = NULL;
- struct cached_data *data = NULL;
+ int fd = __socket (PF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
- __libc_lock_lock (lock);
-
-#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
+ if (__builtin_expect (fd >= 0, 1))
{
- int fd = __socket (PF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
+ struct sockaddr_nl nladdr;
+ memset (&nladdr, '\0', sizeof (nladdr));
+ nladdr.nl_family = AF_NETLINK;
- 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;
-
- if (olddata != NULL && olddata->usecnt > 0
- && atomic_add_zero (&olddata->usecnt, -1))
- free (olddata);
+ close_not_cancel_no_status (fd);
- return;
+ if (success)
+ /* It worked. */
+ return;
}
#if __ASSUME_NETLINK_SUPPORT == 0
@@ -407,26 +318,3 @@ __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);
- }
- }
-}
--
1.7.9

View file

@ -0,0 +1,32 @@
From 20b38e0301279a37a3f1e769843933bcc0d5f736 Mon Sep 17 00:00:00 2001
From: Paul Pluzhnikov <ppluzhnikov@google.com>
Date: Sun, 8 Jan 2012 20:13:35 -0500
Subject: [PATCH 1/1] sscanf always calls realloc
---
ChangeLog | 5 +++++
stdio-common/vfscanf.c | 4 ++--
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/stdio-common/vfscanf.c b/stdio-common/vfscanf.c
index 0e71deb..e18a6c3 100644
--- a/stdio-common/vfscanf.c
+++ b/stdio-common/vfscanf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2006, 2007, 2010, 2011 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2007, 2010, 2011, 2012 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
@@ -274,7 +274,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
CHAR_T *old = wp; \
size_t newsize = (UCHAR_MAX + 1 > 2 * wpmax \
? UCHAR_MAX + 1 : 2 * wpmax); \
- if (use_malloc || __libc_use_alloca (newsize)) \
+ if (use_malloc || !__libc_use_alloca (newsize)) \
{ \
wp = realloc (use_malloc ? wp : NULL, newsize); \
if (wp == NULL) \
--
1.7.3.4