# HG changeset patch # User Christophe Lincoln # Date 1334241096 -7200 # Node ID 590cd40daccf5fa8bff07f84cfe86964336ff459 # Parent 97e8e0e4f8782793b3aefa7be5a68e33e454a6fa Up: glibc (2.14.1) diff -r 97e8e0e4f878 -r 590cd40daccf glibc-base/receipt --- a/glibc-base/receipt Thu Apr 12 15:19:10 2012 +0200 +++ b/glibc-base/receipt Thu Apr 12 16:31:36 2012 +0200 @@ -1,7 +1,7 @@ # SliTaz package receipt. PACKAGE="glibc-base" -VERSION="2.13" +VERSION="2.14.1" CATEGORY="base-system" SHORT_DESC="GNU libc minimal libraries and UTF-8 support for SliTaz." WEB_SITE="http://www.gnu.org/software/libc/" @@ -32,7 +32,7 @@ # i18n for i in $DEFAULT_LOCALE do - cp $_pkg/usr/share/i18n/locales/$i $fs/usr/share/i18n/locales + cp $install/usr/share/i18n/locales/$i $fs/usr/share/i18n/locales done } diff -r 97e8e0e4f878 -r 590cd40daccf glibc-base/stuff/wanted-files.list --- a/glibc-base/stuff/wanted-files.list Thu Apr 12 15:19:10 2012 +0200 +++ b/glibc-base/stuff/wanted-files.list Thu Apr 12 16:31:36 2012 +0200 @@ -1,18 +1,18 @@ -/lib/libutil-2.13.so -/lib/libnss_dns-2.13.so -/lib/libnsl-2.13.so -/lib/libanl-2.13.so -/lib/libm-2.13.so -/lib/libpthread-2.13.so +/lib/libutil-2.14.1.so +/lib/libnss_dns-2.14.1.so +/lib/libnsl-2.14.1.so +/lib/libanl-2.14.1.so +/lib/libm-2.14.1.so +/lib/libpthread-2.14.1.so /lib/libthread_db-1.0.so -/lib/libnss_compat-2.13.so -/lib/libc-2.13.so -/lib/librt-2.13.so -/lib/libcrypt-2.13.so -/lib/ld-2.13.so -/lib/libresolv-2.13.so -/lib/libnss_files-2.13.so -/lib/libdl-2.13.so +/lib/libnss_compat-2.14.1.so +/lib/libc-2.14.1.so +/lib/librt-2.14.1.so +/lib/libcrypt-2.14.1.so +/lib/ld-2.14.1.so +/lib/libresolv-2.14.1.so +/lib/libnss_files-2.14.1.so +/lib/libdl-2.14.1.so /usr/lib/gconv/UNICODE.so /usr/lib/gconv/gconv-modules diff -r 97e8e0e4f878 -r 590cd40daccf glibc-dev/receipt --- a/glibc-dev/receipt Thu Apr 12 15:19:10 2012 +0200 +++ b/glibc-dev/receipt Thu Apr 12 16:31:36 2012 +0200 @@ -1,7 +1,7 @@ # SliTaz package receipt. PACKAGE="glibc-dev" -VERSION="2.13" +VERSION="2.14.1" CATEGORY="development" SHORT_DESC="The GNU C libraries devel files (Part of SliTaz toolchain)." MAINTAINER="pankso@slitaz.org" @@ -17,7 +17,7 @@ { # Mass copy and then remove all files specified in stuff/base-files.list. # We get the files from glibc-base. Locale files are in: glibc-locale. - cp -a $_pkg/* $fs + cp -a $install/* $fs # Rm base files. echo -n "Removing all base files..." diff -r 97e8e0e4f878 -r 590cd40daccf glibc-extra-samba/receipt --- a/glibc-extra-samba/receipt Thu Apr 12 15:19:10 2012 +0200 +++ b/glibc-extra-samba/receipt Thu Apr 12 16:31:36 2012 +0200 @@ -1,7 +1,7 @@ # SliTaz package receipt. PACKAGE="glibc-extra-samba" -VERSION="2.13" +VERSION="2.14.1" CATEGORY="base-system" SHORT_DESC="GNU libc extra gconv modules for samba." WEB_SITE="http://gcc.gnu.org/" @@ -14,6 +14,6 @@ { mkdir -p $fs/usr/lib/gconv for i in IBM850.so IBM437.so; do - cp $_pkg/usr/lib/gconv/$i $fs/usr/lib/gconv/$i + cp $install/usr/lib/gconv/$i $fs/usr/lib/gconv/$i done } diff -r 97e8e0e4f878 -r 590cd40daccf glibc-locale/receipt --- a/glibc-locale/receipt Thu Apr 12 15:19:10 2012 +0200 +++ b/glibc-locale/receipt Thu Apr 12 16:31:36 2012 +0200 @@ -1,7 +1,7 @@ # SliTaz package receipt. PACKAGE="glibc-locale" -VERSION="2.13" +VERSION="2.14.1" CATEGORY="system-tools" SHORT_DESC="The GNU C libraries locale files and utilities (see also locale-*)." MAINTAINER="pankso@slitaz.org" @@ -16,14 +16,14 @@ { mkdir -p $fs/usr/share $fs/usr/lib $fs/usr/bin - cp -a $_pkg/usr/lib/gconv $fs/usr/lib - cp -a $_pkg/usr/share/locale $fs/usr/share - cp -a $_pkg/usr/share/i18n $fs/usr/share - cp -a $_pkg/usr/share/zoneinfo $fs/usr/share + cp -a $install/usr/lib/gconv $fs/usr/lib + cp -a $install/usr/share/locale $fs/usr/share + cp -a $install/usr/share/i18n $fs/usr/share + cp -a $install/usr/share/zoneinfo $fs/usr/share # Utilities and tools - cp -a $_pkg/usr/bin/iconv $fs/usr/bin - cp -a $_pkg/usr/bin/tzselect $fs/usr/bin + cp -a $install/usr/bin/iconv $fs/usr/bin + cp -a $install/usr/bin/tzselect $fs/usr/bin # Rm base files. echo -n "* Removing all base files..." diff -r 97e8e0e4f878 -r 590cd40daccf glibc/receipt --- a/glibc/receipt Thu Apr 12 15:19:10 2012 +0200 +++ b/glibc/receipt Thu Apr 12 16:31:36 2012 +0200 @@ -1,7 +1,7 @@ # SliTaz package receipt. PACKAGE="glibc" -VERSION="2.13" +VERSION="2.14.1" CATEGORY="meta" SHORT_DESC="The GNU C libraries. This package is used to compile the libc." MAINTAINER="pankso@slitaz.org" @@ -10,7 +10,7 @@ WGET_URL="$GNU_MIRROR/$PACKAGE/$TARBALL" DEPENDS="glibc-base glibc-locale glibc-dev" -BUILD_DEPENDS="linux-api-headers" +BUILD_DEPENDS="linux-api-headers autoconf bash" # Genpkg order for tazwok. COOK_OPT="genpkg=glibc-base:glibc-extra-samba:glib-locale:glibc-dev" @@ -20,8 +20,12 @@ { cd $src - # Fix a bug that prevents Glibc from building with GCC-4.5.2: - patch -Np1 -i $stuff/glibc-2.13-gcc_fix-1.patch + # Glibc Bug Fixes Patch from LFS + patch -Np1 -i $stuff/glibc-2.14.1-fixes-1.patch + # Glibc Bug Sort Relocatable Objects Patch + patch -Np1 -i $stuff/glibc-2.14.1-sort-1.patch + # Fix a bug that prevents Glibc from building with GCC-4.6.2 + patch -Np1 -i stuff/glibc-2.14.1-gcc_fix-1.patch # Build in a separate directory. mkdir ../glibc-build && cd ../glibc-build @@ -66,17 +70,27 @@ [ -d "/var/lib/tazpkg/installed/gawk" ] || tazpkg get-install gawk fi - # Following patches and sed fixes comes from LFS development book: - # http://www.linuxfromscratch.org/lfs/view/development/chapter06/glibc.html - DL=$(readelf -l /bin/sh | sed -n 's@.*interpret.*/tools\(.*\)]$@\1@p') - sed -i "s|libs -o|libs -L/usr/lib -Wl,-dynamic-linker=$DL -o|" \ - scripts/test-installation.pl - unset DL + # Fixes and patches from LFS, Redhat sed -i -e 's/"db1"/& \&\& $name ne "nss_test1"/' scripts/test-installation.pl sed -i 's|@BASH@|/bin/bash|' elf/ldd.bash.in - # Fix a bug that prevents Glibc from building with GCC-4.5.2: - patch -Np1 -i $stuff/glibc-2.13-gcc_fix-1.patch + # Glibc misc Bug Fixes + patch -Np1 -i $stuff/glibc-2.14.1-fixes-1.patch + + # Glibc Bug Sort Relocatable Objects Patch + #patch -Np1 -i $stuff/glibc-2.14.1-sort-1.patch + + # Fix a bug that prevents Glibc from building with GCC-4.6.2 + patch -Np1 -i $stuff/glibc-2.14.1-gcc_fix-1.patch + + # Revert commit causing issues with crappy DNS servers + patch -Np1 -i $stuff/glibc-2.14-revert-4768ae77.patch + + # re-export RPC interface until libtirpc is ready as a replacement + # http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=acee4873 (only fedora branch...) + patch -Np1 -i $stuff/glibc-2.14-reexport-rpc-interface.patch + # http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=bdd816a3 (only fedora branch...) + patch -Np1 -i $stuff/glibc-2.14-reinstall-nis-rpc-headers.patch # Fix a stack imbalance that occurs under some conditions: sed -i '195,213 s/PRIVATE_FUTEX/FUTEX_CLOCK_REALTIME/' \ @@ -105,7 +119,8 @@ --enable-kernel=2.6.30 \ --libexecdir=/usr/lib/glibc \ --build=$HOST_SYSTEM \ - --host=$HOST_SYSTEM && + --host=$HOST_SYSTEM \ + --target=$BUILD_SYSTEM && make && make install_root=$DESTDIR install } || return 1 diff -r 97e8e0e4f878 -r 590cd40daccf glibc/stuff/glibc-2.14-reexport-rpc-interface.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/glibc/stuff/glibc-2.14-reexport-rpc-interface.patch Thu Apr 12 16:31:36 2012 +0200 @@ -0,0 +1,26 @@ +diff --git a/include/libc-symbols.h b/include/libc-symbols.h +index 67e1ca2..5e7cca5 100644 +--- a/include/libc-symbols.h ++++ b/include/libc-symbols.h +@@ -635,7 +635,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) +-# define libc_hidden_nolink(name, version) hidden_nolink (name, libc, version) ++# define libc_hidden_nolink(name, version) hidden_def (name) + # define libc_hidden_ver(local, name) hidden_ver (local, name) + # define libc_hidden_data_def(name) hidden_data_def (name) + # define libc_hidden_data_weak(name) hidden_data_weak (name) +diff --git a/sunrpc/Makefile b/sunrpc/Makefile +index 5134ce9..40c73d1 100644 +--- a/sunrpc/Makefile ++++ b/sunrpc/Makefile +@@ -53,7 +53,7 @@ headers-in-tirpc = $(addprefix rpc/,auth.h auth_unix.h clnt.h pmap_clnt.h \ + des_crypt.h) + headers-not-in-tirpc = $(addprefix rpc/,key_prot.h rpc_des.h) \ + $(rpcsvc:%=rpcsvc/%) rpcsvc/bootparam.h +-headers = rpc/netdb.h ++headers = rpc/netdb.h $(headers-in-tirpc) $(headers-not-in-tirpc) + install-others = $(inst_sysconfdir)/rpc + generated = $(rpcsvc:%.x=rpcsvc/%.h) $(rpcsvc:%.x=x%.c) $(rpcsvc:%.x=x%.stmp) \ + $(rpcsvc:%.x=rpcsvc/%.stmp) rpcgen diff -r 97e8e0e4f878 -r 590cd40daccf glibc/stuff/glibc-2.14-reinstall-nis-rpc-headers.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/glibc/stuff/glibc-2.14-reinstall-nis-rpc-headers.patch Thu Apr 12 16:31:36 2012 +0200 @@ -0,0 +1,28 @@ +From bdd816a366c4e5bba5de7157d948e0c0737fb4fb Mon Sep 17 00:00:00 2001 +From: Andreas Schwab +Date: Tue, 17 May 2011 17:42:30 +0200 +Subject: [PATCH] Reinstall NIS RPC headers + +--- + nis/Makefile | 4 ++-- + 1 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/nis/Makefile b/nis/Makefile +index b5c9609..d2934d9 100644 +--- a/nis/Makefile ++++ b/nis/Makefile +@@ -23,9 +23,9 @@ subdir := nis + + aux := nis_hash + ++headers := $(wildcard rpcsvc/*.[hx]) + distribute := nss-nis.h nss-nisplus.h nis_intern.h Banner \ +- nisplus-parser.h nis_xdr.h nss \ +- $(wildcard rpcsvc/*.[hx]) ++ nisplus-parser.h nis_xdr.h nss + + # These are the databases available for the nis (and perhaps later nisplus) + # service. This must be a superset of the services in nss. +-- +1.7.5.4 + diff -r 97e8e0e4f878 -r 590cd40daccf glibc/stuff/glibc-2.14-revert-4768ae77.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/glibc/stuff/glibc-2.14-revert-4768ae77.patch Thu Apr 12 16:31:36 2012 +0200 @@ -0,0 +1,37 @@ +diff -Naur glibc-orig//resolv/res_send.c glibc/resolv/res_send.c +--- glibc-orig//resolv/res_send.c 2011-06-10 18:59:03.041436996 +1000 ++++ glibc/resolv/res_send.c 2011-06-10 19:08:09.379309323 +1000 +@@ -549,7 +549,7 @@ + ns, ansp, ansp2, nansp2, resplen2); + if (n < 0) + return (-1); +- if (n == 0 && (buf2 == NULL || *resplen2 == 0)) ++ if (n == 0) + goto next_ns; + } else { + /* Use datagrams. */ +@@ -559,7 +559,7 @@ + ansp2, nansp2, resplen2); + if (n < 0) + return (-1); +- if (n == 0 && (buf2 == NULL || *resplen2 == 0)) ++ if (n == 0) + goto next_ns; + if (v_circuit) + // XXX Check whether both requests failed or +@@ -1275,14 +1275,10 @@ + (*thisresplenp > *thisanssizp) + ? *thisanssizp : *thisresplenp); + +- if (recvresp1 || (buf2 != NULL && recvresp2)) { +- *resplen2 = 0; ++ if (recvresp1 || (buf2 != NULL && recvresp2)) + return resplen; +- } + if (buf2 != NULL) + { +- /* No data from the first reply. */ +- resplen = 0; + /* We are waiting for a possible second reply. */ + if (hp->id == anhp->id) + recvresp1 = 1; diff -r 97e8e0e4f878 -r 590cd40daccf glibc/stuff/glibc-2.14.1-fixes-1.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/glibc/stuff/glibc-2.14.1-fixes-1.patch Thu Apr 12 16:31:36 2012 +0200 @@ -0,0 +1,159 @@ +Submitted By: Matt Burgess +Date: 2011-10-07 +Initial Package Version: 2.14.1 +Upstream Status: From upstream +Origin: Matt Burgess +Description: Fixes Firefox crashes and a bug when programs link to + SDL. + +diff -Naur glibc-2.14.1.orig/elf/dl-close.c glibc-2.14.1/elf/dl-close.c +--- glibc-2.14.1.orig/elf/dl-close.c 2011-10-07 09:48:55.000000000 +0000 ++++ glibc-2.14.1/elf/dl-close.c 2011-10-07 19:43:10.346411120 +0000 +@@ -119,17 +119,8 @@ + 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)) +diff -Naur glibc-2.14.1.orig/elf/dl-deps.c glibc-2.14.1/elf/dl-deps.c +--- glibc-2.14.1.orig/elf/dl-deps.c 2011-10-07 09:48:55.000000000 +0000 ++++ glibc-2.14.1/elf/dl-deps.c 2011-10-07 19:43:10.348432639 +0000 +@@ -478,6 +478,7 @@ + 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. */ +@@ -678,6 +679,7 @@ + l_initfini[nlist] = NULL; + atomic_write_barrier (); + map->l_initfini = l_initfini; ++ map->l_free_initfini = 1; + if (l_reldeps != NULL) + { + atomic_write_barrier (); +@@ -686,7 +688,7 @@ + _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, +diff -Naur glibc-2.14.1.orig/elf/dl-libc.c glibc-2.14.1/elf/dl-libc.c +--- glibc-2.14.1.orig/elf/dl-libc.c 2011-10-07 09:48:55.000000000 +0000 ++++ glibc-2.14.1/elf/dl-libc.c 2011-10-07 19:43:10.352411141 +0000 +@@ -279,6 +279,10 @@ + 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 +diff -Naur glibc-2.14.1.orig/elf/rtld.c glibc-2.14.1/elf/rtld.c +--- glibc-2.14.1.orig/elf/rtld.c 2011-10-07 09:48:55.000000000 +0000 ++++ glibc-2.14.1/elf/rtld.c 2011-10-07 19:43:10.355406263 +0000 +@@ -2263,6 +2263,7 @@ + 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, +diff -Naur glibc-2.14.1.orig/include/link.h glibc-2.14.1/include/link.h +--- glibc-2.14.1.orig/include/link.h 2011-10-07 09:48:55.000000000 +0000 ++++ glibc-2.14.1/include/link.h 2011-10-07 19:43:10.357462703 +0000 +@@ -192,6 +192,9 @@ + 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 @@ + + /* 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 +diff -Naur glibc-2.14.1.orig/resolv/res_query.c glibc-2.14.1/resolv/res_query.c +--- glibc-2.14.1.orig/resolv/res_query.c 2011-10-07 09:48:55.000000000 +0000 ++++ glibc-2.14.1/resolv/res_query.c 2011-10-07 19:43:10.361412711 +0000 +@@ -122,6 +122,7 @@ + int *resplen2) + { + HEADER *hp = (HEADER *) answer; ++ HEADER *hp2; + int n, use_malloc = 0; + u_int oflags = statp->_flags; + +@@ -239,26 +240,25 @@ + /* __libc_res_nsend might have reallocated the buffer. */ + hp = (HEADER *) *answerp; + +- /* We simplify the following tests by assigning HP to HP2. It +- is easy to verify that this is the same as ignoring all +- tests of HP2. */ +- HEADER *hp2 = answerp2 ? (HEADER *) *answerp2 : hp; +- +- if (n < (int) sizeof (HEADER) && answerp2 != NULL +- && *resplen2 > (int) sizeof (HEADER)) ++ /* We simplify the following tests by assigning HP to HP2 or ++ vice versa. It is easy to verify that this is the same as ++ ignoring all tests of HP or HP2. */ ++ if (answerp2 == NULL || *resplen2 < (int) sizeof (HEADER)) + { +- /* Special case of partial answer. */ +- assert (hp != hp2); +- hp = hp2; ++ hp2 = hp; + } +- else if (answerp2 != NULL && *resplen2 < (int) sizeof (HEADER) +- && n > (int) sizeof (HEADER)) ++ else + { +- /* Special case of partial answer. */ +- assert (hp != hp2); +- hp2 = hp; ++ hp2 = (HEADER *) *answerp2; ++ if (n < (int) sizeof (HEADER)) ++ { ++ hp = hp2; ++ } + } + ++ /* Make sure both hp and hp2 are defined */ ++ assert((hp != NULL) && (hp2 != NULL)); ++ + if ((hp->rcode != NOERROR || ntohs(hp->ancount) == 0) + && (hp2->rcode != NOERROR || ntohs(hp2->ancount) == 0)) { + #ifdef DEBUG diff -r 97e8e0e4f878 -r 590cd40daccf glibc/stuff/glibc-2.14.1-gcc_fix-1.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/glibc/stuff/glibc-2.14.1-gcc_fix-1.patch Thu Apr 12 16:31:36 2012 +0200 @@ -0,0 +1,49 @@ +Submitted By: Matt Burgess +Date: 2010-04-18 +Initial Package Version: 2.11.1 +Upstream Status: Not Submitted +Origin: http://www.eglibc.org/archives/patches/msg00073.html +Description: Fixes the following build problem with GCC-4.5.0: + +/mnt/lfs/sources/libc-build/math/s_frexp.os.dt -MT /mnt/lfs/sources/libc-build/math/s_frexp.os +./sysdeps/i386/fpu/s_frexp.S: Assembler messages: +./sysdeps/i386/fpu/s_frexp.S:66: Error: invalid identifier for ".ifdef" +./sysdeps/i386/fpu/s_frexp.S:66: Error: junk at end of line, first unrecognized character is `1' +./sysdeps/i386/fpu/s_frexp.S:66: Error: junk at end of line, first unrecognized character is `1' +./sysdeps/i386/fpu/s_frexp.S:66: Error: junk at end of line, first unrecognized character is `1' +./sysdeps/i386/fpu/s_frexp.S:66: Error: junk at end of line, first unrecognized character is `.' +./sysdeps/i386/fpu/s_frexp.S:66: Error: junk at end of line, first unrecognized character is `1' +./sysdeps/i386/fpu/s_frexp.S:66: Error: expected comma after name `' in .size directive +./sysdeps/i386/fpu/s_frexp.S:66: Error: ".endif" without ".if" +./sysdeps/i386/fpu/s_frexp.S:66: Error: junk `.get_pc_thunk.dx' after expression +make[2]: *** [/mnt/lfs/sources/libc-build/math/s_frexp.os] Error 1 + +diff -Naur glibc-2.11.1.orig/nptl/sysdeps/pthread/pt-initfini.c glibc-2.11.1/nptl/sysdeps/pthread/pt-initfini.c +--- glibc-2.11.1.orig/nptl/sysdeps/pthread/pt-initfini.c 2009-12-08 20:10:20.000000000 +0000 ++++ glibc-2.11.1/nptl/sysdeps/pthread/pt-initfini.c 2010-04-17 11:34:06.882681001 +0000 +@@ -45,6 +45,11 @@ + /* Embed an #include to pull in the alignment and .end directives. */ + asm ("\n#include \"defs.h\""); + ++asm ("\n#if defined __i686 && defined __ASSEMBLER__"); ++asm ("\n#undef __i686"); ++asm ("\n#define __i686 __i686"); ++asm ("\n#endif"); ++ + /* The initial common code ends here. */ + asm ("\n/*@HEADER_ENDS*/"); + +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 +--- glibc-2.11.1.orig/sysdeps/unix/sysv/linux/i386/sysdep.h 2009-12-08 20:10:20.000000000 +0000 ++++ glibc-2.11.1/sysdeps/unix/sysv/linux/i386/sysdep.h 2010-04-17 11:34:06.882681001 +0000 +@@ -29,6 +29,10 @@ + #include + #include + ++#if defined __i686 && defined __ASSEMBLER__ ++#undef __i686 ++#define __i686 __i686 ++#endif + + /* For Linux we can use the system call table in the header file + /usr/include/asm/unistd.h diff -r 97e8e0e4f878 -r 590cd40daccf glibc/stuff/glibc-2.14.1-sort-1.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/glibc/stuff/glibc-2.14.1-sort-1.patch Thu Apr 12 16:31:36 2012 +0200 @@ -0,0 +1,273 @@ +Submitted By: Bruce Dubbs +Date: 2012-02-24 +Initial Package Version: 2.14.1 +Upstream Status: From upstream +Origin: Upstream +Description: Sort objects by dependency before relocation. + Fixes segfault in dlopen for several programs. + +diff --git a/Makeconfig b/Makeconfig +index 2db2821..68547b2 100644 +--- a/Makeconfig ++++ b/Makeconfig +@@ -938,6 +938,12 @@ libdl = + endif + 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 +@@ -303,45 +303,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 ++#include ++ ++ ++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 ++ ++int ++foo (double d) ++{ ++ return floor (d) != 0.0; ++} +-- +1.7.3.4 +