[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commits] r2811 - in /fsf/glibc-2_5-branch/libc: ./ argp/ debug/ dlfcn/ elf/ iconv/ iconvdata/ include/ include/rpcsvc/ include/sys/ i...



Author: eglibc
Date: Fri Jul 13 00:07:16 2007
New Revision: 2811

Log:
Import glibc-2.5 for 2007-07-13

Added:
    fsf/glibc-2_5-branch/libc/argp/tst-argp2.c
    fsf/glibc-2_5-branch/libc/inet/test-inet6_opt.c
    fsf/glibc-2_5-branch/libc/io/bug-ftw5.c
    fsf/glibc-2_5-branch/libc/localedata/locales/sr_RS
    fsf/glibc-2_5-branch/libc/localedata/locales/sr_RS@latin
    fsf/glibc-2_5-branch/libc/nptl/sysdeps/unix/sysv/linux/rtld-lowlevel.h
    fsf/glibc-2_5-branch/libc/nptl/tst-robust9.c
    fsf/glibc-2_5-branch/libc/nptl/tst-robustpi9.c
    fsf/glibc-2_5-branch/libc/nptl/tst-sem10.c
    fsf/glibc-2_5-branch/libc/posix/bug-regex27.c
    fsf/glibc-2_5-branch/libc/posix/bug-regex28.c
    fsf/glibc-2_5-branch/libc/posix/tst-vfork3.c
    fsf/glibc-2_5-branch/libc/resolv/tst-inet_ntop.c
    fsf/glibc-2_5-branch/libc/stdio-common/bug17.c
    fsf/glibc-2_5-branch/libc/stdio-common/tst-sprintf2.c
    fsf/glibc-2_5-branch/libc/sysdeps/generic/rtld-lowlevel.h
    fsf/glibc-2_5-branch/libc/sysdeps/i386/fpu/math_private.h
    fsf/glibc-2_5-branch/libc/sysdeps/ia64/ldbl2mpn.c
    fsf/glibc-2_5-branch/libc/sysdeps/unix/sysv/linux/posix_madvise.c
    fsf/glibc-2_5-branch/libc/sysdeps/x86_64/fpu/math_private.h
    fsf/glibc-2_5-branch/libc/sysdeps/x86_64/ldbl2mpn.c
    fsf/glibc-2_5-branch/libc/time/tst-strptime3.c
Modified:
    fsf/glibc-2_5-branch/libc/ChangeLog
    fsf/glibc-2_5-branch/libc/argp/Makefile
    fsf/glibc-2_5-branch/libc/argp/argp-help.c
    fsf/glibc-2_5-branch/libc/config.h.in
    fsf/glibc-2_5-branch/libc/debug/xtrace.sh
    fsf/glibc-2_5-branch/libc/dlfcn/dlinfo.c
    fsf/glibc-2_5-branch/libc/elf/dl-addr.c
    fsf/glibc-2_5-branch/libc/elf/dl-close.c
    fsf/glibc-2_5-branch/libc/elf/dl-dst.h
    fsf/glibc-2_5-branch/libc/elf/dl-iteratephdr.c
    fsf/glibc-2_5-branch/libc/elf/dl-load.c
    fsf/glibc-2_5-branch/libc/elf/dl-lookup.c
    fsf/glibc-2_5-branch/libc/elf/dl-minimal.c
    fsf/glibc-2_5-branch/libc/elf/dl-open.c
    fsf/glibc-2_5-branch/libc/elf/dl-runtime.c
    fsf/glibc-2_5-branch/libc/elf/dl-support.c
    fsf/glibc-2_5-branch/libc/elf/dl-sym.c
    fsf/glibc-2_5-branch/libc/elf/dl-sysdep.c
    fsf/glibc-2_5-branch/libc/elf/do-lookup.h
    fsf/glibc-2_5-branch/libc/elf/ldconfig.c
    fsf/glibc-2_5-branch/libc/elf/rtld.c
    fsf/glibc-2_5-branch/libc/iconv/gconv_charset.h
    fsf/glibc-2_5-branch/libc/iconv/iconv_open.c
    fsf/glibc-2_5-branch/libc/iconvdata/gconv-modules
    fsf/glibc-2_5-branch/libc/iconvdata/johab.c
    fsf/glibc-2_5-branch/libc/iconvdata/ksc5601.c
    fsf/glibc-2_5-branch/libc/iconvdata/ksc5601.h
    fsf/glibc-2_5-branch/libc/iconvdata/uhc.c
    fsf/glibc-2_5-branch/libc/include/link.h
    fsf/glibc-2_5-branch/libc/include/rpcsvc/nislib.h
    fsf/glibc-2_5-branch/libc/include/sys/cdefs.h
    fsf/glibc-2_5-branch/libc/include/sys/mman.h
    fsf/glibc-2_5-branch/libc/inet/Makefile
    fsf/glibc-2_5-branch/libc/inet/inet6_opt.c
    fsf/glibc-2_5-branch/libc/io/Makefile
    fsf/glibc-2_5-branch/libc/io/fts.c
    fsf/glibc-2_5-branch/libc/io/ftw.c
    fsf/glibc-2_5-branch/libc/libio/bits/stdio.h
    fsf/glibc-2_5-branch/libc/libio/fileops.c
    fsf/glibc-2_5-branch/libc/libio/libio.h
    fsf/glibc-2_5-branch/libc/libio/libioP.h
    fsf/glibc-2_5-branch/libc/libio/oldfileops.c
    fsf/glibc-2_5-branch/libc/locale/C-translit.h
    fsf/glibc-2_5-branch/libc/locale/C-translit.h.in
    fsf/glibc-2_5-branch/libc/locale/iso-3166.def
    fsf/glibc-2_5-branch/libc/locale/iso-4217.def
    fsf/glibc-2_5-branch/libc/locale/programs/ld-ctype.c
    fsf/glibc-2_5-branch/libc/localedata/ChangeLog
    fsf/glibc-2_5-branch/libc/localedata/SUPPORTED
    fsf/glibc-2_5-branch/libc/localedata/charmaps/EUC-KR
    fsf/glibc-2_5-branch/libc/localedata/charmaps/JOHAB
    fsf/glibc-2_5-branch/libc/localedata/locales/as_IN
    fsf/glibc-2_5-branch/libc/localedata/locales/bn_BD
    fsf/glibc-2_5-branch/libc/localedata/locales/en_ZA
    fsf/glibc-2_5-branch/libc/localedata/locales/ru_RU
    fsf/glibc-2_5-branch/libc/localedata/locales/sl_SI
    fsf/glibc-2_5-branch/libc/localedata/locales/sr_ME
    fsf/glibc-2_5-branch/libc/localedata/locales/translit_neutral
    fsf/glibc-2_5-branch/libc/login/utmp_file.c
    fsf/glibc-2_5-branch/libc/malloc/arena.c
    fsf/glibc-2_5-branch/libc/malloc/memusage.sh
    fsf/glibc-2_5-branch/libc/math/basic-test.c
    fsf/glibc-2_5-branch/libc/math/bug-nextafter.c
    fsf/glibc-2_5-branch/libc/math/bug-nexttoward.c
    fsf/glibc-2_5-branch/libc/math/libm-test.inc
    fsf/glibc-2_5-branch/libc/math/math_private.h
    fsf/glibc-2_5-branch/libc/math/s_nextafter.c
    fsf/glibc-2_5-branch/libc/math/s_nexttowardf.c
    fsf/glibc-2_5-branch/libc/math/test-misc.c
    fsf/glibc-2_5-branch/libc/misc/madvise.c
    fsf/glibc-2_5-branch/libc/nis/nis_call.c
    fsf/glibc-2_5-branch/libc/nis/nis_domain_of.c
    fsf/glibc-2_5-branch/libc/nis/nis_lookup.c
    fsf/glibc-2_5-branch/libc/nis/nis_table.c
    fsf/glibc-2_5-branch/libc/nis/nss-default.c
    fsf/glibc-2_5-branch/libc/nis/nss_nis/nis-hosts.c
    fsf/glibc-2_5-branch/libc/nis/nss_nis/nis-service.c
    fsf/glibc-2_5-branch/libc/nis/nss_nisplus/nisplus-ethers.c
    fsf/glibc-2_5-branch/libc/nis/nss_nisplus/nisplus-network.c
    fsf/glibc-2_5-branch/libc/nis/nss_nisplus/nisplus-pwd.c
    fsf/glibc-2_5-branch/libc/nis/nss_nisplus/nisplus-rpc.c
    fsf/glibc-2_5-branch/libc/nis/nss_nisplus/nisplus-service.c
    fsf/glibc-2_5-branch/libc/nis/nss_nisplus/nisplus-spwd.c
    fsf/glibc-2_5-branch/libc/nis/rpcsvc/nislib.h
    fsf/glibc-2_5-branch/libc/nptl/ChangeLog
    fsf/glibc-2_5-branch/libc/nptl/Makefile
    fsf/glibc-2_5-branch/libc/nptl/allocatestack.c
    fsf/glibc-2_5-branch/libc/nptl/descr.h
    fsf/glibc-2_5-branch/libc/nptl/init.c
    fsf/glibc-2_5-branch/libc/nptl/pthreadP.h
    fsf/glibc-2_5-branch/libc/nptl/pthread_getattr_np.c
    fsf/glibc-2_5-branch/libc/nptl/pthread_mutex_lock.c
    fsf/glibc-2_5-branch/libc/nptl/pthread_mutex_timedlock.c
    fsf/glibc-2_5-branch/libc/nptl/pthread_mutex_trylock.c
    fsf/glibc-2_5-branch/libc/nptl/sysdeps/alpha/tls.h
    fsf/glibc-2_5-branch/libc/nptl/sysdeps/i386/tls.h
    fsf/glibc-2_5-branch/libc/nptl/sysdeps/ia64/tls.h
    fsf/glibc-2_5-branch/libc/nptl/sysdeps/powerpc/tls.h
    fsf/glibc-2_5-branch/libc/nptl/sysdeps/s390/tls.h
    fsf/glibc-2_5-branch/libc/nptl/sysdeps/sh/tls.h
    fsf/glibc-2_5-branch/libc/nptl/sysdeps/sparc/tls.h
    fsf/glibc-2_5-branch/libc/nptl/sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h
    fsf/glibc-2_5-branch/libc/nptl/sysdeps/unix/sysv/linux/fork.c
    fsf/glibc-2_5-branch/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_timedwait.S
    fsf/glibc-2_5-branch/libc/nptl/sysdeps/unix/sysv/linux/i386/sysdep-cancel.h
    fsf/glibc-2_5-branch/libc/nptl/sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h
    fsf/glibc-2_5-branch/libc/nptl/sysdeps/unix/sysv/linux/lowlevelrobustlock.c
    fsf/glibc-2_5-branch/libc/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h
    fsf/glibc-2_5-branch/libc/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h
    fsf/glibc-2_5-branch/libc/nptl/sysdeps/unix/sysv/linux/s390/s390-32/sysdep-cancel.h
    fsf/glibc-2_5-branch/libc/nptl/sysdeps/unix/sysv/linux/s390/s390-64/sysdep-cancel.h
    fsf/glibc-2_5-branch/libc/nptl/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h
    fsf/glibc-2_5-branch/libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep-cancel.h
    fsf/glibc-2_5-branch/libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep-cancel.h
    fsf/glibc-2_5-branch/libc/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
    fsf/glibc-2_5-branch/libc/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S
    fsf/glibc-2_5-branch/libc/nptl/sysdeps/unix/sysv/linux/x86_64/sysdep-cancel.h
    fsf/glibc-2_5-branch/libc/nptl/sysdeps/x86_64/tls.h
    fsf/glibc-2_5-branch/libc/nptl/tst-cancel-wrappers.sh
    fsf/glibc-2_5-branch/libc/nptl/tst-cancel4.c
    fsf/glibc-2_5-branch/libc/nscd/gai.c
    fsf/glibc-2_5-branch/libc/nscd/grpcache.c
    fsf/glibc-2_5-branch/libc/nscd/nscd-client.h
    fsf/glibc-2_5-branch/libc/nscd/nscd_getai.c
    fsf/glibc-2_5-branch/libc/nscd/nscd_getgr_r.c
    fsf/glibc-2_5-branch/libc/nscd/nscd_gethst_r.c
    fsf/glibc-2_5-branch/libc/nscd/nscd_getpw_r.c
    fsf/glibc-2_5-branch/libc/nscd/nscd_helper.c
    fsf/glibc-2_5-branch/libc/nscd/nscd_initgroups.c
    fsf/glibc-2_5-branch/libc/nscd/pwdcache.c
    fsf/glibc-2_5-branch/libc/nscd/selinux.c
    fsf/glibc-2_5-branch/libc/nscd/selinux.h
    fsf/glibc-2_5-branch/libc/nss/nss_files/files-hosts.c
    fsf/glibc-2_5-branch/libc/po/ru.po
    fsf/glibc-2_5-branch/libc/po/sv.po
    fsf/glibc-2_5-branch/libc/posix/Makefile
    fsf/glibc-2_5-branch/libc/posix/execvp.c
    fsf/glibc-2_5-branch/libc/posix/regcomp.c
    fsf/glibc-2_5-branch/libc/posix/unistd.h
    fsf/glibc-2_5-branch/libc/resolv/Makefile
    fsf/glibc-2_5-branch/libc/resolv/inet_ntop.c
    fsf/glibc-2_5-branch/libc/resolv/nss_dns/dns-host.c
    fsf/glibc-2_5-branch/libc/resolv/nss_dns/dns-network.c
    fsf/glibc-2_5-branch/libc/scripts/check-local-headers.sh
    fsf/glibc-2_5-branch/libc/soft-fp/op-4.h
    fsf/glibc-2_5-branch/libc/soft-fp/op-common.h
    fsf/glibc-2_5-branch/libc/stdio-common/Makefile
    fsf/glibc-2_5-branch/libc/stdio-common/_itoa.c
    fsf/glibc-2_5-branch/libc/stdio-common/printf_fp.c
    fsf/glibc-2_5-branch/libc/stdio-common/test-vfprintf.c
    fsf/glibc-2_5-branch/libc/stdio-common/tfformat.c
    fsf/glibc-2_5-branch/libc/stdio-common/tst-sprintf.c
    fsf/glibc-2_5-branch/libc/stdio-common/tstscanf.c
    fsf/glibc-2_5-branch/libc/stdio-common/vfprintf.c
    fsf/glibc-2_5-branch/libc/stdio-common/vfscanf.c
    fsf/glibc-2_5-branch/libc/stdlib/stdlib.h
    fsf/glibc-2_5-branch/libc/sunrpc/Makefile
    fsf/glibc-2_5-branch/libc/sysdeps/generic/ldsodefs.h
    fsf/glibc-2_5-branch/libc/sysdeps/generic/sysdep-cancel.h
    fsf/glibc-2_5-branch/libc/sysdeps/i386/bits/byteswap.h
    fsf/glibc-2_5-branch/libc/sysdeps/i386/fpu/e_log.S
    fsf/glibc-2_5-branch/libc/sysdeps/i386/fpu/e_logf.S
    fsf/glibc-2_5-branch/libc/sysdeps/i386/fpu/e_logl.S
    fsf/glibc-2_5-branch/libc/sysdeps/i386/fpu/e_pow.S
    fsf/glibc-2_5-branch/libc/sysdeps/i386/fpu/e_powf.S
    fsf/glibc-2_5-branch/libc/sysdeps/i386/fpu/e_powl.S
    fsf/glibc-2_5-branch/libc/sysdeps/i386/fpu/s_nextafterl.c
    fsf/glibc-2_5-branch/libc/sysdeps/i386/fpu/s_nexttoward.c
    fsf/glibc-2_5-branch/libc/sysdeps/i386/fpu/s_nexttowardf.c
    fsf/glibc-2_5-branch/libc/sysdeps/i386/ldbl2mpn.c
    fsf/glibc-2_5-branch/libc/sysdeps/ia64/fpu/fesetround.c
    fsf/glibc-2_5-branch/libc/sysdeps/ieee754/dbl-64/e_pow.c
    fsf/glibc-2_5-branch/libc/sysdeps/ieee754/flt-32/s_nextafterf.c
    fsf/glibc-2_5-branch/libc/sysdeps/ieee754/ldbl-128/s_nextafterl.c
    fsf/glibc-2_5-branch/libc/sysdeps/ieee754/ldbl-128/s_nexttoward.c
    fsf/glibc-2_5-branch/libc/sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c
    fsf/glibc-2_5-branch/libc/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c
    fsf/glibc-2_5-branch/libc/sysdeps/ieee754/ldbl-128ibm/s_fpclassifyl.c
    fsf/glibc-2_5-branch/libc/sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c
    fsf/glibc-2_5-branch/libc/sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c
    fsf/glibc-2_5-branch/libc/sysdeps/ieee754/ldbl-128ibm/s_nexttowardf.c
    fsf/glibc-2_5-branch/libc/sysdeps/ieee754/ldbl-96/s_nextafterl.c
    fsf/glibc-2_5-branch/libc/sysdeps/ieee754/ldbl-96/s_nexttoward.c
    fsf/glibc-2_5-branch/libc/sysdeps/ieee754/ldbl-96/s_nexttowardf.c
    fsf/glibc-2_5-branch/libc/sysdeps/ieee754/ldbl-opt/s_nexttowardfd.c
    fsf/glibc-2_5-branch/libc/sysdeps/posix/euidaccess.c
    fsf/glibc-2_5-branch/libc/sysdeps/posix/getaddrinfo.c
    fsf/glibc-2_5-branch/libc/sysdeps/unix/sysv/linux/check_pf.c
    fsf/glibc-2_5-branch/libc/sysdeps/unix/sysv/linux/ifaddrs.c
    fsf/glibc-2_5-branch/libc/sysdeps/unix/sysv/linux/syscalls.list
    fsf/glibc-2_5-branch/libc/sysdeps/x86_64/bits/byteswap.h
    fsf/glibc-2_5-branch/libc/sysdeps/x86_64/fpu/e_log10l.S
    fsf/glibc-2_5-branch/libc/sysdeps/x86_64/fpu/e_log2l.S
    fsf/glibc-2_5-branch/libc/sysdeps/x86_64/fpu/e_logl.S
    fsf/glibc-2_5-branch/libc/sysdeps/x86_64/fpu/e_powl.S
    fsf/glibc-2_5-branch/libc/sysdeps/x86_64/fpu/s_log1pl.S
    fsf/glibc-2_5-branch/libc/time/Makefile
    fsf/glibc-2_5-branch/libc/time/strptime_l.c

