wok rev 12269

Up: glibc (2.14.1)
author Christophe Lincoln <pankso@slitaz.org>
date Thu Apr 12 16:31:36 2012 +0200 (2012-04-12)
parents 97e8e0e4f878
children 475688256701
files glibc-base/receipt glibc-base/stuff/wanted-files.list glibc-dev/receipt glibc-extra-samba/receipt glibc-locale/receipt glibc/receipt glibc/stuff/glibc-2.14-reexport-rpc-interface.patch glibc/stuff/glibc-2.14-reinstall-nis-rpc-headers.patch glibc/stuff/glibc-2.14-revert-4768ae77.patch glibc/stuff/glibc-2.14.1-fixes-1.patch glibc/stuff/glibc-2.14.1-gcc_fix-1.patch glibc/stuff/glibc-2.14.1-sort-1.patch
line diff
     1.1 --- a/glibc-base/receipt	Thu Apr 12 15:19:10 2012 +0200
     1.2 +++ b/glibc-base/receipt	Thu Apr 12 16:31:36 2012 +0200
     1.3 @@ -1,7 +1,7 @@
     1.4  # SliTaz package receipt.
     1.5  
     1.6  PACKAGE="glibc-base"
     1.7 -VERSION="2.13"
     1.8 +VERSION="2.14.1"
     1.9  CATEGORY="base-system"
    1.10  SHORT_DESC="GNU libc minimal libraries and UTF-8 support for SliTaz."
    1.11  WEB_SITE="http://www.gnu.org/software/libc/"
    1.12 @@ -32,7 +32,7 @@
    1.13      # i18n
    1.14      for i in $DEFAULT_LOCALE
    1.15  	do
    1.16 -		cp $_pkg/usr/share/i18n/locales/$i $fs/usr/share/i18n/locales
    1.17 +		cp $install/usr/share/i18n/locales/$i $fs/usr/share/i18n/locales
    1.18  	done
    1.19  }
    1.20  
     2.1 --- a/glibc-base/stuff/wanted-files.list	Thu Apr 12 15:19:10 2012 +0200
     2.2 +++ b/glibc-base/stuff/wanted-files.list	Thu Apr 12 16:31:36 2012 +0200
     2.3 @@ -1,18 +1,18 @@
     2.4 -/lib/libutil-2.13.so
     2.5 -/lib/libnss_dns-2.13.so
     2.6 -/lib/libnsl-2.13.so
     2.7 -/lib/libanl-2.13.so
     2.8 -/lib/libm-2.13.so
     2.9 -/lib/libpthread-2.13.so
    2.10 +/lib/libutil-2.14.1.so
    2.11 +/lib/libnss_dns-2.14.1.so
    2.12 +/lib/libnsl-2.14.1.so
    2.13 +/lib/libanl-2.14.1.so
    2.14 +/lib/libm-2.14.1.so
    2.15 +/lib/libpthread-2.14.1.so
    2.16  /lib/libthread_db-1.0.so
    2.17 -/lib/libnss_compat-2.13.so
    2.18 -/lib/libc-2.13.so
    2.19 -/lib/librt-2.13.so
    2.20 -/lib/libcrypt-2.13.so
    2.21 -/lib/ld-2.13.so
    2.22 -/lib/libresolv-2.13.so
    2.23 -/lib/libnss_files-2.13.so
    2.24 -/lib/libdl-2.13.so
    2.25 +/lib/libnss_compat-2.14.1.so
    2.26 +/lib/libc-2.14.1.so
    2.27 +/lib/librt-2.14.1.so
    2.28 +/lib/libcrypt-2.14.1.so
    2.29 +/lib/ld-2.14.1.so
    2.30 +/lib/libresolv-2.14.1.so
    2.31 +/lib/libnss_files-2.14.1.so
    2.32 +/lib/libdl-2.14.1.so
    2.33  
    2.34  /usr/lib/gconv/UNICODE.so
    2.35  /usr/lib/gconv/gconv-modules
     3.1 --- a/glibc-dev/receipt	Thu Apr 12 15:19:10 2012 +0200
     3.2 +++ b/glibc-dev/receipt	Thu Apr 12 16:31:36 2012 +0200
     3.3 @@ -1,7 +1,7 @@
     3.4  # SliTaz package receipt.
     3.5  
     3.6  PACKAGE="glibc-dev"
     3.7 -VERSION="2.13"
     3.8 +VERSION="2.14.1"
     3.9  CATEGORY="development"
    3.10  SHORT_DESC="The GNU C libraries devel files (Part of SliTaz toolchain)."
    3.11  MAINTAINER="pankso@slitaz.org"
    3.12 @@ -17,7 +17,7 @@
    3.13  {
    3.14      # Mass copy and then remove all files specified in stuff/base-files.list.
    3.15      # We get the files from glibc-base. Locale files are in: glibc-locale.
    3.16 -    cp -a $_pkg/* $fs
    3.17 +    cp -a $install/* $fs
    3.18      
    3.19      # Rm base files.
    3.20      echo -n "Removing all base files..."
     4.1 --- a/glibc-extra-samba/receipt	Thu Apr 12 15:19:10 2012 +0200
     4.2 +++ b/glibc-extra-samba/receipt	Thu Apr 12 16:31:36 2012 +0200
     4.3 @@ -1,7 +1,7 @@
     4.4  # SliTaz package receipt.
     4.5  
     4.6  PACKAGE="glibc-extra-samba"
     4.7 -VERSION="2.13"
     4.8 +VERSION="2.14.1"
     4.9  CATEGORY="base-system"
    4.10  SHORT_DESC="GNU libc extra gconv modules for samba."
    4.11  WEB_SITE="http://gcc.gnu.org/"
    4.12 @@ -14,6 +14,6 @@
    4.13  {
    4.14  	mkdir -p $fs/usr/lib/gconv
    4.15  	for i in IBM850.so IBM437.so; do
    4.16 -		cp $_pkg/usr/lib/gconv/$i $fs/usr/lib/gconv/$i
    4.17 +		cp $install/usr/lib/gconv/$i $fs/usr/lib/gconv/$i
    4.18  	done
    4.19  }
     5.1 --- a/glibc-locale/receipt	Thu Apr 12 15:19:10 2012 +0200
     5.2 +++ b/glibc-locale/receipt	Thu Apr 12 16:31:36 2012 +0200
     5.3 @@ -1,7 +1,7 @@
     5.4  # SliTaz package receipt.
     5.5  
     5.6  PACKAGE="glibc-locale"
     5.7 -VERSION="2.13"
     5.8 +VERSION="2.14.1"
     5.9  CATEGORY="system-tools"
    5.10  SHORT_DESC="The GNU C libraries locale files and utilities (see also locale-*)."
    5.11  MAINTAINER="pankso@slitaz.org"
    5.12 @@ -16,14 +16,14 @@
    5.13  {
    5.14  	mkdir -p $fs/usr/share $fs/usr/lib $fs/usr/bin
    5.15  
    5.16 -	cp -a $_pkg/usr/lib/gconv $fs/usr/lib
    5.17 -	cp -a $_pkg/usr/share/locale $fs/usr/share
    5.18 -	cp -a $_pkg/usr/share/i18n $fs/usr/share
    5.19 -	cp -a $_pkg/usr/share/zoneinfo $fs/usr/share
    5.20 +	cp -a $install/usr/lib/gconv $fs/usr/lib
    5.21 +	cp -a $install/usr/share/locale $fs/usr/share
    5.22 +	cp -a $install/usr/share/i18n $fs/usr/share
    5.23 +	cp -a $install/usr/share/zoneinfo $fs/usr/share
    5.24  
    5.25  	# Utilities and tools
    5.26 -	cp -a $_pkg/usr/bin/iconv $fs/usr/bin
    5.27 -	cp -a $_pkg/usr/bin/tzselect $fs/usr/bin
    5.28 +	cp -a $install/usr/bin/iconv $fs/usr/bin
    5.29 +	cp -a $install/usr/bin/tzselect $fs/usr/bin
    5.30  
    5.31  	# Rm base files.
    5.32  	echo -n "* Removing all base files..."
     6.1 --- a/glibc/receipt	Thu Apr 12 15:19:10 2012 +0200
     6.2 +++ b/glibc/receipt	Thu Apr 12 16:31:36 2012 +0200
     6.3 @@ -1,7 +1,7 @@
     6.4  # SliTaz package receipt.
     6.5  
     6.6  PACKAGE="glibc"
     6.7 -VERSION="2.13"
     6.8 +VERSION="2.14.1"
     6.9  CATEGORY="meta"
    6.10  SHORT_DESC="The GNU C libraries. This package is used to compile the libc."
    6.11  MAINTAINER="pankso@slitaz.org"
    6.12 @@ -10,7 +10,7 @@
    6.13  WGET_URL="$GNU_MIRROR/$PACKAGE/$TARBALL"
    6.14  
    6.15  DEPENDS="glibc-base glibc-locale glibc-dev"
    6.16 -BUILD_DEPENDS="linux-api-headers"
    6.17 +BUILD_DEPENDS="linux-api-headers autoconf bash"
    6.18  
    6.19  # Genpkg order for tazwok.
    6.20  COOK_OPT="genpkg=glibc-base:glibc-extra-samba:glib-locale:glibc-dev"
    6.21 @@ -20,8 +20,12 @@
    6.22  {
    6.23  	cd $src
    6.24  	
    6.25 -	# Fix a bug that prevents Glibc from building with GCC-4.5.2:
    6.26 -	patch -Np1 -i $stuff/glibc-2.13-gcc_fix-1.patch
    6.27 +	# Glibc Bug Fixes Patch from LFS
    6.28 +	patch -Np1 -i $stuff/glibc-2.14.1-fixes-1.patch
    6.29 +	# Glibc Bug Sort Relocatable Objects Patch
    6.30 +	patch -Np1 -i $stuff/glibc-2.14.1-sort-1.patch
    6.31 +	# Fix a bug that prevents Glibc from building with GCC-4.6.2
    6.32 +	patch -Np1 -i stuff/glibc-2.14.1-gcc_fix-1.patch
    6.33  
    6.34  	# Build in a separate directory.
    6.35  	mkdir ../glibc-build && cd ../glibc-build
    6.36 @@ -66,17 +70,27 @@
    6.37  		[ -d "/var/lib/tazpkg/installed/gawk" ] || tazpkg get-install gawk
    6.38  	fi
    6.39  
    6.40 -	# Following patches and sed fixes comes from LFS development book:
    6.41 -	# http://www.linuxfromscratch.org/lfs/view/development/chapter06/glibc.html
    6.42 -	DL=$(readelf -l /bin/sh | sed -n 's@.*interpret.*/tools\(.*\)]$@\1@p')
    6.43 -	sed -i "s|libs -o|libs -L/usr/lib -Wl,-dynamic-linker=$DL -o|" \
    6.44 -		scripts/test-installation.pl
    6.45 -	unset DL
    6.46 +	# Fixes and patches from LFS, Redhat
    6.47  	sed -i -e 's/"db1"/& \&\& $name ne "nss_test1"/' scripts/test-installation.pl
    6.48  	sed -i 's|@BASH@|/bin/bash|' elf/ldd.bash.in
    6.49  
    6.50 -	# Fix a bug that prevents Glibc from building with GCC-4.5.2:
    6.51 -	patch -Np1 -i $stuff/glibc-2.13-gcc_fix-1.patch
    6.52 +	# Glibc misc Bug Fixes
    6.53 +	patch -Np1 -i $stuff/glibc-2.14.1-fixes-1.patch
    6.54 +	
    6.55 +	# Glibc Bug Sort Relocatable Objects Patch
    6.56 +	#patch -Np1 -i $stuff/glibc-2.14.1-sort-1.patch
    6.57 +	
    6.58 +	# Fix a bug that prevents Glibc from building with GCC-4.6.2
    6.59 +	patch -Np1 -i $stuff/glibc-2.14.1-gcc_fix-1.patch
    6.60 +	
    6.61 +	# Revert commit causing issues with crappy DNS servers
    6.62 +	patch -Np1 -i $stuff/glibc-2.14-revert-4768ae77.patch
    6.63 +	
    6.64 +	# re-export RPC interface until libtirpc is ready as a replacement
    6.65 +	# http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=acee4873 (only fedora branch...)
    6.66 +	patch -Np1 -i $stuff/glibc-2.14-reexport-rpc-interface.patch
    6.67 +	# http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=bdd816a3 (only fedora branch...)
    6.68 +	patch -Np1 -i $stuff/glibc-2.14-reinstall-nis-rpc-headers.patch
    6.69  
    6.70  	# Fix a stack imbalance that occurs under some conditions:
    6.71  	sed -i '195,213 s/PRIVATE_FUTEX/FUTEX_CLOCK_REALTIME/' \
    6.72 @@ -105,7 +119,8 @@
    6.73  		--enable-kernel=2.6.30 \
    6.74  		--libexecdir=/usr/lib/glibc \
    6.75  		--build=$HOST_SYSTEM \
    6.76 -		--host=$HOST_SYSTEM &&
    6.77 +		--host=$HOST_SYSTEM \
    6.78 +		--target=$BUILD_SYSTEM &&
    6.79  	make && make install_root=$DESTDIR install
    6.80  	} || return 1
    6.81  
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/glibc/stuff/glibc-2.14-reexport-rpc-interface.patch	Thu Apr 12 16:31:36 2012 +0200
     7.3 @@ -0,0 +1,26 @@
     7.4 +diff --git a/include/libc-symbols.h b/include/libc-symbols.h
     7.5 +index 67e1ca2..5e7cca5 100644
     7.6 +--- a/include/libc-symbols.h
     7.7 ++++ b/include/libc-symbols.h
     7.8 +@@ -635,7 +635,7 @@ for linking")
     7.9 + # define libc_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
    7.10 + # define libc_hidden_def(name) hidden_def (name)
    7.11 + # define libc_hidden_weak(name) hidden_weak (name)
    7.12 +-# define libc_hidden_nolink(name, version) hidden_nolink (name, libc, version)
    7.13 ++# define libc_hidden_nolink(name, version) hidden_def (name)
    7.14 + # define libc_hidden_ver(local, name) hidden_ver (local, name)
    7.15 + # define libc_hidden_data_def(name) hidden_data_def (name)
    7.16 + # define libc_hidden_data_weak(name) hidden_data_weak (name)
    7.17 +diff --git a/sunrpc/Makefile b/sunrpc/Makefile
    7.18 +index 5134ce9..40c73d1 100644
    7.19 +--- a/sunrpc/Makefile
    7.20 ++++ b/sunrpc/Makefile
    7.21 +@@ -53,7 +53,7 @@ headers-in-tirpc = $(addprefix rpc/,auth.h auth_unix.h clnt.h pmap_clnt.h \
    7.22 + 				    des_crypt.h)
    7.23 + headers-not-in-tirpc = $(addprefix rpc/,key_prot.h rpc_des.h) \
    7.24 + 		       $(rpcsvc:%=rpcsvc/%) rpcsvc/bootparam.h
    7.25 +-headers = rpc/netdb.h
    7.26 ++headers = rpc/netdb.h $(headers-in-tirpc) $(headers-not-in-tirpc)
    7.27 + install-others = $(inst_sysconfdir)/rpc
    7.28 + generated = $(rpcsvc:%.x=rpcsvc/%.h) $(rpcsvc:%.x=x%.c) $(rpcsvc:%.x=x%.stmp) \
    7.29 + 	    $(rpcsvc:%.x=rpcsvc/%.stmp) rpcgen
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/glibc/stuff/glibc-2.14-reinstall-nis-rpc-headers.patch	Thu Apr 12 16:31:36 2012 +0200
     8.3 @@ -0,0 +1,28 @@
     8.4 +From bdd816a366c4e5bba5de7157d948e0c0737fb4fb Mon Sep 17 00:00:00 2001
     8.5 +From: Andreas Schwab <schwab@redhat.com>
     8.6 +Date: Tue, 17 May 2011 17:42:30 +0200
     8.7 +Subject: [PATCH] Reinstall NIS RPC headers
     8.8 +
     8.9 +---
    8.10 + nis/Makefile |    4 ++--
    8.11 + 1 files changed, 2 insertions(+), 2 deletions(-)
    8.12 +
    8.13 +diff --git a/nis/Makefile b/nis/Makefile
    8.14 +index b5c9609..d2934d9 100644
    8.15 +--- a/nis/Makefile
    8.16 ++++ b/nis/Makefile
    8.17 +@@ -23,9 +23,9 @@ subdir	:= nis
    8.18 + 
    8.19 + aux			:= nis_hash
    8.20 + 
    8.21 ++headers			:= $(wildcard rpcsvc/*.[hx])
    8.22 + distribute		:= nss-nis.h nss-nisplus.h nis_intern.h Banner \
    8.23 +-			   nisplus-parser.h nis_xdr.h nss \
    8.24 +-			   $(wildcard rpcsvc/*.[hx])
    8.25 ++			   nisplus-parser.h nis_xdr.h nss
    8.26 + 
    8.27 + # These are the databases available for the nis (and perhaps later nisplus)
    8.28 + # service.  This must be a superset of the services in nss.
    8.29 +-- 
    8.30 +1.7.5.4
    8.31 +
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/glibc/stuff/glibc-2.14-revert-4768ae77.patch	Thu Apr 12 16:31:36 2012 +0200
     9.3 @@ -0,0 +1,37 @@
     9.4 +diff -Naur glibc-orig//resolv/res_send.c glibc/resolv/res_send.c
     9.5 +--- glibc-orig//resolv/res_send.c	2011-06-10 18:59:03.041436996 +1000
     9.6 ++++ glibc/resolv/res_send.c	2011-06-10 19:08:09.379309323 +1000
     9.7 +@@ -549,7 +549,7 @@
     9.8 +				    ns, ansp, ansp2, nansp2, resplen2);
     9.9 +			if (n < 0)
    9.10 +				return (-1);
    9.11 +-			if (n == 0 && (buf2 == NULL || *resplen2 == 0))
    9.12 ++			if (n == 0)
    9.13 +				goto next_ns;
    9.14 +		} else {
    9.15 +			/* Use datagrams. */
    9.16 +@@ -559,7 +559,7 @@
    9.17 +				    ansp2, nansp2, resplen2);
    9.18 +			if (n < 0)
    9.19 +				return (-1);
    9.20 +-			if (n == 0 && (buf2 == NULL || *resplen2 == 0))
    9.21 ++			if (n == 0)
    9.22 +				goto next_ns;
    9.23 +			if (v_circuit)
    9.24 +			  // XXX Check whether both requests failed or
    9.25 +@@ -1275,14 +1275,10 @@
    9.26 +				(*thisresplenp > *thisanssizp)
    9.27 +				? *thisanssizp : *thisresplenp);
    9.28 +
    9.29 +-			if (recvresp1 || (buf2 != NULL && recvresp2)) {
    9.30 +-			  *resplen2 = 0;
    9.31 ++			if (recvresp1 || (buf2 != NULL && recvresp2))
    9.32 +			  return resplen;
    9.33 +-			}
    9.34 +			if (buf2 != NULL)
    9.35 +			  {
    9.36 +-			    /* No data from the first reply.  */
    9.37 +-			    resplen = 0;
    9.38 +			    /* We are waiting for a possible second reply.  */
    9.39 +			    if (hp->id == anhp->id)
    9.40 +			      recvresp1 = 1;
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/glibc/stuff/glibc-2.14.1-fixes-1.patch	Thu Apr 12 16:31:36 2012 +0200
    10.3 @@ -0,0 +1,159 @@
    10.4 +Submitted By:            Matt Burgess <matthew_at_linuxfromscratch_dot_org>
    10.5 +Date:                    2011-10-07
    10.6 +Initial Package Version: 2.14.1
    10.7 +Upstream Status:         From upstream
    10.8 +Origin:                  Matt Burgess
    10.9 +Description:             Fixes Firefox crashes and a bug when programs link to
   10.10 +                         SDL.
   10.11 +
   10.12 +diff -Naur glibc-2.14.1.orig/elf/dl-close.c glibc-2.14.1/elf/dl-close.c
   10.13 +--- glibc-2.14.1.orig/elf/dl-close.c	2011-10-07 09:48:55.000000000 +0000
   10.14 ++++ glibc-2.14.1/elf/dl-close.c	2011-10-07 19:43:10.346411120 +0000
   10.15 +@@ -119,17 +119,8 @@
   10.16 +   if (map->l_direct_opencount > 0 || map->l_type != lt_loaded
   10.17 +       || dl_close_state != not_pending)
   10.18 +     {
   10.19 +-      if (map->l_direct_opencount == 0)
   10.20 +-	{
   10.21 +-	  if (map->l_type == lt_loaded)
   10.22 +-	    dl_close_state = rerun;
   10.23 +-	  else if (map->l_type == lt_library)
   10.24 +-	    {
   10.25 +-	      struct link_map **oldp = map->l_initfini;
   10.26 +-	      map->l_initfini = map->l_orig_initfini;
   10.27 +-	      _dl_scope_free (oldp);
   10.28 +-	    }
   10.29 +-	}
   10.30 ++      if (map->l_direct_opencount == 0 && map->l_type == lt_loaded)
   10.31 ++	dl_close_state = rerun;
   10.32 + 
   10.33 +       /* There are still references to this object.  Do nothing more.  */
   10.34 +       if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0))
   10.35 +diff -Naur glibc-2.14.1.orig/elf/dl-deps.c glibc-2.14.1/elf/dl-deps.c
   10.36 +--- glibc-2.14.1.orig/elf/dl-deps.c	2011-10-07 09:48:55.000000000 +0000
   10.37 ++++ glibc-2.14.1/elf/dl-deps.c	2011-10-07 19:43:10.348432639 +0000
   10.38 +@@ -478,6 +478,7 @@
   10.39 + 		  nneeded * sizeof needed[0]);
   10.40 + 	  atomic_write_barrier ();
   10.41 + 	  l->l_initfini = l_initfini;
   10.42 ++	  l->l_free_initfini = 1;
   10.43 + 	}
   10.44 + 
   10.45 +       /* If we have no auxiliary objects just go on to the next map.  */
   10.46 +@@ -678,6 +679,7 @@
   10.47 +   l_initfini[nlist] = NULL;
   10.48 +   atomic_write_barrier ();
   10.49 +   map->l_initfini = l_initfini;
   10.50 ++  map->l_free_initfini = 1;
   10.51 +   if (l_reldeps != NULL)
   10.52 +     {
   10.53 +       atomic_write_barrier ();
   10.54 +@@ -686,7 +688,7 @@
   10.55 +       _dl_scope_free (old_l_reldeps);
   10.56 +     }
   10.57 +   if (old_l_initfini != NULL)
   10.58 +-      map->l_orig_initfini = old_l_initfini;
   10.59 ++    _dl_scope_free (old_l_initfini);
   10.60 + 
   10.61 +   if (errno_reason)
   10.62 +     _dl_signal_error (errno_reason == -1 ? 0 : errno_reason, objname,
   10.63 +diff -Naur glibc-2.14.1.orig/elf/dl-libc.c glibc-2.14.1/elf/dl-libc.c
   10.64 +--- glibc-2.14.1.orig/elf/dl-libc.c	2011-10-07 09:48:55.000000000 +0000
   10.65 ++++ glibc-2.14.1/elf/dl-libc.c	2011-10-07 19:43:10.352411141 +0000
   10.66 +@@ -279,6 +279,10 @@
   10.67 + 	      if (! old->dont_free)
   10.68 + 		free (old);
   10.69 + 	    }
   10.70 ++
   10.71 ++	  /* Free the initfini dependency list.  */
   10.72 ++	  if (l->l_free_initfini)
   10.73 ++	    free (l->l_initfini);
   10.74 + 	}
   10.75 + 
   10.76 +       if (__builtin_expect (GL(dl_ns)[ns]._ns_global_scope_alloc, 0) != 0
   10.77 +diff -Naur glibc-2.14.1.orig/elf/rtld.c glibc-2.14.1/elf/rtld.c
   10.78 +--- glibc-2.14.1.orig/elf/rtld.c	2011-10-07 09:48:55.000000000 +0000
   10.79 ++++ glibc-2.14.1/elf/rtld.c	2011-10-07 19:43:10.355406263 +0000
   10.80 +@@ -2263,6 +2263,7 @@
   10.81 + 	      lnp->dont_free = 1;
   10.82 + 	      lnp = lnp->next;
   10.83 + 	    }
   10.84 ++	  l->l_free_initfini = 0;
   10.85 + 
   10.86 + 	  if (l != &GL(dl_rtld_map))
   10.87 + 	    _dl_relocate_object (l, l->l_scope, GLRO(dl_lazy) ? RTLD_LAZY : 0,
   10.88 +diff -Naur glibc-2.14.1.orig/include/link.h glibc-2.14.1/include/link.h
   10.89 +--- glibc-2.14.1.orig/include/link.h	2011-10-07 09:48:55.000000000 +0000
   10.90 ++++ glibc-2.14.1/include/link.h	2011-10-07 19:43:10.357462703 +0000
   10.91 +@@ -192,6 +192,9 @@
   10.92 + 						 during LD_TRACE_PRELINKING=1
   10.93 + 						 contains any DT_SYMBOLIC
   10.94 + 						 libraries.  */
   10.95 ++    unsigned int l_free_initfini:1; /* Nonzero if l_initfini can be
   10.96 ++				       freed, ie. not allocated with
   10.97 ++				       the dummy malloc in ld.so.  */
   10.98 + 
   10.99 +     /* Collected information about own RPATH directories.  */
  10.100 +     struct r_search_path_struct l_rpath_dirs;
  10.101 +@@ -240,9 +243,6 @@
  10.102 + 
  10.103 +     /* List of object in order of the init and fini calls.  */
  10.104 +     struct link_map **l_initfini;
  10.105 +-    /* The init and fini list generated at startup, saved when the
  10.106 +-       object is also loaded dynamically.  */
  10.107 +-    struct link_map **l_orig_initfini;
  10.108 + 
  10.109 +     /* List of the dependencies introduced through symbol binding.  */
  10.110 +     struct link_map_reldeps
  10.111 +diff -Naur glibc-2.14.1.orig/resolv/res_query.c glibc-2.14.1/resolv/res_query.c
  10.112 +--- glibc-2.14.1.orig/resolv/res_query.c	2011-10-07 09:48:55.000000000 +0000
  10.113 ++++ glibc-2.14.1/resolv/res_query.c	2011-10-07 19:43:10.361412711 +0000
  10.114 +@@ -122,6 +122,7 @@
  10.115 + 		  int *resplen2)
  10.116 + {
  10.117 + 	HEADER *hp = (HEADER *) answer;
  10.118 ++	HEADER *hp2;
  10.119 + 	int n, use_malloc = 0;
  10.120 + 	u_int oflags = statp->_flags;
  10.121 + 
  10.122 +@@ -239,26 +240,25 @@
  10.123 + 	  /* __libc_res_nsend might have reallocated the buffer.  */
  10.124 + 	  hp = (HEADER *) *answerp;
  10.125 + 
  10.126 +-	/* We simplify the following tests by assigning HP to HP2.  It
  10.127 +-	   is easy to verify that this is the same as ignoring all
  10.128 +-	   tests of HP2.  */
  10.129 +-	HEADER *hp2 = answerp2 ? (HEADER *) *answerp2 : hp;
  10.130 +-
  10.131 +-	if (n < (int) sizeof (HEADER) && answerp2 != NULL
  10.132 +-	    && *resplen2 > (int) sizeof (HEADER))
  10.133 ++	/* We simplify the following tests by assigning HP to HP2 or
  10.134 ++	   vice versa.  It is easy to verify that this is the same as
  10.135 ++	   ignoring all tests of HP or HP2.  */
  10.136 ++	if (answerp2 == NULL || *resplen2 < (int) sizeof (HEADER))
  10.137 + 	  {
  10.138 +-	    /* Special case of partial answer.  */
  10.139 +-	    assert (hp != hp2);
  10.140 +-	    hp = hp2;
  10.141 ++	    hp2 = hp;
  10.142 + 	  }
  10.143 +-	else if (answerp2 != NULL && *resplen2 < (int) sizeof (HEADER)
  10.144 +-		 && n > (int) sizeof (HEADER))
  10.145 ++	else
  10.146 + 	  {
  10.147 +-	    /* Special case of partial answer.  */
  10.148 +-	    assert (hp != hp2);
  10.149 +-	    hp2 = hp;
  10.150 ++	    hp2 = (HEADER *) *answerp2;
  10.151 ++	    if (n < (int) sizeof (HEADER))
  10.152 ++	      {
  10.153 ++	        hp = hp2;
  10.154 ++	      }
  10.155 + 	  }
  10.156 + 
  10.157 ++	/* Make sure both hp and hp2 are defined */
  10.158 ++	assert((hp != NULL) && (hp2 != NULL));
  10.159 ++
  10.160 + 	if ((hp->rcode != NOERROR || ntohs(hp->ancount) == 0)
  10.161 + 	    && (hp2->rcode != NOERROR || ntohs(hp2->ancount) == 0)) {
  10.162 + #ifdef DEBUG
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/glibc/stuff/glibc-2.14.1-gcc_fix-1.patch	Thu Apr 12 16:31:36 2012 +0200
    11.3 @@ -0,0 +1,49 @@
    11.4 +Submitted By:            Matt Burgess <matthew_at_linuxfromscratch_dot_org>
    11.5 +Date:                    2010-04-18
    11.6 +Initial Package Version: 2.11.1
    11.7 +Upstream Status:         Not Submitted
    11.8 +Origin:                  http://www.eglibc.org/archives/patches/msg00073.html
    11.9 +Description:             Fixes the following build problem with GCC-4.5.0:
   11.10 +
   11.11 +/mnt/lfs/sources/libc-build/math/s_frexp.os.dt -MT /mnt/lfs/sources/libc-build/math/s_frexp.os
   11.12 +./sysdeps/i386/fpu/s_frexp.S: Assembler messages:
   11.13 +./sysdeps/i386/fpu/s_frexp.S:66: Error: invalid identifier for ".ifdef"
   11.14 +./sysdeps/i386/fpu/s_frexp.S:66: Error: junk at end of line, first unrecognized character is `1'
   11.15 +./sysdeps/i386/fpu/s_frexp.S:66: Error: junk at end of line, first unrecognized character is `1'
   11.16 +./sysdeps/i386/fpu/s_frexp.S:66: Error: junk at end of line, first unrecognized character is `1'
   11.17 +./sysdeps/i386/fpu/s_frexp.S:66: Error: junk at end of line, first unrecognized character is `.'
   11.18 +./sysdeps/i386/fpu/s_frexp.S:66: Error: junk at end of line, first unrecognized character is `1'
   11.19 +./sysdeps/i386/fpu/s_frexp.S:66: Error: expected comma after name `' in .size directive
   11.20 +./sysdeps/i386/fpu/s_frexp.S:66: Error: ".endif" without ".if"
   11.21 +./sysdeps/i386/fpu/s_frexp.S:66: Error: junk `.get_pc_thunk.dx' after expression
   11.22 +make[2]: *** [/mnt/lfs/sources/libc-build/math/s_frexp.os] Error 1
   11.23 +
   11.24 +diff -Naur glibc-2.11.1.orig/nptl/sysdeps/pthread/pt-initfini.c glibc-2.11.1/nptl/sysdeps/pthread/pt-initfini.c
   11.25 +--- glibc-2.11.1.orig/nptl/sysdeps/pthread/pt-initfini.c	2009-12-08 20:10:20.000000000 +0000
   11.26 ++++ glibc-2.11.1/nptl/sysdeps/pthread/pt-initfini.c	2010-04-17 11:34:06.882681001 +0000
   11.27 +@@ -45,6 +45,11 @@
   11.28 + /* Embed an #include to pull in the alignment and .end directives. */
   11.29 + asm ("\n#include \"defs.h\"");
   11.30 + 
   11.31 ++asm ("\n#if defined __i686 && defined __ASSEMBLER__");
   11.32 ++asm ("\n#undef __i686");
   11.33 ++asm ("\n#define __i686 __i686");
   11.34 ++asm ("\n#endif");
   11.35 ++
   11.36 + /* The initial common code ends here. */
   11.37 + asm ("\n/*@HEADER_ENDS*/");
   11.38 + 
   11.39 +diff -Naur glibc-2.11.1.orig/sysdeps/unix/sysv/linux/i386/sysdep.h glibc-2.11.1/sysdeps/unix/sysv/linux/i386/sysdep.h
   11.40 +--- glibc-2.11.1.orig/sysdeps/unix/sysv/linux/i386/sysdep.h	2009-12-08 20:10:20.000000000 +0000
   11.41 ++++ glibc-2.11.1/sysdeps/unix/sysv/linux/i386/sysdep.h	2010-04-17 11:34:06.882681001 +0000
   11.42 +@@ -29,6 +29,10 @@
   11.43 + #include <dl-sysdep.h>
   11.44 + #include <tls.h>
   11.45 + 
   11.46 ++#if defined __i686 && defined __ASSEMBLER__
   11.47 ++#undef __i686
   11.48 ++#define __i686 __i686
   11.49 ++#endif
   11.50 + 
   11.51 + /* For Linux we can use the system call table in the header file
   11.52 + 	/usr/include/asm/unistd.h
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/glibc/stuff/glibc-2.14.1-sort-1.patch	Thu Apr 12 16:31:36 2012 +0200
    12.3 @@ -0,0 +1,273 @@
    12.4 +Submitted By:            Bruce Dubbs <bdubbs_at_linuxfromscratch_dot_org>
    12.5 +Date:                    2012-02-24
    12.6 +Initial Package Version: 2.14.1
    12.7 +Upstream Status:         From upstream
    12.8 +Origin:                  Upstream
    12.9 +Description:             Sort objects by dependency before relocation.
   12.10 +                         Fixes segfault in dlopen for several programs.
   12.11 +
   12.12 +diff --git a/Makeconfig b/Makeconfig
   12.13 +index 2db2821..68547b2 100644
   12.14 +--- a/Makeconfig
   12.15 ++++ b/Makeconfig
   12.16 +@@ -938,6 +938,12 @@ libdl =
   12.17 + endif
   12.18 + endif
   12.19 + 
   12.20 ++ifeq ($(build-shared),yes)
   12.21 ++libm = $(common-objpfx)math/libm.so$(libm.so-version)
   12.22 ++else
   12.23 ++libm = $(common-objpfx)math/libm.a
   12.24 ++endif
   12.25 ++
   12.26 + # These are the subdirectories containing the library source.  The order
   12.27 + # is more or less arbitrary.  The sorting step will take care of the
   12.28 + # dependencies.
   12.29 +diff --git a/elf/Makefile b/elf/Makefile
   12.30 +index 052e763..3f1772a 100644
   12.31 +--- a/elf/Makefile
   12.32 ++++ b/elf/Makefile
   12.33 +@@ -124,7 +124,8 @@ distribute	:= rtld-Rules \
   12.34 + 		   tst-initordera1.c tst-initordera2.c tst-initorderb1.c \
   12.35 + 		   tst-initorderb2.c tst-initordera3.c tst-initordera4.c \
   12.36 + 		   tst-initorder.c \
   12.37 +-		   tst-initorder2.c
   12.38 ++		   tst-initorder2.c \
   12.39 ++		   tst-relsort1.c tst-relsort1mod1.c tst-relsort1mod2.c
   12.40 + 
   12.41 + CFLAGS-dl-runtime.c = -fexceptions -fasynchronous-unwind-tables
   12.42 + CFLAGS-dl-lookup.c = -fexceptions -fasynchronous-unwind-tables
   12.43 +@@ -227,7 +228,7 @@ tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \
   12.44 + 	 tst-audit1 tst-audit2 \
   12.45 + 	 tst-stackguard1 tst-addr1 tst-thrlock \
   12.46 + 	 tst-unique1 tst-unique2 tst-unique3 tst-unique4 \
   12.47 +-	 tst-initorder tst-initorder2
   12.48 ++	 tst-initorder tst-initorder2 tst-relsort1
   12.49 + #	 reldep9
   12.50 + test-srcs = tst-pathopt
   12.51 + selinux-enabled := $(shell cat /selinux/enforce 2> /dev/null)
   12.52 +@@ -290,7 +291,9 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
   12.53 + 		tst-initordera1 tst-initorderb1 \
   12.54 + 		tst-initordera2 tst-initorderb2 \
   12.55 + 		tst-initordera3 tst-initordera4 \
   12.56 +-		tst-initorder2a tst-initorder2b tst-initorder2c tst-initorder2d
   12.57 ++		tst-initorder2a tst-initorder2b tst-initorder2c \
   12.58 ++		tst-initorder2d \
   12.59 ++		tst-relsort1mod1 tst-relsort1mod2
   12.60 + ifeq (yes,$(have-initfini-array))
   12.61 + modules-names += tst-array2dep tst-array5dep
   12.62 + endif
   12.63 +@@ -1195,3 +1198,9 @@ CFLAGS-tst-auditmod6b.c += $(AVX-CFLAGS)
   12.64 + CFLAGS-tst-auditmod6c.c += $(AVX-CFLAGS)
   12.65 + CFLAGS-tst-auditmod7b.c += $(AVX-CFLAGS)
   12.66 + endif
   12.67 ++
   12.68 ++$(objpfx)tst-relsort1: $(libdl)
   12.69 ++$(objpfx)tst-relsort1mod1.so: $(libm) $(objpfx)tst-relsort1mod2.so
   12.70 ++$(objpfx)tst-relsort1mod2.so: $(libm)
   12.71 ++$(objpfx)tst-relsort1.out: $(objpfx)tst-relsort1mod1.so \
   12.72 ++			   $(objpfx)tst-relsort1mod2.so
   12.73 +diff --git a/elf/dl-open.c b/elf/dl-open.c
   12.74 +index a0b5c50..a56bdc1 100644
   12.75 +--- a/elf/dl-open.c
   12.76 ++++ b/elf/dl-open.c
   12.77 +@@ -1,5 +1,5 @@
   12.78 + /* Load a shared object at runtime, relocate it, and run its initializer.
   12.79 +-   Copyright (C) 1996-2007, 2009, 2010, 2011 Free Software Foundation, Inc.
   12.80 ++   Copyright (C) 1996-2007, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
   12.81 +    This file is part of the GNU C Library.
   12.82 + 
   12.83 +    The GNU C Library is free software; you can redistribute it and/or
   12.84 +@@ -303,45 +303,109 @@ dl_open_worker (void *a)
   12.85 +   if (GLRO(dl_lazy))
   12.86 +     reloc_mode |= mode & RTLD_LAZY;
   12.87 + 
   12.88 +-  /* Relocate the objects loaded.  We do this in reverse order so that copy
   12.89 +-     relocs of earlier objects overwrite the data written by later objects.  */
   12.90 +-
   12.91 ++  /* Sort the objects by dependency for the relocation process.  This
   12.92 ++     allows IFUNC relocations to work and it also means copy
   12.93 ++     relocation of dependencies are if necessary overwritten.  */
   12.94 ++  size_t nmaps = 0;
   12.95 +   struct link_map *l = new;
   12.96 +-  while (l->l_next)
   12.97 +-    l = l->l_next;
   12.98 +-  while (1)
   12.99 ++  do
  12.100 ++    {
  12.101 ++      if (! l->l_real->l_relocated)
  12.102 ++	++nmaps;
  12.103 ++      l = l->l_next;
  12.104 ++    }
  12.105 ++  while (l != NULL);
  12.106 ++  struct link_map *maps[nmaps];
  12.107 ++  nmaps = 0;
  12.108 ++  l = new;
  12.109 ++  do
  12.110 +     {
  12.111 +       if (! l->l_real->l_relocated)
  12.112 ++	maps[nmaps++] = l;
  12.113 ++      l = l->l_next;
  12.114 ++    }
  12.115 ++  while (l != NULL);
  12.116 ++  if (nmaps > 1)
  12.117 ++    {
  12.118 ++      char seen[nmaps];
  12.119 ++      memset (seen, '\0', nmaps);
  12.120 ++      size_t i = 0;
  12.121 ++      while (1)
  12.122 + 	{
  12.123 +-#ifdef SHARED
  12.124 +-	  if (__builtin_expect (GLRO(dl_profile) != NULL, 0))
  12.125 ++	  ++seen[i];
  12.126 ++	  struct link_map *thisp = maps[i];
  12.127 ++
  12.128 ++	  /* Find the last object in the list for which the current one is
  12.129 ++	     a dependency and move the current object behind the object
  12.130 ++	     with the dependency.  */
  12.131 ++	  size_t k = nmaps - 1;
  12.132 ++	  while (k > i)
  12.133 + 	    {
  12.134 +-	      /* If this here is the shared object which we want to profile
  12.135 +-		 make sure the profile is started.  We can find out whether
  12.136 +-		 this is necessary or not by observing the `_dl_profile_map'
  12.137 +-		 variable.  If was NULL but is not NULL afterwars we must
  12.138 +-		 start the profiling.  */
  12.139 +-	      struct link_map *old_profile_map = GL(dl_profile_map);
  12.140 ++	      struct link_map **runp = maps[k]->l_initfini;
  12.141 ++	      if (runp != NULL)
  12.142 ++		/* Look through the dependencies of the object.  */
  12.143 ++		while (*runp != NULL)
  12.144 ++		  if (__builtin_expect (*runp++ == thisp, 0))
  12.145 ++		    {
  12.146 ++		      /* Move the current object to the back past the last
  12.147 ++			 object with it as the dependency.  */
  12.148 ++		      memmove (&maps[i], &maps[i + 1],
  12.149 ++			       (k - i) * sizeof (maps[0]));
  12.150 ++		      maps[k] = thisp;
  12.151 ++
  12.152 ++		      if (seen[i + 1] > 1)
  12.153 ++			{
  12.154 ++			  ++i;
  12.155 ++			  goto next_clear;
  12.156 ++			}
  12.157 ++
  12.158 ++		      char this_seen = seen[i];
  12.159 ++		      memmove (&seen[i], &seen[i + 1],
  12.160 ++			       (k - i) * sizeof (seen[0]));
  12.161 ++		      seen[k] = this_seen;
  12.162 ++
  12.163 ++		      goto next;
  12.164 ++		    }
  12.165 ++
  12.166 ++	      --k;
  12.167 ++	    }
  12.168 + 
  12.169 +-	      _dl_relocate_object (l, l->l_scope, reloc_mode | RTLD_LAZY, 1);
  12.170 ++	  if (++i == nmaps)
  12.171 ++	    break;
  12.172 ++	next_clear:
  12.173 ++	  memset (&seen[i], 0, (nmaps - i) * sizeof (seen[0]));
  12.174 ++	next:;
  12.175 ++	}
  12.176 ++    }
  12.177 + 
  12.178 +-	      if (old_profile_map == NULL && GL(dl_profile_map) != NULL)
  12.179 +-		{
  12.180 +-		  /* We must prepare the profiling.  */
  12.181 +-		  _dl_start_profile ();
  12.182 ++  for (size_t i = nmaps; i-- > 0; )
  12.183 ++    {
  12.184 ++      l = maps[i];
  12.185 + 
  12.186 +-		  /* Prevent unloading the object.  */
  12.187 +-		  GL(dl_profile_map)->l_flags_1 |= DF_1_NODELETE;
  12.188 +-		}
  12.189 ++#ifdef SHARED
  12.190 ++      if (__builtin_expect (GLRO(dl_profile) != NULL, 0))
  12.191 ++	{
  12.192 ++	  /* If this here is the shared object which we want to profile
  12.193 ++	     make sure the profile is started.  We can find out whether
  12.194 ++	     this is necessary or not by observing the `_dl_profile_map'
  12.195 ++	     variable.  If it was NULL but is not NULL afterwars we must
  12.196 ++	     start the profiling.  */
  12.197 ++	  struct link_map *old_profile_map = GL(dl_profile_map);
  12.198 ++
  12.199 ++	  _dl_relocate_object (l, l->l_scope, reloc_mode | RTLD_LAZY, 1);
  12.200 ++
  12.201 ++	  if (old_profile_map == NULL && GL(dl_profile_map) != NULL)
  12.202 ++	    {
  12.203 ++	      /* We must prepare the profiling.  */
  12.204 ++	      _dl_start_profile ();
  12.205 ++
  12.206 ++	      /* Prevent unloading the object.  */
  12.207 ++	      GL(dl_profile_map)->l_flags_1 |= DF_1_NODELETE;
  12.208 + 	    }
  12.209 +-	  else
  12.210 +-#endif
  12.211 +-	    _dl_relocate_object (l, l->l_scope, reloc_mode, 0);
  12.212 + 	}
  12.213 +-
  12.214 +-      if (l == new)
  12.215 +-	break;
  12.216 +-      l = l->l_prev;
  12.217 ++      else
  12.218 ++#endif
  12.219 ++	_dl_relocate_object (l, l->l_scope, reloc_mode, 0);
  12.220 +     }
  12.221 + 
  12.222 +   /* If the file is not loaded now as a dependency, add the search
  12.223 +diff --git a/elf/tst-relsort1.c b/elf/tst-relsort1.c
  12.224 +new file mode 100644
  12.225 +index 0000000..972100c
  12.226 +--- /dev/null
  12.227 ++++ b/elf/tst-relsort1.c
  12.228 +@@ -0,0 +1,19 @@
  12.229 ++#include <dlfcn.h>
  12.230 ++#include <stdio.h>
  12.231 ++
  12.232 ++
  12.233 ++static int
  12.234 ++do_test ()
  12.235 ++{
  12.236 ++  const char lib[] = "$ORIGIN/tst-relsort1mod1.so";
  12.237 ++  void *h = dlopen (lib, RTLD_NOW);
  12.238 ++  if (h == NULL)
  12.239 ++    {
  12.240 ++      puts (dlerror ());
  12.241 ++      return 1;
  12.242 ++    }
  12.243 ++  return 0;
  12.244 ++}
  12.245 ++
  12.246 ++#define TEST_FUNCTION do_test ()
  12.247 ++#include "../test-skeleton.c"
  12.248 +diff --git a/elf/tst-relsort1mod1.c b/elf/tst-relsort1mod1.c
  12.249 +new file mode 100644
  12.250 +index 0000000..9e4a943
  12.251 +--- /dev/null
  12.252 ++++ b/elf/tst-relsort1mod1.c
  12.253 +@@ -0,0 +1,7 @@
  12.254 ++extern int foo (double);
  12.255 ++
  12.256 ++int
  12.257 ++bar (void)
  12.258 ++{
  12.259 ++  return foo (1.2);
  12.260 ++}
  12.261 +diff --git a/elf/tst-relsort1mod2.c b/elf/tst-relsort1mod2.c
  12.262 +new file mode 100644
  12.263 +index 0000000..a2c3e55
  12.264 +--- /dev/null
  12.265 ++++ b/elf/tst-relsort1mod2.c
  12.266 +@@ -0,0 +1,7 @@
  12.267 ++#include <math.h>
  12.268 ++
  12.269 ++int
  12.270 ++foo (double d)
  12.271 ++{
  12.272 ++  return floor (d) != 0.0;
  12.273 ++}
  12.274 +-- 
  12.275 +1.7.3.4
  12.276 +