Modified: fsf/glibc-2_5-branch/libc/ChangeLog
==============================================================================
--- fsf/glibc-2_5-branch/libc/ChangeLog (original)
+++ fsf/glibc-2_5-branch/libc/ChangeLog Fri Jul 13 00:07:16 2007
@@ -1,3 +1,868 @@
+2007-07-03  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	[BZ #4702]
+	* nis/nss-default.c: Include errno.h.
+	(init): Preserve errno.
+
+2007-07-01  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* elf/dl-sysdep.c (_dl_important_hwcaps): Add integer overflow check.
+	* elf/dl-minimal.c (__libc_memalign): Likewise.  Handle malloc (0).
+	Return NULL if mmap failed instead of asserting it does not.
+	(calloc): Check for integer overflow.
+
+	* elf/dl-minimal.c (__strtoul_internal): Fix parsing of numbers bigger
+	than LONG_MAX / 10.
+
+2007-06-19  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* sysdeps/generic/ldsodefs.h (rtld_global): Reorder some elements
+	to fill in holes
+	(rtld_global_ro): Likewise.
+
+2007-06-18  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* elf/dl-addr.c (_dl_addr): Skip PT_LOAD checking if l_contiguous.
+	Move PT_LOAD checking to...
+	(_dl_addr_inside_object): ... here, new function.
+	* elf/dl-sym.c (do_sym): If not l_contiguous,
+	call _dl_addr_inside_object.
+	* elf/dl-iteratephdr.c (__dl_iterate_phdr): Likewise.
+	* dlfcn/dlinfo.c (dlinfo_doit): Likewise.
+	* elf/dl-open.c (dl_open_worker): Likewise.
+	(_dl_addr_inside_object): New function if IS_IN_rtld.
+	* elf/dl-load.c (_dl_map_object_from_fd): Set l_contiguous if no
+	holes are present or are PROT_NONE protected.
+	* include/link.h (struct link_map): Add l_contiguous field.
+	* sysdeps/generic/ldsodefs.h (_dl_addr_inside_object): New prototype.
+
+2007-06-18  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* elf/rtld.c (dl_main): Don't call init_tls more than once.
+
+2007-06-19  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* elf/dl-close.c (free_mem): Free _dl_scope_free_list.
+
+2007-06-13  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* include/link.h: Don't include rtld-lowlevel.h.
+	(struct link_map): Remove l_scope_lock.
+	* sysdeps/generic/ldsodefs.h: Don't include rtld-lowlevel.h.
+	(_dl_scope_free_list): New field (variable) in _rtld_global.
+	(DL_LOOKUP_SCOPE_LOCK): Remove.
+	(_dl_scope_free): New prototype.
+	* elf/dl-runtime.c (_dl_fixup): Don't use __rtld_mrlock_*lock.
+	Don't pass DL_LOOKUP_SCOPE_LOCK to _dl_lookup_symbol_x.
+	(_dl_profile_fixup): Likewise.
+	* elf/dl-sym.c (do_sym): Likewise.  Use wrapped _dl_lookup_symbol_x
+	whenever !RTLD_SINGLE_THREAD_P, use THREAD_GSCOPE_SET_FLAG and
+	THREAD_GSCOPE_RESET_FLAG around it.
+	* elf/dl-close.c (_dl_close_worker): Don't use
+	__rtld_mrlock_{change,done}.  Call _dl_scope_free on the old
+	scope.  Make sure THREAD_GSCOPE_WAIT () happens if any old
+	scopes were queued or if l_scope_mem has been abandoned.
+	* elf/dl-open.c (_dl_scope_free): New function.
+	(dl_open_worker): Use it.  Don't use __rtld_mrlock_{change,done}.
+	* elf/dl-support.c (_dl_scope_free_list): New variable.
+	* elf/dl-lookup.c (add_dependency): Remove flags argument.
+	Remove DL_LOOKUP_SCOPE_LOCK handling.
+	(_dl_lookup_symbol_x): Adjust caller.  Remove DL_LOOKUP_SCOPE_LOCK
+	handling.
+	* elf/dl-object.c (_dl_new_object): Don't use
+	__rtld_mrlock_initialize.
+
+2007-06-09  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* elf/do-lookup.h (do_lookup_x): Read r_nlist before r_list and
+	make sure gcc doesn't mess around with this.
+
+2007-06-08  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* elf/dl-lookup.c (_dl_lookup_symbol_x): Remove use of r_nlist.
+
+2007-06-08  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* elf/dl-close.c (_dl_close_worker): Remove all to be removed
+	libraries from the global scope at once and call THREAD_GSCOPE_WAIT
+	at most once per _dl_close_worker.
+
+2007-05-18  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* elf/dl-close.c (_dl_close_worker): When removing object from
+	global scope, wait for all lookups to finish afterwards.
+	* elf/dl-open.c (add_to_global): When global scope array must
+	grow, allocate a new one and free old array only after all
+	lookups finish.
+	* elf/dl-runtime.c (_dl_fixup): Protect using global scope.
+	(_dl_lookup_symbol_x): Likewise.
+	* elf/dl-support.c: Define _dl_wait_lookup_done.
+	* sysdeps/generic/ldsodefs.h (struct rtld_global): Add
+	_dl_wait_lookup_done.
+
+2007-05-11  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* elf/dl-close.c (_dl_close_worker): Help gcc to optimize by
+	adding new variables.
+
+	* elf/dl-open.c (add_to_global): Introduce variable ns to help gcc
+	optimize.  Completely extend global scope array before making the
+	new entries visible.
+
+2007-01-15  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* sysdeps/generic/ldsodefs.h: Define DL_LOOKUP_SCOPE_LOCK.
+	* elf/dl-lookup.c (add_dependency): If scope map is locked, unlock
+	it before getting dl_load_lock and then relock.
+	(_dl_lookup_symbol_x): Pass flags to add_dependency.
+	When rerunning _dl_lookup_symbol_x, compute symbol_scope again in
+	case we unlocked the scope.
+	* elf/dl-runtime.c (_dl_fixup): Pass DL_LOOKUP_SCOPE_LOCK to
+	_dl_lookup_symbol_x in case we locked the scope.
+	(_dl_profile_fixup): Likewise.
+	* elf/dl-sym.c (do_sym): In flags passed to call_dl_lookup, also
+	set DL_LOOKUP_SCOPE_LOCK.
+
+2006-10-29  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* elf/dl-sym.c (do_sym): Use RTLD_SINGLE_THREAD_P.
+	* elf/dl-runtime.c (_dl_fixup, _dl_profile_fixup): Likewise.
+	* elf/dl-close.c (_dl_close_worker): Likewise.
+	* elf/dl-open.c (_dl_open_worker): Likewise.
+	* sysdeps/generic/sysdep-cancel.h (RTLD_SINGLE_THREAD_P): Define.
+
+2006-10-27  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* elf/dl-lookup.c (_dl_debug_bindings): Remove unused symbol_scope
+	argument.
+	(_dl_lookup_symbol_x): Adjust caller.
+
+	* sysdeps/generic/ldsodefs.h (struct link_namespaces): Remove
+	_ns_global_scope.
+	* elf/rtld.c (dl_main): Don't initialize _ns_global_scope.
+
+	* elf/dl-libc.c: Revert l_scope name changes.
+	* elf/dl-load.c: Likewise.
+	* elf/dl-object.c: Likewise.
+	* elf/rtld.c: Likewise.
+	* elf/dl-close.c (_dl_close): Likewise.
+	* elf/dl-open.c (dl_open_worker): Likewise.  If not SINGLE_THREAD_P,
+	always use __rtld_mrlock_{change,done}.  Always free old scope list
+	here if not l_scope_mem.
+	* elf/dl-runtime.c (_dl_fixup, _dl_profile_fixup): Revert l_scope name
+	change.  Never free scope list here.  Just __rtld_mrlock_lock before
+	the lookup and __rtld_mrlock_unlock it after the lookup.
+	* elf/dl-sym.c: Likewise.
+	* include/link.h (struct r_scoperec): Remove.
+	(struct link_map): Replace l_scoperec with l_scope, l_scoperec_mem
+	with l_scope_mem and l_scoperec_lock with l_scope_lock.
+
+2006-10-18  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* elf/dl-lookup.c (_dl_lookup_symbol_x): Add warning to
+	_dl_lookup_symbol_x code.
+
+2006-10-17  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* elf/dl-runtime.c: Include sysdep-cancel.h.
+	(_dl_fixup, _dl_profile_fixup): Use __rtld_mrlock_* and
+	scoperec->nusers only if !SINGLE_THREAD_P.
+	* elf/dl-sym.c: Include sysdep-cancel.h.
+	(do_sym): Use __rtld_mrlock_* and scoperec->nusers only
+	if !SINGLE_THREAD_P.
+	* elf/dl-close.c: Include sysdep-cancel.h.
+	(_dl_close): Use __rtld_mrlock_* and scoperec->nusers only
+	if !SINGLE_THREAD_P.
+	* elf/dl-open.c: Include sysdep-cancel.h.
+	(dl_open_worker): Use __rtld_mrlock_* and scoperec->nusers only
+	if !SINGLE_THREAD_P.
+
+2006-10-09  Ulrich Drepper  <drepper@xxxxxxxxxx>
+	    Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	Implement reference counting of scope records.
+	* elf/dl-close.c (_dl_close): Remove all scopes from removed objects
+	from the list in objects which remain.  Always allocate new scope
+	record.
+	* elf/dl-open.c (dl_open_worker): When growing array for scopes,
+	don't resize, allocate a new one.
+	* elf/dl-runtime.c: Update reference counters before using a scope
+	array.
+	* elf/dl-sym.c: Likewise.
+	* elf/dl-libc.c: Adjust for l_scope name change.
+	* elf/dl-load.c: Likewise.
+	* elf/dl-object.c: Likewise.
+	* elf/rtld.c: Likewise.
+	* include/link.h: Include <rtld-lowlevel.h>.  Define struct
+	r_scoperec.  Replace r_scope with pointer to r_scoperec structure.
+	Add l_scoperec_lock.
+	* sysdeps/generic/ldsodefs.h: Include <rtld-lowlevel.h>.
+	* sysdeps/generic/rtld-lowlevel.h: New file.
+
+2007-06-06  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	[BZ #4586]
+	* sysdeps/i386/ldbl2mpn.c (__mpn_extract_long_double): Treat
+	pseudo-zeros as zero.
+	* sysdeps/x86_64/ldbl2mpn.c: New file.
+	* sysdeps/ia64/ldbl2mpn.c: New file.
+
+2007-06-05  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c
+	(__mpn_construct_long_double): Fix conversion where result ought
+	to be smaller than __LDBL_MIN__, or the low double should be
+	denormal.  Fix decision where to negate low double - honor round
+	to even rules.
+	* stdio-common/tst-sprintf2.c: Include string.h.
+	(COMPARE_LDBL): Define.
+	(TEST): Also test whether a string hexadecimal float representation
+	can be parsed back to the number.
+	(main): Add a couple of further tests.
+
+2007-06-04  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* sysdeps/ieee754/ldbl-128ibm/printf_fphex.c
+	(PRINT_FPHEX_LONG_DOUBLE): Fix printing numbers where lower double
+	is non-zero, but smaller than 2 * __DBL_MIN__.
+	* stdio-common/tst-sprintf2.c: New test.
+	* stdio-common/Makefile (tests): Add tst-sprintf2.
+
+2007-06-04  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c (nextafterl): Remove
+	unused ily variable.  Fix nextafterl on +-__LDBL_MAX__ and +-Inf.
+	Remove unreachable code at the end.
+
+2007-06-01  Steven Munroe  <sjmunroe@xxxxxxxxxx>
+
+	* sysdeps/ieee754/ldbl-128ibm/s_fpclassifyl.c: Correct description of
+	ldbl-128ibm in comment.
+	(fpclassifyl): Correct classification of denormals.
+	* sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c (nextafterl): Correct
+	return value for MIN denormal. Rewrite using long double math too
+	correctly handle denormals and canonicalize the results.
+
+2007-05-29  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* nscd/nscd_helper.c (get_mapping): Handle short replies instead
+	of crashing.  When this is the case or if the reply is malformed,
+	don't try to close the new file descriptor since it does not
+	exist.
+	Patch in part by Guillaume Chazarain <guichaz@xxxxxxxx>.
+
+2007-05-21  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	[BZ #4514]
+	* stdio-common/vfprintf.c (vfprintf): Don't shadow workstart variable,
+	reinitialize workend at the start of each do_positional format spec
+	loop, free workstart before do_positional loops.
+	(printf_unknown): Fix size of work_buffer.
+	* stdio-common/tst-sprintf.c (main): Add 3 new testcases.
+
+2007-05-10  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* include/sys/cdefs.h: Redefine __nonnull so that test for
+	incorrect parameters in the libc code itself are not omitted.
+
+2007-05-07  Ulrich Drepper  <drepper@xxxxxxxxxx>
+	    Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* malloc/arena.c (heap_info): Add mprotect_size field, adjust pad.
+	(new_heap): Initialize mprotect_size.
+	(grow_heap): When growing, only mprotect from mprotect_size till
+	new_size if mprotect_size is smaller.  When shrinking, use PROT_NONE
+	MMAP for __libc_enable_secure only, otherwise use MADV_DONTNEED.
+
+2007-05-06  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* stdio-common/vfprintf.c (process_string_arg): Optimize
+	ridiculous precision in wide char code printing multi-byte string.
+	Reported by Jim Meyering <jim@xxxxxxxxxxxx>.
+
+2007-05-06  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	[BZ #4465]
+	* posix/unistd.h: Remove __THROW from fdatasync.
+
+2007-05-06  Mike Frysinger  <vapier@xxxxxxxxxx>
+
+	[BZ #4465]
+	* sysdeps/unix/sysv/linux/syscalls.list (fdatasync): Add "C" to args.
+
+2007-05-06  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	[BZ #4131]
+	* elf/dl-addr.c (_dl_addr): Compare address with actual segment
+	boundaries to work around systems with overlapping binary loading.
+	Based on a patch by Suzuki <suzuki@xxxxxxxxxx>.
+
+2007-05-04  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* stdio-common/vfprintf.c (process_string_arg): Adjust call to
+	__mbsnrtowcs after last change.
+
+2007-05-02  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* stdio-common/vfprintf.c (process_string_arg): Use a VLA rather than
+	fixed length array for ignore.
+
+2007-04-30  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	[BZ #4438]
+	* stdio-common/vfprintf.c (process_string_arg): Don't overflow the
+	stack for large precisions.
+	* stdio-common/test-vfprintf.c (main): Add test for large
+	precision.
+
+2007-04-30  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* stdio-common/printf_fp.c (___printf_fp): Don't print negative sign
+	for exponent 0.
+	* stdio-common/tfformat.c (sprint_doubles): Add a new test.
+
+2007-04-30  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	[BZ #4439]
+	* resolv/inet_ntop.c (inet_ntop4): Take terminating '\0' into
+	account in the size check.
+	* resolv/tst-inet_ntop.c: New test.
+	* resolv/Makefile (tests): Add tst-inet_ntop.
+
+2007-04-28  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	[BZ #4102]
+	* sysdeps/posix/getaddrinfo.c (default_labels): Assign separate
+	label to Teredo tunnel addresses 2001://32.
+
+2007-04-27  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	[BZ #4342]
+	* stdio-common/vfscanf.c (_IO_vfscanf_internal): Allow
+	hexa-decimal floats without exponent.
+	* stdio-common/tstscanf.c (main): Adjust Test 8 test for success.
+
+2007-04-27  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	[BZ #3213]
+	* locale/C-translit.h.in: Add entry for U2044.
+
+2007-04-25  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/check_pf.c (make_request): Return -1 instead
+	of 0 after the out_fail label.
+
+2007-03-18  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* nscd/gai.c: Include alloca.h.
+	(__libc_use_alloca): Define.
+
+2007-03-15  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/ifaddrs.c (__netlink_request): Never
+	reallocate the buffer, instead fail for MSG_TRUNC or for EBUSY
+	NLMSG_ERR.  Instead use a page sized buffer.
+	* sysdeps/unix/sysv/linux/check_pf.c (make_request): Use page sized
+	buffer.
+
+2007-03-02  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/ifaddrs.c (__netlink_request): Retry with
+	a new netlink socket if NLMSG_ERR -EBUSY is seen after some MSG_TRUNC
+	message.
+
+2007-02-27  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/ifaddrs.c (__netlink_request): Fix
+	memory reallocation.
+
+2007-04-25  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* libio/bits/stdio.h (fgetc_unlocked): Add extern inline optimized
+	version.
+
+2007-04-25  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	[BZ #4406]
+	* iconv/gconv_charset.h (strip): Allow ':'
+	* iconv/iconv_open.c (iconv_open): Adjust comment.
+
+2007-04-23  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	[BZ #4405]
+	* iconvdata/gconv-modules (E13B): Add a missing slash to the alias
+	name.  Patch by Aurelien Jarno <aurelien@xxxxxxxxxxx>.
+
+2007-04-23  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	[BZ #4381]
+	* nss/nss_files/files-hosts.c (HOST_DB_LOOKUP): Ensure sufficient
+	alignment of buffer and tmp_buffer.
+	* nis/nss_nis/nis-hosts.c (internal_nis_gethostent_r,
+	internal_gethostbyname2_r, _nss_nis_gethostbyaddr_r): Ensure sufficient
+	alignment of buffer.
+	* resolv/nss_dns/dns-hosts.c (getanswer_r): Likewise.  Handle buflen
+	bigger than INT_MAX.
+	* resolv/nss_dns/dns-network.c (getanswer_r): Likewise.  Add errnop and
+	h_errnop arguments.  Fail if buflen is too small.
+	(_nss_dns_getnetbyname_r, _nss_dns_getnetbyaddr_r): Adjust callers.
+
+2007-04-19  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* include/sys/mman.h: Mark madvise hidden.
+	* misc/madvise.c: Add libc_hidden_def.
+
+2007-04-17  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	[BZ #4368]
+	* stdlib/stdlib.h: Remove obsolete part of comment for realpath.
+
+2007-04-16  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	[BZ #4364]
+	* posix/unistd.h (_XOPEN_VERSION): Define appropriately for SUSv3.
+
+2007-04-13  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	[BZ #4344]
+	* elf/ldconfig.c (search_dir): Fix 2 off-by-2 errors.
+	Reported by David Anderson <davea42@xxxxxxxxxxxxx>.
+
+2007-04-13  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* stdio-common/printf_fp.c (___printf_fp): Fix exponent -4
+	special case handling when wcp == wstartp + 1.  Fix a comment typo.
+	* stdio-common/tfformat.c (sprint_doubles): Add a new testcase.
+
+2007-02-21  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	[BZ #4070]
+	* stdio-common/printf_fp.c (___printf_fp): Handle a few more
+	special cases.
+	* stdio-common/tfformat.c (sprint_doubles): Some more tests.
+
+2007-02-19  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* stdio-common/printf_fp.c (___printf_fp): Cleanups and minor
+	optimization.
+
+2007-04-06  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* nis/nis_domain_of.c (__nis_domain_of): New function.
+	* include/rpcsvc/nislib.h (__nis_domain_of): New prototype.
+	* nis/nis_lookup.c (nis_lookup): Use __nis_domain_of.
+	* nis/nis_call.c (rec_dirsearch): Likewise.
+	(first_shoot): Likewise.  Remove search_parent_first argument.
+	(struct nis_server_cache): Rename search_parent_first field
+	to search_parent.
+	(nis_server_cache_search, nis_server_cache_add): Rename
+	search_parent_first argument to search_parent.
+	(__nisfind_server): Likewise.  If search_parent, call
+	__nis_domain_of.
+
+2007-04-05  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* nis/nis_call.c (__nisfind_server): Replace (*dir)->do_servers
+	with obj->do_servers after first_shoot.
+
+2007-03-21  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* nis/nis_call.c: Include bits/libc-lock.h, sys/stat.h, unistd.h.
+	(nis_server_cache, nis_server_cache_lock, nis_cold_start_mtime): New
+	variables.
+	(nis_server_cache_search, nis_server_cache_add): New functions.
+	(__nisfind_server): Use them.  Add dbp and flags argument, if
+	call __nisbind_create.
+	(__nisbind_create): Add server_used and current_ep arguments,
+	only call __nis_findfastest if server_used is ~0.
+	(__do_niscall2, __prepare_niscall): Adjust callers.
+	(ckey_cache, ckey_cache_size, ckey_cache_allocated, ckey_cache_pid,
+	ckey_cache_euid, ckey_cache_lock): New variables.
+	(get_ckey): New function.
+	(__nisbind_connect): If not dbp->use_udp, pass IPPROTO_TCP to
+	__pmap_getnisport.  Save __pmap_getnisport result in
+	dbp->addr.sin_port if non-zero.  Use get_ckey to create conversation
+	key.
+	* nis/nis_lookup.c (nis_lookup): Likewise.
+	* nis/nis_table.c (nis_list): Likewise.
+	* nis/rpcsvc/nislib.h (__nisbind_create, __nisfind_server): Adjust
+	prototypes.
+
+	* nis/nss_nisplus/nisplus-pwd.c (_nss_nisplus_getpwnam_r,
+	_nss_nisplus_getpwuid_r): Pass USE_DGRAM flag to nis_list.
+	* nis/nss_nisplus/nisplus-service.c (_nss_nisplus_getservbyname_r,
+	_nss_nisplus_getservbyport_r): Likewise.
+	* nis/nss_nisplus/nisplus-network.c (_nss_nisplus_getnetbyname_r,
+	_nss_nisplus_getnetbyaddr_r): Likewise.
+	* nis/nss_nisplus/nisplus-spwd.c (_nss_nisplus_getspnam_r): Likewise.
+	* nis/nss_nisplus/nisplus-ethers.c (_nss_nisplus_gethostton_r,
+	_nss_nisplus_getntohost_r): Likewise.
+	* nis/nss_nisplus/nisplus-rpc.c (_nss_nisplus_getrpcbyname_r,
+	_nss_nisplus_getrpcbynumber_r): Likewise.
+
+2007-04-01  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* sysdeps/ia64/fpu/fesetround.c (fesetround): Return 0 on success
+	and 1 on failure.
+
+2007-04-01  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c (__nextafterl): Use
+	math_opt_barrier and math_force_eval macros.
+
+2007-03-27  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	[BZ #3306]
+	* math/math_private.h (math_opt_barrier, math_force_eval): Define.
+	* sysdeps/i386/fpu/math_private.h: New file.
+	* sysdeps/x86_64/fpu/math_private.h: New file.
+	* math/s_nexttowardf.c (__nexttowardf): Use math_opt_barrier and
+	math_force_eval macros.  Use "+m" constraint on asm rather than
+	"=m" and "m".
+	* math/s_nextafter.c (__nextafter): Likewise.
+	* sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c (__nexttoward):
+	Likewise.
+	* sysdeps/ieee754/flt-32/s_nextafterf.c (__nextafterf): Likewise.
+	* sysdeps/ieee754/ldbl-128/s_nexttoward.c (__nexttoward): Likewise.
+	* sysdeps/ieee754/ldbl-96/s_nexttoward.c (__nexttoward): Likewise.
+	* sysdeps/i386/fpu/s_nextafterl.c (__nextafterl): Use
+	math_opt_barrier and math_force_eval macros.
+	* sysdeps/ieee754/ldbl-128/s_nextafterl.c (__nextafterl): Likewise.
+	* sysdeps/ieee754/ldbl-96/s_nextafterl.c (__nextafterl): Likewise.
+	* sysdeps/i386/fpu/s_nexttoward.c: Include float.h.
+	(__nexttoward): Use math_opt_barrier and
+	math_force_eval macros.  Use "+m" constraint on asm rather than
+	"=m" and "m".  Only use asm to force double result if
+	FLT_EVAL_METHOD is 2.
+	* sysdeps/i386/fpu/s_nexttowardf.c: Include float.h.
+	(__nexttowardf): Use math_opt_barrier and
+	math_force_eval macros.  Use "+m" constraint on asm rather than
+	"=m" and "m".  Only use asm to force double result if
+	FLT_EVAL_METHOD is not 0.
+	* sysdeps/ieee754/ldbl-128ibm/s_nexttowardf.c: Include float.h.
+	(__nexttowardf): Use math_opt_barrier and
+	math_force_eval macros.  If FLT_EVAL_METHOD is not 0, force
+	x to float using asm.
+	* sysdeps/ieee754/ldbl-opt/s_nexttowardfd.c: Include float.h.
+	(__nldbl_nexttowardf): Use math_opt_barrier and
+	math_force_eval macros.  If FLT_EVAL_METHOD is not 0, force
+	x to float using asm.
+	* sysdeps/ieee754/ldbl-96/s_nexttowardf.c: Include float.h.
+	(__nexttowardf): Use math_opt_barrier and math_force_eval
+	macros.  If FLT_EVAL_METHOD is not 0, force x to float using asm.
+	* math/bug-nextafter.c (zero, inf): New variables.
+	(main): Add new tests.
+	* math/bug-nexttoward.c (zero, inf): New variables.
+	(main): Add new tests.
+
+2007-03-30  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* libio/libio.h (__underflow, __uflow, __overflow, __wunderflow,
+	__wuflow, __woverflow, _IO_getc, _IO_putc, _IO_peekc_locked, _IO_padn,
+	_IO_sgetn, _IO_seekoff, _IO_seekpos, _IO_getwc, _IO_putwc, _IO_wpadn):
+	Remove __THROW.
+	* libio/fileops.c (new_do_write, _IO_file_xsgetn_mmap,
+	_IO_file_xsgetn_maybe_mmap): Likewise.
+	* libio/oldfileops.c (old_do_write): Likewise.
+	* libio/libioP.h (_IO_switch_to_get_mode, _IO_switch_to_wget_mode,
+	_IO_init_marker, _IO_init_wmarker, _IO_default_uflow,
+	_IO_wdefault_uflow, _IO_default_setbuf, _IO_default_seekpos,
+	_IO_do_write, _IO_new_do_write, _IO_old_do_write, _IO_wdo_write,
+	_IO_flush_all_lockp, _IO_flush_all, _IO_cleanup,
+	_IO_flush_all_linebuffered, _IO_new_fgetpos, _IO_old_fgetpos,
+	_IO_new_fsetpos, _IO_old_fsetpos, _IO_new_fgetpos64,
+	_IO_old_fgetpos64, _IO_new_fsetpos64, _IO_old_fsetpos64,
+	_IO_file_setbuf, _IO_file_seekoff, _IO_file_xsputn, _IO_file_xsgetn,
+	_IO_file_underflow, _IO_file_underflow_mmap,
+	_IO_file_underflow_maybe_mmap, _IO_file_overflow, _IO_file_attach,
+	_IO_file_open, _IO_file_fopen, _IO_file_write, _IO_file_read,
+	_IO_file_sync, _IO_file_close_it, _IO_file_finish,
+	_IO_new_file_attach, _IO_new_file_close_it, _IO_new_file_finish,
+	_IO_new_file_fopen, _IO_new_file_setbuf, _IO_file_setbuf_mmap,
+	_IO_new_file_sync, _IO_new_file_underflow, _IO_new_file_overflow,
+	_IO_new_file_seekoff, _IO_new_file_write, _IO_new_file_xsputn,
+	_IO_old_file_setbuf, _IO_old_file_seekoff, _IO_old_file_xsputn,
+	_IO_old_file_underflow, _IO_old_file_overflow, _IO_old_file_attach,
+	_IO_old_file_fopen, _IO_old_file_write, _IO_old_file_sync,
+	_IO_old_file_close_it, _IO_old_file_finish, _IO_wfile_xsputn,
+	_IO_wfile_setbuf, _IO_wfile_sync, _IO_wfile_underflow,
+	_IO_wfile_overflow, _IO_wfile_seekoff, _IO_old_proc_open,
+	_IO_old_proc_close, _IO_getdelim, _IO_flush_all_internal,
+	_IO_adjust_column_internal, _IO_default_uflow_internal,
+	_IO_default_xsgetn_internal, _IO_wdefault_xsputn_internal,
+	_IO_wdefault_xsgetn_internal, _IO_wdefault_uflow_internal,
+	_IO_file_setbuf_internal, _IO_file_seekoff_internal,
+	_IO_file_xsputn_internal, _IO_file_xsgetn_internal,
+	_IO_file_close_it_internal, _IO_file_underflow_internal,
+	_IO_file_overflow_internal, _IO_file_attach_internal,
+	_IO_file_fopen_internal, _IO_file_sync_internal,
+	_IO_file_finish_internal, _IO_wfile_xsputn_internal,
+	_IO_wfile_seekoff_internal, _IO_wfile_sync_internal,
+	_IO_switch_to_wget_mode_internal, _IO_padn_internal,
+	_IO_switch_to_get_mode_internal, _IO_seekoff_unlocked,
+	_IO_seekpos_unlocked): Likewise.
+	(_IO_strtod, _IO_dtoa, _IO_outfloat, _IO_read, _IO_write,
+	_IO_lseek, _IO_close, _IO_fstat): Remove unused prototypes.
+
+2007-03-23  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* scripts/check-local-headers.sh: Filter out sys/capability.h.
+
+2007-03-22  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* config.h.in (HAVE_LIBCAP): Add.
+	* nscd/selinux.h: Include sys/capability.h rather than non-existent
+	sys/capabilities.h.
+	* nscd/selinux.c (preserve_capabilities): Use cap_free instead of
+	free_caps.  Cast away const from 4th cap_set_flag argument.
+
+2007-03-16  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* elf/dl-open.c (dl_open_worker): Declare l in 2 different
+	smaller scopes.
+	* elf/dl-dst.h (DL_DST_REQ_STATIC): Add l as macro argument.
+	(DL_DST_REQUIRED): Adjust user.
+
+2007-03-15  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* locale/programs/ld-ctype.c (find_translit): Return NULL if ctype is
+	NULL.
+
+2007-03-15  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	[BZ #4181]
+	* inet/inet6_opt.c (add_padding): Only insert padding if npad > 0.
+	(inet6_opt_append): Don't check extlen is big enough if extbuf
+	is NULL.
+	(inet6_opt_finish): Likewise.
+	* inet/Makefile (tests): Add test-inet6_opt.
+	* inet/test-inet6_opt.c: New test.
+
+2007-03-15  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	[BZ #4130]
+	* login/utmp_file.c (setutent_file): Use O_LARGEFILE for
+	open_not_cancel_2.
+	(updwtmp_file): Likewise.
+
+2007-03-15  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	[BZ #4101]
+	* argp/argp-help.c (hol_cluster_cmp): Fix comparisons used to find
+	ancestors with the same depths.
+	Patch by Niels Moeller <nisse@xxxxxxxxxxxxxx>.
+	(filter_doc): Don't crash if argp is NULL.
+	* argp/Makefile (tests): Add tst-argp2.
+	* argp/tst-argp2.c: New test.
+
+2007-03-15  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	[BZ #3919]
+	* math/libm-test.inc (log_test): Test -Inf and NaN.
+	(log10_test, log1p_test, log2_test): Test -Inf.
+	* sysdeps/i386/fpu/e_log.S (__ieee754_log): Don't raise
+	FE_INVALID when argument is qNaN.
+	* sysdeps/i386/fpu/e_logl.S (__ieee754_logl): Likewise.
+	* sysdeps/i386/fpu/e_logf.S (__ieee754_logf): Likewise.
+	* sysdeps/x86_64/fpu/e_logl.S (__ieee754_logl): Likewise.
+	* sysdeps/x86_64/fpu/e_log10l.S (__ieee754_log10l): Replace
+	andb $1, %ah with testb $1, %ah, don't test for parity, instead
+	testb $4, %ah and jump if non-zero.
+	* sysdeps/x86_64/fpu/e_log2l.S (__ieee754_log2l): Likewise.
+	* sysdeps/x86_64/fpu/s_log1pl.S (__log1pl): Likewise.
+
+2007-03-06  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* sysdeps/posix/getaddrinfo.c (get_scope): Correct test for
+	172.16/12 address range.
+
+2007-03-01  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	[BZ #4069]
+	* sysdeps/ieee754/dbl-64/e_pow.c (__ieee754_pow): Check for NaN
+	earlier.
+	* math/libm-test.inc (pow_test): Add more tests involving NaNs.
+
+	* sysdeps/i386/fpu/e_powf.S (__ieee754_powf): Avoid invalid exception
+	for x qNaN and y either +-inf or non-integer value.
+	* sysdeps/i386/fpu/e_pow.S (__ieee754_pow): Likewise.
+	* sysdeps/i386/fpu/e_powl.S (__ieee754_powl): Likewise.
+	* sysdeps/x86_64/fpu/e_powl.S (__ieee754_powl): Likewise.
+
+2007-02-21  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	[BZ #4076]
+	* io/ftw.c (ftw_startup): Handle special case of FTW_CHDIR in /.
+	(open_dir_stream): Likewise.
+	* io/Makefile (tests): Add bug-ftw5.
+	* io/bug-ftw5.c: New file.
+
+2007-02-21  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* nscd/grpcache.c (cache_addgr): In case a record changed on
+	refresh, adjust key_copy.
+
+	[BZ #4074]
+	* nscd/pwdcache.c (cache_addpw): In case a record changed on
+	refresh, adjust key_copy.
+
+2007-02-21  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	[BZ #3458]
+	* sysdeps/unix/sysv/linux/posix_madvise.c: New file.
+	* sysdeps/unix/sysv/linux/syscalls.list: Remove posix_madvise entry.
+
+2007-02-17  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	[BZ #3842]
+	* sysdeps/posix/euidaccess.c [_LIBC] (euidaccess): Remove shortcut
+	using __libc_enable_secure.
+
+2007-02-17  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	[BZ #3348]
+	* malloc/memusage.sh: Cleanups.
+	* debug/xtrace.sh: Quoting and trap changes.
+
+2007-02-16  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* locale/iso-3166.def: Add entry for Serbia.
+	* locale/iso-4217.def: Define RSD.
+
+2007-02-15  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* nscd/nscd_helper.c (open_socket): Don't send padding bytes from
+	reqdata.
+
+2007-02-13  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* po/ru.po: Update from translation team.
+
+2007-02-03  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* po/sv.po: Update from translation team. 
+
+2007-02-12  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* sysdeps/i386/bits/byteswap.h (__bswap_32): Add __amdfam10__
+	to the list of i486+ CPUs.
+	* sysdeps/x86_64/bits/byteswap.h (__bswap_32): Likewise.
+
+2007-01-24  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* sysdeps/i386/bits/byteswap.h (__bswap_32): Add __nocona__, __core2__
+	and __geode__ to the list of i486+ CPUs.
+	* sysdeps/x86_64/bits/byteswap.h (__bswap_32): Likewise.
+
+2007-02-08  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	[BZ #3944]
+	* time/strptime_l.c (__strptime_internal): Set have_mon for
+	%b/%B/%h.  Set have_mon and have_mday if tm_mon and tm_mday
+	have been computed from tm_yday and tm_year.  Don't crash
+	in day_of_the_week or day_of_the_year if not have_mon
+	and tm_mon contains bogus value.
+	* time/Makefile (tests): Add tst-strptime3.
+	* time/tst-strptime3.c: New test.
+
+2007-02-05  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	[BZ #3957]
+	* posix/regcomp.c (parse_bracket_exp): Set '\n' bit rather than '\0'
+	bit for RE_HAT_LISTS_NOT_NEWLINE.
+	(build_charclass_op): Remove bogus comment.
+	* posix/Makefile (tests): Add bug-regex27 and bug-regex28.
+	* posix/bug-regex27.c: New test.
+	* posix/bug-regex28.c: New test.
+
+2007-02-02  Bruno Haible  <bruno@xxxxxxxxx>
+
+	[BZ #3954]
+	* iconvdata/ksc5601.c (__ksc5601_sym_to_ucs, __ksc5601_sym_from_ucs):
+	Add mapping for U+327E.
+	* iconvdata/ksc5601.h (KSC5601_SYMBOL): Increment.
+	* iconvdata/johab.c (BODY for FROM_LOOP, BODY for TO_LOOP): Enable
+	mapping of 0xD9 0xE8.
+	* iconvdata/uhc.c (BODY for FROM_LOOP, BODY for TO_LOOP): Disable
+	mapping of U+327E.
+	Reported by Jungshik Shin <jungshik@xxxxxxxxxx>.
+
+	[BZ #3955]
+	* iconvdata/johab.c (BODY for FROM_LOOP, BODY for TO_LOOP): Enable
+	mapping of 0xD9 0xE6 and of 0xD9 0xE7.
+	Reported by Jungshik Shin <jungshik@xxxxxxxxxx>.
+
+2007-01-31  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* nscd/nscd-client.h (__nscd_cache_search): Remove const qualifier
+	from return value.
+	* nscd/nscd_helper.c: Include string.h.
+	(__nscd_cache_search): Remove const qualifier from return value.
+	On strict alignment architectures check hash entry and data head
+	alignment.
+	* nscd/nscd_getpw_r.c (nscd_getpw_r): Don't crash or fail because
+	mmapped data during GC cycle contains garbage.  If
+	__nscd_drop_map_ref fails, decrement mapped->counter when returning
+	error or if retrying with NO_MAPPING, only __nscd_unmap if counter
+	dropped to 0.
+	* nscd/nscd_getgr_r.c (nscd_getgr_r): Likewise.
+	* nscd/nscd_initgroups.c (__nscd_getgrouplist): Likewise.
+	* nscd/nscd_gethst_r.c (nscd_gethst_r): Likewise.
+	* nscd/nscd_getai.c (__nscd_getai): Likewise.
+
+2007-01-22  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	[BZ #3902]
+	* stdio-common/_itoa.c (_itoa): Make sure at least a zero is emitted.
+	* stdio-common/Makefile (tests): Add bug17.
+	* stdio-common/bug17.c: New file.
+
+2007-01-15  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* soft-fp/op-common.h (FP_TRUNC): When truncating a NaN, clear
+	workbits in semi-raw fraction.
+
+	* math/test-misc.c: Add new tests.
+
+2007-01-14  Steven Munroe  <sjmunroe@xxxxxxxxxx>
+
+	* math/basic-test.c: Include test-skeleton.c.
+	(TEST_TRUNC): Define.
+	(truncdfsf_test, trunctfsf_test, trunctfdf_test): New.
+	(main): Rename to ...
+	(do_test): ...this.  Run new tests.
+	(TEST_FUNCTION): Define.
+
+2006-10-05  Steven Munroe  <sjmunroe@xxxxxxxxxx>
+	    Joe Kerian  <jkerian@xxxxxxxxxxxxx>
+
+	[BZ #2749]
+	* soft-fp/op-4.h (__FP_FRAC_SUB_3, __FP_FRAC_SUB_4): Correct borrow
+	handling for high words.
+	* soft-fp/op-common.h (_FP_OVERFLOW_SEMIRAW): Always set inexact
+	and overflow for infinity.
+
+2007-01-13  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* nis/nss_nis/nis-service.c (_nss_nis_getservbyname_r): Correct
+	computation of keylen.
+
+2007-01-10  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* io/fts.c: Make sure fts_cur is always valid after return from
+	fts_read.
+	Patch by Miloslav Trmac <mitr@xxxxxxxxxx>.
+
+2007-01-03  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* posix/execvp.c: Include alloca.h.
+	(allocate_scripts_argv): Renamed to...
+	(scripts_argv): ... this.  Don't allocate buffer here nor count
+	arguments.
+	(execvp): Use alloca if possible.
+	* posix/Makefile: Add rules to build and run tst-vfork3 test.
+	* posix/tst-vfork3.c: New test.
+
 2007-01-05  Steven Munroe  <sjmunroe@xxxxxxxxxx>
 
 	* stdlib/tst-makecontext.c: Include errno.h.  Change main()
@@ -999,7 +1864,7 @@
 	* nis/nis_xdr.c: Avoid some function calls.
 
 2006-08-07  Jakub Jelinek  <jakub@xxxxxxxxxx>
-            Ulrich Drepper  <drepper@xxxxxxxxxx>
+	    Ulrich Drepper  <drepper@xxxxxxxxxx>
 
 	* nis/nis_call.c (rec_dirsearch) [case LOWER_NAME]: Don't take
 	short cut if only one name component is stripped away.

Modified: fsf/glibc-2_5-branch/libc/argp/Makefile
==============================================================================
--- fsf/glibc-2_5-branch/libc/argp/Makefile (original)
+++ fsf/glibc-2_5-branch/libc/argp/Makefile Fri Jul 13 00:07:16 2007
@@ -1,4 +1,4 @@
-# Copyright (C) 1997, 2002, 2003, 2006 Free Software Foundation, Inc.
+# Copyright (C) 1997, 2002, 2003, 2006, 2007 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
@@ -26,7 +26,7 @@
 routines	= $(addprefix argp-, ba fmtstream fs-xinl help parse pv \
 				     pvh xinl eexst)
 
-tests		= argp-test tst-argp1 bug-argp1
+tests		= argp-test tst-argp1 bug-argp1 tst-argp2
 
 CFLAGS-argp-help.c = $(uses-callbacks) -fexceptions
 CFLAGS-argp-parse.c = $(uses-callbacks)

Modified: fsf/glibc-2_5-branch/libc/argp/argp-help.c
==============================================================================
--- fsf/glibc-2_5-branch/libc/argp/argp-help.c (original)
+++ fsf/glibc-2_5-branch/libc/argp/argp-help.c Fri Jul 13 00:07:16 2007
@@ -1,5 +1,6 @@
 /* Hierarchial argument parsing help output
-   Copyright (C) 1995-2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 1995-2003, 2004, 2005, 2006, 2007
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Miles Bader <miles@xxxxxxxxxxxxxx>.
 
@@ -672,9 +673,9 @@
 {
   /* If one cluster is deeper than the other, use its ancestor at the same
      level, so that finding the common ancestor is straightforward.  */
-  while (cl1->depth < cl2->depth)
+  while (cl1->depth > cl2->depth)
     cl1 = cl1->parent;
-  while (cl2->depth < cl1->depth)
+  while (cl2->depth > cl1->depth)
     cl2 = cl2->parent;
 
   /* Now reduce both clusters to their ancestors at the point where both have
@@ -987,7 +988,7 @@
 filter_doc (const char *doc, int key, const struct argp *argp,
 	    const struct argp_state *state)
 {
-  if (argp->help_filter)
+  if (argp && argp->help_filter)
     /* We must apply a user filter to this output.  */
     {
       void *input = __argp_input (argp, state);

Added: fsf/glibc-2_5-branch/libc/argp/tst-argp2.c
==============================================================================
--- fsf/glibc-2_5-branch/libc/argp/tst-argp2.c (added)
+++ fsf/glibc-2_5-branch/libc/argp/tst-argp2.c Fri Jul 13 00:07:16 2007
@@ -1,0 +1,101 @@
+/* Copyright (C) 2007 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@xxxxxxxxxx>, 2007.
+
+   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 <argp.h>
+
+static const struct argp_option opt1[] =
+  {
+    { "opt1", '1', "NUMBER", 0, "Option 1" },
+    { NULL, 0, NULL, 0, NULL }
+  };
+
+static const struct argp_option opt2[] =
+  {
+    { "opt2", '2', "NUMBER", 0, "Option 2" },
+    { NULL, 0, NULL, 0, NULL }
+  };
+
+static const struct argp_option opt3[] =
+  {
+    { "opt3", '3', "NUMBER", 0, "Option 3" },
+    { NULL, 0, NULL, 0, NULL }
+  };
+
+static const struct argp_option opt4[] =
+  {
+    { "opt4", '4', "NUMBER", 0, "Option 4" },
+    { NULL, 0, NULL, 0, NULL }
+  };
+
+static const struct argp_option opt5[] =
+  {
+    { "opt5", '5', "NUMBER", 0, "Option 5" },
+    { NULL, 0, NULL, 0, NULL }
+  };
+
+static struct argp argp5 =
+  {
+    opt5, NULL, "args doc5", "doc5", NULL, NULL, NULL
+  };
+
+static struct argp argp4 =
+  {
+    opt4, NULL, "args doc4", "doc4", NULL, NULL, NULL
+  };
+
+static struct argp argp3 =
+  {
+    opt3, NULL, "args doc3", "doc3", NULL, NULL, NULL
+  };
+
+static struct argp_child children2[] =
+  {
+    { &argp4, 0, "child3", 3 },
+    { &argp5, 0, "child4", 4 },
+    { NULL, 0, NULL, 0 }
+  };
+
+static struct argp argp2 =
+  {
+    opt2, NULL, "args doc2", "doc2", children2, NULL, NULL
+  };
+
+static struct argp_child children1[] =
+  {
+    { &argp2, 0, "child1", 1 },
+    { &argp3, 0, "child2", 2 },
+    { NULL, 0, NULL, 0 }
+  };
+
+static struct argp argp1 =
+  {
+    opt1, NULL, "args doc1", "doc1", children1, NULL, NULL
+  };
+
+
+static int
+do_test (void)
+{
+  argp_help (&argp1, stdout, ARGP_HELP_LONG, (char *) "tst-argp2");
+  return 0;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"

Modified: fsf/glibc-2_5-branch/libc/config.h.in
==============================================================================
--- fsf/glibc-2_5-branch/libc/config.h.in (original)
+++ fsf/glibc-2_5-branch/libc/config.h.in Fri Jul 13 00:07:16 2007
@@ -18,6 +18,9 @@
 
 /* Defined if building with SELinux support & audit libs are detected. */
 #undef	HAVE_LIBAUDIT
+
+/* Defined if building with SELinux support & libcap libs are detected.  */
+#undef  HAVE_LIBCAP
 
 /* Define if using XCOFF. Set by --with-xcoff.  */
 #undef	HAVE_XCOFF

Modified: fsf/glibc-2_5-branch/libc/debug/xtrace.sh
==============================================================================
--- fsf/glibc-2_5-branch/libc/debug/xtrace.sh (original)
+++ fsf/glibc-2_5-branch/libc/debug/xtrace.sh Fri Jul 13 00:07:16 2007
@@ -1,5 +1,5 @@
 #! @BASH@
-# Copyright (C) 1999, 2001-2004, 2005, 2006 Free Software Foundation, Inc.
+# Copyright (C) 1999, 2001-2006, 2007 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 # Contributed by Ulrich Drepper <drepper@xxxxxxx>, 1999.
 
@@ -161,32 +161,32 @@
   while read fct; do
     read file
     if test "$fct" != '??' -a "$file" != '??:0'; then
-      format_line $fct $file
+      format_line "$fct" "$file"
     fi
   done
 else
-  fifo=$(mktemp -u ${TMPDIR:-/tmp}/xtrace.XXXXXX)
+  fifo=$(mktemp -ut xtrace.XXXXXX) || exit
+  trap 'rm -f "$fifo"; exit 1' HUP INT QUIT TERM PIPE
   mkfifo -m 0600 $fifo || exit 1
-  trap 'rm $fifo; exit 1' SIGINT SIGTERM SIGPIPE
 
   # Now start the program and let it write to the FIFO.
   $TERMINAL_PROG -T "xtrace - $program $*" -e /bin/sh -c "LD_PRELOAD=$pcprofileso PCPROFILE_OUTPUT=$fifo $program $*; read < $fifo" &
   termpid=$!
-  $pcprofiledump -u $fifo |
+  $pcprofiledump -u "$fifo" |
   while read line; do
-     echo $line |
+     echo "$line" |
      sed 's/this = \([^,]*\).*/\1/' |
-     addr2line -fC -e $program
+     addr2line -fC -e "$program"
   done |
   while read fct; do
     read file
     if test "$fct" != '??' -a "$file" != '??:0'; then
-      format_line $fct $file
+      format_line "$fct" "$file"
     fi
   done
   read -p "Press return here to close $TERMINAL_PROG($program)."
-  echo > $fifo
-  rm $fifo
+  echo > "$fifo"
+  rm "$fifo"
 fi
 
 exit 0

Modified: fsf/glibc-2_5-branch/libc/dlfcn/dlinfo.c
==============================================================================
--- fsf/glibc-2_5-branch/libc/dlfcn/dlinfo.c (original)
+++ fsf/glibc-2_5-branch/libc/dlfcn/dlinfo.c Fri Jul 13 00:07:16 2007
@@ -1,5 +1,5 @@
 /* dlinfo -- Get information from the dynamic linker.
-   Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2006, 2007 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
@@ -58,9 +58,8 @@
       /* Find the highest-addressed object that CALLER is not below.  */
       for (nsid = 0; nsid < DL_NNS; ++nsid)
 	for (l = GL(dl_ns)[nsid]._ns_loaded; l != NULL; l = l->l_next)
-	  if (caller >= l->l_map_start && caller < l->l_map_end)
-	    /* There must be exactly one DSO for the range of the virtual
-	       memory.  Otherwise something is really broken.  */
+	  if (caller >= l->l_map_start && caller < l->l_map_end
+	      && (l->l_contiguous || _dl_addr_inside_object (l, caller)))
 	    break;
 
       if (l == NULL)

Modified: fsf/glibc-2_5-branch/libc/elf/dl-addr.c
==============================================================================
--- fsf/glibc-2_5-branch/libc/elf/dl-addr.c (original)
+++ fsf/glibc-2_5-branch/libc/elf/dl-addr.c Fri Jul 13 00:07:16 2007
@@ -1,5 +1,5 @@
 /* Locate the shared object symbol nearest a given address.
-   Copyright (C) 1996-2004, 2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 1996-2004, 2005, 2006, 2007 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
@@ -22,143 +22,149 @@
 #include <ldsodefs.h>
 
 
+static void
+__attribute ((always_inline))
+determine_info (const ElfW(Addr) addr, struct link_map *match, Dl_info *info,
+		struct link_map **mapp, const ElfW(Sym) **symbolp)
+{
+  /* Now we know what object the address lies in.  */
+  info->dli_fname = match->l_name;
+  info->dli_fbase = (void *) match->l_map_start;
+
+  /* If this is the main program the information is incomplete.  */
+  if (__builtin_expect (match->l_name[0], 'a') == '\0'
+      && match->l_type == lt_executable)
+    info->dli_fname = _dl_argv[0];
+
+  const ElfW(Sym) *symtab
+    = (const ElfW(Sym) *) D_PTR (match, l_info[DT_SYMTAB]);
+  const char *strtab = (const char *) D_PTR (match, l_info[DT_STRTAB]);
+
+  ElfW(Word) strtabsize = match->l_info[DT_STRSZ]->d_un.d_val;
+
+  const ElfW(Sym) *matchsym = NULL;
+  if (match->l_info[DT_ADDRTAGIDX (DT_GNU_HASH) + DT_NUM + DT_THISPROCNUM
+		    + DT_VERSIONTAGNUM + DT_EXTRANUM + DT_VALNUM] != NULL)
+    {
+      /* We look at all symbol table entries referenced by the hash
+	 table.  */
+      for (Elf_Symndx bucket = 0; bucket < match->l_nbuckets; ++bucket)
+	{
+	  Elf32_Word symndx = match->l_gnu_buckets[bucket];
+	  if (symndx != 0)
+	    {
+	      const Elf32_Word *hasharr = &match->l_gnu_chain_zero[symndx];
+
+	      do
+		{
+		  /* The hash table never references local symbols so
+		     we can omit that test here.  */
+		  if ((symtab[symndx].st_shndx != SHN_UNDEF
+		       || symtab[symndx].st_value != 0)
+#ifdef USE_TLS
+		      && ELFW(ST_TYPE) (symtab[symndx].st_info) != STT_TLS
+#endif
+		      && DL_ADDR_SYM_MATCH (match, &symtab[symndx],
+					    matchsym, addr)
+		      && symtab[symndx].st_name < strtabsize)
+		    matchsym = (ElfW(Sym) *) &symtab[symndx];
+
+		  ++symndx;
+		}
+	      while ((*hasharr++ & 1u) == 0);
+	    }
+	}
+    }
+  else
+    {
+      const ElfW(Sym) *symtabend;
+      if (match->l_info[DT_HASH] != NULL)
+	symtabend = (symtab
+		     + ((Elf_Symndx *) D_PTR (match, l_info[DT_HASH]))[1]);
+      else
+	/* There is no direct way to determine the number of symbols in the
+	   dynamic symbol table and no hash table is present.  The ELF
+	   binary is ill-formed but what shall we do?  Use the beginning of
+	   the string table which generally follows the symbol table.  */
+	symtabend = (const ElfW(Sym) *) strtab;
+
+      for (; (void *) symtab < (void *) symtabend; ++symtab)
+	if ((ELFW(ST_BIND) (symtab->st_info) == STB_GLOBAL
+	     || ELFW(ST_BIND) (symtab->st_info) == STB_WEAK)
+#ifdef USE_TLS
+	    && ELFW(ST_TYPE) (symtab->st_info) != STT_TLS
+#endif
+	    && (symtab->st_shndx != SHN_UNDEF
+		|| symtab->st_value != 0)
+	    && DL_ADDR_SYM_MATCH (match, symtab, matchsym, addr)
+	    && symtab->st_name < strtabsize)
+	  matchsym = (ElfW(Sym) *) symtab;
+    }
+
+  if (mapp)
+    *mapp = match;
+  if (symbolp)
+    *symbolp = matchsym;
+
+  if (matchsym)
+    {
+      /* We found a symbol close by.  Fill in its name and exact
+	 address.  */
+      lookup_t matchl = LOOKUP_VALUE (match);
+
+      info->dli_sname = strtab + matchsym->st_name;
+      info->dli_saddr = DL_SYMBOL_ADDRESS (matchl, matchsym);
+    }
+  else
+    {
+      /* No symbol matches.  We return only the containing object.  */
+      info->dli_sname = NULL;
+      info->dli_saddr = NULL;
+    }
+}
+
+
 int
 internal_function
 _dl_addr (const void *address, Dl_info *info,
 	  struct link_map **mapp, const ElfW(Sym) **symbolp)
 {
   const ElfW(Addr) addr = DL_LOOKUP_ADDRESS (address);
+  int result = 0;
 
   /* Protect against concurrent loads and unloads.  */
   __rtld_lock_lock_recursive (GL(dl_load_lock));
 
   /* Find the highest-addressed object that ADDRESS is not below.  */
-  struct link_map *match = NULL;
   for (Lmid_t ns = 0; ns < DL_NNS; ++ns)
     for (struct link_map *l = GL(dl_ns)[ns]._ns_loaded; l; l = l->l_next)
-      if (addr >= l->l_map_start && addr < l->l_map_end)
+      if (addr >= l->l_map_start && addr < l->l_map_end
+	  && (l->l_contiguous || _dl_addr_inside_object (l, addr)))
 	{
-	  /* We know ADDRESS lies within L if in any shared object.
-	     Make sure it isn't past the end of L's segments.  */
-	  size_t n = l->l_phnum;
-	  if (n > 0)
-	    {
-	      do
-		--n;
-	      while (l->l_phdr[n].p_type != PT_LOAD);
-	      if (addr >= (l->l_addr +
-			   l->l_phdr[n].p_vaddr + l->l_phdr[n].p_memsz))
-		/* Off the end of the highest-addressed shared object.  */
-		continue;
-	    }
-
-	  match = l;
-	  break;
+	  determine_info (addr, l, info, mapp, symbolp);
+	  result = 1;
+	  goto out;
 	}
 
-  int result = 0;
-  if (match != NULL)
-    {
-      /* Now we know what object the address lies in.  */
-      info->dli_fname = match->l_name;
-      info->dli_fbase = (void *) match->l_map_start;
-
-      /* If this is the main program the information is incomplete.  */
-      if (__builtin_expect (match->l_name[0], 'a') == '\0'
-	  && match->l_type == lt_executable)
-	info->dli_fname = _dl_argv[0];
-
-      const ElfW(Sym) *symtab
-	= (const ElfW(Sym) *) D_PTR (match, l_info[DT_SYMTAB]);
-      const char *strtab = (const char *) D_PTR (match, l_info[DT_STRTAB]);
-
-      ElfW(Word) strtabsize = match->l_info[DT_STRSZ]->d_un.d_val;
-
-      const ElfW(Sym) *matchsym = NULL;
-      if (match->l_info[DT_ADDRTAGIDX (DT_GNU_HASH) + DT_NUM + DT_THISPROCNUM
-			+ DT_VERSIONTAGNUM + DT_EXTRANUM + DT_VALNUM] != NULL)
-	{
-	  /* We look at all symbol table entries referenced by the
-	     hash table.  */
-	  for (Elf_Symndx bucket = 0; bucket < match->l_nbuckets; ++bucket)
-	    {
-	      Elf32_Word symndx = match->l_gnu_buckets[bucket];
-	      if (symndx != 0)
-		{
-		  const Elf32_Word *hasharr = &match->l_gnu_chain_zero[symndx];
-
-		  do
-		    {
-		      /* The hash table never references local symbols
-			 so we can omit that test here.  */
-		      if ((symtab[symndx].st_shndx != SHN_UNDEF
-			   || symtab[symndx].st_value != 0)
-#ifdef USE_TLS
-			  && ELFW(ST_TYPE) (symtab[symndx].st_info) != STT_TLS
-#endif
-			  && DL_ADDR_SYM_MATCH (match, &symtab[symndx],
-						matchsym, addr)
-			  && symtab[symndx].st_name < strtabsize)
-			matchsym = (ElfW(Sym) *) &symtab[symndx];
-
-		      ++symndx;
-		    }
-		  while ((*hasharr++ & 1u) == 0);
-		}
-	    }
-	}
-      else
-	{
-	  const ElfW(Sym) *symtabend;
-	  if (match->l_info[DT_HASH] != NULL)
-	    symtabend = (symtab
-			 + ((Elf_Symndx *) D_PTR (match, l_info[DT_HASH]))[1]);
-	  else
-	    /* There is no direct way to determine the number of symbols in the
-	       dynamic symbol table and no hash table is present.  The ELF
-	       binary is ill-formed but what shall we do?  Use the beginning of
-	       the string table which generally follows the symbol table.  */
-	    symtabend = (const ElfW(Sym) *) strtab;
-
-	  for (; (void *) symtab < (void *) symtabend; ++symtab)
-	    if ((ELFW(ST_BIND) (symtab->st_info) == STB_GLOBAL
-		 || ELFW(ST_BIND) (symtab->st_info) == STB_WEAK)
-#ifdef USE_TLS
-		&& ELFW(ST_TYPE) (symtab->st_info) != STT_TLS
-#endif
-		&& (symtab->st_shndx != SHN_UNDEF
-		    || symtab->st_value != 0)
-		&& DL_ADDR_SYM_MATCH (match, symtab, matchsym, addr)
-		&& symtab->st_name < strtabsize)
-	      matchsym = (ElfW(Sym) *) symtab;
-	}
-
-      if (mapp)
-	*mapp = match;
-      if (symbolp)
-	*symbolp = matchsym;
-
-      if (matchsym)
-	{
-	  /* We found a symbol close by.  Fill in its name and exact
-	     address.  */
-	  lookup_t matchl = LOOKUP_VALUE (match);
-
-	  info->dli_sname = strtab + matchsym->st_name;
-	  info->dli_saddr = DL_SYMBOL_ADDRESS (matchl, matchsym);
-	}
-      else
-	{
-	  /* No symbol matches.  We return only the containing object.  */
-	  info->dli_sname = NULL;
-	  info->dli_saddr = NULL;
-	}
-
-      result = 1;
-    }
-
+ out:
   __rtld_lock_unlock_recursive (GL(dl_load_lock));
 
   return result;
 }
 libc_hidden_def (_dl_addr)
+
+/* Return non-zero if ADDR lies within one of L's segments.  */
+int
+internal_function
+_dl_addr_inside_object (struct link_map *l, const ElfW(Addr) addr)
+{
+  int n = l->l_phnum;
+  const ElfW(Addr) reladdr = addr - l->l_addr;
+
+  while (--n >= 0)
+    if (l->l_phdr[n].p_type == PT_LOAD
+	&& reladdr - l->l_phdr[n].p_vaddr >= 0
+	&& reladdr - l->l_phdr[n].p_vaddr < l->l_phdr[n].p_memsz)
+      return 1;
+  return 0;
+}

Modified: fsf/glibc-2_5-branch/libc/elf/dl-close.c
==============================================================================
--- fsf/glibc-2_5-branch/libc/elf/dl-close.c (original)
+++ fsf/glibc-2_5-branch/libc/elf/dl-close.c Fri Jul 13 00:07:16 2007
@@ -1,5 +1,5 @@
 /* Close a shared object opened by `_dl_open'.
-   Copyright (C) 1996-2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 1996-2005, 2006, 2007 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
@@ -19,6 +19,7 @@
 
 #include <assert.h>
 #include <dlfcn.h>
+#include <errno.h>
 #include <libintl.h>
 #include <stddef.h>
 #include <stdio.h>
@@ -29,10 +30,16 @@
 #include <ldsodefs.h>
 #include <sys/types.h>
 #include <sys/mman.h>
+#include <sysdep-cancel.h>
+#include <tls.h>
 
 
 /* Type of the constructor functions.  */
 typedef void (*fini_t) (void);
+
+
+/* Special l_idx value used to indicate which objects remain loaded.  */
+#define IDX_STILL_USED -1
 
 
 #ifdef USE_TLS
@@ -103,8 +110,6 @@
 void
 _dl_close_worker (struct link_map *map)
 {
-  Lmid_t ns = map->l_ns;
-
   /* One less direct use.  */
   --map->l_direct_opencount;
 
@@ -127,13 +132,16 @@
       return;
     }
 
+  Lmid_t nsid = map->l_ns;
+  struct link_namespaces *ns = &GL(dl_ns)[nsid];
+
  retry:
   dl_close_state = pending;
 
 #ifdef USE_TLS
   bool any_tls = false;
 #endif
-  const unsigned int nloaded = GL(dl_ns)[ns]._ns_nloaded;
+  const unsigned int nloaded = ns->_ns_nloaded;
   char used[nloaded];
   char done[nloaded];
   struct link_map *maps[nloaded];
@@ -141,7 +149,7 @@
   /* Run over the list and assign indexes to the link maps and enter
      them into the MAPS array.  */
   int idx = 0;
-  for (struct link_map *l = GL(dl_ns)[ns]._ns_loaded; l != NULL; l = l->l_next)
+  for (struct link_map *l = ns->_ns_loaded; l != NULL; l = l->l_next)
     {
       l->l_idx = idx;
       maps[idx] = l;
@@ -174,7 +182,7 @@
       done[done_index] = 1;
       used[done_index] = 1;
       /* Signal the object is still needed.  */
-      l->l_idx = -1;
+      l->l_idx = IDX_STILL_USED;
 
       /* Mark all dependencies as used.  */
       if (l->l_initfini != NULL)
@@ -182,7 +190,7 @@
 	  struct link_map **lp = &l->l_initfini[1];
 	  while (*lp != NULL)
 	    {
-	      if ((*lp)->l_idx != -1)
+	      if ((*lp)->l_idx != IDX_STILL_USED)
 		{
 		  assert ((*lp)->l_idx >= 0 && (*lp)->l_idx < nloaded);
 
@@ -203,7 +211,7 @@
 	  {
 	    struct link_map *jmap = l->l_reldeps[j];
 
-	    if (jmap->l_idx != -1)
+	    if (jmap->l_idx != IDX_STILL_USED)
 	      {
 		assert (jmap->l_idx >= 0 && jmap->l_idx < nloaded);
 
@@ -218,20 +226,22 @@
     }
 
   /* Sort the entries.  */
-  _dl_sort_fini (GL(dl_ns)[ns]._ns_loaded, maps, nloaded, used, ns);
+  _dl_sort_fini (ns->_ns_loaded, maps, nloaded, used, nsid);
 
   /* Call all termination functions at once.  */
 #ifdef SHARED
-  bool do_audit = GLRO(dl_naudit) > 0 && !GL(dl_ns)[ns]._ns_loaded->l_auditing;
+  bool do_audit = GLRO(dl_naudit) > 0 && !ns->_ns_loaded->l_auditing;
 #endif
   bool unload_any = false;
+  bool scope_mem_left = false;
+  unsigned int unload_global = 0;
   unsigned int first_loaded = ~0;
   for (unsigned int i = 0; i < nloaded; ++i)
     {
       struct link_map *imap = maps[i];
 
       /* All elements must be in the same namespace.  */
-      assert (imap->l_ns == ns);
+      assert (imap->l_ns == nsid);
 
       if (!used[i])
 	{
@@ -246,7 +256,7 @@
 	      if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS,
 				    0))
 		_dl_debug_printf ("\ncalling fini: %s [%lu]\n\n",
-				  imap->l_name, ns);
+				  imap->l_name, nsid);
 
 	      if (imap->l_info[DT_FINI_ARRAY] != NULL)
 		{
@@ -289,6 +299,9 @@
 	  /* We indeed have an object to remove.  */
 	  unload_any = true;
 
+	  if (imap->l_global)
+	    ++unload_global;
+
 	  /* Remember where the first dynamically loaded object is.  */
 	  if (i < first_loaded)
 	    first_loaded = i;
@@ -296,8 +309,9 @@
       /* Else used[i].  */
       else if (imap->l_type == lt_loaded)
 	{
-	  if (imap->l_searchlist.r_list == NULL
-	      && imap->l_initfini != NULL)
+	  struct r_scope_elem *new_list = NULL;
+
+	  if (imap->l_searchlist.r_list == NULL && imap->l_initfini != NULL)
 	    {
 	      /* The object is still used.  But one of the objects we are
 		 unloading right now is responsible for loading it.  If
@@ -314,44 +328,108 @@
 	      imap->l_searchlist.r_list = &imap->l_initfini[cnt + 1];
 	      imap->l_searchlist.r_nlist = cnt;
 
-	      for (cnt = 0; imap->l_scope[cnt] != NULL; ++cnt)
-		/* This relies on l_scope[] entries being always set either
-		   to its own l_symbolic_searchlist address, or some map's
-		   l_searchlist address.  */
-		if (imap->l_scope[cnt] != &imap->l_symbolic_searchlist)
-		  {
-		    struct link_map *tmap;
-
-		    tmap = (struct link_map *) ((char *) imap->l_scope[cnt]
-						- offsetof (struct link_map,
-							    l_searchlist));
-		    assert (tmap->l_ns == ns);
-		    if (tmap->l_idx != -1)
-		      {
-			imap->l_scope[cnt] = &imap->l_searchlist;
-			break;
-		      }
-		  }
-	    }
-	  else
-	    {
-	      unsigned int cnt = 0;
-	      while (imap->l_scope[cnt] != NULL)
+	      new_list = &imap->l_searchlist;
+	    }
+
+	  /* Count the number of scopes which remain after the unload.
+	     When we add the local search list count it.  Always add
+	     one for the terminating NULL pointer.  */
+	  size_t remain = (new_list != NULL) + 1;
+	  bool removed_any = false;
+	  for (size_t cnt = 0; imap->l_scope[cnt] != NULL; ++cnt)
+	    /* This relies on l_scope[] entries being always set either
+	       to its own l_symbolic_searchlist address, or some map's
+	       l_searchlist address.  */
+	    if (imap->l_scope[cnt] != &imap->l_symbolic_searchlist)
+	      {
+		struct link_map *tmap = (struct link_map *)
+		  ((char *) imap->l_scope[cnt]
+		   - offsetof (struct link_map, l_searchlist));
+		assert (tmap->l_ns == nsid);
+		if (tmap->l_idx == IDX_STILL_USED)
+		  ++remain;
+		else
+		  removed_any = true;
+	      }
+	    else
+	      ++remain;
+
+	  if (removed_any)
+	    {
+	      /* Always allocate a new array for the scope.  This is
+		 necessary since we must be able to determine the last
+		 user of the current array.  If possible use the link map's
+		 memory.  */
+	      size_t new_size;
+	      struct r_scope_elem **newp;
+
+#define SCOPE_ELEMS(imap) \
+  (sizeof (imap->l_scope_mem) / sizeof (imap->l_scope_mem[0]))
+
+	      if (imap->l_scope != imap->l_scope_mem
+		  && remain < SCOPE_ELEMS (imap))
 		{
-		  if (imap->l_scope[cnt] == &map->l_searchlist)
+		  new_size = SCOPE_ELEMS (imap);
+		  newp = imap->l_scope_mem;
+		}
+	      else
+		{
+		  new_size = imap->l_scope_max;
+		  newp = (struct r_scope_elem **)
+		    malloc (new_size * sizeof (struct r_scope_elem *));
+		  if (newp == NULL)
+		    _dl_signal_error (ENOMEM, "dlclose", NULL,
+				      N_("cannot create scope list"));
+		}
+
+	      /* Copy over the remaining scope elements.  */
+	      remain = 0;
+	      for (size_t cnt = 0; imap->l_scope[cnt] != NULL; ++cnt)
+		{
+		  if (imap->l_scope[cnt] != &imap->l_symbolic_searchlist)
 		    {
-		      while ((imap->l_scope[cnt] = imap->l_scope[cnt + 1])
-			     != NULL)
-			++cnt;
-		      break;
+		      struct link_map *tmap = (struct link_map *)
+			((char *) imap->l_scope[cnt]
+			 - offsetof (struct link_map, l_searchlist));
+		      if (tmap->l_idx != IDX_STILL_USED)
+			{
+			  /* Remove the scope.  Or replace with own map's
+			     scope.  */
+			  if (new_list != NULL)
+			    {
+			      newp[remain++] = new_list;
+			      new_list = NULL;
+			    }
+			  continue;
+			}
 		    }
-		  ++cnt;
+
+		  newp[remain++] = imap->l_scope[cnt];
 		}
+	      newp[remain] = NULL;
+
+	      struct r_scope_elem **old = imap->l_scope;
+
+	      imap->l_scope = newp;
+
+	      /* No user anymore, we can free it now.  */
+	      if (old != imap->l_scope_mem)
+		{
+		  if (_dl_scope_free (old))
+		    /* If _dl_scope_free used THREAD_GSCOPE_WAIT (),
+		       no need to repeat it.  */
+		    scope_mem_left = false;
+		}
+	      else
+		scope_mem_left = true;
+
+	      imap->l_scope_max = new_size;
 	    }
 
 	  /* The loader is gone, so mark the object as not having one.
-	     Note: l_idx != -1 -> object will be removed.  */
-	  if (imap->l_loader != NULL && imap->l_loader->l_idx != -1)
+	     Note: l_idx != IDX_STILL_USED -> object will be removed.  */
+	  if (imap->l_loader != NULL
+	      && imap->l_loader->l_idx != IDX_STILL_USED)
 	    imap->l_loader = NULL;
 
 	  /* Remember where the first dynamically loaded object is.  */
@@ -368,7 +446,7 @@
   /* Auditing checkpoint: we will start deleting objects.  */
   if (__builtin_expect (do_audit, 0))
     {
-      struct link_map *head = GL(dl_ns)[ns]._ns_loaded;
+      struct link_map *head = ns->_ns_loaded;
       struct audit_ifaces *afct = GLRO(dl_audit);
       /* Do not call the functions for any auditing object.  */
       if (head->l_auditing == 0)
@@ -385,9 +463,49 @@
 #endif
 
   /* Notify the debugger we are about to remove some loaded objects.  */
-  struct r_debug *r = _dl_debug_initialize (0, ns);
+  struct r_debug *r = _dl_debug_initialize (0, nsid);
   r->r_state = RT_DELETE;
   _dl_debug_state ();
+
+  if (unload_global)
+    {
+      /* Some objects are in the global scope list.  Remove them.  */
+      struct r_scope_elem *ns_msl = ns->_ns_main_searchlist;
+      unsigned int i;
+      unsigned int j = 0;
+      unsigned int cnt = ns_msl->r_nlist;
+
+      while (cnt > 0 && ns_msl->r_list[cnt - 1]->l_removed)
+	--cnt;
+
+      if (cnt + unload_global == ns_msl->r_nlist)
+	/* Speed up removing most recently added objects.  */
+	j = cnt;
+      else
+	for (i = 0; i < cnt; i++)
+	  if (ns_msl->r_list[i]->l_removed == 0)
+	    {
+	      if (i != j)
+		ns_msl->r_list[j] = ns_msl->r_list[i];
+	      j++;
+	    }
+      ns_msl->r_nlist = j;
+    }
+
+  if (!RTLD_SINGLE_THREAD_P
+      && (unload_global
+	  || scope_mem_left
+	  || (GL(dl_scope_free_list) != NULL
+	      && GL(dl_scope_free_list)->count)))
+    {
+      struct dl_scope_free_list *fsl;
+
+      THREAD_GSCOPE_WAIT ();
+      /* Now we can free any queued old scopes.  */
+      if ((fsl = GL(dl_scope_free_list)) != NULL)
+	while (fsl->count > 0)
+	  free (fsl->list[--fsl->count]);
+    }
 
 #ifdef USE_TLS
   size_t tls_free_start;
@@ -406,23 +524,6 @@
 
 	  /* That was the last reference, and this was a dlopen-loaded
 	     object.  We can unmap it.  */
-	  if (__builtin_expect (imap->l_global, 0))
-	    {
-	      /* This object is in the global scope list.  Remove it.  */
-	      unsigned int cnt = GL(dl_ns)[ns]._ns_main_searchlist->r_nlist;
-
-	      do
-		--cnt;
-	      while (GL(dl_ns)[ns]._ns_main_searchlist->r_list[cnt] != imap);
-
-	      /* The object was already correctly registered.  */
-	      while (++cnt
-		     < GL(dl_ns)[ns]._ns_main_searchlist->r_nlist)
-		GL(dl_ns)[ns]._ns_main_searchlist->r_list[cnt - 1]
-		  = GL(dl_ns)[ns]._ns_main_searchlist->r_list[cnt];
-
-	      --GL(dl_ns)[ns]._ns_main_searchlist->r_nlist;
-	    }
 
 #ifdef USE_TLS
 	  /* Remove the object from the dtv slotinfo array if it uses TLS.  */
@@ -518,12 +619,12 @@
 	  else
 	    {
 #ifdef SHARED
-	      assert (ns != LM_ID_BASE);
-#endif
-	      GL(dl_ns)[ns]._ns_loaded = imap->l_next;
-	    }
-
-	  --GL(dl_ns)[ns]._ns_nloaded;
+	      assert (nsid != LM_ID_BASE);
+#endif
+	      ns->_ns_loaded = imap->l_next;
+	    }
+
+	  --ns->_ns_nloaded;
 	  if (imap->l_next != NULL)
 	    imap->l_next->l_prev = imap->l_prev;
 
@@ -587,7 +688,7 @@
   /* Auditing checkpoint: we have deleted all objects.  */
   if (__builtin_expect (do_audit, 0))
     {
-      struct link_map *head = GL(dl_ns)[ns]._ns_loaded;
+      struct link_map *head = ns->_ns_loaded;
       /* Do not call the functions for any auditing object.  */
       if (head->l_auditing == 0)
 	{
@@ -673,22 +774,22 @@
 
 libc_freeres_fn (free_mem)
 {
-  for (Lmid_t ns = 0; ns < DL_NNS; ++ns)
-    if (__builtin_expect (GL(dl_ns)[ns]._ns_global_scope_alloc, 0) != 0
-	&& (GL(dl_ns)[ns]._ns_main_searchlist->r_nlist
+  for (Lmid_t nsid = 0; nsid < DL_NNS; ++nsid)
+    if (__builtin_expect (GL(dl_ns)[nsid]._ns_global_scope_alloc, 0) != 0
+	&& (GL(dl_ns)[nsid]._ns_main_searchlist->r_nlist
 	    // XXX Check whether we need NS-specific initial_searchlist
 	    == GLRO(dl_initial_searchlist).r_nlist))
       {
 	/* All object dynamically loaded by the program are unloaded.  Free
 	   the memory allocated for the global scope variable.  */
-	struct link_map **old = GL(dl_ns)[ns]._ns_main_searchlist->r_list;
+	struct link_map **old = GL(dl_ns)[nsid]._ns_main_searchlist->r_list;
 
 	/* Put the old map in.  */
-	GL(dl_ns)[ns]._ns_main_searchlist->r_list
+	GL(dl_ns)[nsid]._ns_main_searchlist->r_list
 	  // XXX Check whether we need NS-specific initial_searchlist
 	  = GLRO(dl_initial_searchlist).r_list;
 	/* Signal that the original map is used.  */
-	GL(dl_ns)[ns]._ns_global_scope_alloc = 0;
+	GL(dl_ns)[nsid]._ns_global_scope_alloc = 0;
 
 	/* Now free the old map.  */
 	free (old);
@@ -712,4 +813,8 @@
 	free_slotinfo (&GL(dl_tls_dtv_slotinfo_list)->next);
     }
 #endif
+
+  void *scope_free_list = GL(dl_scope_free_list);
+  GL(dl_scope_free_list) = NULL;
+  free (scope_free_list);
 }

Modified: fsf/glibc-2_5-branch/libc/elf/dl-dst.h
==============================================================================
--- fsf/glibc-2_5-branch/libc/elf/dl-dst.h (original)
+++ fsf/glibc-2_5-branch/libc/elf/dl-dst.h Fri Jul 13 00:07:16 2007
@@ -1,5 +1,6 @@
 /* Handling of dynamic sring tokens.
-   Copyright (C) 1999,2001,2002,2003,2004,2006 Free Software Foundation, Inc.
+   Copyright (C) 1999,2001,2002,2003,2004,2006,2007
+   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
@@ -50,7 +51,7 @@
 									      \
 	   First get the origin string if it is not available yet.	      \
 	   This can only happen for the map of the executable.  */	      \
-	DL_DST_REQ_STATIC						      \
+	DL_DST_REQ_STATIC (l)						      \
 	if ((l)->l_origin == NULL)					      \
 	  {								      \
 	    assert ((l)->l_name[0] == '\0');				      \
@@ -68,9 +69,9 @@
     __len; })
 
 #ifdef SHARED
-# define DL_DST_REQ_STATIC /* nothing */
+# define DL_DST_REQ_STATIC(l) /* nothing */
 #else
-# define DL_DST_REQ_STATIC \
+# define DL_DST_REQ_STATIC(l) \
   if ((l) == NULL)							      \
     {									      \
       const char *origin = _dl_get_origin ();				      \

Modified: fsf/glibc-2_5-branch/libc/elf/dl-iteratephdr.c
==============================================================================
--- fsf/glibc-2_5-branch/libc/elf/dl-iteratephdr.c (original)
+++ fsf/glibc-2_5-branch/libc/elf/dl-iteratephdr.c Fri Jul 13 00:07:16 2007
@@ -1,5 +1,5 @@
 /* Get loaded objects program headers.
-   Copyright (C) 2001,2002,2003,2004,2006 Free Software Foundation, Inc.
+   Copyright (C) 2001,2002,2003,2004,2006,2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@xxxxxxxxxx>, 2001.
 
@@ -54,9 +54,9 @@
 	nloaded += GL(dl_ns)[cnt]._ns_nloaded;
 
 	if (caller >= (const void *) l->l_map_start
-	    && caller < (const void *) l->l_map_end)
-	  /* There must be exactly one DSO for the range of the virtual
-	     memory.  Otherwise something is really broken.  */
+	    && caller < (const void *) l->l_map_end
+	    && (l->l_contiguous
+		|| _dl_addr_inside_object (l, (ElfW(Addr)) caller)))
 	  ns = cnt;
       }
 

Modified: fsf/glibc-2_5-branch/libc/elf/dl-load.c
==============================================================================
--- fsf/glibc-2_5-branch/libc/elf/dl-load.c (original)
+++ fsf/glibc-2_5-branch/libc/elf/dl-load.c Fri Jul 13 00:07:16 2007
@@ -1,5 +1,5 @@
 /* Map in a shared object's segments from the file.
-   Copyright (C) 1995-2005, 2006  Free Software Foundation, Inc.
+   Copyright (C) 1995-2005, 2006, 2007  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
@@ -1225,6 +1225,8 @@
 		      loadcmds[nloadcmds - 1].mapstart - c->mapend,
 		      PROT_NONE);
 
+	l->l_contiguous = 1;
+
 	goto postmap;
       }
 
@@ -1244,6 +1246,7 @@
     /* Remember which part of the address space this object uses.  */
     l->l_map_start = c->mapstart + l->l_addr;
     l->l_map_end = l->l_map_start + maplength;
+    l->l_contiguous = !has_holes;
 
     while (c < &loadcmds[nloadcmds])
       {

Modified: fsf/glibc-2_5-branch/libc/elf/dl-lookup.c
==============================================================================
--- fsf/glibc-2_5-branch/libc/elf/dl-lookup.c (original)
+++ fsf/glibc-2_5-branch/libc/elf/dl-lookup.c Fri Jul 13 00:07:16 2007
@@ -1,5 +1,5 @@
 /* Look up a symbol in the loaded objects.
-   Copyright (C) 1995-2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 1995-2005, 2006, 2007 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
@@ -25,6 +25,7 @@
 #include <ldsodefs.h>
 #include <dl-hash.h>
 #include <dl-machine.h>
+#include <sysdep-cancel.h>
 #include <bits/libc-lock.h>
 #include <tls.h>
 
@@ -200,14 +201,17 @@
 static void
 internal_function
 _dl_debug_bindings (const char *undef_name, struct link_map *undef_map,
-		    const ElfW(Sym) **ref, struct r_scope_elem *symbol_scope[],
-		    struct sym_val *value,
+		    const ElfW(Sym) **ref, struct sym_val *value,
 		    const struct r_found_version *version, int type_class,
 		    int protected);
 
 
 /* Search loaded objects' symbol tables for a definition of the symbol
-   UNDEF_NAME, perhaps with a requested version for the symbol.  */
+   UNDEF_NAME, perhaps with a requested version for the symbol.
+
+   We must never have calls to the audit functions inside this function
+   or in any function which gets called.  If this would happen the audit
+   code might create a thread which can throw off all the scope locking.  */
 lookup_t
 internal_function
 _dl_lookup_symbol_x (const char *undef_name, struct link_map *undef_map,
@@ -225,17 +229,13 @@
 
   /* No other flag than DL_LOOKUP_ADD_DEPENDENCY is allowed if we look
      up a versioned symbol.  */
-  assert (version == NULL || flags == 0 || flags == DL_LOOKUP_ADD_DEPENDENCY);
+  assert (version == NULL || (flags & ~(DL_LOOKUP_ADD_DEPENDENCY)) == 0);
 
   size_t i = 0;
   if (__builtin_expect (skip_map != NULL, 0))
-    {
-      /* Search the relevant loaded objects for a definition.  */
-      while ((*scope)->r_list[i] != skip_map)
-	++i;
-
-      assert (i < (*scope)->r_nlist);
-    }
+    /* Search the relevant loaded objects for a definition.  */
+    while ((*scope)->r_list[i] != skip_map)
+      ++i;
 
   /* Search the relevant loaded objects for a definition.  */
   for (size_t start = i; *scope != NULL; start = 0, ++scope)
@@ -338,16 +338,15 @@
       && add_dependency (undef_map, current_value.m) < 0)
       /* Something went wrong.  Perhaps the object we tried to reference
 	 was just removed.  Try finding another definition.  */
-      return _dl_lookup_symbol_x (undef_name, undef_map, ref,
-				  symbol_scope, version, type_class,
-				  flags, skip_map);
+      return _dl_lookup_symbol_x (undef_name, undef_map, ref, symbol_scope,
+				  version, type_class, flags, skip_map);
 
   /* The object is used.  */
   current_value.m->l_used = 1;
 
   if (__builtin_expect (GLRO(dl_debug_mask)
 			& (DL_DEBUG_BINDINGS|DL_DEBUG_PRELINK), 0))
-    _dl_debug_bindings (undef_name, undef_map, ref, symbol_scope,
+    _dl_debug_bindings (undef_name, undef_map, ref,
 			&current_value, version, type_class, protected);
 
   *ref = current_value.s;
@@ -404,8 +403,7 @@
 static void
 internal_function
 _dl_debug_bindings (const char *undef_name, struct link_map *undef_map,
-		    const ElfW(Sym) **ref, struct r_scope_elem *symbol_scope[],
-		    struct sym_val *value,
+		    const ElfW(Sym) **ref, struct sym_val *value,
 		    const struct r_found_version *version, int type_class,
 		    int protected)
 {

Modified: fsf/glibc-2_5-branch/libc/elf/dl-minimal.c
==============================================================================
--- fsf/glibc-2_5-branch/libc/elf/dl-minimal.c (original)
+++ fsf/glibc-2_5-branch/libc/elf/dl-minimal.c Fri Jul 13 00:07:16 2007
@@ -1,5 +1,5 @@
 /* Minimal replacements for basic facilities used in the dynamic linker.
-   Copyright (C) 1995-1998,2000-2002,2004,2005,2006
+   Copyright (C) 1995-1998,2000-2002,2004-2006,2007
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -75,14 +75,21 @@
   alloc_ptr = (void *) 0 + (((alloc_ptr - (void *) 0) + align - 1)
 			    & ~(align - 1));
 
-  if (alloc_ptr + n >= alloc_end)
+  if (alloc_ptr + n >= alloc_end || n >= -(uintptr_t) alloc_ptr)
     {
       /* Insufficient space left; allocate another page.  */
       caddr_t page;
       size_t nup = (n + GLRO(dl_pagesize) - 1) & ~(GLRO(dl_pagesize) - 1);
+      if (__builtin_expect (nup == 0, 0))
+	{
+	  if (n)
+	    return NULL;
+	  nup = GLRO(dl_pagesize);
+	}
       page = __mmap (0, nup, PROT_READ|PROT_WRITE,
 		     MAP_ANON|MAP_PRIVATE, _dl_zerofd, 0);
-      assert (page != MAP_FAILED);
+      if (page == MAP_FAILED)
+	return NULL;
       if (page != alloc_end)
 	alloc_ptr = page;
       alloc_end = page + nup;
@@ -108,7 +115,14 @@
   /* New memory from the trivial malloc above is always already cleared.
      (We make sure that's true in the rare occasion it might not be,
      by clearing memory in free, below.)  */
-  return malloc (nmemb * size);
+  size_t bytes = nmemb * size;
+
+#define HALF_SIZE_T (((size_t) 1) << (8 * sizeof (size_t) / 2))
+  if (__builtin_expect ((nmemb | size) >= HALF_SIZE_T, 0)
+      && size != 0 && bytes / size != nmemb)
+    return NULL;
+
+  return malloc (bytes);
 }
 
 /* This will rarely be called.  */
@@ -264,7 +278,7 @@
   while (*nptr >= '0' && *nptr <= '9')
     {
       unsigned long int digval = *nptr - '0';
-      if (result > LONG_MAX / 10
+      if (result > ULONG_MAX / 10
 	  || (result == ULONG_MAX / 10 && digval > ULONG_MAX % 10))
 	{
 	  errno = ERANGE;

Modified: fsf/glibc-2_5-branch/libc/elf/dl-open.c
==============================================================================
--- fsf/glibc-2_5-branch/libc/elf/dl-open.c (original)
+++ fsf/glibc-2_5-branch/libc/elf/dl-open.c Fri Jul 13 00:07:16 2007
@@ -1,5 +1,5 @@
 /* Load a shared object at runtime, relocate it, and run its initializer.
-   Copyright (C) 1996-2004, 2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 1996-2004, 2005, 2006, 2007 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
@@ -31,6 +31,8 @@
 #include <ldsodefs.h>
 #include <bp-sym.h>
 #include <caller.h>
+#include <sysdep-cancel.h>
+#include <tls.h>
 
 #include <dl-dst.h>
 
@@ -96,17 +98,17 @@
      in an realloc() call.  Therefore we allocate a completely new
      array the first time we have to add something to the locale scope.  */
 
-  if (GL(dl_ns)[new->l_ns]._ns_global_scope_alloc == 0)
+  struct link_namespaces *ns = &GL(dl_ns)[new->l_ns];
+  if (ns->_ns_global_scope_alloc == 0)
     {
       /* This is the first dynamic object given global scope.  */
-      GL(dl_ns)[new->l_ns]._ns_global_scope_alloc
-	= GL(dl_ns)[new->l_ns]._ns_main_searchlist->r_nlist + to_add + 8;
+      ns->_ns_global_scope_alloc
+	= ns->_ns_main_searchlist->r_nlist + to_add + 8;
       new_global = (struct link_map **)
-	malloc (GL(dl_ns)[new->l_ns]._ns_global_scope_alloc
-		* sizeof (struct link_map *));
+	malloc (ns->_ns_global_scope_alloc * sizeof (struct link_map *));
       if (new_global == NULL)
 	{
-	  GL(dl_ns)[new->l_ns]._ns_global_scope_alloc = 0;
+	  ns->_ns_global_scope_alloc = 0;
 	nomem:
 	  _dl_signal_error (ENOMEM, new->l_libname->name, NULL,
 			    N_("cannot extend global scope"));
@@ -114,29 +116,39 @@
 	}
 
       /* Copy over the old entries.  */
-      GL(dl_ns)[new->l_ns]._ns_main_searchlist->r_list
-	= memcpy (new_global,
-		  GL(dl_ns)[new->l_ns]._ns_main_searchlist->r_list,
-		  (GL(dl_ns)[new->l_ns]._ns_main_searchlist->r_nlist
+      ns->_ns_main_searchlist->r_list
+	= memcpy (new_global, ns->_ns_main_searchlist->r_list,
+		  (ns->_ns_main_searchlist->r_nlist
 		   * sizeof (struct link_map *)));
     }
-  else if (GL(dl_ns)[new->l_ns]._ns_main_searchlist->r_nlist + to_add
-	   > GL(dl_ns)[new->l_ns]._ns_global_scope_alloc)
+  else if (ns->_ns_main_searchlist->r_nlist + to_add
+	   > ns->_ns_global_scope_alloc)
     {
       /* We have to extend the existing array of link maps in the
 	 main map.  */
+      struct link_map **old_global
+	= GL(dl_ns)[new->l_ns]._ns_main_searchlist->r_list;
+      size_t new_nalloc = ((ns->_ns_global_scope_alloc + to_add) * 2);
+
       new_global = (struct link_map **)
-	realloc (GL(dl_ns)[new->l_ns]._ns_main_searchlist->r_list,
-		 ((GL(dl_ns)[new->l_ns]._ns_global_scope_alloc + to_add + 8)
-		  * sizeof (struct link_map *)));
+	malloc (new_nalloc * sizeof (struct link_map *));
       if (new_global == NULL)
 	goto nomem;
 
-      GL(dl_ns)[new->l_ns]._ns_global_scope_alloc += to_add + 8;
-      GL(dl_ns)[new->l_ns]._ns_main_searchlist->r_list = new_global;
+      memcpy (new_global, old_global,
+	      ns->_ns_global_scope_alloc * sizeof (struct link_map *));
+
+      ns->_ns_global_scope_alloc = new_nalloc;
+      ns->_ns_main_searchlist->r_list = new_global;
+
+      if (!RTLD_SINGLE_THREAD_P)
+	THREAD_GSCOPE_WAIT ();
+
+      free (old_global);
     }
 
   /* Now add the new entries.  */
+  unsigned int new_nlist = ns->_ns_main_searchlist->r_nlist;
   for (cnt = 0; cnt < new->l_searchlist.r_nlist; ++cnt)
     {
       struct link_map *map = new->l_searchlist.r_list[cnt];
@@ -144,15 +156,49 @@
       if (map->l_global == 0)
 	{
 	  map->l_global = 1;
-	  GL(dl_ns)[new->l_ns]._ns_main_searchlist->r_list[GL(dl_ns)[new->l_ns]._ns_main_searchlist->r_nlist]
-	    = map;
-	  ++GL(dl_ns)[new->l_ns]._ns_main_searchlist->r_nlist;
-	}
-    }
+	  ns->_ns_main_searchlist->r_list[new_nlist++] = map;
+	}
+    }
+  atomic_write_barrier ();
+  ns->_ns_main_searchlist->r_nlist = new_nlist;
 
   return 0;
 }
 
+int
+_dl_scope_free (struct r_scope_elem **old)
+{
+  struct dl_scope_free_list *fsl;
+#define DL_SCOPE_FREE_LIST_SIZE (sizeof (fsl->list) / sizeof (fsl->list[0]))
+
+  if (RTLD_SINGLE_THREAD_P)
+    free (old);
+  else if ((fsl = GL(dl_scope_free_list)) == NULL)
+    {
+      GL(dl_scope_free_list) = fsl = malloc (sizeof (*fsl));
+      if (fsl == NULL)
+	{
+	  THREAD_GSCOPE_WAIT ();
+	  free (old);
+	  return 1;
+	}
+      else
+	{
+	  fsl->list[0] = old;
+	  fsl->count = 1;
+	}
+    }
+  else if (fsl->count < DL_SCOPE_FREE_LIST_SIZE)
+    fsl->list[fsl->count++] = old;
+  else
+    {
+      THREAD_GSCOPE_WAIT ();
+      while (fsl->count > 0)
+	free (fsl->list[--fsl->count]);
+      return 1;
+    }
+  return 0;
+}
 
 static void
 dl_open_worker (void *a)
@@ -160,7 +206,7 @@
   struct dl_open_args *args = a;
   const char *file = args->file;
   int mode = args->mode;
-  struct link_map *new, *l;
+  struct link_map *new;
   int lazy;
   unsigned int i;
 #ifdef USE_TLS
@@ -187,13 +233,14 @@
 	 By default we assume this is the main application.  */
       call_map = GL(dl_ns)[LM_ID_BASE]._ns_loaded;
 
+      struct link_map *l;
       for (Lmid_t ns = 0; ns < DL_NNS; ++ns)
 	for (l = GL(dl_ns)[ns]._ns_loaded; l != NULL; l = l->l_next)
 	  if (caller_dlopen >= (const void *) l->l_map_start
-	      && caller_dlopen < (const void *) l->l_map_end)
+	      && caller_dlopen < (const void *) l->l_map_end
+	      && (l->l_contiguous
+		  || _dl_addr_inside_object (l, (ElfW(Addr)) caller_dlopen)))
 	    {
-	      /* There must be exactly one DSO for the range of the virtual
-		 memory.  Otherwise something is really broken.  */
 	      assert (ns == l->l_ns);
 	      call_map = l;
 	      goto found_caller;
@@ -326,7 +373,7 @@
   /* Relocate the objects loaded.  We do this in reverse order so that copy
      relocs of earlier objects overwrite the data written by later objects.  */
 
-  l = new;
+  struct link_map *l = new;
   while (l->l_next)
     l = l->l_next;
   while (1)
@@ -379,6 +426,8 @@
 
 	  while (*runp != NULL)
 	    {
+	      if (*runp == &new->l_searchlist)
+		break;
 	      ++cnt;
 	      ++runp;
 	    }
@@ -391,35 +440,45 @@
 	    {
 	      /* The 'r_scope' array is too small.  Allocate a new one
 		 dynamically.  */
+	      size_t new_size;
 	      struct r_scope_elem **newp;
-	      size_t new_size = imap->l_scope_max * 2;
-
-	      if (imap->l_scope == imap->l_scope_mem)
+
+#define SCOPE_ELEMS(imap) \
+  (sizeof (imap->l_scope_mem) / sizeof (imap->l_scope_mem[0]))
+
+	      if (imap->l_scope != imap->l_scope_mem
+		  && imap->l_scope_max < SCOPE_ELEMS (imap))
 		{
+		  new_size = SCOPE_ELEMS (imap);
+		  newp = imap->l_scope_mem;
+		}
+	      else
+		{
+		  new_size = imap->l_scope_max * 2;
 		  newp = (struct r_scope_elem **)
 		    malloc (new_size * sizeof (struct r_scope_elem *));
 		  if (newp == NULL)
 		    _dl_signal_error (ENOMEM, "dlopen", NULL,
 				      N_("cannot create scope list"));
-		  imap->l_scope = memcpy (newp, imap->l_scope,
-					  cnt * sizeof (imap->l_scope[0]));
 		}
-	      else
-		{
-		  newp = (struct r_scope_elem **)
-		    realloc (imap->l_scope,
-			     new_size * sizeof (struct r_scope_elem *));
-		  if (newp == NULL)
-		    _dl_signal_error (ENOMEM, "dlopen", NULL,
-				      N_("cannot create scope list"));
-		  imap->l_scope = newp;
-		}
+
+	      memcpy (newp, imap->l_scope, cnt * sizeof (imap->l_scope[0]));
+	      struct r_scope_elem **old = imap->l_scope;
+
+	      imap->l_scope = newp;
+
+	      if (old != imap->l_scope_mem)
+		_dl_scope_free (old);
 
 	      imap->l_scope_max = new_size;
 	    }
 
-	  imap->l_scope[cnt++] = &new->l_searchlist;
-	  imap->l_scope[cnt] = NULL;
+	  /* First terminate the extended list.  Otherwise a thread
+	     might use the new last element and then use the garbage
+	     at offset IDX+1.  */
+	  imap->l_scope[cnt + 1] = NULL;
+	  atomic_write_barrier ();
+	  imap->l_scope[cnt] = &new->l_searchlist;
 	}
 #if USE_TLS
       /* Only add TLS memory if this object is loaded now and
@@ -638,3 +697,21 @@
     }
 }
 #endif
+
+#ifdef IS_IN_rtld
+/* Return non-zero if ADDR lies within one of L's segments.  */
+int
+internal_function
+_dl_addr_inside_object (struct link_map *l, const ElfW(Addr) addr)
+{
+  int n = l->l_phnum;
+  const ElfW(Addr) reladdr = addr - l->l_addr;
+
+  while (--n >= 0)
+    if (l->l_phdr[n].p_type == PT_LOAD
+	&& reladdr - l->l_phdr[n].p_vaddr >= 0
+	&& reladdr - l->l_phdr[n].p_vaddr < l->l_phdr[n].p_memsz)
+      return 1;
+  return 0;
+}
+#endif

Modified: fsf/glibc-2_5-branch/libc/elf/dl-runtime.c
==============================================================================
--- fsf/glibc-2_5-branch/libc/elf/dl-runtime.c (original)
+++ fsf/glibc-2_5-branch/libc/elf/dl-runtime.c Fri Jul 13 00:07:16 2007
@@ -1,5 +1,5 @@
 /* On-demand PLT fixup for shared objects.
-   Copyright (C) 1995-2002,2003,2004,2005 Free Software Foundation, Inc.
+   Copyright (C) 1995-2006, 2007 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
@@ -24,7 +24,10 @@
 #include <unistd.h>
 #include <sys/param.h>
 #include <ldsodefs.h>
+#include <sysdep-cancel.h>
 #include "dynamic-link.h"
+#include <tls.h>
+
 
 #if (!defined ELF_MACHINE_NO_RELA && !defined ELF_MACHINE_PLT_REL) \
     || ELF_MACHINE_NO_REL
@@ -92,16 +95,26 @@
 	    version = NULL;
 	}
 
-      result = _dl_lookup_symbol_x (strtab + sym->st_name, l, &sym,
-				    l->l_scope, version, ELF_RTYPE_CLASS_PLT,
-				    DL_LOOKUP_ADD_DEPENDENCY, NULL);
+      /* We need to keep the scope around so do some locking.  This is
+	 not necessary for objects which cannot be unloaded or when
+	 we are not using any threads (yet).  */
+      int flags = DL_LOOKUP_ADD_DEPENDENCY;
+      if (!RTLD_SINGLE_THREAD_P)
+	THREAD_GSCOPE_SET_FLAG ();
+
+      result = _dl_lookup_symbol_x (strtab + sym->st_name, l, &sym, l->l_scope,
+				    version, ELF_RTYPE_CLASS_PLT, flags, NULL);
+
+      /* We are done with the global scope.  */
+      if (!RTLD_SINGLE_THREAD_P)
+	THREAD_GSCOPE_RESET_FLAG ();
 
       /* Currently result contains the base load address (or link map)
 	 of the object that defines sym.  Now add in the symbol
 	 offset.  */
       value = DL_FIXUP_MAKE_VALUE (result,
-				   sym ? LOOKUP_VALUE_ADDRESS (result)
-					 + sym->st_value : 0);
+				   sym ? (LOOKUP_VALUE_ADDRESS (result)
+					  + sym->st_value) : 0);
     }
   else
     {
@@ -174,10 +187,20 @@
 		version = NULL;
 	    }
 
-	  result = _dl_lookup_symbol_x (strtab + refsym->st_name, l, &defsym,
-					l->l_scope, version,
-					ELF_RTYPE_CLASS_PLT,
-					DL_LOOKUP_ADD_DEPENDENCY, NULL);
+	  /* We need to keep the scope around so do some locking.  This is
+	     not necessary for objects which cannot be unloaded or when
+	     we are not using any threads (yet).  */
+	  int flags = DL_LOOKUP_ADD_DEPENDENCY;
+	  if (!RTLD_SINGLE_THREAD_P)
+	    THREAD_GSCOPE_SET_FLAG ();
+
+	  result = _dl_lookup_symbol_x (strtab + refsym->st_name, l,
+					&defsym, l->l_scope, version,
+					ELF_RTYPE_CLASS_PLT, flags, NULL);
+
+	  /* We are done with the global scope.  */
+	  if (!RTLD_SINGLE_THREAD_P)
+	    THREAD_GSCOPE_RESET_FLAG ();
 
 	  /* Currently result contains the base load address (or link map)
 	     of the object that defines sym.  Now add in the symbol

Modified: fsf/glibc-2_5-branch/libc/elf/dl-support.c
==============================================================================
--- fsf/glibc-2_5-branch/libc/elf/dl-support.c (original)
+++ fsf/glibc-2_5-branch/libc/elf/dl-support.c Fri Jul 13 00:07:16 2007
@@ -1,5 +1,5 @@
 /* Support for dynamic linking code in static libc.
-   Copyright (C) 1996-2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 1996-2005, 2006, 2007 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
@@ -134,6 +134,11 @@
   = _dl_make_stack_executable;
 
 
+/* Function in libpthread to wait for termination of lookups.  */
+void (*_dl_wait_lookup_done) (void);
+
+struct dl_scope_free_list *_dl_scope_free_list;
+
 #ifdef NEED_DL_SYSINFO
 /* Needed for improved syscall handling on at least x86/Linux.  */
 uintptr_t _dl_sysinfo = DL_SYSINFO_DEFAULT;

Modified: fsf/glibc-2_5-branch/libc/elf/dl-sym.c
==============================================================================
--- fsf/glibc-2_5-branch/libc/elf/dl-sym.c (original)
+++ fsf/glibc-2_5-branch/libc/elf/dl-sym.c Fri Jul 13 00:07:16 2007
@@ -1,5 +1,5 @@
 /* Look up a symbol in a shared object loaded by `dlopen'.
-   Copyright (C) 1999,2000,2001,2002,2004,2006 Free Software Foundation, Inc.
+   Copyright (C) 1999-2002,2004,2006,2007 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
@@ -17,6 +17,7 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#include <assert.h>
 #include <stddef.h>
 #include <setjmp.h>
 #include <libintl.h>
@@ -24,6 +25,7 @@
 #include <dlfcn.h>
 #include <ldsodefs.h>
 #include <dl-hash.h>
+#include <sysdep-cancel.h>
 #ifdef USE_TLS
 # include <dl-tls.h>
 #endif
@@ -58,6 +60,29 @@
 #endif
 
 
+struct call_dl_lookup_args
+{
+  /* Arguments to do_dlsym.  */
+  struct link_map *map;
+  const char *name;
+  struct r_found_version *vers;
+  int flags;
+
+  /* Return values of do_dlsym.  */
+  lookup_t loadbase;
+  const ElfW(Sym) **refp;
+};
+
+static void
+call_dl_lookup (void *ptr)
+{
+  struct call_dl_lookup_args *args = (struct call_dl_lookup_args *) ptr;
+  args->map = GLRO(dl_lookup_symbol_x) (args->name, args->map, args->refp,
+					args->map->l_scope, args->vers, 0,
+					args->flags, NULL);
+}
+
+
 static void *
 internal_function
 do_sym (void *handle, const char *name, void *who,
@@ -75,19 +100,59 @@
   for (Lmid_t ns = 0; ns < DL_NNS; ++ns)
     for (struct link_map *l = GL(dl_ns)[ns]._ns_loaded; l != NULL;
 	 l = l->l_next)
-      if (caller >= l->l_map_start && caller < l->l_map_end)
-	{
-	  /* There must be exactly one DSO for the range of the virtual
-	     memory.  Otherwise something is really broken.  */
+      if (caller >= l->l_map_start && caller < l->l_map_end
+	  && (l->l_contiguous || _dl_addr_inside_object (l, caller)))
+	{
 	  match = l;
 	  break;
 	}
 

[... 23266 lines stripped ...]