summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2006-11-07 22:59:31 +0000
committerjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2006-11-07 22:59:31 +0000
commit2a9b4a0cce09a1bccb092ddc9fb98532ec8b720f (patch)
treed89ccfd8639aaf3a0ece7ac6ccff0b345ba757c7 /libc
parent5464a78aac33302c987c3dab8463f53c3c1dd7df (diff)
Merge changes between r426 and r615 from /fsf/trunk.
git-svn-id: svn://svn.eglibc.org/trunk@616 7b3dc134-2b1b-0410-93df-9e9f96275f8d
Diffstat (limited to 'libc')
-rw-r--r--libc/ChangeLog257
-rw-r--r--libc/Makeconfig2
-rw-r--r--libc/Makerules3
-rw-r--r--libc/config.h.in20
-rw-r--r--libc/config.make.in5
-rwxr-xr-xlibc/configure81
-rw-r--r--libc/configure.in44
-rw-r--r--libc/csu/Versions4
-rw-r--r--libc/csu/libc-start.c17
-rw-r--r--libc/csu/libc-tls.c58
-rw-r--r--libc/csu/tst-atomic.c113
-rw-r--r--libc/csu/version.c3
-rw-r--r--libc/dlfcn/Makefile5
-rw-r--r--libc/dlfcn/dlinfo.c8
-rw-r--r--libc/elf/Makefile18
-rw-r--r--libc/elf/dl-addr.c4
-rw-r--r--libc/elf/dl-cache.c6
-rw-r--r--libc/elf/dl-close.c139
-rw-r--r--libc/elf/dl-iteratephdr.c2
-rw-r--r--libc/elf/dl-libc.c3
-rw-r--r--libc/elf/dl-load.c21
-rw-r--r--libc/elf/dl-lookup.c16
-rw-r--r--libc/elf/dl-object.c18
-rw-r--r--libc/elf/dl-open.c92
-rw-r--r--libc/elf/dl-reloc.c24
-rw-r--r--libc/elf/dl-runtime.c48
-rw-r--r--libc/elf/dl-support.c4
-rw-r--r--libc/elf/dl-sym.c31
-rw-r--r--libc/elf/dl-sysdep.c32
-rw-r--r--libc/elf/dl-tls.c79
-rw-r--r--libc/elf/ldconfig.c2
-rw-r--r--libc/elf/rtld.c65
-rw-r--r--libc/elf/tst-thrlock.c59
-rw-r--r--libc/elf/tst-tls-dlinfo.c4
-rw-r--r--libc/elf/tst-tls1.c8
-rw-r--r--libc/elf/tst-tls10.h3
-rw-r--r--libc/elf/tst-tls14.c8
-rw-r--r--libc/elf/tst-tls2.c8
-rw-r--r--libc/elf/tst-tls3.c8
-rw-r--r--libc/elf/tst-tls4.c4
-rw-r--r--libc/elf/tst-tls5.c4
-rw-r--r--libc/elf/tst-tls6.c4
-rw-r--r--libc/elf/tst-tls7.c4
-rw-r--r--libc/elf/tst-tls8.c4
-rw-r--r--libc/elf/tst-tls9.c4
-rw-r--r--libc/elf/tst-tlsmod1.c4
-rw-r--r--libc/elf/tst-tlsmod13.c3
-rw-r--r--libc/elf/tst-tlsmod13a.c3
-rw-r--r--libc/elf/tst-tlsmod14a.c10
-rw-r--r--libc/elf/tst-tlsmod2.c2
-rw-r--r--libc/elf/tst-tlsmod3.c4
-rw-r--r--libc/elf/tst-tlsmod4.c4
-rw-r--r--libc/elf/tst-tlsmod5.c2
-rw-r--r--libc/elf/tst-tlsmod6.c2
-rw-r--r--libc/include/atomic.h286
-rw-r--r--libc/include/dlfcn.h3
-rw-r--r--libc/include/errno.h2
-rw-r--r--libc/include/libc-symbols.h34
-rw-r--r--libc/include/link.h41
-rw-r--r--libc/include/stdio.h1
-rw-r--r--libc/include/tls.h3
-rw-r--r--libc/io/Makefile13
-rw-r--r--libc/io/fstat.c12
-rw-r--r--libc/io/fstat64.c9
-rw-r--r--libc/io/fstatat.c9
-rw-r--r--libc/io/fstatat64.c9
-rw-r--r--libc/io/lstat.c12
-rw-r--r--libc/io/lstat64.c9
-rw-r--r--libc/io/mknod.c12
-rw-r--r--libc/io/mknodat.c10
-rw-r--r--libc/io/stat.c12
-rw-r--r--libc/io/stat64.c9
-rw-r--r--libc/libio/stdio.c10
-rw-r--r--libc/locale/global-locale.c4
-rw-r--r--libc/locale/localeinfo.h4
-rw-r--r--libc/localedata/ChangeLog7
-rw-r--r--libc/localedata/SUPPORTED1
-rw-r--r--libc/localedata/locales/mai_IN84
-rw-r--r--libc/malloc/arena.c8
-rw-r--r--libc/malloc/hooks.c4
-rw-r--r--libc/malloc/malloc.c4
-rw-r--r--libc/malloc/memusage.c6
-rw-r--r--libc/manual/conf.texi5
-rw-r--r--libc/nptl/ChangeLog105
-rw-r--r--libc/nptl/init.c2
-rw-r--r--libc/nptl/pthread_attr_setstacksize.c2
-rw-r--r--libc/nptl/pthread_barrier_wait.c (renamed from libc/nptl/sysdeps/pthread/pthread_barrier_wait.c)0
-rw-r--r--libc/nptl/pthread_cond_broadcast.c (renamed from libc/nptl/sysdeps/pthread/pthread_cond_broadcast.c)0
-rw-r--r--libc/nptl/pthread_cond_signal.c (renamed from libc/nptl/sysdeps/pthread/pthread_cond_signal.c)0
-rw-r--r--libc/nptl/pthread_cond_timedwait.c (renamed from libc/nptl/sysdeps/pthread/pthread_cond_timedwait.c)0
-rw-r--r--libc/nptl/pthread_cond_wait.c (renamed from libc/nptl/sysdeps/pthread/pthread_cond_wait.c)0
-rw-r--r--libc/nptl/pthread_getcpuclockid.c (renamed from libc/nptl/sysdeps/pthread/pthread_getcpuclockid.c)0
-rw-r--r--libc/nptl/pthread_once.c (renamed from libc/nptl/sysdeps/pthread/pthread_once.c)0
-rw-r--r--libc/nptl/pthread_rwlock_rdlock.c (renamed from libc/nptl/sysdeps/pthread/pthread_rwlock_rdlock.c)0
-rw-r--r--libc/nptl/pthread_rwlock_timedrdlock.c (renamed from libc/nptl/sysdeps/pthread/pthread_rwlock_timedrdlock.c)0
-rw-r--r--libc/nptl/pthread_rwlock_timedwrlock.c (renamed from libc/nptl/sysdeps/pthread/pthread_rwlock_timedwrlock.c)0
-rw-r--r--libc/nptl/pthread_rwlock_unlock.c (renamed from libc/nptl/sysdeps/pthread/pthread_rwlock_unlock.c)0
-rw-r--r--libc/nptl/pthread_rwlock_wrlock.c (renamed from libc/nptl/sysdeps/pthread/pthread_rwlock_wrlock.c)0
-rw-r--r--libc/nptl/pthread_spin_destroy.c (renamed from libc/nptl/sysdeps/pthread/pthread_spin_destroy.c)0
-rw-r--r--libc/nptl/pthread_spin_init.c (renamed from libc/nptl/sysdeps/pthread/pthread_spin_init.c)0
-rw-r--r--libc/nptl/pthread_spin_unlock.c (renamed from libc/nptl/sysdeps/pthread/pthread_spin_unlock.c)0
-rw-r--r--libc/nptl/sysdeps/alpha/tls.h5
-rw-r--r--libc/nptl/sysdeps/i386/tls.h5
-rw-r--r--libc/nptl/sysdeps/ia64/pthread_spin_unlock.c4
-rw-r--r--libc/nptl/sysdeps/ia64/tls.h3
-rw-r--r--libc/nptl/sysdeps/powerpc/tls.h5
-rw-r--r--libc/nptl/sysdeps/s390/tls.h5
-rw-r--r--libc/nptl/sysdeps/sh/tls.h5
-rw-r--r--libc/nptl/sysdeps/sparc/tls.h3
-rw-r--r--libc/nptl/sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h8
-rw-r--r--libc/nptl/sysdeps/unix/sysv/linux/i386/sysdep-cancel.h6
-rw-r--r--libc/nptl/sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h8
-rw-r--r--libc/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h6
-rw-r--r--libc/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h6
-rw-r--r--libc/nptl/sysdeps/unix/sysv/linux/rtld-lowlevel.h20
-rw-r--r--libc/nptl/sysdeps/unix/sysv/linux/s390/s390-32/sysdep-cancel.h8
-rw-r--r--libc/nptl/sysdeps/unix/sysv/linux/s390/s390-64/sysdep-cancel.h8
-rw-r--r--libc/nptl/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h8
-rw-r--r--libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep-cancel.h8
-rw-r--r--libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep-cancel.h6
-rw-r--r--libc/nptl/sysdeps/unix/sysv/linux/x86_64/sysdep-cancel.h8
-rw-r--r--libc/nptl/sysdeps/x86_64/tls.h3
-rw-r--r--libc/nptl/tst-tls5.h2
-rw-r--r--libc/nptl_db/ChangeLog9
-rw-r--r--libc/nptl_db/db_info.c2
-rw-r--r--libc/nptl_db/structs.def6
-rw-r--r--libc/nscd/Makefile2
-rw-r--r--libc/po/sv.po31
-rw-r--r--libc/resolv/Versions6
-rw-r--r--libc/stdlib/Makefile4
-rw-r--r--libc/stdlib/atexit.c11
-rw-r--r--libc/stdlib/stdlib.h3
-rw-r--r--libc/sunrpc/Makefile4
-rw-r--r--libc/sunrpc/tst-xdrmem2.c114
-rw-r--r--libc/sunrpc/xdr_mem.c10
-rw-r--r--libc/sysdeps/alpha/dl-machine.h28
-rw-r--r--libc/sysdeps/alpha/libc-tls.c6
-rw-r--r--libc/sysdeps/generic/ldsodefs.h34
-rw-r--r--libc/sysdeps/generic/sysdep-cancel.h1
-rw-r--r--libc/sysdeps/generic/tls.h7
-rw-r--r--libc/sysdeps/gnu/netinet/tcp.h1
-rw-r--r--libc/sysdeps/i386/dl-machine.h12
-rw-r--r--libc/sysdeps/i386/i486/bits/atomic.h2
-rw-r--r--libc/sysdeps/i386/i686/memcmp.S6
-rw-r--r--libc/sysdeps/i386/sysdep.h14
-rw-r--r--libc/sysdeps/ia64/dl-machine.h6
-rw-r--r--libc/sysdeps/ia64/libc-tls.c6
-rw-r--r--libc/sysdeps/mach/hurd/fork.c4
-rw-r--r--libc/sysdeps/mach/hurd/i386/tls.h5
-rw-r--r--libc/sysdeps/powerpc/fpu/bits/mathinline.h58
-rw-r--r--libc/sysdeps/powerpc/fpu/math_private.h83
-rw-r--r--libc/sysdeps/powerpc/powerpc32/dl-machine.c6
-rw-r--r--libc/sysdeps/powerpc/powerpc32/dl-machine.h8
-rw-r--r--libc/sysdeps/powerpc/powerpc32/sysdep.h2
-rw-r--r--libc/sysdeps/powerpc/powerpc64/dl-machine.h11
-rw-r--r--libc/sysdeps/s390/libc-tls.c8
-rw-r--r--libc/sysdeps/s390/s390-32/dl-machine.h12
-rw-r--r--libc/sysdeps/s390/s390-64/dl-machine.h12
-rw-r--r--libc/sysdeps/sh/dl-machine.h6
-rw-r--r--libc/sysdeps/sparc/sparc32/dl-machine.h4
-rw-r--r--libc/sysdeps/sparc/sparc64/dl-machine.h4
-rw-r--r--libc/sysdeps/unix/sysv/linux/i386/sigaction.c14
-rw-r--r--libc/sysdeps/unix/sysv/linux/i386/sysconf.c29
-rw-r--r--libc/sysdeps/unix/sysv/linux/x86_64/sigaction.c7
-rw-r--r--libc/sysdeps/unix/sysv/linux/x86_64/sysconf.c29
-rw-r--r--libc/sysdeps/x86_64/bits/atomic.h15
-rw-r--r--libc/sysdeps/x86_64/dl-machine.h8
-rw-r--r--libc/tls.make.c6
168 files changed, 1645 insertions, 1263 deletions
diff --git a/libc/ChangeLog b/libc/ChangeLog
index 3c9628c13..5a4e984ee 100644
--- a/libc/ChangeLog
+++ b/libc/ChangeLog
@@ -1,3 +1,258 @@
+2006-11-03 Steven Munroe <sjmunroe@us.ibm.com>
+
+ * sysdeps/powerpc/fpu/bits/mathinline.h
+ [__LIBC_INTERNAL_MATH_INLINES]: Moved to ...
+ * sysdeps/powerpc/fpu/math_private.h: ...here. New file.
+
+2006-11-05 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/unix/sysv/linux/i386/sysconf.c (intel_check_word):
+ Update handling of cache descriptor 0x49 for new models.
+ * sysdeps/unix/sysv/linux/x86_64/sysconf.c (intel_check_word):
+ Likewise.
+
+2006-11-02 Jakub Jelinek <jakub@redhat.com>
+
+ * malloc/memusage.c (dest): Reset not_me back to false after
+ printing statistics.
+
+2006-11-02 Ulrich Drepper <drepper@redhat.com>
+
+ * configure.in: Work around ld --help change and avoid -z relro
+ test completely if the architecture doesn't care about security.
+
+2006-11-01 Ulrich Drepper <drepper@redhat.com>
+
+ * po/sv.po: Update from translation team.
+
+2006-10-31 Ulrich Drepper <drepper@redhat.com>
+
+ * stdlib/atexit.c (atexit): Don't mark as hidden when used to
+ generate compatibility version.
+
+2006-10-29 Ulrich Drepper <drepper@redhat.com>
+
+ * configure.in: Relax -z relro requirement a bit.
+
+ * po/sv.po: Update from translation team.
+
+2006-10-29 Jakub Jelinek <jakub@redhat.com>
+
+ * 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 Ulrich Drepper <drepper@redhat.com>
+
+ * configure.in: Require assembler support for visibility, compiler
+ support for visibility and aliases, linker support for various -z
+ options.
+ * Makeconfig: Remove conditional code which now is unnecessary.
+ * config.h.in: Likewise.
+ * config.make.in: Likewise.
+ * dlfcn/Makefile: Likewise.
+ * elf/Makefile: Likewise.
+ * elf/dl-load.c: Likewise.
+ * elf/rtld.c: Likewise.
+ * include/libc-symbols.h: Likewise.
+ * include/stdio.h: Likewise.
+ * io/Makefile: Likewise.
+ * io/fstat.c: Likewise.
+ * io/fstat64.c: Likewise.
+ * io/fstatat.c: Likewise.
+ * io/fstatat64.c: Likewise.
+ * io/lstat.c: Likewise.
+ * io/lstat64.c: Likewise.
+ * io/mknod.c: Likewise.
+ * io/mknodat.c: Likewise.
+ * io/stat.c: Likewise.
+ * io/stat64.c: Likewise.
+ * libio/stdio.c: Likewise.
+ * nscd/Makefile: Likewise.
+ * stdlib/Makefile: Likewise.
+ * stdlib/atexit.c: Likewise.
+ * sysdeps/generic/ldsodefs.h: Likewise.
+ * sysdeps/i386/dl-machine.h: Likewise.
+ * sysdeps/i386/sysdep.h: Likewise.
+ * sysdeps/i386/i686/memcmp.S: Likewise.
+ * sysdeps/powerpc/powerpc32/sysdep.h: Likewise.
+ * sysdeps/unix/sysv/linux/i386/sigaction.c: Likewise.
+ * sysdeps/unix/sysv/linux/x86_64/sigaction.c: Likewise.
+
+ * Makerules: USE_TLS support is now default.
+ * tls.make.c: Likewise.
+ * csu/Versions: Likewise.
+ * csu/libc-start.c: Likewise.
+ * csu/libc-tls.c: Likewise.
+ * csu/version.c: Likewise.
+ * dlfcn/dlinfo.c: Likewise.
+ * elf/dl-addr.c: Likewise.
+ * elf/dl-cache.c: Likewise.
+ * elf/dl-close.c: Likewise.
+ * elf/dl-iteratephdr.c: Likewise.
+ * elf/dl-load.c: Likewise.
+ * elf/dl-lookup.c: Likewise.
+ * elf/dl-object.c: Likewise.
+ * elf/dl-open.c: Likewise.
+ * elf/dl-reloc.c: Likewise.
+ * elf/dl-support.c: Likewise.
+ * elf/dl-sym.c: Likewise.
+ * elf/dl-sysdep.c: Likewise.
+ * elf/dl-tls.c: Likewise.
+ * elf/ldconfig.c: Likewise.
+ * elf/rtld.c: Likewise.
+ * elf/tst-tls-dlinfo.c: Likewise.
+ * elf/tst-tls1.c: Likewise.
+ * elf/tst-tls10.h: Likewise.
+ * elf/tst-tls14.c: Likewise.
+ * elf/tst-tls2.c: Likewise.
+ * elf/tst-tls3.c: Likewise.
+ * elf/tst-tls4.c: Likewise.
+ * elf/tst-tls5.c: Likewise.
+ * elf/tst-tls6.c: Likewise.
+ * elf/tst-tls7.c: Likewise.
+ * elf/tst-tls8.c: Likewise.
+ * elf/tst-tls9.c: Likewise.
+ * elf/tst-tlsmod1.c: Likewise.
+ * elf/tst-tlsmod13.c: Likewise.
+ * elf/tst-tlsmod13a.c: Likewise.
+ * elf/tst-tlsmod14a.c: Likewise.
+ * elf/tst-tlsmod2.c: Likewise.
+ * elf/tst-tlsmod3.c: Likewise.
+ * elf/tst-tlsmod4.c: Likewise.
+ * elf/tst-tlsmod5.c: Likewise.
+ * elf/tst-tlsmod6.c: Likewise.
+ * include/errno.h: Likewise.
+ * include/link.h: Likewise.
+ * include/tls.h: Likewise.
+ * locale/global-locale.c: Likewise.
+ * locale/localeinfo.h: Likewise.
+ * malloc/arena.c: Likewise.
+ * malloc/hooks.c: Likewise.
+ * malloc/malloc.c: Likewise.
+ * resolv/Versions: Likewise.
+ * sysdeps/alpha/dl-machine.h: Likewise.
+ * sysdeps/alpha/libc-tls.c: Likewise.
+ * sysdeps/generic/ldsodefs.h: Likewise.
+ * sysdeps/generic/tls.h: Likewise.
+ * sysdeps/i386/dl-machine.h: Likewise.
+ * sysdeps/ia64/dl-machine.h: Likewise.
+ * sysdeps/ia64/libc-tls.c: Likewise.
+ * sysdeps/mach/hurd/fork.c: Likewise.
+ * sysdeps/mach/hurd/i386/tls.h: Likewise.
+ * sysdeps/powerpc/powerpc32/dl-machine.c: Likwise.
+ * sysdeps/powerpc/powerpc32/dl-machine.h: Likewise.
+ * sysdeps/powerpc/powerpc64/dl-machine.h: Likewise.
+ * sysdeps/s390/libc-tls.c: Likewise.
+ * sysdeps/s390/s390-32/dl-machine.h: Likewise.
+ * sysdeps/s390/s390-64/dl-machine.h: Likewise.
+ * sysdeps/sh/dl-machine.h: Likewise.
+ * sysdeps/sparc/sparc32/dl-machine.h: Likewise.
+ * sysdeps/sparc/sparc64/dl-machine.h: Likewise.
+ * sysdeps/x86_64/dl-machine.h: Likewise.
+
+ * elf/dl-close.c (_dl_close_worker): Renamed from _dl_close and
+ split out locking and parameter checking.
+ (_dl_close): Call _dl_close_worker after locking and checking.
+ * elf/dl-open.c (_dl_open): Call _dl_close_worker instead of
+ _dl_close.
+ * elf/Makefile: Add rules to build and run tst-thrlock.
+ * elf/tst-thrlock.c: New file.
+
+ [BZ #3426]
+ * stdlib/stdlib.h: Adjust comment for canonicalize_file_name to
+ reality.
+
+ [BZ #3429]
+ * elf/dl-open.c (dl_open_worker): Keep holding dl_load_lock until
+ we are sure we do not need it anymore for _dl_close. Also move
+ the asserts inside the lock region.
+ Patch mostly by Suzuki <suzuki@in.ibm.com>.
+
+2006-10-27 Jakub Jelinek <jakub@redhat.com>
+
+ * 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-25 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/gnu/netinet/tcp.h: Define TCP_CONGESTION.
+
+2006-10-18 Ulrich Drepper <drepper@redhat.com>
+
+ * configure.in: Disable building profile libraries by default.
+
+2006-10-17 Jakub Jelinek <jakub@redhat.com>
+
+ * sunrpc/xdr_mem.c (xdrmem_setpos): Don't compare addresses
+ as signed longs, check for x_base + pos overflow.
+ * sunrpc/Makefile (tests): Add tst-xdrmem2.
+ * sunrpc/tst-xdrmem2.c: New test.
+
+2006-10-18 Ulrich Drepper <drepper@redhat.com>
+
+ * elf/dl-lookup.c (_dl_lookup_symbol_x): Add warning to
+ _dl_lookup_symbol_x code.
+
+2006-10-17 Jakub Jelinek <jakub@redhat.com>
+
+ * elf/dl-runtime.c: Include sysdep-cancel.h.
+ (_dl_fixup, _dl_profile_fixup): Use __rtld_mrlock_* and
+ scoperec->nusers only if !SINGLE_THREAD_P. Use atomic_*
+ instead of catomic_* macros.
+ * elf/dl-sym.c: Include sysdep-cancel.h.
+ (do_sym): Use __rtld_mrlock_* and scoperec->nusers only
+ if !SINGLE_THREAD_P. Use atomic_* instead of catomic_* macros.
+ * elf/dl-close.c: Include sysdep-cancel.h.
+ (_dl_close): Use __rtld_mrlock_* and scoperec->nusers only
+ if !SINGLE_THREAD_P. Use atomic_* instead of catomic_* macros.
+ * elf/dl-open.c: Include sysdep-cancel.h.
+ (dl_open_worker): Use __rtld_mrlock_* and scoperec->nusers only
+ if !SINGLE_THREAD_P. Use atomic_* instead of catomic_* macros.
+
+2006-10-17 Jakub Jelinek <jakub@redhat.com>
+
+ [BZ #3313]
+ * malloc/malloc.c (malloc_consolidate): Set maxfb to address of last
+ fastbin rather than end of fastbin array.
+
+2006-10-18 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/i386/i486/bits/atomic.h (catomic_decrement): Use correct
+ body macro.
+ * sysdeps/x86_64/bits/atomic.h
+ (__arch_c_compare_and_exchange_val_64_acq): Add missing casts.
+ (catomic_decrement): Use correct body macro.
+
+2006-10-17 Jakub Jelinek <jakub@redhat.com>
+
+ * include/atomic.h: Add a unique prefix to all local variables
+ in macros.
+ * csu/tst-atomic.c (do_test): Test also catomic_* macros.
+
2006-10-16 Ulrich Drepper <drepper@redhat.com>
[BZ #3369]
@@ -108,7 +363,7 @@
* elf/dl-load.c: Likewise.
* elf/dl-object.c: Likewise.
* elf/rtld.c: Likewise.
- * include/link.h: Inlcude <rtld-lowlevel.h>. Define struct
+ * 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>.
diff --git a/libc/Makeconfig b/libc/Makeconfig
index 5a1aebccf..349f94d9a 100644
--- a/libc/Makeconfig
+++ b/libc/Makeconfig
@@ -407,11 +407,9 @@ LDFLAGS.so += $(combreloc-LDFLAGS)
LDFLAGS-rtld += $(combreloc-LDFLAGS)
endif
-ifeq (yes,$(have-z-relro))
relro-LDFLAGS = -Wl,-z,relro
LDFLAGS.so += $(relro-LDFLAGS)
LDFLAGS-rtld += $(relro-LDFLAGS)
-endif
ifeq (yes,$(have-hash-style))
# For the time being we unconditionally use 'both'. At some time we
diff --git a/libc/Makerules b/libc/Makerules
index b0be86b36..200f8d7ee 100644
--- a/libc/Makerules
+++ b/libc/Makerules
@@ -1233,10 +1233,7 @@ endif
ifeq ($(firstword $(sysd-sorted-done) f)$(firstword $(generating) f),tf)
-include $(common-objpfx)tls.make
-config-tls := notls
-ifeq ($(use-tls),yes)
config-tls := tls
-endif
ifeq ($(use-thread),yes)
config-tls := thread
endif
diff --git a/libc/config.h.in b/libc/config.h.in
index da973f6a5..a46e40526 100644
--- a/libc/config.h.in
+++ b/libc/config.h.in
@@ -120,23 +120,6 @@
/* Define if the linker supports the -z combreloc option. */
#undef HAVE_Z_COMBRELOC
-/* Define if the assembler supported .protected. */
-#undef HAVE_PROTECTED
-
-/* Define if the assembler supported .hidden. */
-#undef HAVE_HIDDEN
-
-/* Define if the compiler supports __attribute__ ((visibility (...))). */
-#undef HAVE_VISIBILITY_ATTRIBUTE
-
-/* Define if the compiler doesn't support __attribute__ ((visibility (...)))
- together with __asm__ redirection properly. */
-#undef HAVE_BROKEN_VISIBILITY_ATTRIBUTE
-
-/* Define if the compiler doesn't support __attribute__ ((alias (...)))
- together with __asm__ redirection properly. */
-#undef HAVE_BROKEN_ALIAS_ATTRIBUTE
-
/* Define if _rtld_local structure should be forced into .sdata section. */
#undef HAVE_SDATA_SECTION
@@ -188,9 +171,6 @@
/* Defined if forced unwind support is available. */
#undef HAVE_FORCED_UNWIND
-/* Defined if the linker supports the -z relro option. */
-#undef HAVE_Z_RELRO
-
/* Defined of libidn is available. */
#undef HAVE_LIBIDN
diff --git a/libc/config.make.in b/libc/config.make.in
index 677da3a89..7aa9c1c12 100644
--- a/libc/config.make.in
+++ b/libc/config.make.in
@@ -38,14 +38,9 @@ c++-sysincludes = @CXX_SYSINCLUDES@
all-warnings = @all_warnings@
elf = @elf@
-have-protected = @libc_cv_asm_protected_directive@
-have-z-nodelete = @libc_cv_z_nodelete@
-have-z-nodlopen = @libc_cv_z_nodlopen@
-have-z-initfirst = @libc_cv_z_initfirst@
have-z-combreloc = @libc_cv_z_combreloc@
have-z-execstack = @libc_cv_z_execstack@
have-initfini = @libc_cv_have_initfini@
-have-z-relro = @libc_cv_z_relro@
have-Bgroup = @libc_cv_Bgroup@
have-as-needed = @libc_cv_as_needed@
libgcc_s_suffix = @libc_cv_libgcc_s_suffix@
diff --git a/libc/configure b/libc/configure
index d14f89a8a..0f00394f0 100755
--- a/libc/configure
+++ b/libc/configure
@@ -313,7 +313,7 @@ ac_includes_default="\
# include <unistd.h>
#endif"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS with_fp with_cvs enable_check_abi oldest_abi bindnow force_install all_warnings build build_cpu build_vendor build_os host host_cpu host_vendor host_os subdirs add_ons add_on_subdirs base_machine submachine sysnames sysdeps_add_ons INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT BUILD_CC cross_compiling CPP CXX CXXFLAGS ac_ct_CXX AR OBJDUMP RANLIB ac_ct_RANLIB MIG AS LD PWD_P MAKE MSGFMT MAKEINFO SED AUTOCONF SYSINCLUDES CXX_SYSINCLUDES libc_cv_gcc_static_libgcc BASH libc_cv_have_bash2 KSH libc_cv_have_ksh AWK PERL INSTALL_INFO BISON VERSIONING libc_cv_asm_protected_directive libc_cv_cc_with_libunwind libc_cv_z_nodelete libc_cv_z_nodlopen libc_cv_z_initfirst libc_cv_z_relro libc_cv_Bgroup libc_cv_libgcc_s_suffix libc_cv_as_needed ASFLAGS_config libc_cv_z_combreloc libc_cv_z_execstack libc_cv_fpie libc_cv_hashstyle fno_unit_at_a_time libc_cv_ssp libc_cv_have_initfini no_whole_archive exceptions LIBGD have_libaudit have_libcap have_selinux EGREP sizeof_long_double libc_cv_gcc_unwind_find_fde uname_sysname uname_release uname_version old_glibc_headers libc_cv_slibdir libc_cv_localedir libc_cv_sysconfdir libc_cv_rootsbindir libc_cv_forced_unwind use_ldconfig ldd_rewrite_script elf xcoff static shared pic_default profile omitfp bounded static_nss nopic_initfini DEFINES mach_interface_list VERSION RELEASE LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS with_fp with_cvs enable_check_abi oldest_abi bindnow force_install all_warnings build build_cpu build_vendor build_os host host_cpu host_vendor host_os subdirs add_ons add_on_subdirs base_machine submachine sysnames sysdeps_add_ons INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT BUILD_CC cross_compiling CPP CXX CXXFLAGS ac_ct_CXX AR OBJDUMP RANLIB ac_ct_RANLIB MIG AS LD PWD_P MAKE MSGFMT MAKEINFO SED AUTOCONF SYSINCLUDES CXX_SYSINCLUDES libc_cv_gcc_static_libgcc BASH libc_cv_have_bash2 KSH libc_cv_have_ksh AWK PERL INSTALL_INFO BISON VERSIONING libc_cv_cc_with_libunwind libc_cv_Bgroup libc_cv_libgcc_s_suffix libc_cv_as_needed ASFLAGS_config libc_cv_z_combreloc libc_cv_z_execstack libc_cv_fpie libc_cv_hashstyle fno_unit_at_a_time libc_cv_ssp libc_cv_have_initfini no_whole_archive exceptions LIBGD have_libaudit have_libcap have_selinux EGREP sizeof_long_double libc_cv_gcc_unwind_find_fde uname_sysname uname_release uname_version old_glibc_headers libc_cv_slibdir libc_cv_localedir libc_cv_sysconfdir libc_cv_rootsbindir libc_cv_forced_unwind use_ldconfig ldd_rewrite_script elf xcoff static shared pic_default profile omitfp bounded static_nss nopic_initfini DEFINES mach_interface_list VERSION RELEASE LIBOBJS LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@@ -864,7 +864,7 @@ Optional Features:
[default=no]
--enable-shared build shared library [default=yes if GNU ld &
ELF]
- --enable-profile build profiled library [default=yes]
+ --enable-profile build profiled library [default=no]
--enable-omitfp build undebuggable optimized library
[default=no]
--enable-bounded build with runtime bounds checking
@@ -1543,7 +1543,7 @@ if test "${enable_profile+set}" = set; then
enableval="$enable_profile"
profile=$enableval
else
- profile=yes
+ profile=no
fi;
# Check whether --enable-omitfp or --disable-omitfp was given.
if test "${enable_omitfp+set}" = set; then
@@ -5339,22 +5339,15 @@ EOF
(exit $ac_status); }; }; then
libc_cv_asm_protected_directive=yes
else
- libc_cv_asm_protected_directive=no
+ { { echo "$as_me:$LINENO: error: assembler support for symbol visibility is required" >&5
+echo "$as_me: error: assembler support for symbol visibility is required" >&2;}
+ { (exit 1); exit 1; }; }
fi
rm -f conftest*
fi
echo "$as_me:$LINENO: result: $libc_cv_asm_protected_directive" >&5
echo "${ECHO_T}$libc_cv_asm_protected_directive" >&6
- cat >>confdefs.h <<\_ACEOF
-#define HAVE_PROTECTED 1
-_ACEOF
-
- cat >>confdefs.h <<\_ACEOF
-#define HAVE_HIDDEN 1
-_ACEOF
-
-
if test $libc_cv_asm_protected_directive = yes; then
echo "$as_me:$LINENO: checking whether __attribute__((visibility())) is supported" >&5
echo $ECHO_N "checking whether __attribute__((visibility())) is supported... $ECHO_C" >&6
@@ -5383,11 +5376,10 @@ EOF
fi
echo "$as_me:$LINENO: result: $libc_cv_visibility_attribute" >&5
echo "${ECHO_T}$libc_cv_visibility_attribute" >&6
- if test $libc_cv_visibility_attribute = yes; then
- cat >>confdefs.h <<\_ACEOF
-#define HAVE_VISIBILITY_ATTRIBUTE 1
-_ACEOF
-
+ if test $libc_cv_visibility_attribute != yes; then
+ { { echo "$as_me:$LINENO: error: compiler support for visibility attribute is required" >&5
+echo "$as_me: error: compiler support for visibility attribute is required" >&2;}
+ { (exit 1); exit 1; }; }
fi
fi
@@ -5419,10 +5411,9 @@ fi
echo "$as_me:$LINENO: result: $libc_cv_broken_visibility_attribute" >&5
echo "${ECHO_T}$libc_cv_broken_visibility_attribute" >&6
if test $libc_cv_broken_visibility_attribute = yes; then
- cat >>confdefs.h <<\_ACEOF
-#define HAVE_BROKEN_VISIBILITY_ATTRIBUTE 1
-_ACEOF
-
+ { { echo "$as_me:$LINENO: error: working compiler support for visibility attribute is required" >&5
+echo "$as_me: error: working compiler support for visibility attribute is required" >&2;}
+ { (exit 1); exit 1; }; }
fi
fi
@@ -5457,10 +5448,9 @@ fi
echo "$as_me:$LINENO: result: $libc_cv_broken_alias_attribute" >&5
echo "${ECHO_T}$libc_cv_broken_alias_attribute" >&6
if test $libc_cv_broken_alias_attribute = yes; then
- cat >>confdefs.h <<\_ACEOF
-#define HAVE_BROKEN_ALIAS_ATTRIBUTE 1
-_ACEOF
-
+ { { echo "$as_me:$LINENO: error: working alias attribute support required" >&5
+echo "$as_me: error: working alias attribute support required" >&2;}
+ { (exit 1); exit 1; }; }
fi
if test $libc_cv_visibility_attribute = yes; then
@@ -5572,14 +5562,15 @@ EOF
then
libc_cv_z_nodelete=yes
else
- libc_cv_z_nodelete=no
+ { { echo "$as_me:$LINENO: error: linker with -z nodelete support required" >&5
+echo "$as_me: error: linker with -z nodelete support required" >&2;}
+ { (exit 1); exit 1; }; }
fi
rm -f conftest*
fi
echo "$as_me:$LINENO: result: $libc_cv_z_nodelete" >&5
echo "${ECHO_T}$libc_cv_z_nodelete" >&6
-
echo "$as_me:$LINENO: checking for -z nodlopen option" >&5
echo $ECHO_N "checking for -z nodlopen option... $ECHO_C" >&6
if test "${libc_cv_z_nodlopen+set}" = set; then
@@ -5600,14 +5591,15 @@ EOF
then
libc_cv_z_nodlopen=yes
else
- libc_cv_z_nodlopen=no
+ { { echo "$as_me:$LINENO: error: linker with -z nodlopen support required" >&5
+echo "$as_me: error: linker with -z nodlopen support required" >&2;}
+ { (exit 1); exit 1; }; }
fi
rm -f conftest*
fi
echo "$as_me:$LINENO: result: $libc_cv_z_nodlopen" >&5
echo "${ECHO_T}$libc_cv_z_nodlopen" >&6
-
echo "$as_me:$LINENO: checking for -z initfirst option" >&5
echo $ECHO_N "checking for -z initfirst option... $ECHO_C" >&6
if test "${libc_cv_z_initfirst+set}" = set; then
@@ -5628,15 +5620,18 @@ EOF
then
libc_cv_z_initfirst=yes
else
- libc_cv_z_initfirst=no
+ { { echo "$as_me:$LINENO: error: linker with -z initfirst support required" >&5
+echo "$as_me: error: linker with -z initfirst support required" >&2;}
+ { (exit 1); exit 1; }; }
fi
rm -f conftest*
fi
echo "$as_me:$LINENO: result: $libc_cv_z_initfirst" >&5
echo "${ECHO_T}$libc_cv_z_initfirst" >&6
-
- echo "$as_me:$LINENO: checking for -z relro option" >&5
+ case "$base_machine" in
+ i[34567]86 | x86_64 | powerpc* | s390* | sparc* | alpha*)
+ echo "$as_me:$LINENO: checking for -z relro option" >&5
echo $ECHO_N "checking for -z relro option... $ECHO_C" >&6
if test "${libc_cv_z_relro+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -5662,13 +5657,14 @@ else
fi
echo "$as_me:$LINENO: result: $libc_cv_z_relro" >&5
echo "${ECHO_T}$libc_cv_z_relro" >&6
-
- if test $libc_cv_z_relro = yes; then
- cat >>confdefs.h <<\_ACEOF
-#define HAVE_Z_RELRO 1
-_ACEOF
-
- fi
+ if test "$libc_cv_z_relro" = no; then
+ { { echo "$as_me:$LINENO: error: linker with -z relro support required" >&5
+echo "$as_me: error: linker with -z relro support required" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ ;;
+ *) ;;
+ esac
echo "$as_me:$LINENO: checking for -Bgroup option" >&5
echo $ECHO_N "checking for -Bgroup option... $ECHO_C" >&6
@@ -8510,12 +8506,7 @@ s,@PERL@,$PERL,;t t
s,@INSTALL_INFO@,$INSTALL_INFO,;t t
s,@BISON@,$BISON,;t t
s,@VERSIONING@,$VERSIONING,;t t
-s,@libc_cv_asm_protected_directive@,$libc_cv_asm_protected_directive,;t t
s,@libc_cv_cc_with_libunwind@,$libc_cv_cc_with_libunwind,;t t
-s,@libc_cv_z_nodelete@,$libc_cv_z_nodelete,;t t
-s,@libc_cv_z_nodlopen@,$libc_cv_z_nodlopen,;t t
-s,@libc_cv_z_initfirst@,$libc_cv_z_initfirst,;t t
-s,@libc_cv_z_relro@,$libc_cv_z_relro,;t t
s,@libc_cv_Bgroup@,$libc_cv_Bgroup,;t t
s,@libc_cv_libgcc_s_suffix@,$libc_cv_libgcc_s_suffix,;t t
s,@libc_cv_as_needed@,$libc_cv_as_needed,;t t
diff --git a/libc/configure.in b/libc/configure.in
index 924b0406c..71ceb04b3 100644
--- a/libc/configure.in
+++ b/libc/configure.in
@@ -131,9 +131,9 @@ AC_ARG_ENABLE([shared],
[shared=default])
AC_ARG_ENABLE([profile],
AC_HELP_STRING([--enable-profile],
- [build profiled library @<:@default=yes@:>@]),
+ [build profiled library @<:@default=no@:>@]),
[profile=$enableval],
- [profile=yes])
+ [profile=no])
AC_ARG_ENABLE([omitfp],
AC_HELP_STRING([--enable-omitfp],
[build undebuggable optimized library @<:@default=no@:>@]),
@@ -1259,12 +1259,9 @@ EOF
if AC_TRY_COMMAND(${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
libc_cv_asm_protected_directive=yes
else
- libc_cv_asm_protected_directive=no
+ AC_MSG_ERROR(assembler support for symbol visibility is required)
fi
rm -f conftest*])
- AC_SUBST(libc_cv_asm_protected_directive)
- AC_DEFINE(HAVE_PROTECTED)
- AC_DEFINE(HAVE_HIDDEN)
if test $libc_cv_asm_protected_directive = yes; then
AC_CACHE_CHECK(whether __attribute__((visibility())) is supported,
@@ -1283,8 +1280,8 @@ EOF
fi
rm -f conftest.[cs]
])
- if test $libc_cv_visibility_attribute = yes; then
- AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
+ if test $libc_cv_visibility_attribute != yes; then
+ AC_MSG_ERROR(compiler support for visibility attribute is required)
fi
fi
@@ -1307,7 +1304,7 @@ changequote([,])dnl
rm -f conftest.c conftest.s
])
if test $libc_cv_broken_visibility_attribute = yes; then
- AC_DEFINE(HAVE_BROKEN_VISIBILITY_ATTRIBUTE)
+ AC_MSG_ERROR(working compiler support for visibility attribute is required)
fi
fi
@@ -1331,7 +1328,7 @@ EOF
rm -f conftest.c conftest.s
])
if test $libc_cv_broken_alias_attribute = yes; then
- AC_DEFINE(HAVE_BROKEN_ALIAS_ATTRIBUTE)
+ AC_MSG_ERROR(working alias attribute support required)
fi
if test $libc_cv_visibility_attribute = yes; then
@@ -1403,10 +1400,9 @@ EOF
then
libc_cv_z_nodelete=yes
else
- libc_cv_z_nodelete=no
+ AC_MSG_ERROR(linker with -z nodelete support required)
fi
rm -f conftest*])
- AC_SUBST(libc_cv_z_nodelete)
AC_CACHE_CHECK(for -z nodlopen option,
libc_cv_z_nodlopen, [dnl
@@ -1420,10 +1416,9 @@ EOF
then
libc_cv_z_nodlopen=yes
else
- libc_cv_z_nodlopen=no
+ AC_MSG_ERROR(linker with -z nodlopen support required)
fi
rm -f conftest*])
- AC_SUBST(libc_cv_z_nodlopen)
AC_CACHE_CHECK(for -z initfirst option,
libc_cv_z_initfirst, [dnl
@@ -1437,13 +1432,16 @@ EOF
then
libc_cv_z_initfirst=yes
else
- libc_cv_z_initfirst=no
+ AC_MSG_ERROR(linker with -z initfirst support required)
fi
rm -f conftest*])
- AC_SUBST(libc_cv_z_initfirst)
- AC_CACHE_CHECK(for -z relro option,
- libc_cv_z_relro, [dnl
+ case "$base_machine" in
+changequote(,)dnl
+ i[34567]86 | x86_64 | powerpc* | s390* | sparc* | alpha*)
+changequote([,])dnl
+ AC_CACHE_CHECK(for -z relro option,
+ libc_cv_z_relro, [dnl
libc_cv_z_relro=no
if AC_TRY_COMMAND([${CC-cc} -v --help 2>&1|grep "z relro" 1>&AS_MESSAGE_LOG_FD])
then
@@ -1452,10 +1450,12 @@ EOF
libc_cv_z_relro=yes
fi
fi])
- AC_SUBST(libc_cv_z_relro)
- if test $libc_cv_z_relro = yes; then
- AC_DEFINE(HAVE_Z_RELRO)
- fi
+ if test "$libc_cv_z_relro" = no; then
+ AC_MSG_ERROR(linker with -z relro support required)
+ fi
+ ;;
+ *) ;;
+ esac
AC_CACHE_CHECK(for -Bgroup option,
libc_cv_Bgroup, [dnl
diff --git a/libc/csu/Versions b/libc/csu/Versions
index a1321a9df..f0b4f0054 100644
--- a/libc/csu/Versions
+++ b/libc/csu/Versions
@@ -5,7 +5,7 @@ libc {
# helper functions
__libc_init_first; __libc_start_main;
-%if !(USE_TLS && HAVE___THREAD)
+%if !HAVE___THREAD
# global variables
_errno;
@@ -18,7 +18,7 @@ libc {
gnu_get_libc_release; gnu_get_libc_version;
}
GLIBC_PRIVATE {
-%if USE_TLS && HAVE___THREAD
+%if HAVE___THREAD
# This version is for the TLS symbol, GLIBC_2.0 is the old object symbol.
errno;
%endif
diff --git a/libc/csu/libc-start.c b/libc/csu/libc-start.c
index 194db6b1e..634844759 100644
--- a/libc/csu/libc-start.c
+++ b/libc/csu/libc-start.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2003, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -30,11 +30,7 @@ extern int __libc_multiple_libcs;
#include <tls.h>
#ifndef SHARED
# include <dl-osinfo.h>
-extern void __pthread_initialize_minimal (void)
-# if !(USE_TLS - 0) && !defined NONTLS_INIT_TP
- __attribute__ ((weak))
-# endif
- ;
+extern void __pthread_initialize_minimal (void);
# ifndef THREAD_SET_STACK_GUARD
/* Only exported for architectures that don't store the stack guard canary
in thread local area. */
@@ -140,13 +136,8 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
/* Initialize the thread library at least a bit since the libgcc
functions are using thread functions if these are available and
- we need to setup errno. If there is no thread library and we
- handle TLS the function is defined in the libc to initialized the
- TLS handling. */
-# if !(USE_TLS - 0) && !defined NONTLS_INIT_TP
- if (__pthread_initialize_minimal)
-# endif
- __pthread_initialize_minimal ();
+ we need to setup errno. */
+ __pthread_initialize_minimal ();
#endif
# ifndef SHARED
diff --git a/libc/csu/libc-tls.c b/libc/csu/libc-tls.c
index 3544e396d..0d240ccef 100644
--- a/libc/csu/libc-tls.c
+++ b/libc/csu/libc-tls.c
@@ -1,5 +1,5 @@
/* Initialization code for TLS in statically linked application.
- Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -29,7 +29,6 @@
#error makefile bug, this file is for static only
#endif
-#ifdef USE_TLS
extern ElfW(Phdr) *_dl_phdr;
extern size_t _dl_phnum;
@@ -143,19 +142,19 @@ __libc_setup_tls (size_t tcbsize, size_t tcbalign)
The initialized value of _dl_tls_static_size is provided by dl-open.c
to request some surplus that permits dynamic loading of modules with
IE-model TLS. */
-# if TLS_TCB_AT_TP
+#if TLS_TCB_AT_TP
tcb_offset = roundup (memsz + GL(dl_tls_static_size), tcbalign);
tlsblock = __sbrk (tcb_offset + tcbsize + max_align);
-# elif TLS_DTV_AT_TP
+#elif TLS_DTV_AT_TP
tcb_offset = roundup (tcbsize, align ?: 1);
tlsblock = __sbrk (tcb_offset + memsz + max_align
+ TLS_PRE_TCB_SIZE + GL(dl_tls_static_size));
tlsblock += TLS_PRE_TCB_SIZE;
-# else
+#else
/* In case a model with a different layout for the TCB and DTV
is defined add another #elif here and in the following #ifs. */
-# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
-# endif
+# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
+#endif
/* Align the TLS block. */
tlsblock = (void *) (((uintptr_t) tlsblock + max_align - 1)
@@ -166,16 +165,16 @@ __libc_setup_tls (size_t tcbsize, size_t tcbalign)
// static_dtv[1].counter = 0; would be needed if not already done
/* Initialize the TLS block. */
-# if TLS_TCB_AT_TP
+#if TLS_TCB_AT_TP
static_dtv[2].pointer.val = ((char *) tlsblock + tcb_offset
- roundup (memsz, align ?: 1));
static_map.l_tls_offset = roundup (memsz, align ?: 1);
-# elif TLS_DTV_AT_TP
+#elif TLS_DTV_AT_TP
static_dtv[2].pointer.val = (char *) tlsblock + tcb_offset;
static_map.l_tls_offset = tcb_offset;
-# else
-# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
-# endif
+#else
+# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
+#endif
static_dtv[2].pointer.is_static = true;
/* sbrk gives us zero'd memory, so we don't need to clear the remainder. */
memcpy (static_dtv[2].pointer.val, initimage, filesz);
@@ -183,16 +182,16 @@ __libc_setup_tls (size_t tcbsize, size_t tcbalign)
/* Install the pointer to the dtv. */
/* Initialize the thread pointer. */
-# if TLS_TCB_AT_TP
+#if TLS_TCB_AT_TP
INSTALL_DTV ((char *) tlsblock + tcb_offset, static_dtv);
const char *lossage = TLS_INIT_TP ((char *) tlsblock + tcb_offset, 0);
-# elif TLS_DTV_AT_TP
+#elif TLS_DTV_AT_TP
INSTALL_DTV (tlsblock, static_dtv);
const char *lossage = TLS_INIT_TP (tlsblock, 0);
-# else
-# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
-# endif
+#else
+# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
+#endif
if (__builtin_expect (lossage != NULL, 0))
__libc_fatal (lossage);
@@ -212,11 +211,11 @@ __libc_setup_tls (size_t tcbsize, size_t tcbalign)
memsz = roundup (memsz, align ?: 1);
-# if TLS_TCB_AT_TP
+#if TLS_TCB_AT_TP
memsz += tcbsize;
-# elif TLS_DTV_AT_TP
+#elif TLS_DTV_AT_TP
memsz += tcb_offset;
-# endif
+#endif
init_static_tls (memsz, MAX (TLS_TCB_ALIGN, max_align));
}
@@ -230,11 +229,11 @@ _dl_tls_setup (void)
{
init_slotinfo ();
init_static_tls (
-# if TLS_TCB_AT_TP
+#if TLS_TCB_AT_TP
TLS_TCB_SIZE,
-# else
+#else
0,
-# endif
+#endif
TLS_TCB_ALIGN);
return 0;
}
@@ -248,16 +247,3 @@ __pthread_initialize_minimal (void)
{
__libc_setup_tls (TLS_INIT_TCB_SIZE, TLS_INIT_TCB_ALIGN);
}
-
-#elif defined NONTLS_INIT_TP
-
-/* This is the minimal initialization function used when libpthread is
- not used. */
-void
-__attribute__ ((weak))
-__pthread_initialize_minimal (void)
-{
- NONTLS_INIT_TP;
-}
-
-#endif
diff --git a/libc/csu/tst-atomic.c b/libc/csu/tst-atomic.c
index 7a2e3d086..7c0b022b7 100644
--- a/libc/csu/tst-atomic.c
+++ b/libc/csu/tst-atomic.c
@@ -1,5 +1,5 @@
/* Tests for atomic.h macros.
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
@@ -379,6 +379,117 @@ do_test (void)
}
#endif
+#ifdef catomic_compare_and_exchange_val_acq
+ mem = 24;
+ if (catomic_compare_and_exchange_val_acq (&mem, 35, 24) != 24
+ || mem != 35)
+ {
+ puts ("catomic_compare_and_exchange_val_acq test 1 failed");
+ ret = 1;
+ }
+
+ mem = 12;
+ if (catomic_compare_and_exchange_val_acq (&mem, 10, 15) != 12
+ || mem != 12)
+ {
+ puts ("catomic_compare_and_exchange_val_acq test 2 failed");
+ ret = 1;
+ }
+
+ mem = -15;
+ if (catomic_compare_and_exchange_val_acq (&mem, -56, -15) != -15
+ || mem != -56)
+ {
+ puts ("catomic_compare_and_exchange_val_acq test 3 failed");
+ ret = 1;
+ }
+
+ mem = -1;
+ if (catomic_compare_and_exchange_val_acq (&mem, 17, 0) != -1
+ || mem != -1)
+ {
+ puts ("catomic_compare_and_exchange_val_acq test 4 failed");
+ ret = 1;
+ }
+#endif
+
+ mem = 24;
+ if (catomic_compare_and_exchange_bool_acq (&mem, 35, 24)
+ || mem != 35)
+ {
+ puts ("catomic_compare_and_exchange_bool_acq test 1 failed");
+ ret = 1;
+ }
+
+ mem = 12;
+ if (! catomic_compare_and_exchange_bool_acq (&mem, 10, 15)
+ || mem != 12)
+ {
+ puts ("catomic_compare_and_exchange_bool_acq test 2 failed");
+ ret = 1;
+ }
+
+ mem = -15;
+ if (catomic_compare_and_exchange_bool_acq (&mem, -56, -15)
+ || mem != -56)
+ {
+ puts ("catomic_compare_and_exchange_bool_acq test 3 failed");
+ ret = 1;
+ }
+
+ mem = -1;
+ if (! catomic_compare_and_exchange_bool_acq (&mem, 17, 0)
+ || mem != -1)
+ {
+ puts ("catomic_compare_and_exchange_bool_acq test 4 failed");
+ ret = 1;
+ }
+
+ mem = 2;
+ if (catomic_exchange_and_add (&mem, 11) != 2
+ || mem != 13)
+ {
+ puts ("catomic_exchange_and_add test failed");
+ ret = 1;
+ }
+
+ mem = -21;
+ catomic_add (&mem, 22);
+ if (mem != 1)
+ {
+ puts ("catomic_add test failed");
+ ret = 1;
+ }
+
+ mem = -1;
+ catomic_increment (&mem);
+ if (mem != 0)
+ {
+ puts ("catomic_increment test failed");
+ ret = 1;
+ }
+
+ mem = 2;
+ if (catomic_increment_val (&mem) != 3)
+ {
+ puts ("catomic_increment_val test failed");
+ ret = 1;
+ }
+
+ mem = 17;
+ catomic_decrement (&mem);
+ if (mem != 16)
+ {
+ puts ("catomic_decrement test failed");
+ ret = 1;
+ }
+
+ if (catomic_decrement_val (&mem) != 15)
+ {
+ puts ("catomic_decrement_val test failed");
+ ret = 1;
+ }
+
return ret;
}
diff --git a/libc/csu/version.c b/libc/csu/version.c
index 2196d2043..1b98c4a7e 100644
--- a/libc/csu/version.c
+++ b/libc/csu/version.c
@@ -34,9 +34,6 @@ Compiled by GNU CC version "__VERSION__".\n"
#ifdef GLIBC_OLDEST_ABI
"The oldest ABI supported: " GLIBC_OLDEST_ABI ".\n"
#endif
-#ifdef USE_TLS
-"Thread-local storage support included.\n"
-#endif
"For bug reporting instructions, please see:\n\
<http://www.gnu.org/software/libc/bugs.html>.\n";
diff --git a/libc/dlfcn/Makefile b/libc/dlfcn/Makefile
index 63e7b31b2..e8fbab295 100644
--- a/libc/dlfcn/Makefile
+++ b/libc/dlfcn/Makefile
@@ -41,10 +41,7 @@ endif
ifeq (yes,$(build-shared))
tests = glrefmain failtest tst-dladdr default errmsg1 tstcxaatexit \
bug-dlopen1 bug-dlsym1 tst-dlinfo bug-atexit1 bug-atexit2 \
- bug-atexit3
-ifeq (yes,$(have-protected))
-tests += tstatexit
-endif
+ bug-atexit3 tstatexit
endif
modules-names = glreflib1 glreflib2 failtestmod defaultmod1 defaultmod2 \
errmsg1mod modatexit modcxaatexit \
diff --git a/libc/dlfcn/dlinfo.c b/libc/dlfcn/dlinfo.c
index b1e2b009a..923127cbf 100644
--- a/libc/dlfcn/dlinfo.c
+++ b/libc/dlfcn/dlinfo.c
@@ -32,9 +32,7 @@ dlinfo (void *handle, int request, void *arg)
#else
-# ifdef USE_TLS
-# include <dl-tls.h>
-# endif
+# include <dl-tls.h>
struct dlinfo_args
{
@@ -97,18 +95,14 @@ RTLD_SELF used in code not dynamically loaded"));
case RTLD_DI_TLS_MODID:
*(size_t *) args->arg = 0;
-#ifdef USE_TLS
*(size_t *) args->arg = l->l_tls_modid;
-#endif
break;
case RTLD_DI_TLS_DATA:
{
void *data = NULL;
-#ifdef USE_TLS
if (l->l_tls_modid != 0)
data = _dl_tls_get_addr_soft (l);
-#endif
*(void **) args->arg = data;
break;
}
diff --git a/libc/elf/Makefile b/libc/elf/Makefile
index b1a9bab02..afebaec1e 100644
--- a/libc/elf/Makefile
+++ b/libc/elf/Makefile
@@ -159,8 +159,8 @@ endif
ifeq (yes,$(build-shared))
tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \
constload1 order $(tests-vis-$(have-protected)) noload filter unload \
- reldep reldep2 reldep3 reldep4 $(tests-nodelete-$(have-z-nodelete)) \
- $(tests-nodlopen-$(have-z-nodlopen)) neededtest neededtest2 \
+ reldep reldep2 reldep3 reldep4 nodelete nodelete2 \
+ nodlopen nodlopen2 neededtest neededtest2 \
neededtest3 neededtest4 unload2 lateglobal initfirst global \
restest2 next dblload dblunload reldep5 reldep6 reldep7 reldep8 \
circleload1 tst-tls3 tst-tls4 tst-tls5 tst-tls6 tst-tls7 tst-tls8 \
@@ -171,12 +171,10 @@ tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \
tst-dlmopen1 tst-dlmopen2 tst-dlmopen3 \
unload3 unload4 unload5 unload6 unload7 tst-global1 order2 \
tst-audit1 tst-audit2 \
- tst-stackguard1 tst-addr1
+ tst-stackguard1 tst-addr1 tst-thrlock
# reldep9
test-srcs = tst-pathopt
tests-vis-yes = vismain
-tests-nodelete-yes = nodelete nodelete2
-tests-nodlopen-yes = nodlopen nodlopen2
tests-execstack-yes = tst-execstack tst-execstack-needed tst-execstack-prog
endif
ifeq (yesyes,$(have-fpie)$(build-shared))
@@ -186,8 +184,9 @@ tests: $(objpfx)tst-leaks1-mem
modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
testobj1_1 failobj constload2 constload3 unloadmod \
dep1 dep2 dep3 dep4 $(modules-vis-$(have-protected)) \
- $(modules-nodelete-$(have-z-nodelete)) \
- $(modules-nodlopen-$(have-z-nodlopen)) filtmod1 filtmod2 \
+ nodelmod1 nodelmod2 nodelmod3 nodelmod4 \
+ nodel2mod1 nodel2mod2 nodel2mod3 \
+ nodlopenmod nodlopenmod2 filtmod1 filtmod2 \
reldepmod1 reldepmod2 reldepmod3 reldepmod4 nextmod1 nextmod2 \
reldep4mod1 reldep4mod2 reldep4mod3 reldep4mod4 \
neededobj1 neededobj2 neededobj3 neededobj4 \
@@ -221,9 +220,6 @@ ifeq (yesyes,$(have-fpie)$(build-shared))
modules-names += tst-piemod1
endif
modules-vis-yes = vismod1 vismod2 vismod3
-modules-nodelete-yes = nodelmod1 nodelmod2 nodelmod3 nodelmod4 \
- nodel2mod1 nodel2mod2 nodel2mod3
-modules-nodlopen-yes = nodlopenmod nodlopenmod2
modules-execstack-yes = tst-execstack-mod
extra-test-objs += $(addsuffix .os,$(strip $(modules-names)))
# We need this variable to be sure the test modules get the right CPPFLAGS.
@@ -916,3 +912,5 @@ $(objpfx)tst-leaks1-mem: $(objpfx)tst-leaks1.out
tst-leaks1-ENV = MALLOC_TRACE=$(objpfx)tst-leaks1.mtrace
$(objpfx)tst-addr1: $(libdl)
+
+$(objpfx)tst-thrlock: $(libdl) $(shared-thread-library)
diff --git a/libc/elf/dl-addr.c b/libc/elf/dl-addr.c
index 720b24d04..e55dc4b46 100644
--- a/libc/elf/dl-addr.c
+++ b/libc/elf/dl-addr.c
@@ -93,9 +93,7 @@ _dl_addr (const void *address, Dl_info *info,
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)
@@ -123,9 +121,7 @@ _dl_addr (const void *address, Dl_info *info,
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)
diff --git a/libc/elf/dl-cache.c b/libc/elf/dl-cache.c
index fc7d9916c..bbeba77e4 100644
--- a/libc/elf/dl-cache.c
+++ b/libc/elf/dl-cache.c
@@ -256,11 +256,7 @@ _dl_load_cache_lookup (const char *name)
platform = 1ULL << platform;
/* Only accept hwcap if it's for the right platform. */
-#ifdef USE_TLS
-# define _DL_HWCAP_TLS_MASK (1LL << 63)
-#else
-# define _DL_HWCAP_TLS_MASK 0
-#endif
+#define _DL_HWCAP_TLS_MASK (1LL << 63)
#define HWCAP_CHECK \
if (GLRO(dl_osversion) && lib->osversion > GLRO(dl_osversion)) \
continue; \
diff --git a/libc/elf/dl-close.c b/libc/elf/dl-close.c
index 84e57e09d..df968fe64 100644
--- a/libc/elf/dl-close.c
+++ b/libc/elf/dl-close.c
@@ -30,6 +30,7 @@
#include <ldsodefs.h>
#include <sys/types.h>
#include <sys/mman.h>
+#include <sysdep-cancel.h>
/* Type of the constructor functions. */
@@ -40,7 +41,6 @@ typedef void (*fini_t) (void);
#define IDX_STILL_USED -1
-#ifdef USE_TLS
/* Returns true we an non-empty was found. */
static bool
remove_slotinfo (size_t idx, struct dtv_slotinfo_list *listp, size_t disp,
@@ -102,26 +102,12 @@ remove_slotinfo (size_t idx, struct dtv_slotinfo_list *listp, size_t disp,
/* No non-entry in this list element. */
return false;
}
-#endif
void
-_dl_close (void *_map)
+_dl_close_worker (struct link_map *map)
{
- struct link_map *map = _map;
Lmid_t ns = map->l_ns;
- unsigned int i;
- /* First see whether we can remove the object at all. */
- if (__builtin_expect (map->l_flags_1 & DF_1_NODELETE, 0)
- && map->l_init_called)
- /* Nope. Do nothing. */
- return;
-
- if (__builtin_expect (map->l_direct_opencount, 1) == 0)
- GLRO(dl_signal_error) (0, map->l_name, NULL, N_("shared object not open"));
-
- /* Acquire the lock. */
- __rtld_lock_lock_recursive (GL(dl_load_lock));
/* One less direct use. */
--map->l_direct_opencount;
@@ -142,16 +128,13 @@ _dl_close (void *_map)
_dl_debug_printf ("\nclosing file=%s; direct_opencount=%u\n",
map->l_name, map->l_direct_opencount);
- __rtld_lock_unlock_recursive (GL(dl_load_lock));
return;
}
retry:
dl_close_state = pending;
-#ifdef USE_TLS
bool any_tls = false;
-#endif
const unsigned int nloaded = GL(dl_ns)[ns]._ns_nloaded;
char used[nloaded];
char done[nloaded];
@@ -245,7 +228,7 @@ _dl_close (void *_map)
#endif
bool unload_any = false;
unsigned int first_loaded = ~0;
- for (i = 0; i < nloaded; ++i)
+ for (unsigned int i = 0; i < nloaded; ++i)
{
struct link_map *imap = maps[i];
@@ -342,14 +325,14 @@ _dl_close (void *_map)
one for the terminating NULL pointer. */
size_t remain = (new_list != NULL) + 1;
bool removed_any = false;
- for (size_t cnt = 0; imap->l_scoperec->scope[cnt] != NULL; ++cnt)
+ 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_scoperec->scope[cnt] != &imap->l_symbolic_searchlist)
+ if (imap->l_scope[cnt] != &imap->l_symbolic_searchlist)
{
struct link_map *tmap = (struct link_map *)
- ((char *) imap->l_scoperec->scope[cnt]
+ ((char *) imap->l_scope[cnt]
- offsetof (struct link_map, l_searchlist));
assert (tmap->l_ns == ns);
if (tmap->l_idx == IDX_STILL_USED)
@@ -367,38 +350,35 @@ _dl_close (void *_map)
user of the current array. If possible use the link map's
memory. */
size_t new_size;
- struct r_scoperec *newp;
- if (imap->l_scoperec != &imap->l_scoperec_mem
- && remain < NINIT_SCOPE_ELEMS (imap)
- && imap->l_scoperec_mem.nusers == 0)
+ 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))
{
- new_size = NINIT_SCOPE_ELEMS (imap);
- newp = &imap->l_scoperec_mem;
+ new_size = SCOPE_ELEMS (imap);
+ newp = imap->l_scope_mem;
}
else
{
new_size = imap->l_scope_max;
- newp = (struct r_scoperec *)
- malloc (sizeof (struct r_scoperec)
- + new_size * sizeof (struct r_scope_elem *));
+ 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"));
}
- newp->nusers = 0;
- newp->remove_after_use = false;
- newp->notify = false;
-
/* Copy over the remaining scope elements. */
remain = 0;
- for (size_t cnt = 0; imap->l_scoperec->scope[cnt] != NULL; ++cnt)
+ for (size_t cnt = 0; imap->l_scope[cnt] != NULL; ++cnt)
{
- if (imap->l_scoperec->scope[cnt]
- != &imap->l_symbolic_searchlist)
+ if (imap->l_scope[cnt] != &imap->l_symbolic_searchlist)
{
struct link_map *tmap = (struct link_map *)
- ((char *) imap->l_scoperec->scope[cnt]
+ ((char *) imap->l_scope[cnt]
- offsetof (struct link_map, l_searchlist));
if (tmap->l_idx != IDX_STILL_USED)
{
@@ -406,33 +386,30 @@ _dl_close (void *_map)
scope. */
if (new_list != NULL)
{
- newp->scope[remain++] = new_list;
+ newp[remain++] = new_list;
new_list = NULL;
}
continue;
}
}
- newp->scope[remain++] = imap->l_scoperec->scope[cnt];
+ newp[remain++] = imap->l_scope[cnt];
}
- newp->scope[remain] = NULL;
+ newp[remain] = NULL;
- struct r_scoperec *old = imap->l_scoperec;
+ struct r_scope_elem **old = imap->l_scope;
- __rtld_mrlock_change (imap->l_scoperec_lock);
- imap->l_scoperec = newp;
- __rtld_mrlock_done (imap->l_scoperec_lock);
-
- if (catomic_increment_val (&old->nusers) != 1)
+ if (RTLD_SINGLE_THREAD_P)
+ imap->l_scope = newp;
+ else
{
- old->remove_after_use = true;
- old->notify = true;
- if (catomic_decrement_val (&old->nusers) != 0)
- __rtld_waitzero (old->nusers);
+ __rtld_mrlock_change (imap->l_scope_lock);
+ imap->l_scope = newp;
+ __rtld_mrlock_done (imap->l_scope_lock);
}
/* No user anymore, we can free it now. */
- if (old != &imap->l_scoperec_mem)
+ if (old != imap->l_scope_mem)
free (old);
imap->l_scope_max = new_size;
@@ -479,15 +456,13 @@ _dl_close (void *_map)
r->r_state = RT_DELETE;
_dl_debug_state ();
-#ifdef USE_TLS
size_t tls_free_start;
size_t tls_free_end;
tls_free_start = tls_free_end = NO_TLS_OFFSET;
-#endif
/* Check each element of the search list to see if all references to
it are gone. */
- for (i = first_loaded; i < nloaded; ++i)
+ for (unsigned int i = first_loaded; i < nloaded; ++i)
{
struct link_map *imap = maps[i];
if (!used[i])
@@ -514,7 +489,6 @@ _dl_close (void *_map)
--GL(dl_ns)[ns]._ns_main_searchlist->r_nlist;
}
-#ifdef USE_TLS
/* Remove the object from the dtv slotinfo array if it uses TLS. */
if (__builtin_expect (imap->l_tls_blocksize > 0, 0))
{
@@ -533,7 +507,7 @@ _dl_close (void *_map)
this search list, going in either direction. When the
whole chunk is at the end of the used area then we can
reclaim it. */
-# if TLS_TCB_AT_TP
+#if TLS_TCB_AT_TP
if (tls_free_start == NO_TLS_OFFSET
|| (size_t) imap->l_tls_offset == tls_free_start)
{
@@ -573,7 +547,7 @@ _dl_close (void *_map)
= tls_free_end - imap->l_tls_blocksize;
}
}
-# elif TLS_DTV_AT_TP
+#elif TLS_DTV_AT_TP
if ((size_t) imap->l_tls_offset == tls_free_end)
/* Extend the contiguous chunk being reclaimed. */
tls_free_end -= imap->l_tls_blocksize;
@@ -590,12 +564,11 @@ _dl_close (void *_map)
tls_free_start = imap->l_tls_offset;
tls_free_end = tls_free_start + imap->l_tls_blocksize;
}
-# else
-# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
-# endif
+#else
+# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
+#endif
}
}
-#endif
/* We can unmap all the maps at once. We determined the
start address and length when we loaded the object and
@@ -646,8 +619,8 @@ _dl_close (void *_map)
free (imap->l_initfini);
/* Remove the scope array if we allocated it. */
- if (imap->l_scoperec != &imap->l_scoperec_mem)
- free (imap->l_scoperec);
+ if (imap->l_scope != imap->l_scope_mem)
+ free (imap->l_scope);
if (imap->l_phdr_allocated)
free ((void *) imap->l_phdr);
@@ -661,7 +634,6 @@ _dl_close (void *_map)
}
}
-#ifdef USE_TLS
/* If we removed any object which uses TLS bump the generation counter. */
if (any_tls)
{
@@ -671,7 +643,6 @@ _dl_close (void *_map)
if (tls_free_end == GL(dl_tls_static_used))
GL(dl_tls_static_used) = tls_free_start;
}
-#endif
#ifdef SHARED
/* Auditing checkpoint: we have deleted all objects. */
@@ -703,11 +674,34 @@ _dl_close (void *_map)
goto retry;
dl_close_state = not_pending;
+}
+
+
+void
+_dl_close (void *_map)
+{
+ struct link_map *map = _map;
+
+ /* First see whether we can remove the object at all. */
+ if (__builtin_expect (map->l_flags_1 & DF_1_NODELETE, 0))
+ {
+ assert (map->l_init_called);
+ /* Nope. Do nothing. */
+ return;
+ }
+
+ if (__builtin_expect (map->l_direct_opencount, 1) == 0)
+ GLRO(dl_signal_error) (0, map->l_name, NULL, N_("shared object not open"));
+
+ /* Acquire the lock. */
+ __rtld_lock_lock_recursive (GL(dl_load_lock));
+
+ _dl_close_worker (map);
+
__rtld_lock_unlock_recursive (GL(dl_load_lock));
}
-#ifdef USE_TLS
static bool __libc_freeres_fn_section
free_slotinfo (struct dtv_slotinfo_list **elemp)
{
@@ -734,7 +728,6 @@ free_slotinfo (struct dtv_slotinfo_list **elemp)
return true;
}
-#endif
libc_freeres_fn (free_mem)
@@ -760,22 +753,20 @@ libc_freeres_fn (free_mem)
free (old);
}
-#ifdef USE_TLS
if (USE___THREAD || GL(dl_tls_dtv_slotinfo_list) != NULL)
{
/* Free the memory allocated for the dtv slotinfo array. We can do
this only if all modules which used this memory are unloaded. */
-# ifdef SHARED
+#ifdef SHARED
if (GL(dl_initial_dtv) == NULL)
/* There was no initial TLS setup, it was set up later when
it used the normal malloc. */
free_slotinfo (&GL(dl_tls_dtv_slotinfo_list));
else
-# endif
+#endif
/* The first element of the list does not have to be deallocated.
It was allocated in the dynamic linker (i.e., with a different
malloc), and in the static library it's in .bss space. */
free_slotinfo (&GL(dl_tls_dtv_slotinfo_list)->next);
}
-#endif
}
diff --git a/libc/elf/dl-iteratephdr.c b/libc/elf/dl-iteratephdr.c
index 52a114421..d03d8b6da 100644
--- a/libc/elf/dl-iteratephdr.c
+++ b/libc/elf/dl-iteratephdr.c
@@ -70,11 +70,9 @@ __dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info,
info.dlpi_subs = GL(dl_load_adds) - nloaded;
info.dlpi_tls_modid = 0;
info.dlpi_tls_data = NULL;
-#ifdef USE_TLS
info.dlpi_tls_modid = l->l_tls_modid;
if (info.dlpi_tls_modid != 0)
info.dlpi_tls_data = _dl_tls_get_addr_soft (l);
-#endif
ret = callback (&info, sizeof (struct dl_phdr_info), data);
if (ret)
break;
diff --git a/libc/elf/dl-libc.c b/libc/elf/dl-libc.c
index 8b78a7a38..a6d0d1fce 100644
--- a/libc/elf/dl-libc.c
+++ b/libc/elf/dl-libc.c
@@ -133,8 +133,7 @@ do_dlsym_private (void *ptr)
struct do_dlsym_args *args = (struct do_dlsym_args *) ptr;
args->ref = NULL;
l = GLRO(dl_lookup_symbol_x) (args->name, args->map, &args->ref,
- args->map->l_scoperec->scope, &vers, 0, 0,
- NULL);
+ args->map->l_scope, &vers, 0, 0, NULL);
args->loadbase = l;
}
diff --git a/libc/elf/dl-load.c b/libc/elf/dl-load.c
index 172fb2fc3..ccbbf4fdd 100644
--- a/libc/elf/dl-load.c
+++ b/libc/elf/dl-load.c
@@ -1085,7 +1085,6 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
break;
case PT_TLS:
-#ifdef USE_TLS
if (ph->p_memsz == 0)
/* Nothing to do for an empty segment. */
break;
@@ -1113,7 +1112,7 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
break;
}
-# ifdef SHARED
+#ifdef SHARED
if (l->l_prev == NULL || (mode & __RTLD_AUDIT) != 0)
/* We are loading the executable itself when the dynamic linker
was executed directly. The setup will happen later. */
@@ -1122,7 +1121,7 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
/* In a static binary there is no way to tell if we dynamically
loaded libpthread. */
if (GL(dl_error_catch_tsd) == &_dl_initial_error_catch_tsd)
-# endif
+#endif
{
/* We have not yet loaded libpthread.
We can do the TLS setup right now! */
@@ -1155,7 +1154,6 @@ cannot allocate TLS data structures for initial thread");
_dl_deallocate_tls (tcb, 1);
goto call_lose;
}
-#endif
/* Uh-oh, the binary expects TLS support but we cannot
provide it. */
@@ -1394,7 +1392,7 @@ cannot allocate TLS data structures for initial thread");
requires that it be executable. We must change the
protection of the variable which contains the flags used in
the mprotect calls. */
-#if defined HAVE_Z_RELRO && defined SHARED
+#ifdef SHARED
if ((mode & (__RTLD_DLOPEN | __RTLD_AUDIT)) == __RTLD_DLOPEN)
{
const uintptr_t p = (uintptr_t) &__stack_prot & -GLRO(dl_pagesize);
@@ -1431,11 +1429,9 @@ cannot enable executable stack as shared object requires");
}
}
-#ifdef USE_TLS
/* Adjust the address of the TLS initialization image. */
if (l->l_tls_initimage != NULL)
l->l_tls_initimage = (char *) l->l_tls_initimage + l->l_addr;
-#endif
/* We are done mapping in the file. We no longer need the descriptor. */
if (__builtin_expect (__close (fd) != 0, 0))
@@ -1473,7 +1469,7 @@ cannot enable executable stack as shared object requires");
have to do this for the main map. */
if ((mode & RTLD_DEEPBIND) == 0
&& __builtin_expect (l->l_info[DT_SYMBOLIC] != NULL, 0)
- && &l->l_searchlist != l->l_scoperec->scope[0])
+ && &l->l_searchlist != l->l_scope[0])
{
/* Create an appropriate searchlist. It contains only this map.
This is the definition of DT_SYMBOLIC in SysVr4. */
@@ -1490,11 +1486,11 @@ cannot enable executable stack as shared object requires");
l->l_symbolic_searchlist.r_nlist = 1;
/* Now move the existing entries one back. */
- memmove (&l->l_scoperec->scope[1], &l->l_scoperec->scope[0],
- (l->l_scope_max - 1) * sizeof (l->l_scoperec->scope[0]));
+ memmove (&l->l_scope[1], &l->l_scope[0],
+ (l->l_scope_max - 1) * sizeof (l->l_scope[0]));
/* Now add the new entry. */
- l->l_scoperec->scope[0] = &l->l_symbolic_searchlist;
+ l->l_scope[0] = &l->l_symbolic_searchlist;
}
/* Remember whether this object must be initialized first. */
@@ -1939,11 +1935,10 @@ open_path (const char *name, size_t namelen, int preloaded,
must not be freed using the general free() in libc. */
if (sps->malloced)
free (sps->dirs);
-#ifdef HAVE_Z_RELRO
+
/* rtld_search_dirs is attribute_relro, therefore avoid writing
into it. */
if (sps != &rtld_search_dirs)
-#endif
sps->dirs = (void *) -1;
}
diff --git a/libc/elf/dl-lookup.c b/libc/elf/dl-lookup.c
index 7cfcc620a..019278c9b 100644
--- a/libc/elf/dl-lookup.c
+++ b/libc/elf/dl-lookup.c
@@ -200,14 +200,17 @@ add_dependency (struct link_map *undef_map, struct link_map *map)
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,
@@ -347,7 +350,7 @@ _dl_lookup_symbol_x (const char *undef_name, struct link_map *undef_map,
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 +407,7 @@ _dl_setup_hash (struct link_map *map)
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)
{
@@ -447,12 +449,10 @@ _dl_debug_bindings (const char *undef_name, struct link_map *undef_map,
conflict = 1;
}
-# ifdef USE_TLS
if (value->s
&& (__builtin_expect (ELFW(ST_TYPE) (value->s->st_info)
== STT_TLS, 0)))
type_class = 4;
-# endif
if (conflict
|| GLRO(dl_trace_prelink_map) == undef_map
diff --git a/libc/elf/dl-object.c b/libc/elf/dl-object.c
index c5dae9ef1..33ee860e5 100644
--- a/libc/elf/dl-object.c
+++ b/libc/elf/dl-object.c
@@ -64,7 +64,7 @@ _dl_new_object (char *realname, const char *libname, int type,
new->l_name = realname;
new->l_type = type;
new->l_loader = loader;
-#if defined USE_TLS && NO_TLS_OFFSET != 0
+#if NO_TLS_OFFSET != 0
new->l_tls_offset = NO_TLS_OFFSET;
#endif
new->l_ns = nsid;
@@ -82,13 +82,12 @@ _dl_new_object (char *realname, const char *libname, int type,
/* Use the 'l_scope_mem' array by default for the the 'l_scope'
information. If we need more entries we will allocate a large
array dynamically. */
- new->l_scoperec = &new->l_scoperec_mem;
- new->l_scope_max = (sizeof (new->l_scope_realmem.scope_elems)
- / sizeof (new->l_scope_realmem.scope_elems[0]));
+ new->l_scope = new->l_scope_mem;
+ new->l_scope_max = sizeof (new->l_scope_mem) / sizeof (new->l_scope_mem[0]);
/* No need to initialize the scope lock if the initializer is zero. */
#if _RTLD_MRLOCK_INITIALIZER != 0
- __rtld_mrlock_initialize (new->l_scoperec_mem.lock);
+ __rtld_mrlock_initialize (new->l_scope_lock);
#endif
/* Counter for the scopes we have to handle. */
@@ -104,8 +103,7 @@ _dl_new_object (char *realname, const char *libname, int type,
l->l_next = new;
/* Add the global scope. */
- new->l_scoperec->scope[idx++]
- = &GL(dl_ns)[nsid]._ns_loaded->l_searchlist;
+ new->l_scope[idx++] = &GL(dl_ns)[nsid]._ns_loaded->l_searchlist;
}
else
GL(dl_ns)[nsid]._ns_loaded = new;
@@ -121,15 +119,15 @@ _dl_new_object (char *realname, const char *libname, int type,
loader = loader->l_loader;
/* Insert the scope if it isn't the global scope we already added. */
- if (idx == 0 || &loader->l_searchlist != new->l_scoperec->scope[0])
+ if (idx == 0 || &loader->l_searchlist != new->l_scope[0])
{
if ((mode & RTLD_DEEPBIND) != 0 && idx != 0)
{
- new->l_scoperec->scope[1] = new->l_scoperec->scope[0];
+ new->l_scope[1] = new->l_scope[0];
idx = 0;
}
- new->l_scoperec->scope[idx] = &loader->l_searchlist;
+ new->l_scope[idx] = &loader->l_searchlist;
}
new->l_local_scope[0] = &new->l_searchlist;
diff --git a/libc/elf/dl-open.c b/libc/elf/dl-open.c
index 35712b5ac..c99752112 100644
--- a/libc/elf/dl-open.c
+++ b/libc/elf/dl-open.c
@@ -31,6 +31,7 @@
#include <ldsodefs.h>
#include <bp-sym.h>
#include <caller.h>
+#include <sysdep-cancel.h>
#include <dl-dst.h>
@@ -163,9 +164,7 @@ dl_open_worker (void *a)
struct link_map *new, *l;
int lazy;
unsigned int i;
-#ifdef USE_TLS
bool any_tls = false;
-#endif
struct link_map *call_map = NULL;
/* Check whether _dl_open() has been called from a valid DSO. */
@@ -343,7 +342,7 @@ dl_open_worker (void *a)
start the profiling. */
struct link_map *old_profile_map = GL(dl_profile_map);
- _dl_relocate_object (l, l->l_scoperec->scope, 1, 1);
+ _dl_relocate_object (l, l->l_scope, 1, 1);
if (old_profile_map == NULL && GL(dl_profile_map) != NULL)
{
@@ -356,7 +355,7 @@ dl_open_worker (void *a)
}
else
#endif
- _dl_relocate_object (l, l->l_scoperec->scope, lazy, 0);
+ _dl_relocate_object (l, l->l_scope, lazy, 0);
}
if (l == new)
@@ -374,7 +373,7 @@ dl_open_worker (void *a)
not been loaded here and now. */
if (imap->l_init_called && imap->l_type == lt_loaded)
{
- struct r_scope_elem **runp = imap->l_scoperec->scope;
+ struct r_scope_elem **runp = imap->l_scope;
size_t cnt = 0;
while (*runp != NULL)
@@ -394,59 +393,52 @@ dl_open_worker (void *a)
/* The 'r_scope' array is too small. Allocate a new one
dynamically. */
size_t new_size;
- struct r_scoperec *newp;
+ struct r_scope_elem **newp;
+
+#define SCOPE_ELEMS(imap) \
+ (sizeof (imap->l_scope_mem) / sizeof (imap->l_scope_mem[0]))
- if (imap->l_scoperec != &imap->l_scoperec_mem
- && imap->l_scope_max < NINIT_SCOPE_ELEMS (imap)
- && imap->l_scoperec_mem.nusers == 0)
+ if (imap->l_scope != imap->l_scope_mem
+ && imap->l_scope_max < SCOPE_ELEMS (imap))
{
- new_size = NINIT_SCOPE_ELEMS (imap);
- newp = &imap->l_scoperec_mem;
+ new_size = SCOPE_ELEMS (imap);
+ newp = imap->l_scope_mem;
}
else
{
new_size = imap->l_scope_max * 2;
- newp = (struct r_scoperec *)
- malloc (sizeof (struct r_scoperec)
- + new_size * sizeof (struct r_scope_elem *));
+ 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"));
}
- newp->nusers = 0;
- newp->remove_after_use = false;
- newp->notify = false;
- memcpy (newp->scope, imap->l_scoperec->scope,
- cnt * sizeof (imap->l_scoperec->scope[0]));
- struct r_scoperec *old = imap->l_scoperec;
+ memcpy (newp, imap->l_scope, cnt * sizeof (imap->l_scope[0]));
+ struct r_scope_elem **old = imap->l_scope;
- if (old == &imap->l_scoperec_mem)
- imap->l_scoperec = newp;
+ if (RTLD_SINGLE_THREAD_P)
+ imap->l_scope = newp;
else
{
- __rtld_mrlock_change (imap->l_scoperec_lock);
- imap->l_scoperec = newp;
- __rtld_mrlock_done (imap->l_scoperec_lock);
-
- catomic_increment (&old->nusers);
- old->remove_after_use = true;
- if (catomic_decrement_val (&old->nusers) == 0)
- /* No user, we can free it here and now. */
- free (old);
+ __rtld_mrlock_change (imap->l_scope_lock);
+ imap->l_scope = newp;
+ __rtld_mrlock_done (imap->l_scope_lock);
}
+ if (old != imap->l_scope_mem)
+ free (old);
+
imap->l_scope_max = new_size;
}
/* 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_scoperec->scope[cnt + 1] = NULL;
+ imap->l_scope[cnt + 1] = NULL;
atomic_write_barrier ();
- imap->l_scoperec->scope[cnt] = &new->l_searchlist;
+ imap->l_scope[cnt] = &new->l_searchlist;
}
-#if USE_TLS
/* Only add TLS memory if this object is loaded now and
therefore is not yet initialized. */
else if (! imap->l_init_called
@@ -461,11 +453,11 @@ dl_open_worker (void *a)
if (imap->l_need_tls_init)
{
imap->l_need_tls_init = 0;
-# ifdef SHARED
+#ifdef SHARED
/* Update the slot information data for at least the
generation of the DSO we are allocating data for. */
_dl_update_slotinfo (imap->l_tls_modid);
-# endif
+#endif
GL(dl_init_static_tls) (imap);
assert (imap->l_need_tls_init == 0);
@@ -474,15 +466,12 @@ dl_open_worker (void *a)
/* We have to bump the generation counter. */
any_tls = true;
}
-#endif
}
-#if USE_TLS
/* Bump the generation number if necessary. */
if (any_tls && __builtin_expect (++GL(dl_tls_generation) == 0, 0))
_dl_fatal_printf (N_("\
TLS generation counter wrapped! Please report this."));
-#endif
/* Run the initializer functions of new objects. */
_dl_init (new, args->argc, args->argv, args->env);
@@ -572,20 +561,13 @@ no more namespaces available for dlmopen()"));
_dl_unload_cache ();
#endif
- /* Release the lock. */
- __rtld_lock_unlock_recursive (GL(dl_load_lock));
-
+ /* See if an error occurred during loading. */
if (__builtin_expect (errstring != NULL, 0))
{
- /* Some error occurred during loading. */
- char *local_errstring;
- size_t len_errstring;
-
/* Remove the object from memory. It may be in an inconsistent
state if relocation failed, for example. */
if (args.map)
{
-#ifdef USE_TLS
/* Maybe some of the modules which were loaded use TLS.
Since it will be removed in the following _dl_close call
we have to mark the dtv array as having gaps to fill the
@@ -595,14 +577,19 @@ no more namespaces available for dlmopen()"));
up. */
if ((mode & __RTLD_AUDIT) == 0)
GL(dl_tls_dtv_gaps) = true;
-#endif
- _dl_close (args.map);
+ _dl_close_worker (args.map);
}
+ assert (_dl_debug_initialize (0, args.nsid)->r_state == RT_CONSISTENT);
+
+ /* Release the lock. */
+ __rtld_lock_unlock_recursive (GL(dl_load_lock));
+
/* Make a local copy of the error string so that we can release the
memory allocated for it. */
- len_errstring = strlen (errstring) + 1;
+ size_t len_errstring = strlen (errstring) + 1;
+ char *local_errstring;
if (objname == errstring + len_errstring)
{
size_t total_len = len_errstring + strlen (objname) + 1;
@@ -619,14 +606,15 @@ no more namespaces available for dlmopen()"));
if (malloced)
free ((char *) errstring);
- assert (_dl_debug_initialize (0, args.nsid)->r_state == RT_CONSISTENT);
-
/* Reraise the error. */
_dl_signal_error (errcode, objname, NULL, local_errstring);
}
assert (_dl_debug_initialize (0, args.nsid)->r_state == RT_CONSISTENT);
+ /* Release the lock. */
+ __rtld_lock_unlock_recursive (GL(dl_load_lock));
+
#ifndef SHARED
DL_STATIC_INIT (args.map);
#endif
diff --git a/libc/elf/dl-reloc.c b/libc/elf/dl-reloc.c
index 6b232d653..61714695a 100644
--- a/libc/elf/dl-reloc.c
+++ b/libc/elf/dl-reloc.c
@@ -1,5 +1,5 @@
/* Relocate a shared object and resolve its references to other loaded objects.
- Copyright (C) 1995-2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1995-2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -35,7 +35,6 @@
#endif
-#ifdef USE_TLS
/* We are trying to perform a static TLS relocation in MAP, but it was
dynamically loaded. This can only work if there is enough surplus in
the static TLS area already allocated for each running thread. If this
@@ -56,7 +55,7 @@ _dl_allocate_static_tls (struct link_map *map)
cannot allocate memory in static TLS block"));
}
-# if TLS_TCB_AT_TP
+#if TLS_TCB_AT_TP
size_t freebytes;
size_t n;
size_t blsize;
@@ -73,7 +72,7 @@ cannot allocate memory in static TLS block"));
- map->l_tls_firstbyte_offset);
map->l_tls_offset = GL(dl_tls_static_used) = offset;
-# elif TLS_DTV_AT_TP
+#elif TLS_DTV_AT_TP
size_t used;
size_t check;
@@ -87,9 +86,9 @@ cannot allocate memory in static TLS block"));
map->l_tls_offset = offset;
GL(dl_tls_static_used) = used;
-# else
-# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
-# endif
+#else
+# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
+#endif
/* If the object is not yet relocated we cannot initialize the
static TLS region. Delay it. */
@@ -115,13 +114,13 @@ cannot allocate memory in static TLS block"));
void
_dl_nothread_init_static_tls (struct link_map *map)
{
-# if TLS_TCB_AT_TP
+#if TLS_TCB_AT_TP
void *dest = (char *) THREAD_SELF - map->l_tls_offset;
-# elif TLS_DTV_AT_TP
+#elif TLS_DTV_AT_TP
void *dest = (char *) THREAD_SELF + map->l_tls_offset + TLS_PRE_TCB_SIZE;
-# else
-# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
-# endif
+#else
+# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
+#endif
/* Fill in the DTV slot so that a later LD/GD access will find it. */
dtv_t *dtv = THREAD_DTV ();
@@ -133,7 +132,6 @@ _dl_nothread_init_static_tls (struct link_map *map)
memset (__mempcpy (dest, map->l_tls_initimage, map->l_tls_initimage_size),
'\0', map->l_tls_blocksize - map->l_tls_initimage_size);
}
-#endif
void
diff --git a/libc/elf/dl-runtime.c b/libc/elf/dl-runtime.c
index 05fd974bf..afc99f615 100644
--- a/libc/elf/dl-runtime.c
+++ b/libc/elf/dl-runtime.c
@@ -24,6 +24,7 @@
#include <unistd.h>
#include <sys/param.h>
#include <ldsodefs.h>
+#include <sysdep-cancel.h>
#include "dynamic-link.h"
#if (!defined ELF_MACHINE_NO_RELA && !defined ELF_MACHINE_PLT_REL) \
@@ -92,29 +93,15 @@ _dl_fixup (
version = NULL;
}
- struct r_scoperec *scoperec = l->l_scoperec;
- if (l->l_type == lt_loaded)
- {
- __rtld_mrlock_lock (l->l_scoperec_lock);
- scoperec = l->l_scoperec;
- catomic_increment (&scoperec->nusers);
- __rtld_mrlock_unlock (l->l_scoperec_lock);
- }
+ if (l->l_type == lt_loaded && !RTLD_SINGLE_THREAD_P)
+ __rtld_mrlock_lock (l->l_scope_lock);
result = _dl_lookup_symbol_x (strtab + sym->st_name, l, &sym,
- scoperec->scope, version,
- ELF_RTYPE_CLASS_PLT,
+ l->l_scope, version, ELF_RTYPE_CLASS_PLT,
DL_LOOKUP_ADD_DEPENDENCY, NULL);
- if (l->l_type == lt_loaded
- && catomic_decrement_val (&scoperec->nusers) == 0
- && __builtin_expect (scoperec->remove_after_use, 0))
- {
- if (scoperec->notify)
- __rtld_notify (scoperec->nusers);
- else
- free (scoperec);
- }
+ if (l->l_type == lt_loaded && !RTLD_SINGLE_THREAD_P)
+ __rtld_mrlock_unlock (l->l_scope_lock);
/* Currently result contains the base load address (or link map)
of the object that defines sym. Now add in the symbol
@@ -194,29 +181,16 @@ _dl_profile_fixup (
version = NULL;
}
- struct r_scoperec *scoperec = l->l_scoperec;
- if (l->l_type == lt_loaded)
- {
- __rtld_mrlock_lock (l->l_scoperec_lock);
- scoperec = l->l_scoperec;
- catomic_increment (&scoperec->nusers);
- __rtld_mrlock_unlock (l->l_scoperec_lock);
- }
+ if (l->l_type == lt_loaded && !RTLD_SINGLE_THREAD_P)
+ __rtld_mrlock_lock (l->l_scope_lock);
result = _dl_lookup_symbol_x (strtab + refsym->st_name, l, &defsym,
- scoperec->scope, version,
+ l->l_scope, version,
ELF_RTYPE_CLASS_PLT,
DL_LOOKUP_ADD_DEPENDENCY, NULL);
- if (l->l_type == lt_loaded
- && catomic_decrement_val (&scoperec->nusers) == 0
- && __builtin_expect (scoperec->remove_after_use, 0))
- {
- if (scoperec->notify)
- __rtld_notify (scoperec->nusers);
- else
- free (scoperec);
- }
+ if (l->l_type == lt_loaded && !RTLD_SINGLE_THREAD_P)
+ __rtld_mrlock_unlock (l->l_scope_lock);
/* Currently result contains the base load address (or link map)
of the object that defines sym. Now add in the symbol
diff --git a/libc/elf/dl-support.c b/libc/elf/dl-support.c
index c3b6350ed..fe8c68c9e 100644
--- a/libc/elf/dl-support.c
+++ b/libc/elf/dl-support.c
@@ -1,5 +1,5 @@
/* Support for dynamic linking code in static libc.
- Copyright (C) 1996-2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1996-2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -97,9 +97,7 @@ int _dl_starting_up = 1;
hp_timing_t _dl_cpuclock_offset;
#endif
-#ifdef USE_TLS
void (*_dl_init_static_tls) (struct link_map *) = &_dl_nothread_init_static_tls;
-#endif
size_t _dl_pagesize;
diff --git a/libc/elf/dl-sym.c b/libc/elf/dl-sym.c
index 43933466b..88a5adb0d 100644
--- a/libc/elf/dl-sym.c
+++ b/libc/elf/dl-sym.c
@@ -25,12 +25,11 @@
#include <dlfcn.h>
#include <ldsodefs.h>
#include <dl-hash.h>
-#ifdef USE_TLS
-# include <dl-tls.h>
-#endif
+#include <sysdep-cancel.h>
+#include <dl-tls.h>
-#if defined USE_TLS && defined SHARED
+#ifdef SHARED
/* Systems which do not have tls_index also probably have to define
DONT_USE_TLS_INDEX. */
@@ -64,7 +63,6 @@ struct call_dl_lookup_args
/* Arguments to do_dlsym. */
struct link_map *map;
const char *name;
- struct r_scope_elem **scope;
struct r_found_version *vers;
int flags;
@@ -78,7 +76,7 @@ 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->scope, args->vers, 0,
+ args->map->l_scope, args->vers, 0,
args->flags, NULL);
}
@@ -115,22 +113,18 @@ do_sym (void *handle, const char *name, void *who,
the initial binary. And then the more complex part
where the object is dynamically loaded and the scope
array can change. */
- if (match->l_type != lt_loaded)
+ if (match->l_type != lt_loaded || RTLD_SINGLE_THREAD_P)
result = GLRO(dl_lookup_symbol_x) (name, match, &ref,
- match->l_scoperec->scope, vers, 0,
+ match->l_scope, vers, 0,
flags | DL_LOOKUP_ADD_DEPENDENCY,
NULL);
else
{
- __rtld_mrlock_lock (match->l_scoperec_lock);
- struct r_scoperec *scoperec = match->l_scoperec;
- catomic_increment (&scoperec->nusers);
- __rtld_mrlock_unlock (match->l_scoperec_lock);
+ __rtld_mrlock_lock (match->l_scope_lock);
struct call_dl_lookup_args args;
args.name = name;
args.map = match;
- args.scope = scoperec->scope;
args.vers = vers;
args.flags = flags | DL_LOOKUP_ADD_DEPENDENCY;
args.refp = &ref;
@@ -141,14 +135,7 @@ do_sym (void *handle, const char *name, void *who,
int err = GLRO(dl_catch_error) (&objname, &errstring, &malloced,
call_dl_lookup, &args);
- if (catomic_decrement_val (&scoperec->nusers) == 0
- && __builtin_expect (scoperec->remove_after_use, 0))
- {
- if (scoperec->notify)
- __rtld_notify (scoperec->nusers);
- else
- free (scoperec);
- }
+ __rtld_mrlock_unlock (match->l_scope_lock);
if (__builtin_expect (errstring != NULL, 0))
{
@@ -195,7 +182,7 @@ RTLD_NEXT used in code not dynamically loaded"));
{
void *value;
-#if defined USE_TLS && defined SHARED
+#ifdef SHARED
if (ELFW(ST_TYPE) (ref->st_info) == STT_TLS)
/* The found symbol is a thread-local storage variable.
Return the address for to the current thread. */
diff --git a/libc/elf/dl-sysdep.c b/libc/elf/dl-sysdep.c
index 985e2b8f7..d06ce1754 100644
--- a/libc/elf/dl-sysdep.c
+++ b/libc/elf/dl-sysdep.c
@@ -1,5 +1,5 @@
/* Operating system support for run-time dynamic linker. Generic Unix version.
- Copyright (C) 1995-1998, 2000-2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1995-1998, 2000-2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -405,25 +405,8 @@ _dl_important_hwcaps (const char *platform, size_t platform_len, size_t *sz,
}
#endif
-#ifdef USE_TLS
/* For TLS enabled builds always add 'tls'. */
++cnt;
-#else
- if (cnt == 0)
- {
- /* If we no have platform name and no important capability we only
- have the base directory to search. */
- result = (struct r_strlenpair *) malloc (sizeof (*result));
- if (result == NULL)
- goto no_memory;
-
- result[0].str = (char *) result; /* Does not really matter. */
- result[0].len = 0;
-
- *sz = 1;
- return result;
- }
-#endif
/* Create temporary data structure to generate result table. */
temp = (struct r_strlenpair *) alloca (cnt * sizeof (*temp));
@@ -465,11 +448,11 @@ _dl_important_hwcaps (const char *platform, size_t platform_len, size_t *sz,
temp[m].len = platform_len;
++m;
}
-#ifdef USE_TLS
+
temp[m].str = "tls";
temp[m].len = 3;
++m;
-#endif
+
assert (m == cnt);
/* Determine the total size of all strings together. */
@@ -487,13 +470,8 @@ _dl_important_hwcaps (const char *platform, size_t platform_len, size_t *sz,
*sz = 1 << cnt;
result = (struct r_strlenpair *) malloc (*sz * sizeof (*result) + total);
if (result == NULL)
- {
-#ifndef USE_TLS
- no_memory:
-#endif
- _dl_signal_error (ENOMEM, NULL, NULL,
- N_("cannot create capability list"));
- }
+ _dl_signal_error (ENOMEM, NULL, NULL,
+ N_("cannot create capability list"));
if (cnt == 1)
{
diff --git a/libc/elf/dl-tls.c b/libc/elf/dl-tls.c
index a0f4f77ff..d5865ab40 100644
--- a/libc/elf/dl-tls.c
+++ b/libc/elf/dl-tls.c
@@ -26,30 +26,26 @@
#include <sys/param.h>
#include <tls.h>
-
-/* We don't need any of this if TLS is not supported. */
-#ifdef USE_TLS
-
-# include <dl-tls.h>
-# include <ldsodefs.h>
+#include <dl-tls.h>
+#include <ldsodefs.h>
/* Amount of excess space to allocate in the static TLS area
to allow dynamic loading of modules defining IE-model TLS data. */
-# define TLS_STATIC_SURPLUS 64 + DL_NNS * 100
+#define TLS_STATIC_SURPLUS 64 + DL_NNS * 100
/* Value used for dtv entries for which the allocation is delayed. */
-# define TLS_DTV_UNALLOCATED ((void *) -1l)
+#define TLS_DTV_UNALLOCATED ((void *) -1l)
/* Out-of-memory handler. */
-# ifdef SHARED
+#ifdef SHARED
static void
__attribute__ ((__noreturn__))
oom (void)
{
_dl_fatal_printf ("cannot allocate memory for thread-local data: ABORT\n");
}
-# endif
+#endif
size_t
@@ -113,7 +109,7 @@ _dl_next_tls_modid (void)
}
-# ifdef SHARED
+#ifdef SHARED
void
internal_function
_dl_determine_tlsoffset (void)
@@ -158,7 +154,7 @@ _dl_determine_tlsoffset (void)
memory requirement for the next TLS block is smaller than the
gap. */
-# if TLS_TCB_AT_TP
+#if TLS_TCB_AT_TP
/* We simply start with zero. */
size_t offset = 0;
@@ -205,7 +201,7 @@ _dl_determine_tlsoffset (void)
GL(dl_tls_static_used) = offset;
GL(dl_tls_static_size) = (roundup (offset + TLS_STATIC_SURPLUS, max_align)
+ TLS_TCB_SIZE);
-# elif TLS_DTV_AT_TP
+#elif TLS_DTV_AT_TP
/* The TLS blocks start right after the TCB. */
size_t offset = TLS_TCB_SIZE;
@@ -249,9 +245,9 @@ _dl_determine_tlsoffset (void)
GL(dl_tls_static_used) = offset;
GL(dl_tls_static_size) = roundup (offset + TLS_STATIC_SURPLUS,
TLS_TCB_ALIGN);
-# else
-# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
-# endif
+#else
+# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
+#endif
/* The alignment requirement for the static TLS block. */
GL(dl_tls_static_align) = max_align;
@@ -288,7 +284,7 @@ _dl_tls_setup (void)
return 0;
}
rtld_hidden_def (_dl_tls_setup)
-# endif
+#endif
static void *
internal_function
@@ -337,13 +333,13 @@ _dl_allocate_tls_storage (void)
void *result;
size_t size = GL(dl_tls_static_size);
-# if TLS_DTV_AT_TP
+#if TLS_DTV_AT_TP
/* Memory layout is:
[ TLS_PRE_TCB_SIZE ] [ TLS_TCB_SIZE ] [ TLS blocks ]
^ This should be returned. */
size += (TLS_PRE_TCB_SIZE + GL(dl_tls_static_align) - 1)
& ~(GL(dl_tls_static_align) - 1);
-# endif
+#endif
/* Allocate a correctly aligned chunk of memory. */
result = __libc_memalign (GL(dl_tls_static_align), size);
@@ -352,14 +348,14 @@ _dl_allocate_tls_storage (void)
/* Allocate the DTV. */
void *allocated = result;
-# if TLS_TCB_AT_TP
+#if TLS_TCB_AT_TP
/* The TCB follows the TLS blocks. */
result = (char *) result + size - TLS_TCB_SIZE;
/* Clear the TCB data structure. We can't ask the caller (i.e.
libpthread) to do it, because we will initialize the DTV et al. */
memset (result, '\0', TLS_TCB_SIZE);
-# elif TLS_DTV_AT_TP
+#elif TLS_DTV_AT_TP
result = (char *) result + size - GL(dl_tls_static_size);
/* Clear the TCB data structure and TLS_PRE_TCB_SIZE bytes before it.
@@ -367,7 +363,7 @@ _dl_allocate_tls_storage (void)
initialize the DTV et al. */
memset ((char *) result - TLS_PRE_TCB_SIZE, '\0',
TLS_PRE_TCB_SIZE + TLS_TCB_SIZE);
-# endif
+#endif
result = allocate_dtv (result);
if (result == NULL)
@@ -428,14 +424,14 @@ _dl_allocate_tls_init (void *result)
assert (map->l_tls_modid == cnt);
assert (map->l_tls_blocksize >= map->l_tls_initimage_size);
-# if TLS_TCB_AT_TP
+#if TLS_TCB_AT_TP
assert ((size_t) map->l_tls_offset >= map->l_tls_blocksize);
dest = (char *) result - map->l_tls_offset;
-# elif TLS_DTV_AT_TP
+#elif TLS_DTV_AT_TP
dest = (char *) result + map->l_tls_offset;
-# else
-# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
-# endif
+#else
+# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
+#endif
/* Copy the initialization image and clear the BSS part. */
dtv[map->l_tls_modid].pointer.val = dest;
@@ -491,21 +487,21 @@ _dl_deallocate_tls (void *tcb, bool dealloc_tcb)
if (dealloc_tcb)
{
-# if TLS_TCB_AT_TP
+#if TLS_TCB_AT_TP
/* The TCB follows the TLS blocks. Back up to free the whole block. */
tcb -= GL(dl_tls_static_size) - TLS_TCB_SIZE;
-# elif TLS_DTV_AT_TP
+#elif TLS_DTV_AT_TP
/* Back up the TLS_PRE_TCB_SIZE bytes. */
tcb -= (TLS_PRE_TCB_SIZE + GL(dl_tls_static_align) - 1)
& ~(GL(dl_tls_static_align) - 1);
-# endif
+#endif
free (tcb);
}
}
rtld_hidden_def (_dl_deallocate_tls)
-# ifdef SHARED
+#ifdef SHARED
/* The __tls_get_addr function has two basic forms which differ in the
arguments. The IA-64 form takes two parameters, the module ID and
offset. The form used, among others, on IA-32 takes a reference to
@@ -513,15 +509,15 @@ rtld_hidden_def (_dl_deallocate_tls)
form seems to be more often used (in the moment) so we default to
it. Users of the IA-64 form have to provide adequate definitions
of the following macros. */
-# ifndef GET_ADDR_ARGS
-# define GET_ADDR_ARGS tls_index *ti
-# endif
-# ifndef GET_ADDR_MODULE
-# define GET_ADDR_MODULE ti->ti_module
-# endif
-# ifndef GET_ADDR_OFFSET
-# define GET_ADDR_OFFSET ti->ti_offset
-# endif
+# ifndef GET_ADDR_ARGS
+# define GET_ADDR_ARGS tls_index *ti
+# endif
+# ifndef GET_ADDR_MODULE
+# define GET_ADDR_MODULE ti->ti_module
+# endif
+# ifndef GET_ADDR_OFFSET
+# define GET_ADDR_OFFSET ti->ti_offset
+# endif
static void *
@@ -732,7 +728,7 @@ __tls_get_addr (GET_ADDR_ARGS)
return (char *) p + GET_ADDR_OFFSET;
}
-# endif
+#endif
/* Look up the module's TLS block as for __tls_get_addr,
@@ -840,4 +836,3 @@ cannot create TLS data structures"));
listp->slotinfo[idx].map = l;
listp->slotinfo[idx].gen = GL(dl_tls_generation) + 1;
}
-#endif /* use TLS */
diff --git a/libc/elf/ldconfig.c b/libc/elf/ldconfig.c
index 5b9a5b174..b14696d49 100644
--- a/libc/elf/ldconfig.c
+++ b/libc/elf/ldconfig.c
@@ -1185,9 +1185,7 @@ main (int argc, char **argv)
add_dir (argv[i]);
}
-#ifdef USE_TLS
hwcap_extra[63 - _DL_FIRST_EXTRA] = "tls";
-#endif
set_hwcap ();
diff --git a/libc/elf/rtld.c b/libc/elf/rtld.c
index ace3a3099..5e6ee5160 100644
--- a/libc/elf/rtld.c
+++ b/libc/elf/rtld.c
@@ -1,5 +1,5 @@
/* Run time dynamic linker.
- Copyright (C) 1995-2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+ Copyright (C) 1995-2002,2003,2004,2005,2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -207,8 +207,7 @@ DL_SYSINFO_IMPLEMENTATION
is fine, too. The latter is important here. We can avoid setting
up a temporary link map for ld.so if we can mark _rtld_global as
hidden. */
-#if defined PI_STATIC_AND_HIDDEN && defined HAVE_HIDDEN \
- && defined HAVE_VISIBILITY_ATTRIBUTE
+#ifdef PI_STATIC_AND_HIDDEN
# define DONT_USE_BOOTSTRAP_MAP 1
#endif
@@ -292,7 +291,7 @@ _dl_start_final (void *arg, struct dl_start_final_info *info)
GL(dl_rtld_map).l_map_end = (ElfW(Addr)) _end;
GL(dl_rtld_map).l_text_end = (ElfW(Addr)) _etext;
/* Copy the TLS related data if necessary. */
-#if USE_TLS && !defined DONT_USE_BOOTSTRAP_MAP
+#ifndef DONT_USE_BOOTSTRAP_MAP
# if USE___THREAD
assert (info->l.l_tls_modid != 0);
GL(dl_rtld_map).l_tls_blocksize = info->l.l_tls_blocksize;
@@ -400,7 +399,7 @@ _dl_start (void *arg)
bootstrap_map.l_ld = (void *) bootstrap_map.l_addr + elf_machine_dynamic ();
elf_get_dynamic_info (&bootstrap_map, NULL);
-#if defined USE_TLS && NO_TLS_OFFSET != 0
+#if NO_TLS_OFFSET != 0
bootstrap_map.l_tls_offset = NO_TLS_OFFSET;
#endif
@@ -609,7 +608,7 @@ relocate_doit (void *a)
{
struct relocate_args *args = (struct relocate_args *) a;
- _dl_relocate_object (args->l, args->l->l_scoperec->scope, args->lazy, 0);
+ _dl_relocate_object (args->l, args->l->l_scope, args->lazy, 0);
}
static void
@@ -701,7 +700,6 @@ match_version (const char *string, struct link_map *map)
return 0;
}
-#ifdef USE_TLS
static bool tls_init_tp_called;
static void *
@@ -773,7 +771,6 @@ cannot allocate TLS data structures for initial thread");
return tcbp;
}
-#endif
#ifdef _LIBC_REENTRANT
/* _dl_error_catch_tsd points to this for the single-threaded case.
@@ -861,18 +858,14 @@ dl_main (const ElfW(Phdr) *phdr,
hp_timing_t stop;
hp_timing_t diff;
#endif
-#ifdef USE_TLS
void *tcbp = NULL;
-#endif
#ifdef _LIBC_REENTRANT
/* Explicit initialization since the reloc would just be more work. */
GL(dl_error_catch_tsd) = &_dl_initial_error_catch_tsd;
#endif
-#ifdef USE_TLS
GL(dl_init_static_tls) = &_dl_nothread_init_static_tls;
-#endif
#if defined SHARED && defined _LIBC_REENTRANT \
&& defined __rtld_lock_default_lock_recursive
@@ -1157,7 +1150,6 @@ of this helper program; chances are you did not intend to run this program.\n\
break;
case PT_TLS:
-#ifdef USE_TLS
if (ph->p_memsz > 0)
{
/* Note that in the case the dynamic linker we duplicate work
@@ -1177,10 +1169,6 @@ of this helper program; chances are you did not intend to run this program.\n\
/* This image gets the ID one. */
GL(dl_tls_max_dtv_idx) = main_map->l_tls_modid = 1;
}
-#else
- _dl_fatal_printf ("\
-ld.so does not support TLS, but program uses it!\n");
-#endif
break;
case PT_GNU_STACK:
@@ -1192,13 +1180,12 @@ ld.so does not support TLS, but program uses it!\n");
main_map->l_relro_size = ph->p_memsz;
break;
}
-#ifdef USE_TLS
- /* Adjust the address of the TLS initialization image in case
- the executable is actually an ET_DYN object. */
- if (main_map->l_tls_initimage != NULL)
- main_map->l_tls_initimage
- = (char *) main_map->l_tls_initimage + main_map->l_addr;
-#endif
+
+ /* Adjust the address of the TLS initialization image in case
+ the executable is actually an ET_DYN object. */
+ if (main_map->l_tls_initimage != NULL)
+ main_map->l_tls_initimage
+ = (char *) main_map->l_tls_initimage + main_map->l_addr;
if (! main_map->l_map_end)
main_map->l_map_end = ~0;
if (! main_map->l_text_end)
@@ -1401,12 +1388,10 @@ ld.so does not support TLS, but program uses it!\n");
break;
}
-#ifdef USE_TLS
/* Add the dynamic linker to the TLS list if it also uses TLS. */
if (GL(dl_rtld_map).l_tls_blocksize != 0)
/* Assign a module ID. Do this before loading any audit modules. */
GL(dl_rtld_map).l_tls_modid = _dl_next_tls_modid ();
-#endif
/* If we have auditing DSOs to load, do it now. */
if (__builtin_expect (audit_list != NULL, 0))
@@ -1416,7 +1401,6 @@ ld.so does not support TLS, but program uses it!\n");
struct audit_list *al = audit_list->next;
do
{
-#ifdef USE_TLS
int tls_idx = GL(dl_tls_max_dtv_idx);
/* Now it is time to determine the layout of the static TLS
@@ -1428,7 +1412,7 @@ ld.so does not support TLS, but program uses it!\n");
/* Since we start using the auditing DSOs right away we need to
initialize the data structures now. */
tcbp = init_tls ();
-#endif
+
struct dlmopen_args dlmargs;
dlmargs.fname = al->name;
dlmargs.map = NULL;
@@ -1543,9 +1527,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
assert (GL(dl_ns)[ns]._ns_loaded == NULL);
assert (GL(dl_ns)[ns]._ns_nloaded == 0);
-#ifdef USE_TLS
GL(dl_tls_max_dtv_idx) = tls_idx;
-#endif
goto not_loaded;
}
}
@@ -1821,7 +1803,6 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
_dl_receive_error (print_missing_version, version_check_doit, &args);
}
-#ifdef USE_TLS
/* We do not initialize any of the TLS functionality unless any of the
initial modules uses TLS. This makes dynamic loading of modules with
TLS impossible, but to support it requires either eagerly doing setup
@@ -1832,7 +1813,6 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
bool was_tls_init_tp_called = tls_init_tp_called;
if (tcbp == NULL)
tcbp = init_tls ();
-#endif
/* Set up the stack checker's canary. */
uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard ();
@@ -1889,13 +1869,12 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
(size_t) l->l_map_start,
(int) sizeof l->l_addr * 2,
(size_t) l->l_addr);
-#ifdef USE_TLS
+
if (l->l_tls_modid)
_dl_printf (" TLS(0x%Zx, 0x%0*Zx)\n", l->l_tls_modid,
(int) sizeof l->l_tls_offset * 2,
(size_t) l->l_tls_offset);
else
-#endif
_dl_printf ("\n");
}
}
@@ -1963,7 +1942,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
lookup_t result;
result = _dl_lookup_symbol_x (INTUSE(_dl_argv)[i], main_map,
- &ref, main_map->l_scoperec->scope,
+ &ref, main_map->l_scope,
NULL, ELF_RTYPE_CLASS_PLT,
DL_LOOKUP_ADD_DEPENDENCY, NULL);
@@ -2007,7 +1986,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
/* Mark the link map as not yet relocated again. */
GL(dl_rtld_map).l_relocated = 0;
_dl_relocate_object (&GL(dl_rtld_map),
- main_map->l_scoperec->scope, 0, 0);
+ main_map->l_scope, 0, 0);
}
}
#define VERNEEDTAG (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGIDX (DT_VERNEED))
@@ -2143,7 +2122,6 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
/* Now set up the variable which helps the assembler startup code. */
GL(dl_ns)[LM_ID_BASE]._ns_main_searchlist = &main_map->l_searchlist;
- GL(dl_ns)[LM_ID_BASE]._ns_global_scope[0] = &main_map->l_searchlist;
/* Save the information about the original global scope list since
we need it in the memory handling later. */
@@ -2179,11 +2157,9 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
if (l->l_relro_size)
_dl_protect_relro (l);
-#ifdef USE_TLS
/* Add object to slot information data if necessasy. */
if (l->l_tls_blocksize != 0 && tls_init_tp_called)
_dl_add_to_slotinfo (l);
-#endif
}
_dl_sysdep_start_cleanup ();
@@ -2227,14 +2203,12 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
}
if (l != &GL(dl_rtld_map))
- _dl_relocate_object (l, l->l_scoperec->scope, GLRO(dl_lazy),
+ _dl_relocate_object (l, l->l_scope, GLRO(dl_lazy),
consider_profiling);
-#ifdef USE_TLS
/* Add object to slot information data if necessasy. */
if (l->l_tls_blocksize != 0 && tls_init_tp_called)
_dl_add_to_slotinfo (l);
-#endif
l = l->l_prev;
}
@@ -2263,7 +2237,6 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
# define NONTLS_INIT_TP do { } while (0)
#endif
-#ifdef USE_TLS
if (!was_tls_init_tp_called && GL(dl_tls_max_dtv_idx) > 0)
++GL(dl_tls_generation);
@@ -2281,9 +2254,6 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
_dl_fatal_printf ("cannot set up thread-local storage: %s\n",
lossage);
}
-#else
- NONTLS_INIT_TP;
-#endif
if (! prelinked && rtld_multiple_ref)
{
@@ -2303,8 +2273,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
HP_TIMING_NOW (start);
/* Mark the link map as not yet relocated again. */
GL(dl_rtld_map).l_relocated = 0;
- _dl_relocate_object (&GL(dl_rtld_map), main_map->l_scoperec->scope,
- 0, 0);
+ _dl_relocate_object (&GL(dl_rtld_map), main_map->l_scope, 0, 0);
HP_TIMING_NOW (stop);
HP_TIMING_DIFF (add, start, stop);
HP_TIMING_ACCUM_NT (relocate_time, add);
diff --git a/libc/elf/tst-thrlock.c b/libc/elf/tst-thrlock.c
new file mode 100644
index 000000000..fe72eba14
--- /dev/null
+++ b/libc/elf/tst-thrlock.c
@@ -0,0 +1,59 @@
+#include <dlfcn.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <gnu/lib-names.h>
+
+static void *
+tf (void *arg)
+{
+ void *h = dlopen (LIBM_SO, RTLD_LAZY);
+ if (h == NULL)
+ {
+ printf ("dlopen failed: %s\n", dlerror ());
+ exit (1);
+ }
+ if (dlsym (h, "sin") == NULL)
+ {
+ printf ("dlsym failed: %s\n", dlerror ());
+ exit (1);
+ }
+ if (dlclose (h) != 0)
+ {
+ printf ("dlclose failed: %s\n", dlerror ());
+ exit (1);
+ }
+ return NULL;
+}
+
+
+static int
+do_test (void)
+{
+#define N 10
+ pthread_t th[N];
+ for (int i = 0; i < N; ++i)
+ {
+ int e = pthread_create (&th[i], NULL, tf, NULL);
+ if (e != 0)
+ {
+ printf ("pthread_create failed with %d (%s)\n", e, strerror (e));
+ return 1;
+ }
+ }
+ for (int i = 0; i < N; ++i)
+ {
+ void *res;
+ int e = pthread_join (th[i], &res);
+ if (e != 0 || res != NULL)
+ {
+ puts ("thread failed");
+ return 1;
+ }
+ }
+ return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/libc/elf/tst-tls-dlinfo.c b/libc/elf/tst-tls-dlinfo.c
index e97b5081f..26c281117 100644
--- a/libc/elf/tst-tls-dlinfo.c
+++ b/libc/elf/tst-tls-dlinfo.c
@@ -9,7 +9,6 @@
static int
do_test (void)
{
-#ifdef USE_TLS
static const char modname[] = "tst-tlsmod2.so";
int result = 0;
int *foop;
@@ -83,9 +82,6 @@ do_test (void)
dlclose (h);
return result;
-#else
- return 0;
-#endif
}
diff --git a/libc/elf/tst-tls1.c b/libc/elf/tst-tls1.c
index 478f5bbdc..3b9b10f9a 100644
--- a/libc/elf/tst-tls1.c
+++ b/libc/elf/tst-tls1.c
@@ -3,21 +3,18 @@
#include <tls.h>
-#ifdef USE_TLS
-# include "tls-macros.h"
+#include "tls-macros.h"
/* Two common 'int' variables in TLS. */
COMMON_INT_DEF(foo);
COMMON_INT_DEF(bar);
-#endif
#define TEST_FUNCTION do_test ()
static int
do_test (void)
{
-#ifdef USE_TLS
int result = 0;
int *ap, *bp;
@@ -82,9 +79,6 @@ do_test (void)
}
return result;
-#else
- return 0;
-#endif
}
diff --git a/libc/elf/tst-tls10.h b/libc/elf/tst-tls10.h
index 1be6adc29..bffc332a0 100644
--- a/libc/elf/tst-tls10.h
+++ b/libc/elf/tst-tls10.h
@@ -1,8 +1,7 @@
#include <tls.h>
#include <stdlib.h>
-#if defined USE_TLS && defined HAVE___THREAD \
- && defined HAVE_TLS_MODEL_ATTRIBUTE
+#if defined HAVE___THREAD && defined HAVE_TLS_MODEL_ATTRIBUTE
# define USE_TLS__THREAD
struct A
diff --git a/libc/elf/tst-tls14.c b/libc/elf/tst-tls14.c
index 428fd5293..c1e6ba7e2 100644
--- a/libc/elf/tst-tls14.c
+++ b/libc/elf/tst-tls14.c
@@ -6,9 +6,9 @@
#include <tls.h>
-#if USE_TLS && HAVE___THREAD
+#if HAVE___THREAD
-#define AL 4096
+# define AL 4096
struct foo
{
int i;
@@ -55,11 +55,11 @@ do_test (void)
return result;
}
-#define TEST_FUNCTION do_test ()
+# define TEST_FUNCTION do_test ()
#else
-#define TEST_FUNCTION 0
+# define TEST_FUNCTION 0
#endif
diff --git a/libc/elf/tst-tls2.c b/libc/elf/tst-tls2.c
index 417489968..3d13272c0 100644
--- a/libc/elf/tst-tls2.c
+++ b/libc/elf/tst-tls2.c
@@ -3,21 +3,18 @@
#include <tls.h>
-#ifdef USE_TLS
-# include "tls-macros.h"
+#include "tls-macros.h"
/* Two 'int' variables in TLS. */
VAR_INT_DEF(foo);
VAR_INT_DEF(bar);
-#endif
#define TEST_FUNCTION do_test ()
static int
do_test (void)
{
-#ifdef USE_TLS
int result = 0;
int *ap, *bp;
@@ -82,9 +79,6 @@ do_test (void)
}
return result;
-#else
- return 0;
-#endif
}
diff --git a/libc/elf/tst-tls3.c b/libc/elf/tst-tls3.c
index 84be43575..c5e501eb4 100644
--- a/libc/elf/tst-tls3.c
+++ b/libc/elf/tst-tls3.c
@@ -3,15 +3,13 @@
#include <tls.h>
-#ifdef USE_TLS
-# include "tls-macros.h"
+#include "tls-macros.h"
/* One define int variable, two externs. */
COMMON_INT_DECL(foo);
VAR_INT_DECL(bar);
VAR_INT_DEF(baz);
-#endif
extern int in_dso (void);
@@ -21,7 +19,6 @@ extern int in_dso (void);
static int
do_test (void)
{
-#ifdef USE_TLS
int result = 0;
int *ap, *bp, *cp;
@@ -67,9 +64,6 @@ do_test (void)
result |= in_dso ();
return result;
-#else
- return 0;
-#endif
}
diff --git a/libc/elf/tst-tls4.c b/libc/elf/tst-tls4.c
index f92ee53ce..4ae33db24 100644
--- a/libc/elf/tst-tls4.c
+++ b/libc/elf/tst-tls4.c
@@ -9,7 +9,6 @@
static int
do_test (void)
{
-#ifdef USE_TLS
static const char modname[] = "tst-tlsmod2.so";
int result = 0;
int *foop;
@@ -47,9 +46,6 @@ do_test (void)
dlclose (h);
return result;
-#else
- return 0;
-#endif
}
diff --git a/libc/elf/tst-tls5.c b/libc/elf/tst-tls5.c
index a571d2cd3..27b18294f 100644
--- a/libc/elf/tst-tls5.c
+++ b/libc/elf/tst-tls5.c
@@ -9,7 +9,6 @@
static int
do_test (void)
{
-#ifdef USE_TLS
static const char modname[] = "tst-tlsmod2.so";
int result = 0;
int *foop;
@@ -63,9 +62,6 @@ do_test (void)
dlclose (h);
return result;
-#else
- return 0;
-#endif
}
diff --git a/libc/elf/tst-tls6.c b/libc/elf/tst-tls6.c
index 68d706538..021622d9c 100644
--- a/libc/elf/tst-tls6.c
+++ b/libc/elf/tst-tls6.c
@@ -10,7 +10,6 @@
static int
do_test (void)
{
-#ifdef USE_TLS
static const char modname[] = "tst-tlsmod2.so";
int result = 0;
int *foop;
@@ -81,9 +80,6 @@ do_test (void)
}
return result;
-#else
- return 0;
-#endif
}
diff --git a/libc/elf/tst-tls7.c b/libc/elf/tst-tls7.c
index 37f1a63e1..1edc2b635 100644
--- a/libc/elf/tst-tls7.c
+++ b/libc/elf/tst-tls7.c
@@ -10,7 +10,6 @@
static int
do_test (void)
{
-#ifdef USE_TLS
static const char modname[] = "tst-tlsmod3.so";
int result = 0;
int (*fp) (void);
@@ -52,9 +51,6 @@ do_test (void)
}
return result;
-#else
- return 0;
-#endif
}
diff --git a/libc/elf/tst-tls8.c b/libc/elf/tst-tls8.c
index ccc4e9f6f..36b1baca6 100644
--- a/libc/elf/tst-tls8.c
+++ b/libc/elf/tst-tls8.c
@@ -10,7 +10,6 @@
static int
do_test (void)
{
-#ifdef USE_TLS
static const char modname1[] = "$ORIGIN/tst-tlsmod3.so";
static const char modname2[] = "$ORIGIN/tst-tlsmod4.so";
int result = 0;
@@ -165,9 +164,6 @@ do_test (void)
}
return result;
-#else
- return 0;
-#endif
}
diff --git a/libc/elf/tst-tls9.c b/libc/elf/tst-tls9.c
index e317696df..12078518f 100644
--- a/libc/elf/tst-tls9.c
+++ b/libc/elf/tst-tls9.c
@@ -9,7 +9,6 @@
static int
do_test (void)
{
-#ifdef USE_TLS
static const char modname1[] = "tst-tlsmod5.so";
static const char modname2[] = "tst-tlsmod6.so";
int result = 0;
@@ -33,9 +32,6 @@ do_test (void)
dlclose (h2);
return result;
-#else
- return 0;
-#endif
}
diff --git a/libc/elf/tst-tlsmod1.c b/libc/elf/tst-tlsmod1.c
index c74a617b7..4d966c947 100644
--- a/libc/elf/tst-tlsmod1.c
+++ b/libc/elf/tst-tlsmod1.c
@@ -2,7 +2,6 @@
#include <tls.h>
-#ifdef USE_TLS
#include "tls-macros.h"
@@ -10,7 +9,6 @@
COMMON_INT_DEF(foo);
VAR_INT_DEF(bar);
VAR_INT_DECL(baz);
-#endif
extern int in_dso (void);
@@ -18,7 +16,6 @@ int
in_dso (void)
{
int result = 0;
-#ifdef USE_TLS
int *ap, *bp, *cp;
/* Get variables using initial exec model. */
@@ -62,7 +59,6 @@ in_dso (void)
printf ("baz = %d\n", *cp);
result = 1;
}
-#endif
return result;
}
diff --git a/libc/elf/tst-tlsmod13.c b/libc/elf/tst-tlsmod13.c
index beca89f6f..e4e23af2d 100644
--- a/libc/elf/tst-tlsmod13.c
+++ b/libc/elf/tst-tlsmod13.c
@@ -1,7 +1,6 @@
#include <tls.h>
-#if defined USE_TLS && defined HAVE___THREAD \
- && defined HAVE_TLS_MODEL_ATTRIBUTE
+#if defined HAVE___THREAD && defined HAVE_TLS_MODEL_ATTRIBUTE
__thread int a[2] __attribute__ ((tls_model ("initial-exec")));
#else
int a[2];
diff --git a/libc/elf/tst-tlsmod13a.c b/libc/elf/tst-tlsmod13a.c
index 14b12b032..70a02131e 100644
--- a/libc/elf/tst-tlsmod13a.c
+++ b/libc/elf/tst-tlsmod13a.c
@@ -1,7 +1,6 @@
#include <tls.h>
-#if defined USE_TLS && defined HAVE___THREAD \
- && defined HAVE_TLS_MODEL_ATTRIBUTE
+#if defined HAVE___THREAD && defined HAVE_TLS_MODEL_ATTRIBUTE
__thread int b[2] __attribute__ ((tls_model ("initial-exec")));
#else
int b[2];
diff --git a/libc/elf/tst-tlsmod14a.c b/libc/elf/tst-tlsmod14a.c
index 0bb393d9c..ad1d179aa 100644
--- a/libc/elf/tst-tlsmod14a.c
+++ b/libc/elf/tst-tlsmod14a.c
@@ -3,9 +3,9 @@
#include <tls.h>
-#if USE_TLS && HAVE___THREAD
+#if HAVE___THREAD
-#define AL 4096
+# define AL 4096
struct foo
{
int i;
@@ -15,9 +15,9 @@ static __thread struct foo f;
static struct foo g;
-#ifndef FCT
-# define FCT in_dso1
-#endif
+# ifndef FCT
+# define FCT in_dso1
+# endif
int
diff --git a/libc/elf/tst-tlsmod2.c b/libc/elf/tst-tlsmod2.c
index 98d9d3e51..981923313 100644
--- a/libc/elf/tst-tlsmod2.c
+++ b/libc/elf/tst-tlsmod2.c
@@ -2,7 +2,6 @@
#include <tls.h>
-#ifdef USE_TLS
#include "tls-macros.h"
@@ -35,4 +34,3 @@ in_dso (int n, int *caller_foop)
return result;
}
-#endif
diff --git a/libc/elf/tst-tlsmod3.c b/libc/elf/tst-tlsmod3.c
index 4a8aad659..5c456ee2d 100644
--- a/libc/elf/tst-tlsmod3.c
+++ b/libc/elf/tst-tlsmod3.c
@@ -2,8 +2,7 @@
#include <tls.h>
-#ifdef USE_TLS
-# include "tls-macros.h"
+#include "tls-macros.h"
extern int in_dso (int n, int *caller_foop);
@@ -38,4 +37,3 @@ in_dso2 (void)
return result;
}
-#endif
diff --git a/libc/elf/tst-tlsmod4.c b/libc/elf/tst-tlsmod4.c
index 5285e821b..dd9548661 100644
--- a/libc/elf/tst-tlsmod4.c
+++ b/libc/elf/tst-tlsmod4.c
@@ -2,8 +2,7 @@
#include <tls.h>
-#ifdef USE_TLS
-# include "tls-macros.h"
+#include "tls-macros.h"
COMMON_INT_DEF(baz);
@@ -35,4 +34,3 @@ in_dso (int n, int *caller_bazp)
return result;
}
-#endif
diff --git a/libc/elf/tst-tlsmod5.c b/libc/elf/tst-tlsmod5.c
index 2ec69e13b..00d3a9d92 100644
--- a/libc/elf/tst-tlsmod5.c
+++ b/libc/elf/tst-tlsmod5.c
@@ -1,7 +1,5 @@
#include <tls.h>
-#ifdef USE_TLS
#include "tls-macros.h"
COMMON_INT_DEF(foo);
-#endif
diff --git a/libc/elf/tst-tlsmod6.c b/libc/elf/tst-tlsmod6.c
index 0fda51b22..244d9ae48 100644
--- a/libc/elf/tst-tlsmod6.c
+++ b/libc/elf/tst-tlsmod6.c
@@ -1,7 +1,5 @@
#include <tls.h>
-#ifdef USE_TLS
#include "tls-macros.h"
COMMON_INT_DEF(bar);
-#endif
diff --git a/libc/include/atomic.h b/libc/include/atomic.h
index 340c6e6bf..ec1e9899f 100644
--- a/libc/include/atomic.h
+++ b/libc/include/atomic.h
@@ -39,7 +39,12 @@
Architectures must provide a few lowlevel macros (the compare
and exchange definitions). All others are optional. They
should only be provided if the architecture has specific
- support for the operation. */
+ support for the operation.
+
+ As <atomic.h> macros are usually heavily nested and often use local
+ variables to make sure side-effects are evaluated properly, use for
+ macro local variables a per-macro unique prefix. This file uses
+ __atgN_ prefix where N is different in each macro. */
#include <stdlib.h>
@@ -50,33 +55,33 @@
and following args. */
#define __atomic_val_bysize(pre, post, mem, ...) \
({ \
- __typeof (*mem) __result; \
+ __typeof (*mem) __atg1_result; \
if (sizeof (*mem) == 1) \
- __result = pre##_8_##post (mem, __VA_ARGS__); \
+ __atg1_result = pre##_8_##post (mem, __VA_ARGS__); \
else if (sizeof (*mem) == 2) \
- __result = pre##_16_##post (mem, __VA_ARGS__); \
+ __atg1_result = pre##_16_##post (mem, __VA_ARGS__); \
else if (sizeof (*mem) == 4) \
- __result = pre##_32_##post (mem, __VA_ARGS__); \
+ __atg1_result = pre##_32_##post (mem, __VA_ARGS__); \
else if (sizeof (*mem) == 8) \
- __result = pre##_64_##post (mem, __VA_ARGS__); \
+ __atg1_result = pre##_64_##post (mem, __VA_ARGS__); \
else \
abort (); \
- __result; \
+ __atg1_result; \
})
#define __atomic_bool_bysize(pre, post, mem, ...) \
({ \
- int __result; \
+ int __atg2_result; \
if (sizeof (*mem) == 1) \
- __result = pre##_8_##post (mem, __VA_ARGS__); \
+ __atg2_result = pre##_8_##post (mem, __VA_ARGS__); \
else if (sizeof (*mem) == 2) \
- __result = pre##_16_##post (mem, __VA_ARGS__); \
+ __atg2_result = pre##_16_##post (mem, __VA_ARGS__); \
else if (sizeof (*mem) == 4) \
- __result = pre##_32_##post (mem, __VA_ARGS__); \
+ __atg2_result = pre##_32_##post (mem, __VA_ARGS__); \
else if (sizeof (*mem) == 8) \
- __result = pre##_64_##post (mem, __VA_ARGS__); \
+ __atg2_result = pre##_64_##post (mem, __VA_ARGS__); \
else \
abort (); \
- __result; \
+ __atg2_result; \
})
@@ -124,8 +129,9 @@
# define atomic_compare_and_exchange_bool_acq(mem, newval, oldval) \
({ /* Cannot use __oldval here, because macros later in this file might \
call this macro with __oldval argument. */ \
- __typeof (oldval) __old = (oldval); \
- atomic_compare_and_exchange_val_acq (mem, newval, __old) != __old; \
+ __typeof (oldval) __atg3_old = (oldval); \
+ atomic_compare_and_exchange_val_acq (mem, newval, __atg3_old) \
+ != __atg3_old; \
})
# endif
#endif
@@ -140,8 +146,9 @@
# define catomic_compare_and_exchange_bool_acq(mem, newval, oldval) \
({ /* Cannot use __oldval here, because macros later in this file might \
call this macro with __oldval argument. */ \
- __typeof (oldval) __old = (oldval); \
- catomic_compare_and_exchange_val_acq (mem, newval, __old) != __old; \
+ __typeof (oldval) __atg4_old = (oldval); \
+ catomic_compare_and_exchange_val_acq (mem, newval, __atg4_old) \
+ != __atg4_old; \
})
# endif
#endif
@@ -162,18 +169,17 @@
/* Store NEWVALUE in *MEM and return the old value. */
#ifndef atomic_exchange_acq
# define atomic_exchange_acq(mem, newvalue) \
- ({ __typeof (*(mem)) __oldval; \
- __typeof (mem) __memp = (mem); \
- __typeof (*(mem)) __value = (newvalue); \
+ ({ __typeof (*(mem)) __atg5_oldval; \
+ __typeof (mem) __atg5_memp = (mem); \
+ __typeof (*(mem)) __atg5_value = (newvalue); \
\
do \
- __oldval = *__memp; \
- while (__builtin_expect (atomic_compare_and_exchange_bool_acq (__memp, \
- __value, \
- __oldval),\
- 0)); \
+ __atg5_oldval = *__atg5_memp; \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg5_memp, __atg5_value, \
+ __atg5_oldval), 0)); \
\
- __oldval; })
+ __atg5_oldval; })
#endif
#ifndef atomic_exchange_rel
@@ -184,54 +190,53 @@
/* Add VALUE to *MEM and return the old value of *MEM. */
#ifndef atomic_exchange_and_add
# define atomic_exchange_and_add(mem, value) \
- ({ __typeof (*(mem)) __oldval; \
- __typeof (mem) __memp = (mem); \
- __typeof (*(mem)) __value = (value); \
+ ({ __typeof (*(mem)) __atg6_oldval; \
+ __typeof (mem) __atg6_memp = (mem); \
+ __typeof (*(mem)) __atg6_value = (value); \
\
do \
- __oldval = *__memp; \
- while (__builtin_expect (atomic_compare_and_exchange_bool_acq (__memp, \
- __oldval \
- + __value,\
- __oldval),\
- 0)); \
+ __atg6_oldval = *__atg6_memp; \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg6_memp, \
+ __atg6_oldval \
+ + __atg6_value, \
+ __atg6_oldval), 0)); \
\
- __oldval; })
+ __atg6_oldval; })
#endif
#ifndef catomic_exchange_and_add
# define catomic_exchange_and_add(mem, value) \
- ({ __typeof (*(mem)) __oldv; \
- __typeof (mem) __memp = (mem); \
- __typeof (*(mem)) __value = (value); \
+ ({ __typeof (*(mem)) __atg7_oldv; \
+ __typeof (mem) __atg7_memp = (mem); \
+ __typeof (*(mem)) __atg7_value = (value); \
\
do \
- __oldv = *__memp; \
- while (__builtin_expect (catomic_compare_and_exchange_bool_acq (__memp, \
- __oldv \
- + __value,\
- __oldv), \
- 0)); \
+ __atg7_oldv = *__atg7_memp; \
+ while (__builtin_expect \
+ (catomic_compare_and_exchange_bool_acq (__atg7_memp, \
+ __atg7_oldv \
+ + __atg7_value, \
+ __atg7_oldv), 0)); \
\
- __oldv; })
+ __atg7_oldv; })
#endif
#ifndef atomic_max
# define atomic_max(mem, value) \
do { \
- __typeof (*(mem)) __oldval; \
- __typeof (mem) __memp = (mem); \
- __typeof (*(mem)) __value = (value); \
+ __typeof (*(mem)) __atg8_oldval; \
+ __typeof (mem) __atg8_memp = (mem); \
+ __typeof (*(mem)) __atg8_value = (value); \
do { \
- __oldval = *__memp; \
- if (__oldval >= __value) \
+ __atg8_oldval = *__atg8_memp; \
+ if (__atg8_oldval >= __atg8_value) \
break; \
- } while (__builtin_expect (atomic_compare_and_exchange_bool_acq (__memp, \
- __value, \
- __oldval),\
- 0)); \
+ } while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg8_memp, __atg8_value,\
+ __atg8_oldval), 0)); \
} while (0)
#endif
@@ -239,17 +244,17 @@
#ifndef catomic_max
# define catomic_max(mem, value) \
do { \
- __typeof (*(mem)) __oldv; \
- __typeof (mem) __memp = (mem); \
- __typeof (*(mem)) __value = (value); \
+ __typeof (*(mem)) __atg9_oldv; \
+ __typeof (mem) __atg9_memp = (mem); \
+ __typeof (*(mem)) __atg9_value = (value); \
do { \
- __oldv = *__memp; \
- if (__oldv >= __value) \
+ __atg9_oldv = *__atg9_memp; \
+ if (__atg9_oldv >= __atg9_value) \
break; \
- } while (__builtin_expect (catomic_compare_and_exchange_bool_acq (__memp, \
- __value,\
- __oldv),\
- 0)); \
+ } while (__builtin_expect \
+ (catomic_compare_and_exchange_bool_acq (__atg9_memp, \
+ __atg9_value, \
+ __atg9_oldv), 0)); \
} while (0)
#endif
@@ -257,17 +262,17 @@
#ifndef atomic_min
# define atomic_min(mem, value) \
do { \
- __typeof (*(mem)) __oldval; \
- __typeof (mem) __memp = (mem); \
- __typeof (*(mem)) __value = (value); \
+ __typeof (*(mem)) __atg10_oldval; \
+ __typeof (mem) __atg10_memp = (mem); \
+ __typeof (*(mem)) __atg10_value = (value); \
do { \
- __oldval = *__memp; \
- if (__oldval <= __value) \
+ __atg10_oldval = *__atg10_memp; \
+ if (__atg10_oldval <= __atg10_value) \
break; \
- } while (__builtin_expect (atomic_compare_and_exchange_bool_acq (__memp, \
- __value, \
- __oldval),\
- 0)); \
+ } while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg10_memp, \
+ __atg10_value, \
+ __atg10_oldval), 0)); \
} while (0)
#endif
@@ -340,35 +345,34 @@
/* Decrement *MEM if it is > 0, and return the old value. */
#ifndef atomic_decrement_if_positive
# define atomic_decrement_if_positive(mem) \
- ({ __typeof (*(mem)) __oldval; \
- __typeof (mem) __memp = (mem); \
+ ({ __typeof (*(mem)) __atg11_oldval; \
+ __typeof (mem) __atg11_memp = (mem); \
\
do \
{ \
- __oldval = *__memp; \
- if (__builtin_expect (__oldval <= 0, 0)) \
+ __atg11_oldval = *__atg11_memp; \
+ if (__builtin_expect (__atg11_oldval <= 0, 0)) \
break; \
} \
- while (__builtin_expect (atomic_compare_and_exchange_bool_acq (__memp, \
- __oldval \
- - 1, \
- __oldval),\
- 0));\
- __oldval; })
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg11_memp, \
+ __atg11_oldval - 1, \
+ __atg11_oldval), 0)); \
+ __atg11_oldval; })
#endif
#ifndef atomic_add_negative
# define atomic_add_negative(mem, value) \
- ({ __typeof (value) __aan_value = (value); \
- atomic_exchange_and_add (mem, __aan_value) < -__aan_value; })
+ ({ __typeof (value) __atg12_value = (value); \
+ atomic_exchange_and_add (mem, __atg12_value) < -__atg12_value; })
#endif
#ifndef atomic_add_zero
# define atomic_add_zero(mem, value) \
- ({ __typeof (value) __aaz_value = (value); \
- atomic_exchange_and_add (mem, __aaz_value) == -__aaz_value; })
+ ({ __typeof (value) __atg13_value = (value); \
+ atomic_exchange_and_add (mem, __atg13_value) == -__atg13_value; })
#endif
@@ -380,108 +384,102 @@
#ifndef atomic_bit_test_set
# define atomic_bit_test_set(mem, bit) \
- ({ __typeof (*(mem)) __oldval; \
- __typeof (mem) __memp = (mem); \
- __typeof (*(mem)) __mask = ((__typeof (*(mem))) 1 << (bit)); \
+ ({ __typeof (*(mem)) __atg14_old; \
+ __typeof (mem) __atg14_memp = (mem); \
+ __typeof (*(mem)) __atg14_mask = ((__typeof (*(mem))) 1 << (bit)); \
\
do \
- __oldval = (*__memp); \
- while (__builtin_expect (atomic_compare_and_exchange_bool_acq (__memp, \
- __oldval \
- | __mask, \
- __oldval),\
- 0)); \
+ __atg14_old = (*__atg14_memp); \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg14_memp, \
+ __atg14_old | __atg14_mask,\
+ __atg14_old), 0)); \
\
- __oldval & __mask; })
+ __atg14_old & __atg14_mask; })
#endif
/* Atomically *mem &= mask. */
#ifndef atomic_and
# define atomic_and(mem, mask) \
do { \
- __typeof (*(mem)) __oldval; \
- __typeof (mem) __memp = (mem); \
- __typeof (*(mem)) __mask = (mask); \
+ __typeof (*(mem)) __atg15_old; \
+ __typeof (mem) __atg15_memp = (mem); \
+ __typeof (*(mem)) __atg15_mask = (mask); \
\
do \
- __oldval = (*__memp); \
- while (__builtin_expect (atomic_compare_and_exchange_bool_acq (__memp, \
- __oldval \
- & __mask, \
- __oldval), \
- 0)); \
+ __atg15_old = (*__atg15_memp); \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg15_memp, \
+ __atg15_old & __atg15_mask, \
+ __atg15_old), 0)); \
} while (0)
#endif
/* Atomically *mem &= mask and return the old value of *mem. */
#ifndef atomic_and_val
# define atomic_and_val(mem, mask) \
- ({ __typeof (*(mem)) __oldval; \
- __typeof (mem) __memp = (mem); \
- __typeof (*(mem)) __mask = (mask); \
+ ({ __typeof (*(mem)) __atg16_old; \
+ __typeof (mem) __atg16_memp = (mem); \
+ __typeof (*(mem)) __atg16_mask = (mask); \
\
do \
- __oldval = (*__memp); \
- while (__builtin_expect (atomic_compare_and_exchange_bool_acq (__memp, \
- __oldval \
- & __mask, \
- __oldval),\
- 0)); \
+ __atg16_old = (*__atg16_memp); \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg16_memp, \
+ __atg16_old & __atg16_mask,\
+ __atg16_old), 0)); \
\
- __oldval; })
+ __atg16_old; })
#endif
/* Atomically *mem |= mask and return the old value of *mem. */
#ifndef atomic_or
# define atomic_or(mem, mask) \
do { \
- __typeof (*(mem)) __oldval; \
- __typeof (mem) __memp = (mem); \
- __typeof (*(mem)) __mask = (mask); \
+ __typeof (*(mem)) __atg17_old; \
+ __typeof (mem) __atg17_memp = (mem); \
+ __typeof (*(mem)) __atg17_mask = (mask); \
\
do \
- __oldval = (*__memp); \
- while (__builtin_expect (atomic_compare_and_exchange_bool_acq (__memp, \
- __oldval \
- | __mask, \
- __oldval), \
- 0)); \
+ __atg17_old = (*__atg17_memp); \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg17_memp, \
+ __atg17_old | __atg17_mask, \
+ __atg17_old), 0)); \
} while (0)
#endif
#ifndef catomic_or
# define catomic_or(mem, mask) \
do { \
- __typeof (*(mem)) __oldval; \
- __typeof (mem) __memp = (mem); \
- __typeof (*(mem)) __mask = (mask); \
+ __typeof (*(mem)) __atg18_old; \
+ __typeof (mem) __atg18_memp = (mem); \
+ __typeof (*(mem)) __atg18_mask = (mask); \
\
do \
- __oldval = (*__memp); \
- while (__builtin_expect (catomic_compare_and_exchange_bool_acq (__memp, \
- __oldval \
- | __mask, \
- __oldval),\
- 0)); \
+ __atg18_old = (*__atg18_memp); \
+ while (__builtin_expect \
+ (catomic_compare_and_exchange_bool_acq (__atg18_memp, \
+ __atg18_old | __atg18_mask,\
+ __atg18_old), 0)); \
} while (0)
#endif
/* Atomically *mem |= mask and return the old value of *mem. */
#ifndef atomic_or_val
# define atomic_or_val(mem, mask) \
- ({ __typeof (*(mem)) __oldval; \
- __typeof (mem) __memp = (mem); \
- __typeof (*(mem)) __mask = (mask); \
+ ({ __typeof (*(mem)) __atg19_old; \
+ __typeof (mem) __atg19_memp = (mem); \
+ __typeof (*(mem)) __atg19_mask = (mask); \
\
do \
- __oldval = (*__memp); \
- while (__builtin_expect (atomic_compare_and_exchange_bool_acq (__memp, \
- __oldval \
- | __mask, \
- __oldval),\
- 0)); \
+ __atg19_old = (*__atg19_memp); \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg19_memp, \
+ __atg19_old | __atg19_mask,\
+ __atg19_old), 0)); \
\
- __oldval; })
+ __atg19_old; })
#endif
#ifndef atomic_full_barrier
diff --git a/libc/include/dlfcn.h b/libc/include/dlfcn.h
index 9144dd2f3..79c8f7d31 100644
--- a/libc/include/dlfcn.h
+++ b/libc/include/dlfcn.h
@@ -47,6 +47,9 @@ libc_hidden_proto (_dl_addr)
/* Close an object previously opened by _dl_open. */
extern void _dl_close (void *map) attribute_hidden;
+/* Same as above, but without locking and safety checks for user
+ provided map arguments. */
+extern void _dl_close_worker (struct link_map *map) attribute_hidden;
/* Look up NAME in shared object HANDLE (which may be RTLD_DEFAULT or
RTLD_NEXT). WHO is the calling function, for RTLD_NEXT. Returns
diff --git a/libc/include/errno.h b/libc/include/errno.h
index fe8bca44c..80c7b6ec1 100644
--- a/libc/include/errno.h
+++ b/libc/include/errno.h
@@ -19,7 +19,7 @@ extern int rtld_errno attribute_hidden;
# else
-# include <tls.h> /* Defines USE_TLS. */
+# include <tls.h>
# if USE___THREAD
# undef errno
diff --git a/libc/include/libc-symbols.h b/libc/include/libc-symbols.h
index da46f5e80..9eabcbd35 100644
--- a/libc/include/libc-symbols.h
+++ b/libc/include/libc-symbols.h
@@ -114,6 +114,13 @@
# define _weak_alias(name, aliasname) \
extern __typeof (name) aliasname __attribute__ ((weak, alias (#name)));
+/* Same as WEAK_ALIAS, but mark symbol as hidden. */
+# define weak_hidden_alias(name, aliasname) \
+ _weak_hidden_alias (name, aliasname)
+# define _weak_hidden_alias(name, aliasname) \
+ extern __typeof (name) aliasname \
+ __attribute__ ((weak, alias (#name), __visibility__ ("hidden")));
+
/* Declare SYMBOL as weak undefined symbol (resolved to 0 if not defined). */
# define weak_extern(symbol) _weak_extern (weak symbol)
# define _weak_extern(expr) _Pragma (#expr)
@@ -121,6 +128,7 @@
# else
# define weak_alias(name, aliasname) strong_alias(name, aliasname)
+# define weak_hidden_alias(name, aliasname) strong_alias(name, aliasname)
# define weak_extern(symbol) /* Nothing. */
# endif
@@ -431,8 +439,7 @@ for linking")
strong_alias(real, name)
#endif
-#if defined HAVE_VISIBILITY_ATTRIBUTE \
- && (defined SHARED || defined LIBC_NONSHARED)
+#if defined SHARED || defined LIBC_NONSHARED
# define attribute_hidden __attribute__ ((visibility ("hidden")))
#else
# define attribute_hidden
@@ -444,11 +451,7 @@ for linking")
# define attribute_tls_model_ie
#endif
-#ifdef HAVE_Z_RELRO
-# define attribute_relro __attribute__ ((section (".data.rel.ro")))
-#else
-# define attribute_relro
-#endif
+#define attribute_relro __attribute__ ((section (".data.rel.ro")))
/* Handling on non-exported internal names. We have to do this only
for shared code. */
@@ -457,14 +460,9 @@ for linking")
# define INTDEF(name) strong_alias (name, name##_internal)
# define INTVARDEF(name) \
_INTVARDEF (name, name##_internal)
-# if defined HAVE_VISIBILITY_ATTRIBUTE
-# define _INTVARDEF(name, aliasname) \
+# define _INTVARDEF(name, aliasname) \
extern __typeof (name) aliasname __attribute__ ((alias (#name), \
visibility ("hidden")));
-# else
-# define _INTVARDEF(name, aliasname) \
- extern __typeof (name) aliasname __attribute__ ((alias (#name)));
-# endif
# define INTDEF2(name, newname) strong_alias (name, newname##_internal)
# define INTVARDEF2(name, newname) _INTVARDEF (name, newname##_internal)
#else
@@ -549,16 +547,10 @@ for linking")
versioned_symbol (libc, __real_foo, foo, GLIBC_2_1);
libc_hidden_ver (__real_foo, foo) */
-#if defined SHARED && defined DO_VERSIONING \
- && !defined HAVE_BROKEN_ALIAS_ATTRIBUTE && !defined NO_HIDDEN
+#if defined SHARED && defined DO_VERSIONING && !defined NO_HIDDEN
# ifndef __ASSEMBLER__
-# if !defined HAVE_VISIBILITY_ATTRIBUTE \
- || defined HAVE_BROKEN_VISIBILITY_ATTRIBUTE
-# define __hidden_proto_hiddenattr(attrs...)
-# else
-# define __hidden_proto_hiddenattr(attrs...) \
+# define __hidden_proto_hiddenattr(attrs...) \
__attribute__ ((visibility ("hidden"), ##attrs))
-# endif
# define hidden_proto(name, attrs...) \
__hidden_proto (name, __GI_##name, ##attrs)
# define __hidden_proto(name, internal, attrs...) \
diff --git a/libc/include/link.h b/libc/include/link.h
index 4b2f07e86..b45deabf7 100644
--- a/libc/include/link.h
+++ b/libc/include/link.h
@@ -42,7 +42,7 @@ extern unsigned int la_objopen (struct link_map *__map, Lmid_t __lmid,
#include <stddef.h>
#include <bits/linkmap.h>
#include <dl-lookupcfg.h>
-#include <tls.h> /* Defines USE_TLS. */
+#include <tls.h>
#include <bits/libc-lock.h>
#include <rtld-lowlevel.h>
@@ -75,18 +75,6 @@ struct r_search_path_struct
};
-/* Structure for a scope. Each such data structure has a lock. The
- lock allows many readers. It can be invalidated by setting bit 31
- which means that no more lockers are allowe */
-struct r_scoperec
-{
- bool remove_after_use;
- bool notify;
- int nusers;
- struct r_scope_elem *scope[0];
-};
-
-
/* Structure describing a loaded shared object. The `l_next' and `l_prev'
members form a chain of all the shared objects loaded at startup.
@@ -226,27 +214,14 @@ struct link_map
ElfW(Addr) l_text_end;
/* Default array for 'l_scope'. */
- union
- {
- struct r_scoperec l_scoperec_mem;
- struct
- {
- struct r_scoperec scoperec_struct;
- /* XXX This number should be increased once the scope memory
- handling has been tested. */
- struct r_scope_elem *scope_elems[4];
-#define NINIT_SCOPE_ELEMS(map) \
- (sizeof ((map)->l_scope_realmem.scope_elems) \
- / sizeof ((map)->l_scope_realmem.scope_elems[0]))
- } l_scope_realmem;
- };
+ struct r_scope_elem *l_scope_mem[4];
/* Size of array allocated for 'l_scope'. */
size_t l_scope_max;
/* This is an array defining the lookup scope for this link map.
There are initially at most three different scope lists. */
- struct r_scoperec *l_scoperec;
+ struct r_scope_elem **l_scope;
/* We need to protect using the SCOPEREC. */
- __rtld_mrlock_define (, l_scoperec_lock)
+ __rtld_mrlock_define (, l_scope_lock)
/* A similar array, this time only with the local scope. This is
used occasionally. */
@@ -286,7 +261,6 @@ struct link_map
const ElfW(Sym) *ret;
} l_lookup_cache;
-#ifdef USE_TLS
/* Thread-local storage related info. */
/* Start of the initialization image. */
@@ -299,14 +273,13 @@ struct link_map
size_t l_tls_align;
/* Offset of first byte module alignment. */
size_t l_tls_firstbyte_offset;
-# ifndef NO_TLS_OFFSET
-# define NO_TLS_OFFSET 0
-# endif
+#ifndef NO_TLS_OFFSET
+# define NO_TLS_OFFSET 0
+#endif
/* For objects present at startup time: offset in the static TLS block. */
ptrdiff_t l_tls_offset;
/* Index of the module in the dtv array. */
size_t l_tls_modid;
-#endif
/* Information used to change permission after the relocations are
done. */
diff --git a/libc/include/stdio.h b/libc/include/stdio.h
index e040380d7..b293b8f1c 100644
--- a/libc/include/stdio.h
+++ b/libc/include/stdio.h
@@ -131,7 +131,6 @@ libc_hidden_proto (__vsnprintf_chk)
libc_hidden_proto (__vfprintf_chk)
# if !defined NOT_IN_libc && defined SHARED && defined DO_VERSIONING \
- && defined HAVE_VISIBILITY_ATTRIBUTE && !defined HAVE_BROKEN_ALIAS_ATTRIBUTE\
&& !defined NO_HIDDEN
/* Special gcc builtins. */
extern size_t __builtin_fwrite (const void *, size_t, size_t, void *)
diff --git a/libc/include/tls.h b/libc/include/tls.h
index ffd3e4e70..1642456a7 100644
--- a/libc/include/tls.h
+++ b/libc/include/tls.h
@@ -5,8 +5,7 @@
#include_next <tls.h>
-#if USE_TLS && HAVE___THREAD \
- && (!defined NOT_IN_libc || defined IS_IN_libpthread)
+#if HAVE___THREAD && (!defined NOT_IN_libc || defined IS_IN_libpthread)
# define USE___THREAD 1
diff --git a/libc/io/Makefile b/libc/io/Makefile
index c06d747d4..4aadfbca0 100644
--- a/libc/io/Makefile
+++ b/libc/io/Makefile
@@ -90,19 +90,6 @@ CFLAGS-posix_fallocate64.c = -fexceptions
CFLAGS-test-stat.c = -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE
CFLAGS-test-lfs.c = -D_LARGEFILE64_SOURCE
-ifeq (yes,$(have-protected))
-CFLAGS-stat.c = -DHAVE_DOT_HIDDEN
-CFLAGS-fstat.c = -DHAVE_DOT_HIDDEN
-CFLAGS-lstat.c = -DHAVE_DOT_HIDDEN
-CFLAGS-mknod.c = -DHAVE_DOT_HIDDEN
-CFLAGS-stat64.c = -DHAVE_DOT_HIDDEN
-CFLAGS-fstat64.c = -DHAVE_DOT_HIDDEN
-CFLAGS-lstat64.c = -DHAVE_DOT_HIDDEN
-CFLAGS-fstatat.c = -DHAVE_DOT_HIDDEN
-CFLAGS-fstatat64.c = -DHAVE_DOT_HIDDEN
-CFLAGS-mknodat.c = -DHAVE_DOT_HIDDEN
-endif
-
test-stat2-ARGS = Makefile . $(objpfx)test-stat2
tst-statvfs-ARGS = $(objpfx)tst-statvfs tst-statvfs.c /tmp
diff --git a/libc/io/fstat.c b/libc/io/fstat.c
index 0f95c1a6e..e2f9abd38 100644
--- a/libc/io/fstat.c
+++ b/libc/io/fstat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 1998, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998, 2001, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -47,16 +47,10 @@
#undef fstat
#undef __fstat
int
+attribute_hidden
__fstat (int fd, struct stat *buf)
{
return __fxstat (_STAT_VER, fd, buf);
}
-weak_alias (__fstat, fstat)
-
-/* Hide the symbol so that no definition but the one locally in the
- executable or DSO is used. */
-#ifdef HAVE_DOT_HIDDEN
-asm (".hidden\tfstat");
-asm (".hidden\t__fstat");
-#endif
+weak_hidden_alias (__fstat, fstat)
diff --git a/libc/io/fstat64.c b/libc/io/fstat64.c
index 79bd967d8..fe655444b 100644
--- a/libc/io/fstat64.c
+++ b/libc/io/fstat64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 2001, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -46,13 +46,8 @@
#undef fstat64
int
+attribute_hidden
fstat64 (int fd, struct stat64 *buf)
{
return __fxstat64 (_STAT_VER, fd, buf);
}
-
-/* Hide the symbol so that no definition but the one locally in the
- executable or DSO is used. */
-#ifdef HAVE_DOT_HIDDEN
-asm (".hidden\tfstat64");
-#endif
diff --git a/libc/io/fstatat.c b/libc/io/fstatat.c
index 1ac80597a..abf083c72 100644
--- a/libc/io/fstatat.c
+++ b/libc/io/fstatat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -46,13 +46,8 @@
#undef fstatat
int
+attribute_hidden
fstatat (int fd, const char *file, struct stat *buf, int flag)
{
return __fxstatat (_STAT_VER, fd, file, buf, flag);
}
-
-/* Hide the symbol so that no definition but the one locally in the
- executable or DSO is used. */
-#ifdef HAVE_DOT_HIDDEN
-asm (".hidden\tfstatat");
-#endif
diff --git a/libc/io/fstatat64.c b/libc/io/fstatat64.c
index a14b42d42..6fdf709af 100644
--- a/libc/io/fstatat64.c
+++ b/libc/io/fstatat64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -46,13 +46,8 @@
#undef fstatat64
int
+attribute_hidden
fstatat64 (int fd, const char *file, struct stat64 *buf, int flag)
{
return __fxstatat64 (_STAT_VER, fd, file, buf, flag);
}
-
-/* Hide the symbol so that no definition but the one locally in the
- executable or DSO is used. */
-#ifdef HAVE_DOT_HIDDEN
-asm (".hidden\tfstatat64");
-#endif
diff --git a/libc/io/lstat.c b/libc/io/lstat.c
index c4d7abe2c..620e47877 100644
--- a/libc/io/lstat.c
+++ b/libc/io/lstat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 2001, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -47,16 +47,10 @@
#undef lstat
#undef __lstat
int
+attribute_hidden
__lstat (const char *file, struct stat *buf)
{
return __lxstat (_STAT_VER, file, buf);
}
-weak_alias (__lstat, lstat)
-
-/* Hide the symbol so that no definition but the one locally in the
- executable or DSO is used. */
-#ifdef HAVE_DOT_HIDDEN
-asm (".hidden\tlstat");
-asm (".hidden\t__lstat");
-#endif
+weak_hidden_alias (__lstat, lstat)
diff --git a/libc/io/lstat64.c b/libc/io/lstat64.c
index 8a994e486..3e4ba2d97 100644
--- a/libc/io/lstat64.c
+++ b/libc/io/lstat64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 2001, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -46,13 +46,8 @@
#undef lstat64
int
+attribute_hidden
lstat64 (const char *file, struct stat64 *buf)
{
return __lxstat64 (_STAT_VER, file, buf);
}
-
-/* Hide the symbol so that no definition but the one locally in the
- executable or DSO is used. */
-#ifdef HAVE_DOT_HIDDEN
-asm (".hidden\tlstat64");
-#endif
diff --git a/libc/io/mknod.c b/libc/io/mknod.c
index 7d43593a2..cc5fd2610 100644
--- a/libc/io/mknod.c
+++ b/libc/io/mknod.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1996, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1996, 2001, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -47,16 +47,10 @@
all callers. */
int
+attribute_hidden
__mknod (const char *path, mode_t mode, dev_t dev)
{
return __xmknod (_MKNOD_VER, path, mode, &dev);
}
-weak_alias (__mknod, mknod)
-
-/* Hide the symbol so that no definition but the one locally in the
- executable or DSO is used. */
-#ifdef HAVE_DOT_HIDDEN
-asm (".hidden\tmknod");
-asm (".hidden\t__mknod");
-#endif
+weak_hidden_alias (__mknod, mknod)
diff --git a/libc/io/mknodat.c b/libc/io/mknodat.c
index ac515b5b4..b02ba695f 100644
--- a/libc/io/mknodat.c
+++ b/libc/io/mknodat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1996, 2001, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1996, 2001, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -47,14 +47,8 @@
all callers. */
int
+attribute_hidden
mknodat (int fd, const char *path, mode_t mode, dev_t dev)
{
return __xmknodat (_MKNOD_VER, fd, path, mode, &dev);
}
-
-
-/* Hide the symbol so that no definition but the one locally in the
- executable or DSO is used. */
-#ifdef HAVE_DOT_HIDDEN
-asm (".hidden\tmknodat");
-#endif
diff --git a/libc/io/stat.c b/libc/io/stat.c
index 6af604957..6f1c28fc5 100644
--- a/libc/io/stat.c
+++ b/libc/io/stat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 2001, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -46,16 +46,10 @@
#undef stat
int
+attribute_hidden
__stat (const char *file, struct stat *buf)
{
return __xstat (_STAT_VER, file, buf);
}
-weak_alias (__stat, stat)
-
-/* Hide the symbol so that no definition but the one locally in the
- executable or DSO is used. */
-#ifdef HAVE_DOT_HIDDEN
-asm (".hidden\tstat");
-asm (".hidden\t__stat");
-#endif
+weak_hidden_alias (__stat, stat)
diff --git a/libc/io/stat64.c b/libc/io/stat64.c
index cadf1e1f1..14e036a70 100644
--- a/libc/io/stat64.c
+++ b/libc/io/stat64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 2001, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -46,13 +46,8 @@
#undef stat64
int
+attribute_hidden
stat64 (const char *file, struct stat64 *buf)
{
return __xstat64 (_STAT_VER, file, buf);
}
-
-/* Hide the symbol so that no definition but the one locally in the
- executable or DSO is used. */
-#ifdef HAVE_DOT_HIDDEN
-asm (".hidden\tstat64");
-#endif
diff --git a/libc/libio/stdio.c b/libc/libio/stdio.c
index 8dc24ed98..b2baf65be 100644
--- a/libc/libio/stdio.c
+++ b/libc/libio/stdio.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1993,1994,1996,1997,2000,2002 Free Software Foundation, Inc.
+/* Copyright (C) 1993,1994,1996,1997,2000,2002,2006
+ Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -40,14 +41,9 @@ _IO_FILE *stderr = (FILE *) &_IO_2_1_stderr_;
#undef _IO_stderr
#ifdef _LIBC
# define AL(name) AL2 (name, _IO_##name)
-# if defined HAVE_VISIBILITY_ATTRIBUTE
-# define AL2(name, al) \
+# define AL2(name, al) \
extern __typeof (name) al __attribute__ ((alias (#name), \
visibility ("hidden")))
-# else
-# define AL2(name, al) \
- extern __typeof (name) al __attribute__ ((alias (#name)))
-# endif
AL(stdin);
AL(stdout);
AL(stderr);
diff --git a/libc/locale/global-locale.c b/libc/locale/global-locale.c
index a5cae3c5d..2280f68df 100644
--- a/libc/locale/global-locale.c
+++ b/libc/locale/global-locale.c
@@ -1,5 +1,5 @@
/* Locale object representing the global locale controlled by setlocale.
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -60,7 +60,7 @@ struct __locale_struct _nl_global_locale attribute_hidden =
};
#include <tls.h>
-#if USE_TLS && HAVE___THREAD
+#if HAVE___THREAD
/* The tsd macros don't permit an initializer. */
__thread void *__libc_tsd_LOCALE = &_nl_global_locale;
#else
diff --git a/libc/locale/localeinfo.h b/libc/locale/localeinfo.h
index 4f746a298..5c1f27f7e 100644
--- a/libc/locale/localeinfo.h
+++ b/libc/locale/localeinfo.h
@@ -215,9 +215,7 @@ __libc_tsd_define (extern, LOCALE)
we can use __thread variables. So only in that case do we attempt this. */
#if !defined SHARED && defined HAVE___THREAD && defined HAVE_WEAK_SYMBOLS
# include <tls.h>
-# if USE_TLS
-# define NL_CURRENT_INDIRECT 1
-# endif
+# define NL_CURRENT_INDIRECT 1
#endif
#ifdef NL_CURRENT_INDIRECT
diff --git a/libc/localedata/ChangeLog b/libc/localedata/ChangeLog
index f805ee8c0..2d13f941d 100644
--- a/libc/localedata/ChangeLog
+++ b/libc/localedata/ChangeLog
@@ -1,3 +1,10 @@
+2006-11-02 Ulrich Drepper <drepper@redhat.com>
+
+ * locales/mai_IN: New file.
+ Provided by Rajesh Ranjan <rajeshkajha@yahoo.com>.
+
+ * SUPPORTED: Add mai_IN/UTF-8.
+
2006-10-12 Ulrich Drepper <drepper@redhat.com>
[BZ #3320]
diff --git a/libc/localedata/SUPPORTED b/libc/localedata/SUPPORTED
index 89c99cded..dff286997 100644
--- a/libc/localedata/SUPPORTED
+++ b/libc/localedata/SUPPORTED
@@ -252,6 +252,7 @@ lt_LT.UTF-8/UTF-8 \
lt_LT/ISO-8859-13 \
lv_LV.UTF-8/UTF-8 \
lv_LV/ISO-8859-13 \
+mai_IN/UTF-8 \
mg_MG.UTF-8/UTF-8 \
mg_MG/ISO-8859-15 \
mi_NZ.UTF-8/UTF-8 \
diff --git a/libc/localedata/locales/mai_IN b/libc/localedata/locales/mai_IN
new file mode 100644
index 000000000..32bd12721
--- /dev/null
+++ b/libc/localedata/locales/mai_IN
@@ -0,0 +1,84 @@
+comment_char %
+escape_char /
+% Maithili language locale for India.
+% Contributed by Rajesh Ranjan <rajeshkajha@yahoo.com> and
+% Sangeeta Kumari <sangeeta09@gmail.com>.
+
+LC_IDENTIFICATION
+title "Maithili language locale for India"
+source "Maithili Computing Research Center, Pune, India"
+address "B-3/302, Lunkad Daffodills, Viman Nagar, Pune, India"
+contact ""
+email "rajeshkajha@yahoo.com"
+tel ""
+fax ""
+language "Maithili"
+territory "India"
+revision "1.0"
+date "2006-11-01"
+%
+category "mai_IN:2006";LC_IDENTIFICATION
+category "mai_IN:2006";LC_CTYPE
+category "mai_IN:2006";LC_COLLATE
+category "mai_IN:2006";LC_TIME
+category "mai_IN:2006";LC_NUMERIC
+category "mai_IN:2006";LC_MONETARY
+category "mai_IN:2006";LC_MESSAGES
+category "mai_IN:2006";LC_PAPER
+category "mai_IN:2006";LC_NAME
+category "mai_IN:2006";LC_ADDRESS
+category "mai_IN:2006";LC_TELEPHONE
+
+END LC_IDENTIFICATION
+
+LC_CTYPE
+copy "hi_IN"
+END LC_CTYPE
+
+LC_COLLATE
+copy "hi_IN"
+END LC_COLLATE
+
+LC_MONETARY
+copy "hi_IN"
+END LC_MONETARY
+
+
+LC_NUMERIC
+copy "hi_IN"
+END LC_NUMERIC
+
+
+LC_TIME
+copy "hi_IN"
+END LC_TIME
+
+
+LC_MESSAGES
+copy "hi_IN"
+END LC_MESSAGES
+
+
+LC_PAPER
+copy "hi_IN"
+END LC_PAPER
+
+
+LC_NAME
+copy "hi_IN"
+END LC_NAME
+
+
+LC_ADDRESS
+copy "hi_IN"
+END LC_ADDRESS
+
+
+LC_TELEPHONE
+copy "hi_IN"
+END LC_TELEPHONE
+
+
+LC_MEASUREMENT
+copy "hi_IN"
+END LC_MEASUREMENT
diff --git a/libc/malloc/arena.c b/libc/malloc/arena.c
index 2179174d6..1d9f95211 100644
--- a/libc/malloc/arena.c
+++ b/libc/malloc/arena.c
@@ -149,7 +149,7 @@ int __malloc_initialized = -1;
static __malloc_ptr_t (*save_malloc_hook) (size_t __size,
__const __malloc_ptr_t);
-# if !defined _LIBC || !defined USE_TLS || (defined SHARED && !USE___THREAD)
+# if !defined _LIBC || (defined SHARED && !USE___THREAD)
static __malloc_ptr_t (*save_memalign_hook) (size_t __align, size_t __size,
__const __malloc_ptr_t);
# endif
@@ -385,7 +385,7 @@ extern struct dl_open_hook *_dl_open_hook;
libc_hidden_proto (_dl_open_hook);
# endif
-# if defined SHARED && defined USE_TLS && !USE___THREAD
+# if defined SHARED && !USE___THREAD
/* This is called by __pthread_initialize_minimal when it needs to use
malloc to set up the TLS state. We cannot do the full work of
ptmalloc_init (below) until __pthread_initialize_minimal has finished,
@@ -428,7 +428,7 @@ ptmalloc_init (void)
__malloc_initialized = 0;
#ifdef _LIBC
-# if defined SHARED && defined USE_TLS && !USE___THREAD
+# if defined SHARED && !USE___THREAD
/* ptmalloc_init_minimal may already have been called via
__libc_malloc_pthread_startup, above. */
if (mp_.pagesize == 0)
@@ -437,7 +437,7 @@ ptmalloc_init (void)
ptmalloc_init_minimal();
#ifndef NO_THREADS
-# if defined _LIBC && defined USE_TLS
+# if defined _LIBC
/* We know __pthread_initialize_minimal has already been called,
and that is enough. */
# define NO_STARTER
diff --git a/libc/malloc/hooks.c b/libc/malloc/hooks.c
index 708f0faf8..8346e7345 100644
--- a/libc/malloc/hooks.c
+++ b/libc/malloc/hooks.c
@@ -1,5 +1,5 @@
/* Malloc implementation for multiple threads without lock contention.
- Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2001,2002,2003,2004,2005,2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Wolfram Gloger <wg@malloc.de>, 2001.
@@ -414,7 +414,7 @@ memalign_check(alignment, bytes, caller)
#ifndef NO_THREADS
# ifdef _LIBC
-# if USE___THREAD || (defined USE_TLS && !defined SHARED)
+# if USE___THREAD || !defined SHARED
/* These routines are never needed in this configuration. */
# define NO_STARTER
# endif
diff --git a/libc/malloc/malloc.c b/libc/malloc/malloc.c
index 38ceb1e90..d15ed57bd 100644
--- a/libc/malloc/malloc.c
+++ b/libc/malloc/malloc.c
@@ -1618,7 +1618,7 @@ static Void_t* memalign_check(size_t alignment, size_t bytes,
const Void_t *caller);
#ifndef NO_THREADS
# ifdef _LIBC
-# if USE___THREAD || (defined USE_TLS && !defined SHARED)
+# if USE___THREAD || !defined SHARED
/* These routines are never needed in this configuration. */
# define NO_STARTER
# endif
@@ -4699,7 +4699,7 @@ static void malloc_consolidate(av) mstate av;
search all bins all the time. */
maxfb = &(av->fastbins[fastbin_index(get_max_fast ())]);
#else
- maxfb = &(av->fastbins[NFASTBINS]);
+ maxfb = &(av->fastbins[NFASTBINS - 1]);
#endif
fb = &(av->fastbins[0]);
do {
diff --git a/libc/malloc/memusage.c b/libc/malloc/memusage.c
index 9003d8094..bf2978ef0 100644
--- a/libc/malloc/memusage.c
+++ b/libc/malloc/memusage.c
@@ -887,4 +887,10 @@ dest (void)
fputc ('=', stderr);
fputs ("\e[0;0m\n", stderr);
}
+
+ /* Any following malloc/free etc. calls should generate statistics again,
+ because otherwise freeing something that has been malloced before
+ this destructor (including struct header in front of it) wouldn't
+ be properly freed. */
+ not_me = false;
}
diff --git a/libc/manual/conf.texi b/libc/manual/conf.texi
index ef00db6b7..605e30507 100644
--- a/libc/manual/conf.texi
+++ b/libc/manual/conf.texi
@@ -1455,11 +1455,6 @@ Inquire about the value of @code{_POSIX_ASYNC_IO}.
Inquire about the value of @code{_POSIX_PRIO_IO}.
@comment unistd.h
-@comment POSIX.1g
-@item _PC_SOCK_MAXBUF
-Inquire about the value of @code{_POSIX_PIPE_BUF}.
-
-@comment unistd.h
@comment LFS
@item _PC_FILESIZEBITS
Inquire about the availability of large files on the filesystem.
diff --git a/libc/nptl/ChangeLog b/libc/nptl/ChangeLog
index a1e64928a..c65b60dbf 100644
--- a/libc/nptl/ChangeLog
+++ b/libc/nptl/ChangeLog
@@ -1,3 +1,108 @@
+2006-10-30 Jakub Jelinek <jakub@redhat.com>
+
+ * sysdeps/ia64/pthread_spin_unlock.c (pthread_spin_unlock): Use
+ __sync_lock_release instead of __sync_lock_release_si.
+
+2006-10-29 Jakub Jelinek <jakub@redhat.com>
+
+ * sysdeps/unix/sysv/linux/i386/sysdep-cancel.h (RTLD_SINGLE_THREAD_P):
+ Define.
+ (SINGLE_THREAD_P): Define to 1 if IS_IN_rtld.
+ * sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h: Likewise.
+ * sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h: Likewise.
+ * sysdeps/unix/sysv/linux/s390/s390-32/sysdep-cancel.h: Likewise.
+ * sysdeps/unix/sysv/linux/s390/s390-64/sysdep-cancel.h: Likewise.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h: Likewise.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h: Likewise.
+ * sysdeps/unix/sysv/linux/x86_64/sysdep-cancel.h: Likewise.
+ * sysdeps/unix/sysv/linux/sparc/sparc32/sysdep-cancel.h: Likewise.
+ * sysdeps/unix/sysv/linux/sparc/sparc64/sysdep-cancel.h: Likewise.
+ * sysdeps/unix/sysv/linux/sh/sysdep-cancel.h: Likewise.
+
+2006-10-27 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/pthread/pthread_barrier_wait.c: Move to...
+ * pthread_barrier_wait.c: ...here.
+ * sysdeps/pthread/pthread_cond_broadcast.c: Move to...
+ * pthread_cond_broadcast.c: ...here.
+ * sysdeps/pthread/pthread_cond_signal.c: Move to...
+ * pthread_cond_signal.c: ...here.
+ * sysdeps/pthread/pthread_cond_timedwait.c: Move to...
+ * pthread_cond_timedwait.c: ...here.
+ * sysdeps/pthread/pthread_cond_wait.c: Move to...
+ * pthread_cond_wait.c: ...here.
+ * sysdeps/pthread/pthread_once.c: Move to...
+ * pthread_once.c: ...here.
+ * sysdeps/pthread/pthread_rwlock_rdlock.c: Move to...
+ * pthread_rwlock_rdlock.c: ...here.
+ * sysdeps/pthread/pthread_rwlock_timedrdlock.c: Move to...
+ * pthread_rwlock_timedrdlock.c: ...here.
+ * sysdeps/pthread/pthread_rwlock_timedwrlock.c: Move to...
+ * pthread_rwlock_timedwrlock.c: ...here.
+ * sysdeps/pthread/pthread_rwlock_unlock.c: Move to...
+ * pthread_rwlock_unlock.c: ...here.
+ * sysdeps/pthread/pthread_rwlock_wrlock.c: Move to...
+ * pthread_rwlock_wrlock.c: ...here.
+ * sysdeps/pthread/pthread_spin_destroy.c: Move to...
+ * pthread_spin_destroy.c: ...here.
+ * sysdeps/pthread/pthread_spin_init.c: Move to...
+ * pthread_spin_init.c: ...here.
+ * sysdeps/pthread/pthread_spin_unlock.c: Move to...
+ * pthread_spin_unlock.c: ...here.
+ * sysdeps/pthread/pthread_getcpuclockid.c: Move to...
+ * pthread_getcpuclockid.c: ...here.
+
+ * init.c: USE_TLS support is now default.
+ * tst-tls5.h: Likewise.
+ * sysdeps/alpha/tls.h: Likewise.
+ * sysdeps/i386/tls.h: Likewise.
+ * sysdeps/ia64/tls.h: Likewise.
+ * sysdeps/powerpc/tls.h: Likewise.
+ * sysdeps/s390/tls.h: Likewise.
+ * sysdeps/sh/tls.h: Likewise.
+ * sysdeps/sparc/tls.h: Likewise.
+ * sysdeps/x86_64/tls.h: Likewise.
+
+2006-10-27 Jakub Jelinek <jakub@redhat.com>
+
+ * sysdeps/unix/sysv/linux/rtld-lowlevel.h (__rtld_mrlock_lock,
+ __rtld_mrlock_change): Update oldval if atomic compare and exchange
+ failed.
+
+ * sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h (SINGLE_THREAD_P):
+ Define to THREAD_SELF->header.multiple_threads.
+ * sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h (SINGLE_THREAD_P):
+ Likewise.
+ * sysdeps/unix/sysv/linux/i386/sysdep-cancel.h (SINGLE_THREAD_P):
+ Likewise.
+ * sysdeps/unix/sysv/linux/s390/s390-32/sysdep-cancel.h
+ (SINGLE_THREAD_P): Likewise.
+ * sysdeps/unix/sysv/linux/s390/s390-64/sysdep-cancel.h
+ (SINGLE_THREAD_P): Likewise.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h
+ (SINGLE_THREAD_P): Likewise.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h
+ (SINGLE_THREAD_P): Likewise.
+ * sysdeps/unix/sysv/linux/x86_64/sysdep-cancel.h (SINGLE_THREAD_P):
+ Likewise.
+ * sysdeps/unix/sysv/linux/sparc/sparc32/sysdep-cancel.h
+ (SINGLE_THREAD_P): Likewise.
+ * sysdeps/unix/sysv/linux/sparc/sparc64/sysdep-cancel.h
+ (SINGLE_THREAD_P): Likewise.
+ * sysdeps/unix/sysv/linux/sh/sysdep-cancel.h (SINGLE_THREAD_P):
+ Likewise.
+
+2006-10-26 Jakub Jelinek <jakub@redhat.com>
+
+ * pthread_attr_setstacksize.c (NEW_VERNUM): Define to GLIBC_2_3_3
+ by default rather than 2_3_3.
+
+2006-10-17 Jakub Jelinek <jakub@redhat.com>
+
+ * sysdeps/unix/sysv/linux/rtld-lowlevel.h (__rtld_mrlock_lock,
+ __rtld_mrlock_unlock, __rtld_mrlock_change, __rtld_mrlock_done): Use
+ atomic_* instead of catomic_* macros.
+
2006-10-12 Ulrich Drepper <drepper@redhat.com>
[BZ #3285]
diff --git a/libc/nptl/init.c b/libc/nptl/init.c
index 14441153b..dddc975a5 100644
--- a/libc/nptl/init.c
+++ b/libc/nptl/init.c
@@ -73,7 +73,7 @@ int __set_robust_list_avail;
static const char nptl_version[] __attribute_used__ = VERSION;
-#if defined USE_TLS && !defined SHARED
+#ifndef SHARED
extern void __libc_setup_tls (size_t tcbsize, size_t tcbalign);
#endif
diff --git a/libc/nptl/pthread_attr_setstacksize.c b/libc/nptl/pthread_attr_setstacksize.c
index cfafb0a6a..097453898 100644
--- a/libc/nptl/pthread_attr_setstacksize.c
+++ b/libc/nptl/pthread_attr_setstacksize.c
@@ -23,7 +23,7 @@
#include "pthreadP.h"
#ifndef NEW_VERNUM
-# define NEW_VERNUM 2_3_3
+# define NEW_VERNUM GLIBC_2_3_3
#endif
diff --git a/libc/nptl/sysdeps/pthread/pthread_barrier_wait.c b/libc/nptl/pthread_barrier_wait.c
index c6b563f24..c6b563f24 100644
--- a/libc/nptl/sysdeps/pthread/pthread_barrier_wait.c
+++ b/libc/nptl/pthread_barrier_wait.c
diff --git a/libc/nptl/sysdeps/pthread/pthread_cond_broadcast.c b/libc/nptl/pthread_cond_broadcast.c
index 2b8b5460f..2b8b5460f 100644
--- a/libc/nptl/sysdeps/pthread/pthread_cond_broadcast.c
+++ b/libc/nptl/pthread_cond_broadcast.c
diff --git a/libc/nptl/sysdeps/pthread/pthread_cond_signal.c b/libc/nptl/pthread_cond_signal.c
index 5a9bbcad9..5a9bbcad9 100644
--- a/libc/nptl/sysdeps/pthread/pthread_cond_signal.c
+++ b/libc/nptl/pthread_cond_signal.c
diff --git a/libc/nptl/sysdeps/pthread/pthread_cond_timedwait.c b/libc/nptl/pthread_cond_timedwait.c
index fdbf43eae..fdbf43eae 100644
--- a/libc/nptl/sysdeps/pthread/pthread_cond_timedwait.c
+++ b/libc/nptl/pthread_cond_timedwait.c
diff --git a/libc/nptl/sysdeps/pthread/pthread_cond_wait.c b/libc/nptl/pthread_cond_wait.c
index f5f5cec5a..f5f5cec5a 100644
--- a/libc/nptl/sysdeps/pthread/pthread_cond_wait.c
+++ b/libc/nptl/pthread_cond_wait.c
diff --git a/libc/nptl/sysdeps/pthread/pthread_getcpuclockid.c b/libc/nptl/pthread_getcpuclockid.c
index 8506f94eb..8506f94eb 100644
--- a/libc/nptl/sysdeps/pthread/pthread_getcpuclockid.c
+++ b/libc/nptl/pthread_getcpuclockid.c
diff --git a/libc/nptl/sysdeps/pthread/pthread_once.c b/libc/nptl/pthread_once.c
index 9b2cef864..9b2cef864 100644
--- a/libc/nptl/sysdeps/pthread/pthread_once.c
+++ b/libc/nptl/pthread_once.c
diff --git a/libc/nptl/sysdeps/pthread/pthread_rwlock_rdlock.c b/libc/nptl/pthread_rwlock_rdlock.c
index e225d7030..e225d7030 100644
--- a/libc/nptl/sysdeps/pthread/pthread_rwlock_rdlock.c
+++ b/libc/nptl/pthread_rwlock_rdlock.c
diff --git a/libc/nptl/sysdeps/pthread/pthread_rwlock_timedrdlock.c b/libc/nptl/pthread_rwlock_timedrdlock.c
index 80ea83a3d..80ea83a3d 100644
--- a/libc/nptl/sysdeps/pthread/pthread_rwlock_timedrdlock.c
+++ b/libc/nptl/pthread_rwlock_timedrdlock.c
diff --git a/libc/nptl/sysdeps/pthread/pthread_rwlock_timedwrlock.c b/libc/nptl/pthread_rwlock_timedwrlock.c
index 97c0598f9..97c0598f9 100644
--- a/libc/nptl/sysdeps/pthread/pthread_rwlock_timedwrlock.c
+++ b/libc/nptl/pthread_rwlock_timedwrlock.c
diff --git a/libc/nptl/sysdeps/pthread/pthread_rwlock_unlock.c b/libc/nptl/pthread_rwlock_unlock.c
index 9cae8b6c2..9cae8b6c2 100644
--- a/libc/nptl/sysdeps/pthread/pthread_rwlock_unlock.c
+++ b/libc/nptl/pthread_rwlock_unlock.c
diff --git a/libc/nptl/sysdeps/pthread/pthread_rwlock_wrlock.c b/libc/nptl/pthread_rwlock_wrlock.c
index 822aeed79..822aeed79 100644
--- a/libc/nptl/sysdeps/pthread/pthread_rwlock_wrlock.c
+++ b/libc/nptl/pthread_rwlock_wrlock.c
diff --git a/libc/nptl/sysdeps/pthread/pthread_spin_destroy.c b/libc/nptl/pthread_spin_destroy.c
index 4d0109cf0..4d0109cf0 100644
--- a/libc/nptl/sysdeps/pthread/pthread_spin_destroy.c
+++ b/libc/nptl/pthread_spin_destroy.c
diff --git a/libc/nptl/sysdeps/pthread/pthread_spin_init.c b/libc/nptl/pthread_spin_init.c
index c2275085e..c2275085e 100644
--- a/libc/nptl/sysdeps/pthread/pthread_spin_init.c
+++ b/libc/nptl/pthread_spin_init.c
diff --git a/libc/nptl/sysdeps/pthread/pthread_spin_unlock.c b/libc/nptl/pthread_spin_unlock.c
index f97cadfbd..f97cadfbd 100644
--- a/libc/nptl/sysdeps/pthread/pthread_spin_unlock.c
+++ b/libc/nptl/pthread_spin_unlock.c
diff --git a/libc/nptl/sysdeps/alpha/tls.h b/libc/nptl/sysdeps/alpha/tls.h
index 20f780c5f..be2430f67 100644
--- a/libc/nptl/sysdeps/alpha/tls.h
+++ b/libc/nptl/sysdeps/alpha/tls.h
@@ -1,5 +1,5 @@
/* Definition for thread-local data handling. NPTL/Alpha version.
- Copyright (C) 2003, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -48,9 +48,6 @@ typedef union dtv
# error "TLS support is required."
#endif
-/* Signal that TLS support is available. */
-# define USE_TLS 1
-
#ifndef __ASSEMBLER__
/* Get system call information. */
diff --git a/libc/nptl/sysdeps/i386/tls.h b/libc/nptl/sysdeps/i386/tls.h
index a870a848c..d5b3797e6 100644
--- a/libc/nptl/sysdeps/i386/tls.h
+++ b/libc/nptl/sysdeps/i386/tls.h
@@ -1,5 +1,5 @@
/* Definition for thread-local data handling. nptl/i386 version.
- Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -65,9 +65,6 @@ typedef struct
# error "TLS support is required."
#endif
-/* Signal that TLS support is available. */
-#define USE_TLS 1
-
/* Alignment requirement for the stack. For IA-32 this is governed by
the SSE memory functions. */
#define STACK_ALIGN 16
diff --git a/libc/nptl/sysdeps/ia64/pthread_spin_unlock.c b/libc/nptl/sysdeps/ia64/pthread_spin_unlock.c
index 6232764b1..50d9c5f6a 100644
--- a/libc/nptl/sysdeps/ia64/pthread_spin_unlock.c
+++ b/libc/nptl/sysdeps/ia64/pthread_spin_unlock.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
@@ -23,6 +23,6 @@
int
pthread_spin_unlock (pthread_spinlock_t *lock)
{
- __sync_lock_release_si ((int *) lock);
+ __sync_lock_release ((int *) lock);
return 0;
}
diff --git a/libc/nptl/sysdeps/ia64/tls.h b/libc/nptl/sysdeps/ia64/tls.h
index 69101ad8c..22a8b0814 100644
--- a/libc/nptl/sysdeps/ia64/tls.h
+++ b/libc/nptl/sysdeps/ia64/tls.h
@@ -61,9 +61,6 @@ register struct pthread *__thread_self __asm__("r13");
# error "TLS support is required."
#endif
-/* Signal that TLS support is available. */
-#define USE_TLS 1
-
/* Alignment requirement for the stack. */
#define STACK_ALIGN 16
diff --git a/libc/nptl/sysdeps/powerpc/tls.h b/libc/nptl/sysdeps/powerpc/tls.h
index 976a27136..ddaafe23d 100644
--- a/libc/nptl/sysdeps/powerpc/tls.h
+++ b/libc/nptl/sysdeps/powerpc/tls.h
@@ -1,5 +1,5 @@
/* Definition for thread-local data handling. NPTL/PowerPC version.
- Copyright (C) 2003, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -48,9 +48,6 @@ typedef union dtv
# error "TLS support is required."
#endif
-/* Signal that TLS support is available. */
-# define USE_TLS 1
-
#ifndef __ASSEMBLER__
/* Get system call information. */
diff --git a/libc/nptl/sysdeps/s390/tls.h b/libc/nptl/sysdeps/s390/tls.h
index 89ff095d5..6f6f17b97 100644
--- a/libc/nptl/sysdeps/s390/tls.h
+++ b/libc/nptl/sysdeps/s390/tls.h
@@ -1,5 +1,5 @@
/* Definition for thread-local data handling. NPTL/s390 version.
- Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -66,9 +66,6 @@ typedef struct
# error "TLS support is required."
#endif
-/* Signal that TLS support is available. */
-#define USE_TLS 1
-
/* Alignment requirement for the stack. For IA-32 this is governed by
the SSE memory functions. */
#define STACK_ALIGN 16
diff --git a/libc/nptl/sysdeps/sh/tls.h b/libc/nptl/sysdeps/sh/tls.h
index 49d105518..d9aa1073b 100644
--- a/libc/nptl/sysdeps/sh/tls.h
+++ b/libc/nptl/sysdeps/sh/tls.h
@@ -1,5 +1,5 @@
/* Definition for thread-local data handling. NPTL/SH version.
- Copyright (C) 2003, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -56,9 +56,6 @@ typedef struct
# error "TLS support is required."
#endif
-/* Signal that TLS support is available. */
-# define USE_TLS 1
-
#ifndef __ASSEMBLER__
/* Get system call information. */
diff --git a/libc/nptl/sysdeps/sparc/tls.h b/libc/nptl/sysdeps/sparc/tls.h
index 127bbf695..4fbe42659 100644
--- a/libc/nptl/sysdeps/sparc/tls.h
+++ b/libc/nptl/sysdeps/sparc/tls.h
@@ -60,9 +60,6 @@ typedef struct
# error "TLS support is required."
#endif
-/* Signal that TLS support is available. */
-#define USE_TLS 1
-
#ifndef __ASSEMBLER__
/* Get system call information. */
# include <sysdep.h>
diff --git a/libc/nptl/sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h b/libc/nptl/sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h
index f3f7718e3..aa42768f7 100644
--- a/libc/nptl/sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h
+++ b/libc/nptl/sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -167,3 +167,9 @@ extern int __local_multiple_threads attribute_hidden;
# define NO_CANCELLATION 1
#endif
+
+#ifndef __ASSEMBLER__
+# define RTLD_SINGLE_THREAD_P \
+ __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
+ header.multiple_threads) == 0, 1)
+#endif
diff --git a/libc/nptl/sysdeps/unix/sysv/linux/i386/sysdep-cancel.h b/libc/nptl/sysdeps/unix/sysv/linux/i386/sysdep-cancel.h
index 2d1ad3d7c..1cd4b9b8b 100644
--- a/libc/nptl/sysdeps/unix/sysv/linux/i386/sysdep-cancel.h
+++ b/libc/nptl/sysdeps/unix/sysv/linux/i386/sysdep-cancel.h
@@ -147,3 +147,9 @@
# define NO_CANCELLATION 1
#endif
+
+#ifndef __ASSEMBLER__
+# define RTLD_SINGLE_THREAD_P \
+ __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
+ header.multiple_threads) == 0, 1)
+#endif
diff --git a/libc/nptl/sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h b/libc/nptl/sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h
index 63aaa96eb..c4d52860d 100644
--- a/libc/nptl/sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h
+++ b/libc/nptl/sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2002.
@@ -220,3 +220,9 @@ __GC_##name: \
# define NO_CANCELLATION 1
#endif
+
+#ifndef __ASSEMBLER__
+# define RTLD_SINGLE_THREAD_P \
+ __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
+ header.multiple_threads) == 0, 1)
+#endif
diff --git a/libc/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h b/libc/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h
index dcbc0d652..3752abc87 100644
--- a/libc/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h
+++ b/libc/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h
@@ -128,3 +128,9 @@
# define NO_CANCELLATION 1
#endif
+
+#ifndef __ASSEMBLER__
+# define RTLD_SINGLE_THREAD_P \
+ __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
+ header.multiple_threads) == 0, 1)
+#endif
diff --git a/libc/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h b/libc/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h
index 83eb444ec..707765ab5 100644
--- a/libc/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h
+++ b/libc/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h
@@ -117,3 +117,9 @@
# define NO_CANCELLATION 1
#endif
+
+#ifndef __ASSEMBLER__
+# define RTLD_SINGLE_THREAD_P \
+ __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
+ header.multiple_threads) == 0, 1)
+#endif
diff --git a/libc/nptl/sysdeps/unix/sysv/linux/rtld-lowlevel.h b/libc/nptl/sysdeps/unix/sysv/linux/rtld-lowlevel.h
index b16fd2165..bc7a6454e 100644
--- a/libc/nptl/sysdeps/unix/sysv/linux/rtld-lowlevel.h
+++ b/libc/nptl/sysdeps/unix/sysv/linux/rtld-lowlevel.h
@@ -62,17 +62,18 @@ typedef int __rtld_mrlock_t;
{ \
int newval = ((oldval & __RTLD_MRLOCK_RBITS) \
+ __RTLD_MRLOCK_INC); \
- int ret = catomic_compare_and_exchange_val_acq (&(lock), \
- newval, \
- oldval); \
+ int ret = atomic_compare_and_exchange_val_acq (&(lock), \
+ newval, \
+ oldval); \
if (__builtin_expect (ret == oldval, 1)) \
goto out; \
+ oldval = ret; \
} \
atomic_delay (); \
} \
if ((oldval & __RTLD_MRLOCK_RWAIT) == 0) \
{ \
- catomic_or (&(lock), __RTLD_MRLOCK_RWAIT); \
+ atomic_or (&(lock), __RTLD_MRLOCK_RWAIT); \
oldval |= __RTLD_MRLOCK_RWAIT; \
} \
lll_futex_wait (lock, oldval); \
@@ -83,7 +84,7 @@ typedef int __rtld_mrlock_t;
#define __rtld_mrlock_unlock(lock) \
do { \
- int oldval = catomic_exchange_and_add (&(lock), -__RTLD_MRLOCK_INC); \
+ int oldval = atomic_exchange_and_add (&(lock), -__RTLD_MRLOCK_INC); \
if (__builtin_expect ((oldval \
& (__RTLD_MRLOCK_RBITS | __RTLD_MRLOCK_WWAIT)) \
== (__RTLD_MRLOCK_INC | __RTLD_MRLOCK_WWAIT), 0)) \
@@ -103,19 +104,20 @@ typedef int __rtld_mrlock_t;
for (int tries = 0; tries < __RTLD_MRLOCK_TRIES; ++tries) \
{ \
oldval = lock; \
- while (__builtin_expect ((oldval & __RTLD_MRLOCK_RBITS) == 0, 1))\
+ while (__builtin_expect ((oldval & __RTLD_MRLOCK_RBITS) == 0, 1)) \
{ \
int newval = ((oldval & __RTLD_MRLOCK_RWAIT) \
+ __RTLD_MRLOCK_WRITER); \
- int ret = catomic_compare_and_exchange_val_acq (&(lock), \
+ int ret = atomic_compare_and_exchange_val_acq (&(lock), \
newval, \
oldval); \
if (__builtin_expect (ret == oldval, 1)) \
goto out; \
+ oldval = ret; \
} \
atomic_delay (); \
} \
- catomic_or (&(lock), __RTLD_MRLOCK_WWAIT); \
+ atomic_or (&(lock), __RTLD_MRLOCK_WWAIT); \
oldval |= __RTLD_MRLOCK_WWAIT; \
lll_futex_wait (lock, oldval); \
} \
@@ -125,7 +127,7 @@ typedef int __rtld_mrlock_t;
#define __rtld_mrlock_done(lock) \
do { \
- int oldval = catomic_exchange_and_add (&(lock), -__RTLD_MRLOCK_WRITER); \
+ int oldval = atomic_exchange_and_add (&(lock), -__RTLD_MRLOCK_WRITER); \
if (__builtin_expect ((oldval & __RTLD_MRLOCK_RWAIT) != 0, 0)) \
lll_futex_wake (&(lock), 0x7fffffff); \
} while (0)
diff --git a/libc/nptl/sysdeps/unix/sysv/linux/s390/s390-32/sysdep-cancel.h b/libc/nptl/sysdeps/unix/sysv/linux/s390/s390-32/sysdep-cancel.h
index 09dac2c90..17ab562da 100644
--- a/libc/nptl/sysdeps/unix/sysv/linux/s390/s390-32/sysdep-cancel.h
+++ b/libc/nptl/sysdeps/unix/sysv/linux/s390/s390-32/sysdep-cancel.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
@@ -113,3 +113,9 @@ L(pseudo_end):
# define NO_CANCELLATION 1
#endif
+
+#ifndef __ASSEMBLER__
+# define RTLD_SINGLE_THREAD_P \
+ __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
+ header.multiple_threads) == 0, 1)
+#endif
diff --git a/libc/nptl/sysdeps/unix/sysv/linux/s390/s390-64/sysdep-cancel.h b/libc/nptl/sysdeps/unix/sysv/linux/s390/s390-64/sysdep-cancel.h
index f8eb6a9eb..77ce74249 100644
--- a/libc/nptl/sysdeps/unix/sysv/linux/s390/s390-64/sysdep-cancel.h
+++ b/libc/nptl/sysdeps/unix/sysv/linux/s390/s390-64/sysdep-cancel.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
@@ -126,3 +126,9 @@ extern int __local_multiple_threads attribute_hidden;
# define NO_CANCELLATION 1
#endif
+
+#ifndef __ASSEMBLER__
+# define RTLD_SINGLE_THREAD_P \
+ __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
+ header.multiple_threads) == 0, 1)
+#endif
diff --git a/libc/nptl/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h b/libc/nptl/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h
index 9a967eaf5..a8065c6a8 100644
--- a/libc/nptl/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h
+++ b/libc/nptl/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -161,3 +161,9 @@
# define NO_CANCELLATION 1
#endif
+
+#ifndef __ASSEMBLER__
+# define RTLD_SINGLE_THREAD_P \
+ __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
+ header.multiple_threads) == 0, 1)
+#endif
diff --git a/libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep-cancel.h b/libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep-cancel.h
index 75a4eb946..f0349906b 100644
--- a/libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep-cancel.h
+++ b/libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep-cancel.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2002.
@@ -104,3 +104,9 @@ __##syscall_name##_nocancel: \
# define NO_CANCELLATION 1
#endif
+
+#ifndef __ASSEMBLER__
+# define RTLD_SINGLE_THREAD_P \
+ __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
+ header.multiple_threads) == 0, 1)
+#endif
diff --git a/libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep-cancel.h b/libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep-cancel.h
index dd263a597..2c76d0171 100644
--- a/libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep-cancel.h
+++ b/libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep-cancel.h
@@ -102,3 +102,9 @@ __##syscall_name##_nocancel: \
# define NO_CANCELLATION 1
#endif
+
+#ifndef __ASSEMBLER__
+# define RTLD_SINGLE_THREAD_P \
+ __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
+ header.multiple_threads) == 0, 1)
+#endif
diff --git a/libc/nptl/sysdeps/unix/sysv/linux/x86_64/sysdep-cancel.h b/libc/nptl/sysdeps/unix/sysv/linux/x86_64/sysdep-cancel.h
index 97debaba9..3e741da79 100644
--- a/libc/nptl/sysdeps/unix/sysv/linux/x86_64/sysdep-cancel.h
+++ b/libc/nptl/sysdeps/unix/sysv/linux/x86_64/sysdep-cancel.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2002.
@@ -136,3 +136,9 @@ extern int __local_multiple_threads attribute_hidden;
# define NO_CANCELLATION 1
#endif
+
+#ifndef __ASSEMBLER__
+# define RTLD_SINGLE_THREAD_P \
+ __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
+ header.multiple_threads) == 0, 1)
+#endif
diff --git a/libc/nptl/sysdeps/x86_64/tls.h b/libc/nptl/sysdeps/x86_64/tls.h
index 65ff0639b..7618573e0 100644
--- a/libc/nptl/sysdeps/x86_64/tls.h
+++ b/libc/nptl/sysdeps/x86_64/tls.h
@@ -62,9 +62,6 @@ typedef struct
# error "TLS support is required."
#endif
-/* Signal that TLS support is available. */
-#define USE_TLS 1
-
/* Alignment requirement for the stack. */
#define STACK_ALIGN 16
diff --git a/libc/nptl/tst-tls5.h b/libc/nptl/tst-tls5.h
index b7c14eb82..9a76ab782 100644
--- a/libc/nptl/tst-tls5.h
+++ b/libc/nptl/tst-tls5.h
@@ -2,7 +2,7 @@
#include <stdlib.h>
#include <tls.h>
-#if USE_TLS && HAVE___THREAD
+#if HAVE___THREAD
struct tls_obj
{
diff --git a/libc/nptl_db/ChangeLog b/libc/nptl_db/ChangeLog
index 2bb82f488..3a8c3c68e 100644
--- a/libc/nptl_db/ChangeLog
+++ b/libc/nptl_db/ChangeLog
@@ -1,3 +1,12 @@
+2006-10-26 Pete Eberlein <eberlein@us.ibm.com>
+
+ * nptl_db/db_info.c [TLS_DTV_AT_TP]: Fixed size init for dtvp
+ to sizeof a pointer, instead of sizeof the union.
+
+2006-10-27 Ulrich Drepper <drepper@redhat.com>
+
+ * structs.def: USE_TLS support is now default.
+
2006-02-03 Roland McGrath <roland@redhat.com>
* structs.def: Add a descriptor for pointer.val field of dtv_t.
diff --git a/libc/nptl_db/db_info.c b/libc/nptl_db/db_info.c
index 5000b99ba..6d5eb4b1d 100644
--- a/libc/nptl_db/db_info.c
+++ b/libc/nptl_db/db_info.c
@@ -59,7 +59,7 @@ typedef struct link_map link_map;
i.e. at the very end of the area covered by TLS_PRE_TCB_SIZE. */
DESC (_thread_db_pthread_dtvp,
TLS_PRE_TCB_SIZE + offsetof (tcbhead_t, dtv)
- - (TLS_TCB_SIZE == 0 ? sizeof (tcbhead_t) : 0), union dtv)
+ - (TLS_TCB_SIZE == 0 ? sizeof (tcbhead_t) : 0), union dtv *)
#endif
diff --git a/libc/nptl_db/structs.def b/libc/nptl_db/structs.def
index 823af5cba..20fa01490 100644
--- a/libc/nptl_db/structs.def
+++ b/libc/nptl_db/structs.def
@@ -68,15 +68,11 @@ DB_STRUCT_FIELD (pthread_key_data, data)
DB_STRUCT (pthread_key_data_level2)
DB_STRUCT_ARRAY_FIELD (pthread_key_data_level2, data)
-#if USE_TLS
DB_STRUCT_FIELD (link_map, l_tls_modid)
-#endif
-#if !defined IS_IN_libpthread || USE_TLS
DB_STRUCT_ARRAY_FIELD (dtv, dtv)
-# define pointer_val pointer.val /* Field of anonymous struct in dtv_t. */
+#define pointer_val pointer.val /* Field of anonymous struct in dtv_t. */
DB_STRUCT_FIELD (dtv_t, pointer_val)
-#endif
#if !defined IS_IN_libpthread || TLS_TCB_AT_TP
DB_STRUCT_FIELD (pthread, dtvp)
#endif
diff --git a/libc/nscd/Makefile b/libc/nscd/Makefile
index 9c9801821..21657abeb 100644
--- a/libc/nscd/Makefile
+++ b/libc/nscd/Makefile
@@ -119,9 +119,7 @@ CFLAGS-initgrcache.c += $(nscd-cflags)
CFLAGS-gai.c += $(nscd-cflags)
ifeq (yesyes,$(have-fpie)$(build-shared))
-ifeq (yes,$(have-z-relro))
relro-LDFLAGS += -Wl,-z,now
-endif
$(objpfx)nscd: $(addprefix $(objpfx),$(nscd-modules:=.o))
$(LINK.o) -pie -Wl,-O1 $(nscd-cflags) \
diff --git a/libc/po/sv.po b/libc/po/sv.po
index 906b225d1..37a6af79b 100644
--- a/libc/po/sv.po
+++ b/libc/po/sv.po
@@ -1,13 +1,13 @@
# GNU libc message catalog for swedish
-# Copyright © 1996, 1998, 2001, 2002, 2003 Free Software Foundation, Inc.
+# Copyright © 1996, 1998, 2001, 2002, 2003, 2006 Free Software Foundation, Inc.
# Jan Djärv <jan.h.d@swipnet.se>, 1996, 1998, 2001, 2002, 2003, 2006.
-# Revision: 1.49
+# Revision: 1.51
#
msgid ""
msgstr ""
"Project-Id-Version: libc 2.5\n"
"POT-Creation-Date: 2006-09-29 11:38-0700\n"
-"PO-Revision-Date: 2006-10-09 20:38+0200\n"
+"PO-Revision-Date: 2006-11-01 08:40+0100\n"
"Last-Translator: Jan Djärv <jan.h.d@swipnet.se>\n"
"Language-Team: Swedish <tp-sv@listor.tp-sv.se>\n"
"MIME-Version: 1.0\n"
@@ -53,7 +53,9 @@ msgstr "Försök med \"%s --help\" eller \"%s --usage\" för mer information\n"
#: argp/argp-help.c:1671
#, c-format
msgid "Report bugs to %s.\n"
-msgstr "Rapportera fel till %s.\n"
+msgstr ""
+"Rapportera fel till %s.\n"
+"Rapportera fel eller synpunkter på översättningen till <tp-sv@listor.tp-sv.se>.\n"
#: argp/argp-parse.c:102
msgid "Give this help list"
@@ -286,7 +288,7 @@ msgstr "Försök med \"xtrace --help\" för mer information\\n"
#: debug/xtrace.sh:39
msgid "xtrace: option `$1' requires an argument.\\n"
-msgstr "xtrace: flaggan \"%s\" behöver ett argument\\n"
+msgstr "xtrace: flaggan \"$1\" behöver ett argument\\n"
#: debug/xtrace.sh:46
msgid ""
@@ -316,7 +318,8 @@ msgstr ""
"motsvarande korta.\n"
"\n"
"För felrapporteringsinstruktioner, se:\n"
-"<http://www.gnu.org/software/libc/bugs.html>."
+"<http://www.gnu.org/software/libc/bugs.html>.\n"
+"Rapportera fel eller synpunkter på översättningen till <tp-sv@listor.tp-sv.se>.\\n"
#: debug/xtrace.sh:125
msgid "xtrace: unrecognized option `$1'\\n"
@@ -484,7 +487,7 @@ msgstr "kan inte skapa kopia av RUNPATH/RPATH"
#: elf/dl-load.c:659
msgid "cannot create search path array"
-msgstr "kan inte skapa säkvägslista"
+msgstr "kan inte skapa sökvägslista"
#: elf/dl-load.c:870
msgid "cannot stat shared object"
@@ -548,7 +551,7 @@ msgstr "delat objekt kan inte göras dlopen() på"
#: elf/dl-load.c:1372
msgid "cannot allocate memory for program header"
-msgstr "Kan inte allokera minne för programhuvud"
+msgstr "kan inte allokera minne för programhuvud"
#: elf/dl-load.c:1389 elf/dl-open.c:174
msgid "invalid caller"
@@ -576,11 +579,11 @@ msgstr "ogiltigt ELF-huvud"
#: elf/dl-load.c:1704
msgid "ELF file data encoding not big-endian"
-msgstr "Kodning för ELF-fildata är inte \"big-endian\""
+msgstr "Kodning för ELF-fildata är inte rak byteordning"
#: elf/dl-load.c:1706
msgid "ELF file data encoding not little-endian"
-msgstr "Kodning för ELF-fildata är inte \"little-endian\""
+msgstr "Kodning för ELF-fildata är inte omvänd byteordning"
#: elf/dl-load.c:1710
msgid "ELF file version ident does not match current one"
@@ -718,11 +721,11 @@ msgstr "Generera inte länkar"
#: elf/ldconfig.c:137
msgid "Change to and use ROOT as root directory"
-msgstr "Byt till och använd ROOT som rotkatalog"
+msgstr "Byt till och använd ROT som rotkatalog"
#: elf/ldconfig.c:137
msgid "ROOT"
-msgstr "ROOT"
+msgstr "ROT"
#: elf/ldconfig.c:138
msgid "CACHE"
@@ -866,7 +869,7 @@ msgstr "bibliotek %s och %s i katalog %s har samma \"soname\" men olika typ."
#: elf/ldconfig.c:995
#, c-format
msgid "Can't open configuration file %s"
-msgstr "Kan inte öppna konfigurationsfil \"%s\""
+msgstr "Kan inte öppna konfigurationsfil %s"
#: elf/ldconfig.c:1059
#, c-format
@@ -881,7 +884,7 @@ msgstr "%s:%u: hwcap-index %lu är större än maximum %u"
#: elf/ldconfig.c:1072 elf/ldconfig.c:1080
#, c-format
msgid "%s:%u: hwcap index %lu already defined as %s"
-msgstr "%s:%u: hwcap-index %lu redan definierad som %s"
+msgstr "%s:%u: hwcap-index %lu redan definierat som %s"
#: elf/ldconfig.c:1083
#, c-format
diff --git a/libc/resolv/Versions b/libc/resolv/Versions
index 7016365be..5a350cae3 100644
--- a/libc/resolv/Versions
+++ b/libc/resolv/Versions
@@ -2,7 +2,7 @@
libc {
GLIBC_2.0 {
-%if !(USE_TLS && HAVE___THREAD)
+%if !HAVE___THREAD
# global variables
_h_errno;
%endif
@@ -17,7 +17,7 @@ libc {
# variables in normal name space
h_errlist; h_nerr;
-%if !(USE_TLS && HAVE___THREAD)
+%if !HAVE___THREAD
h_errno;
%endif
@@ -34,7 +34,7 @@ libc {
GLIBC_PRIVATE {
__gai_sigqueue;
-%if USE_TLS && HAVE___THREAD
+%if HAVE___THREAD
# This version is for the TLS symbol, GLIBC_2.0 is the old object symbol.
h_errno; __resp;
%endif
diff --git a/libc/stdlib/Makefile b/libc/stdlib/Makefile
index e632d3523..a0ff427b7 100644
--- a/libc/stdlib/Makefile
+++ b/libc/stdlib/Makefile
@@ -102,10 +102,6 @@ CFLAGS-strfmon.c = -D_IO_MTSAFE_IO
CFLAGS-strfmon_l.c = -D_IO_MTSAFE_IO
endif
-ifeq (yes,$(have-protected))
-CFLAGS-atexit.c = -DHAVE_DOT_HIDDEN
-endif
-
CFLAGS-tst-bsearch.c = $(stack-align-test-flags)
CFLAGS-tst-qsort.c = $(stack-align-test-flags)
diff --git a/libc/stdlib/atexit.c b/libc/stdlib/atexit.c
index 307662bdc..256c5fcfc 100644
--- a/libc/stdlib/atexit.c
+++ b/libc/stdlib/atexit.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1996, 1999, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1996, 1999, 2001, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -43,14 +43,11 @@ extern void *__dso_handle __attribute__ ((__weak__));
/* Register FUNC to be executed by `exit'. */
int
+#ifndef atexit
+attribute_hidden
+#endif
atexit (void (*func) (void))
{
return __cxa_atexit ((void (*) (void *)) func, NULL,
&__dso_handle == NULL ? NULL : __dso_handle);
}
-
-/* Hide the symbol so that no definition but the one locally in the
- executable or DSO is used. */
-#ifdef HAVE_DOT_HIDDEN
-asm (".hidden\tatexit");
-#endif
diff --git a/libc/stdlib/stdlib.h b/libc/stdlib/stdlib.h
index c3fc14562..7b39bc018 100644
--- a/libc/stdlib/stdlib.h
+++ b/libc/stdlib/stdlib.h
@@ -741,8 +741,7 @@ __END_NAMESPACE_STD
#ifdef __USE_GNU
/* Return a malloc'd string containing the canonical absolute name of the
- named file. The last file name component need not exist, and may be a
- symlink to a nonexistent file. */
+ existing named file. */
extern char *canonicalize_file_name (__const char *__name)
__THROW __nonnull ((1)) __wur;
#endif
diff --git a/libc/sunrpc/Makefile b/libc/sunrpc/Makefile
index bc826affd..30f74dc13 100644
--- a/libc/sunrpc/Makefile
+++ b/libc/sunrpc/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1994-2004, 2005 Free Software Foundation, Inc.
+# Copyright (C) 1994-2004, 2005, 2006 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
@@ -85,7 +85,7 @@ all: # Make this the default target; it will be defined in Rules.
include ../Makeconfig
-tests = tst-xdrmem
+tests = tst-xdrmem tst-xdrmem2
xtests := tst-getmyaddr
ifeq ($(have-thread-library),yes)
diff --git a/libc/sunrpc/tst-xdrmem2.c b/libc/sunrpc/tst-xdrmem2.c
new file mode 100644
index 000000000..eed8ccc07
--- /dev/null
+++ b/libc/sunrpc/tst-xdrmem2.c
@@ -0,0 +1,114 @@
+/* Copyright (C) 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jakub Jelinek <jakub@redhat.com>, 2006.
+
+ 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 <limits.h>
+#include <stdio.h>
+#include <string.h>
+#include <rpc/rpc.h>
+#include <sys/mman.h>
+#include <unistd.h>
+
+static int
+do_test (void)
+{
+ XDR xdrs;
+ void *buf;
+ size_t ps = sysconf (_SC_PAGESIZE);
+ uintptr_t half = -1;
+ int v_int;
+ u_short v_u_short;
+
+ half = (half >> 1) & ~(uintptr_t) (ps - 1);
+ buf = mmap ((void *) half, 2 * ps, PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_ANON, -1, 0);
+ if (buf == MAP_FAILED || buf != (void *) half)
+ {
+ puts ("Couldn't mmap 2 pages in the middle of address space");
+ return 0;
+ }
+
+ xdrmem_create (&xdrs, (char *) buf, 2 * ps, XDR_ENCODE);
+
+#define T(type, val) \
+ v_##type = val; \
+ if (! xdr_##type (&xdrs, &v_##type)) \
+ { \
+ puts ("encoding of " #type \
+ " " #val " failed"); \
+ return 1; \
+ }
+
+ T(int, 127)
+
+ u_int pos = xdr_getpos (&xdrs);
+
+ T(u_short, 31)
+
+ if (! xdr_setpos (&xdrs, pos))
+ {
+ puts ("xdr_setpos during encoding failed");
+ return 1;
+ }
+
+ T(u_short, 36)
+
+#undef T
+
+ xdr_destroy (&xdrs);
+
+ xdrmem_create (&xdrs, (char *) buf, 2 * ps, XDR_DECODE);
+
+#define T(type, val) \
+ v_##type = 0x15; \
+ if (! xdr_##type (&xdrs, &v_##type)) \
+ { \
+ puts ("decoding of " #type \
+ " " #val " failed"); \
+ return 1; \
+ } \
+ if (v_##type != val) \
+ { \
+ puts ("decoded value differs, " \
+ "type " #type " " #val); \
+ return 1; \
+ }
+
+ T(int, 127)
+
+ pos = xdr_getpos (&xdrs);
+
+ T(u_short, 36)
+
+ if (! xdr_setpos (&xdrs, pos))
+ {
+ puts ("xdr_setpos during encoding failed");
+ return 1;
+ }
+
+ T(u_short, 36)
+
+#undef T
+
+ xdr_destroy (&xdrs);
+
+ return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/libc/sunrpc/xdr_mem.c b/libc/sunrpc/xdr_mem.c
index e3167de04..7b1261bba 100644
--- a/libc/sunrpc/xdr_mem.c
+++ b/libc/sunrpc/xdr_mem.c
@@ -177,13 +177,15 @@ xdrmem_setpos (xdrs, pos)
{
caddr_t newaddr = xdrs->x_base + pos;
caddr_t lastaddr = xdrs->x_private + xdrs->x_handy;
+ size_t handy = lastaddr - newaddr;
- if ((long) newaddr > (long) lastaddr
- || (UINT_MAX < LONG_MAX
- && (long) UINT_MAX < (long) lastaddr - (long) newaddr))
+ if (newaddr > lastaddr
+ || newaddr < xdrs->x_base
+ || handy != (u_int) handy)
return FALSE;
+
xdrs->x_private = newaddr;
- xdrs->x_handy = (long) lastaddr - (long) newaddr;
+ xdrs->x_handy = (u_int) handy;
return TRUE;
}
diff --git a/libc/sysdeps/alpha/dl-machine.h b/libc/sysdeps/alpha/dl-machine.h
index 88c357ea0..29f500b2d 100644
--- a/libc/sysdeps/alpha/dl-machine.h
+++ b/libc/sysdeps/alpha/dl-machine.h
@@ -1,5 +1,5 @@
/* Machine-dependent ELF dynamic relocation inline functions. Alpha version.
- Copyright (C) 1996-2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1996-2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson <rth@tamu.edu>.
@@ -232,14 +232,14 @@ $fixup_stack: \n\
to one of the main executable's symbols, as for a COPY reloc.
This is unused on Alpha. */
-#if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD)
-#define elf_machine_type_class(type) \
+#if !defined RTLD_BOOTSTRAP || USE___THREAD
+# define elf_machine_type_class(type) \
(((type) == R_ALPHA_JMP_SLOT \
|| (type) == R_ALPHA_DTPMOD64 \
|| (type) == R_ALPHA_DTPREL64 \
|| (type) == R_ALPHA_TPREL64) * ELF_RTYPE_CLASS_PLT)
#else
-#define elf_machine_type_class(type) \
+# define elf_machine_type_class(type) \
(((type) == R_ALPHA_JMP_SLOT) * ELF_RTYPE_CLASS_PLT)
#endif
@@ -439,40 +439,40 @@ elf_machine_rela (struct link_map *map,
memcpy (reloc_addr_arg, &sym_value, 8);
}
#endif
-#if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD)
+#if !defined RTLD_BOOTSTRAP || USE___THREAD
else if (r_type == R_ALPHA_DTPMOD64)
{
-#ifdef RTLD_BOOTSTRAP
+# ifdef RTLD_BOOTSTRAP
/* During startup the dynamic linker is always index 1. */
*reloc_addr = 1;
-#else
+# else
/* Get the information from the link map returned by the
resolv function. */
if (sym_map != NULL)
*reloc_addr = sym_map->l_tls_modid;
-#endif
+# endif
}
else if (r_type == R_ALPHA_DTPREL64)
{
-#ifndef RTLD_BOOTSTRAP
+# ifndef RTLD_BOOTSTRAP
/* During relocation all TLS symbols are defined and used.
Therefore the offset is already correct. */
*reloc_addr = sym_raw_value;
-#endif
+# endif
}
else if (r_type == R_ALPHA_TPREL64)
{
-#ifdef RTLD_BOOTSTRAP
+# ifdef RTLD_BOOTSTRAP
*reloc_addr = sym_raw_value + map->l_tls_offset;
-#else
+# else
if (sym_map)
{
CHECK_STATIC_TLS (map, sym_map);
*reloc_addr = sym_raw_value + sym_map->l_tls_offset;
}
-#endif
+# endif
}
-#endif /* USE_TLS */
+#endif
else
_dl_reloc_bad_type (map, r_type, 0);
}
diff --git a/libc/sysdeps/alpha/libc-tls.c b/libc/sysdeps/alpha/libc-tls.c
index 24629e9ac..7e0276917 100644
--- a/libc/sysdeps/alpha/libc-tls.c
+++ b/libc/sysdeps/alpha/libc-tls.c
@@ -1,5 +1,5 @@
/* Thread-local storage handling in the ELF dynamic linker. Alpha version.
- Copyright (C) 2003, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -20,8 +20,6 @@
#include <csu/libc-tls.c>
#include <dl-tls.h>
-#if USE_TLS
-
/* On Alpha, linker optimizations are not required, so __tls_get_addr
can be called even in statically linked binaries. In this case module
must be always 1 and PT_TLS segment exist in the binary, otherwise it
@@ -33,5 +31,3 @@ __tls_get_addr (tls_index *ti)
dtv_t *dtv = THREAD_DTV ();
return (char *) dtv[1].pointer.val + ti->ti_offset;
}
-
-#endif
diff --git a/libc/sysdeps/generic/ldsodefs.h b/libc/sysdeps/generic/ldsodefs.h
index e9198bca0..dda91bb80 100644
--- a/libc/sysdeps/generic/ldsodefs.h
+++ b/libc/sysdeps/generic/ldsodefs.h
@@ -377,8 +377,6 @@ struct rtld_global
struct link_map *_ns_loaded;
/* Number of object in the _dl_loaded list. */
unsigned int _ns_nloaded;
- /* Array representing global scope. */
- struct r_scope_elem *_ns_global_scope[2];
/* Direct pointer to the searchlist of the main object. */
struct r_scope_elem *_ns_main_searchlist;
/* This is zero at program start to signal that the global scope map is
@@ -449,11 +447,6 @@ struct rtld_global
It returns an errno code or zero on success. */
EXTERN int (*_dl_make_stack_executable_hook) (void **) internal_function;
- /* Keep the conditional TLS members at the end so the layout of the
- structure used by !USE_TLS code matches the prefix of the layout in
- the USE_TLS rtld. Note that `struct link_map' is conditionally
- defined as well, so _dl_rtld_map needs to be last before this. */
-#ifdef USE_TLS
/* Highest dtv index currently needed. */
EXTERN size_t _dl_tls_max_dtv_idx;
/* Flag signalling whether there are gaps in the module ID allocation. */
@@ -481,10 +474,10 @@ struct rtld_global
/* Number of additional entries in the slotinfo array of each slotinfo
list element. A large number makes it almost certain take we never
have to iterate beyond the first element in the slotinfo list. */
-# define TLS_SLOTINFO_SURPLUS (62)
+#define TLS_SLOTINFO_SURPLUS (62)
/* Number of additional slots in the dtv allocated. */
-# define DTV_SURPLUS (14)
+#define DTV_SURPLUS (14)
/* Initial dtv of the main thread, not allocated with normal malloc. */
EXTERN void *_dl_initial_dtv;
@@ -492,23 +485,18 @@ struct rtld_global
EXTERN size_t _dl_tls_generation;
EXTERN void (*_dl_init_static_tls) (struct link_map *);
-#endif
#ifdef SHARED
};
# define __rtld_global_attribute__
# ifdef IS_IN_rtld
-# ifdef HAVE_VISIBILITY_ATTRIBUTE
-# ifdef HAVE_SDATA_SECTION
-# define __rtld_local_attribute__ \
+# ifdef HAVE_SDATA_SECTION
+# define __rtld_local_attribute__ \
__attribute__ ((visibility ("hidden"), section (".sdata")))
-# undef __rtld_global_attribute__
-# define __rtld_global_attribute__ __attribute__ ((section (".sdata")))
-# else
-# define __rtld_local_attribute__ __attribute__ ((visibility ("hidden")))
-# endif
+# undef __rtld_global_attribute__
+# define __rtld_global_attribute__ __attribute__ ((section (".sdata")))
# else
-# define __rtld_local_attribute__
+# define __rtld_local_attribute__ __attribute__ ((visibility ("hidden")))
# endif
extern struct rtld_global _rtld_local __rtld_local_attribute__;
# undef __rtld_local_attribute__
@@ -670,11 +658,7 @@ struct rtld_global_ro
};
# define __rtld_global_attribute__
# ifdef IS_IN_rtld
-# ifdef HAVE_VISIBILITY_ATTRIBUTE
-# define __rtld_local_attribute__ __attribute__ ((visibility ("hidden")))
-# else
-# define __rtld_local_attribute__
-# endif
+# define __rtld_local_attribute__ __attribute__ ((visibility ("hidden")))
extern struct rtld_global_ro _rtld_local_ro
attribute_relro __rtld_local_attribute__;
extern struct rtld_global_ro _rtld_global_ro
@@ -1039,9 +1023,7 @@ rtld_hidden_proto (_dl_allocate_tls_init)
extern void _dl_deallocate_tls (void *tcb, bool dealloc_tcb) internal_function;
rtld_hidden_proto (_dl_deallocate_tls)
-#if defined USE_TLS
extern void _dl_nothread_init_static_tls (struct link_map *) attribute_hidden;
-#endif
/* Find origin of the executable. */
extern const char *_dl_get_origin (void) attribute_hidden;
diff --git a/libc/sysdeps/generic/sysdep-cancel.h b/libc/sysdeps/generic/sysdep-cancel.h
index f07b784f2..ba6a1e04b 100644
--- a/libc/sysdeps/generic/sysdep-cancel.h
+++ b/libc/sysdeps/generic/sysdep-cancel.h
@@ -2,6 +2,7 @@
/* No multi-thread handling enabled. */
#define SINGLE_THREAD_P (1)
+#define RTLD_SINGLE_THREAD_P (1)
#define LIBC_CANCEL_ASYNC() 0 /* Just a dummy value. */
#define LIBC_CANCEL_RESET(val) ((void)(val)) /* Nothing, but evaluate it. */
#define LIBC_CANCEL_HANDLED() /* Nothing. */
diff --git a/libc/sysdeps/generic/tls.h b/libc/sysdeps/generic/tls.h
index 6a23ec05e..06e41ad12 100644
--- a/libc/sysdeps/generic/tls.h
+++ b/libc/sysdeps/generic/tls.h
@@ -1,5 +1,5 @@
/* Definition for thread-local data handling. Generic version.
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -17,11 +17,6 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-/* By default no TLS support is available. This is signaled by the
- absence of the symbol USE_TLS. */
-#undef USE_TLS
-
-
/* An architecture-specific version of this file has to defined a
number of symbols:
diff --git a/libc/sysdeps/gnu/netinet/tcp.h b/libc/sysdeps/gnu/netinet/tcp.h
index 87099ec14..2c04ec9b7 100644
--- a/libc/sysdeps/gnu/netinet/tcp.h
+++ b/libc/sysdeps/gnu/netinet/tcp.h
@@ -49,6 +49,7 @@
#define TCP_WINDOW_CLAMP 10 /* Bound advertised window */
#define TCP_INFO 11 /* Information about this connection. */
#define TCP_QUICKACK 12 /* Bock/reenable quick ACKs. */
+#define TCP_CONGESTION 13 /* Congestion control algorithm. */
#ifdef __USE_MISC
# include <sys/types.h>
diff --git a/libc/sysdeps/i386/dl-machine.h b/libc/sysdeps/i386/dl-machine.h
index df3edf546..04296d2a9 100644
--- a/libc/sysdeps/i386/dl-machine.h
+++ b/libc/sysdeps/i386/dl-machine.h
@@ -1,5 +1,5 @@
/* Machine-dependent ELF dynamic relocation inline functions. i386 version.
- Copyright (C) 1995-2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1995-2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -34,9 +34,7 @@ elf_machine_matches_host (const Elf32_Ehdr *ehdr)
}
-#if defined PI_STATIC_AND_HIDDEN \
- && defined HAVE_VISIBILITY_ATTRIBUTE && defined HAVE_HIDDEN \
- && !defined HAVE_BROKEN_VISIBILITY_ATTRIBUTE
+#ifdef PI_STATIC_AND_HIDDEN
/* Return the link-time address of _DYNAMIC. Conveniently, this is the
first element of the GOT, a special entry that is never relocated. */
@@ -244,7 +242,7 @@ _dl_start_user:\n\
define the value.
ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one
of the main executable's symbols, as for a COPY reloc. */
-#if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD)
+#if !defined RTLD_BOOTSTRAP || USE___THREAD
# define elf_machine_type_class(type) \
((((type) == R_386_JMP_SLOT || (type) == R_386_TLS_DTPMOD32 \
|| (type) == R_386_TLS_DTPOFF32 || (type) == R_386_TLS_TPOFF32 \
@@ -352,7 +350,7 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
*reloc_addr = value;
break;
-#if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD)
+#if !defined RTLD_BOOTSTRAP || USE___THREAD
case R_386_TLS_DTPMOD32:
# ifdef RTLD_BOOTSTRAP
/* During startup the dynamic linker is always the module
@@ -476,7 +474,6 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
*reloc_addr = (value + reloc->r_addend - (Elf32_Addr) reloc_addr);
break;
-# ifdef USE_TLS
case R_386_TLS_DTPMOD32:
/* Get the information from the link map returned by the
resolv function. */
@@ -513,7 +510,6 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
+ reloc->r_addend;
}
break;
-# endif /* use TLS */
case R_386_COPY:
if (sym == NULL)
/* This can happen in trace mode if an object could not be
diff --git a/libc/sysdeps/i386/i486/bits/atomic.h b/libc/sysdeps/i386/i486/bits/atomic.h
index 218656b2f..a27734c37 100644
--- a/libc/sysdeps/i386/i486/bits/atomic.h
+++ b/libc/sysdeps/i386/i486/bits/atomic.h
@@ -425,7 +425,7 @@ typedef uintmax_t uatomic_max_t;
"cmpl $0, %%gs:%P2\n\tje 0f\n\tlock\n0:\t"
#define catomic_decrement(mem) \
- __arch_increment_body (__arch_decrement_cprefix, __arch_c, mem)
+ __arch_decrement_body (__arch_decrement_cprefix, __arch_c, mem)
#define atomic_decrement_and_test(mem) \
diff --git a/libc/sysdeps/i386/i686/memcmp.S b/libc/sysdeps/i386/i686/memcmp.S
index 4bd5394be..113760d84 100644
--- a/libc/sysdeps/i386/i686/memcmp.S
+++ b/libc/sysdeps/i386/i686/memcmp.S
@@ -1,5 +1,5 @@
/* Compare two memory blocks for differences in the first COUNT bytes.
- Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -44,13 +44,9 @@
absolute address. */ \
addl (%ebx,INDEX,4), %ebx
-#ifdef HAVE_HIDDEN
.section .gnu.linkonce.t.__i686.get_pc_thunk.bx,"ax",@progbits
.globl __i686.get_pc_thunk.bx
.hidden __i686.get_pc_thunk.bx
-#else
- .text
-#endif
ALIGN (4)
.type __i686.get_pc_thunk.bx,@function
__i686.get_pc_thunk.bx:
diff --git a/libc/sysdeps/i386/sysdep.h b/libc/sysdeps/i386/sysdep.h
index 2739cb00b..e03a8e926 100644
--- a/libc/sysdeps/i386/sysdep.h
+++ b/libc/sysdeps/i386/sysdep.h
@@ -1,5 +1,6 @@
/* Assembler macros for i386.
- Copyright (C) 1991-93,95,96,98,2002,2003,2005 Free Software Foundation, Inc.
+ Copyright (C) 1991-93,95,96,98,2002,2003,2005,2006
+ Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -132,15 +133,7 @@ lose: SYSCALL_PIC_SETUP \
cfi_adjust_cfa_offset (-4); \
addl $_GLOBAL_OFFSET_TABLE+[.-0b], %ebx;
-# ifndef HAVE_HIDDEN
-# define SETUP_PIC_REG(reg) \
- call 1f; \
- .subsection 1; \
-1:movl (%esp), %e##reg; \
- ret; \
- .previous
-# else
-# define SETUP_PIC_REG(reg) \
+# define SETUP_PIC_REG(reg) \
.ifndef __i686.get_pc_thunk.reg; \
.section .gnu.linkonce.t.__i686.get_pc_thunk.reg,"ax",@progbits; \
.globl __i686.get_pc_thunk.reg; \
@@ -153,7 +146,6 @@ __i686.get_pc_thunk.reg: \
.previous; \
.endif; \
call __i686.get_pc_thunk.reg
-# endif
# define LOAD_PIC_REG(reg) \
SETUP_PIC_REG(reg); addl $_GLOBAL_OFFSET_TABLE_, %e##reg
diff --git a/libc/sysdeps/ia64/dl-machine.h b/libc/sysdeps/ia64/dl-machine.h
index 55349690e..61b4ea99a 100644
--- a/libc/sysdeps/ia64/dl-machine.h
+++ b/libc/sysdeps/ia64/dl-machine.h
@@ -1,5 +1,5 @@
/* Machine-dependent ELF dynamic relocation inline functions. IA-64 version.
- Copyright (C) 1995-1997, 2000-2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1995-1997, 2000-2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -311,7 +311,7 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
of the main executable's symbols, as for a COPY reloc, which we don't
use. */
/* ??? Ignore *MSB for now. */
-#if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD)
+#if !defined RTLD_BOOTSTRAP || USE___THREAD
#define elf_machine_type_class(type) \
(((type) == R_IA64_IPLTLSB || (type) == R_IA64_DTPMOD64LSB \
|| (type) == R_IA64_DTPREL64LSB || (type) == R_IA64_TPREL64LSB) \
@@ -432,7 +432,7 @@ elf_machine_rela (struct link_map *map,
value = _dl_make_fptr (sym_map, sym, value);
else if (R_IA64_TYPE (r_type) == R_IA64_TYPE (R_IA64_PCREL64LSB))
value -= (Elf64_Addr) reloc_addr & -16;
-#if defined USE_TLS && (!defined RTLD_BOOTSTRAP || defined USE___THREAD)
+#if !defined RTLD_BOOTSTRAP || defined USE___THREAD
else if (R_IA64_TYPE (r_type) == R_IA64_TYPE (R_IA64_DTPMOD64LSB))
# ifdef RTLD_BOOTSTRAP
/* During startup the dynamic linker is always index 1. */
diff --git a/libc/sysdeps/ia64/libc-tls.c b/libc/sysdeps/ia64/libc-tls.c
index 2c0eeae86..975128400 100644
--- a/libc/sysdeps/ia64/libc-tls.c
+++ b/libc/sysdeps/ia64/libc-tls.c
@@ -1,5 +1,5 @@
/* Thread-local storage handling in the ELF dynamic linker. IA-64 version.
- Copyright (C) 2003, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -19,8 +19,6 @@
#include <csu/libc-tls.c>
-#if USE_TLS
-
/* On IA-64, as it lacks linker optimizations, __tls_get_addr can be
called even in statically linked binaries.
In this case module must be always 1 and PT_TLS segment
@@ -32,5 +30,3 @@ __tls_get_addr (size_t m, size_t offset)
dtv_t *dtv = THREAD_DTV ();
return (char *) dtv[1].pointer.val + offset;
}
-
-#endif
diff --git a/libc/sysdeps/mach/hurd/fork.c b/libc/sysdeps/mach/hurd/fork.c
index fa7da6020..3288f186e 100644
--- a/libc/sysdeps/mach/hurd/fork.c
+++ b/libc/sysdeps/mach/hurd/fork.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1994,1995,1996,1997,1999,2001,2002,2004,2005
+/* Copyright (C) 1994,1995,1996,1997,1999,2001,2002,2004,2005,2006
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -532,11 +532,9 @@ __fork (void)
/* Set the child user thread up to return 1 from the setjmp above. */
_hurd_longjmp_thread_state (&state, env, 1);
-#if USE_TLS
/* Do special thread setup for TLS if needed. */
if (err = _hurd_tls_fork (thread, &state))
LOSE;
-#endif
if (err = __thread_set_state (thread, MACHINE_THREAD_STATE_FLAVOR,
(natural_t *) &state, statecount))
diff --git a/libc/sysdeps/mach/hurd/i386/tls.h b/libc/sysdeps/mach/hurd/i386/tls.h
index 223a47d2f..972cac57a 100644
--- a/libc/sysdeps/mach/hurd/i386/tls.h
+++ b/libc/sysdeps/mach/hurd/i386/tls.h
@@ -1,5 +1,5 @@
/* Definitions for thread-local data handling. Hurd/i386 version.
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -25,9 +25,6 @@
/* Some things really need not be machine-dependent. */
# include <sysdeps/mach/hurd/tls.h>
-/* Indiciate that TLS support is available. */
-# define USE_TLS 1
-
/* The TCB can have any size and the memory following the address the
thread pointer points to is unspecified. Allocate the TCB there. */
# define TLS_TCB_AT_TP 1
diff --git a/libc/sysdeps/powerpc/fpu/bits/mathinline.h b/libc/sysdeps/powerpc/fpu/bits/mathinline.h
index aed899e88..04478309d 100644
--- a/libc/sysdeps/powerpc/fpu/bits/mathinline.h
+++ b/libc/sysdeps/powerpc/fpu/bits/mathinline.h
@@ -121,62 +121,4 @@ __NTH (fdimf (float __x, float __y))
#endif /* __USE_ISOC99 */
#endif /* !__NO_MATH_INLINES && __OPTIMIZE__ */
-
-/* This code is used internally in the GNU libc. */
-#ifdef __LIBC_INTERNAL_MATH_INLINES
-
-#include <sysdep.h>
-#include <ldsodefs.h>
-#include <dl-procinfo.h>
-
-# if __WORDSIZE == 64 || defined _ARCH_PWR4
-# define __CPU_HAS_FSQRT 1
-# else
-# define __CPU_HAS_FSQRT ((GLRO(dl_hwcap) & PPC_FEATURE_64) != 0)
-# endif
-
-extern double __slow_ieee754_sqrt (double);
-__MATH_INLINE double
-__NTH (__ieee754_sqrt (double __x))
-{
- double __z;
-
- /* If the CPU is 64-bit we can use the optional FP instructions. */
- if (__CPU_HAS_FSQRT)
- {
- /* Volatile is required to prevent the compiler from moving the
- fsqrt instruction above the branch. */
- __asm __volatile (
- " fsqrt %0,%1\n"
- : "=f" (__z)
- : "f" (__x));
- }
- else
- __z = __slow_ieee754_sqrt(__x);
-
- return __z;
-}
-
-extern float __slow_ieee754_sqrtf (float);
-__MATH_INLINE float
-__NTH (__ieee754_sqrtf (float __x))
-{
- float __z;
-
- /* If the CPU is 64-bit we can use the optional FP instructions. */
- if (__CPU_HAS_FSQRT)
- {
- /* Volatile is required to prevent the compiler from moving the
- fsqrts instruction above the branch. */
- __asm __volatile (
- " fsqrts %0,%1\n"
- : "=f" (__z)
- : "f" (__x));
- }
- else
- __z = __slow_ieee754_sqrtf(__x);
-
- return __z;
-}
-#endif /* __LIBC_INTERNAL_MATH_INLINES */
#endif /* __GNUC__ && !_SOFT_FLOAT */
diff --git a/libc/sysdeps/powerpc/fpu/math_private.h b/libc/sysdeps/powerpc/fpu/math_private.h
new file mode 100644
index 000000000..90021c6d3
--- /dev/null
+++ b/libc/sysdeps/powerpc/fpu/math_private.h
@@ -0,0 +1,83 @@
+/* Private inline math functions for powerpc.
+ Copyright (C) 2006
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ 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., 51 Franklin St - Fifth Floor, Boston,
+ MA 02110-1301 USA */
+
+#ifndef _PPC_MATH_PRIVATE_H_
+#define _PPC_MATH_PRIVATE_H_
+
+#include <sysdep.h>
+#include <ldsodefs.h>
+#include <dl-procinfo.h>
+
+# if __WORDSIZE == 64 || defined _ARCH_PWR4
+# define __CPU_HAS_FSQRT 1
+# else
+# define __CPU_HAS_FSQRT ((GLRO(dl_hwcap) & PPC_FEATURE_64) != 0)
+# endif
+
+# ifndef __LIBC_INTERNAL_MATH_INLINES
+extern double __slow_ieee754_sqrt (double);
+__inline double
+__ieee754_sqrt (double __x)
+{
+ double __z;
+
+ /* If the CPU is 64-bit we can use the optional FP instructions. */
+ if (__CPU_HAS_FSQRT)
+ {
+ /* Volatile is required to prevent the compiler from moving the
+ fsqrt instruction above the branch. */
+ __asm __volatile (
+ " fsqrt %0,%1\n"
+ : "=f" (__z)
+ : "f" (__x));
+ }
+ else
+ __z = __slow_ieee754_sqrt(__x);
+
+ return __z;
+}
+
+extern float __slow_ieee754_sqrtf (float);
+
+__inline float
+__ieee754_sqrtf (float __x)
+{
+ float __z;
+
+ /* If the CPU is 64-bit we can use the optional FP instructions. */
+ if (__CPU_HAS_FSQRT)
+ {
+ /* Volatile is required to prevent the compiler from moving the
+ fsqrts instruction above the branch. */
+ __asm __volatile (
+ " fsqrts %0,%1\n"
+ : "=f" (__z)
+ : "f" (__x));
+ }
+ else
+ __z = __slow_ieee754_sqrtf(__x);
+
+ return __z;
+}
+#endif /* __LIBC_INTERNAL_MATH_INLINES */
+
+#include <math/math_private.h>
+
+#endif /* _PPC_MATH_PRIVATE_H_ */
diff --git a/libc/sysdeps/powerpc/powerpc32/dl-machine.c b/libc/sysdeps/powerpc/powerpc32/dl-machine.c
index 4120a0238..fc460993b 100644
--- a/libc/sysdeps/powerpc/powerpc32/dl-machine.c
+++ b/libc/sysdeps/powerpc/powerpc32/dl-machine.c
@@ -1,5 +1,5 @@
/* Machine-dependent ELF dynamic relocation functions. PowerPC version.
- Copyright (C) 1995-2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1995-2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -564,13 +564,12 @@ __process_machine_rela (struct link_map *map,
}
break;
-#ifdef USE_TLS
#define CHECK_STATIC_TLS(map, sym_map) \
do { \
if (__builtin_expect ((sym_map)->l_tls_offset == NO_TLS_OFFSET, 0)) \
_dl_allocate_static_tls (sym_map); \
} while (0)
-# define DO_TLS_RELOC(suffix) \
+#define DO_TLS_RELOC(suffix) \
case R_PPC_DTPREL##suffix: \
/* During relocation all TLS symbols are defined and used. \
Therefore the offset is already correct. */ \
@@ -609,7 +608,6 @@ __process_machine_rela (struct link_map *map,
DO_TLS_RELOC (16_LO)
DO_TLS_RELOC (16_HI)
DO_TLS_RELOC (16_HA)
-#endif
default:
_dl_reloc_bad_type (map, rinfo, 0);
diff --git a/libc/sysdeps/powerpc/powerpc32/dl-machine.h b/libc/sysdeps/powerpc/powerpc32/dl-machine.h
index 496fa71ec..a50ffdd1c 100644
--- a/libc/sysdeps/powerpc/powerpc32/dl-machine.h
+++ b/libc/sysdeps/powerpc/powerpc32/dl-machine.h
@@ -1,5 +1,5 @@
/* Machine-dependent ELF dynamic relocation inline functions. PowerPC version.
- Copyright (C) 1995-2002, 2003, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1995-2002, 2003, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -138,7 +138,7 @@ __elf_preferred_address(struct link_map *loader, size_t maplength,
/* We never want to use a PLT entry as the destination of a
reloc, when what is being relocated is a branch. This is
partly for efficiency, but mostly so we avoid loops. */
-#if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD)
+#if !defined RTLD_BOOTSTRAP || USE___THREAD
#define elf_machine_type_class(type) \
((((type) == R_PPC_JMP_SLOT \
|| (type) == R_PPC_REL24 \
@@ -330,7 +330,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
*reloc_addr = value;
break;
-#if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD) \
+#if (!defined RTLD_BOOTSTRAP || USE___THREAD) \
&& !defined RESOLVE_CONFLICT_FIND_MAP
# ifdef RTLD_BOOTSTRAP
# define NOT_BOOTSTRAP 0
@@ -361,7 +361,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
*reloc_addr = TLS_TPREL_VALUE (sym_map, sym, reloc);
}
break;
-#endif /* USE_TLS etc. */
+#endif
case R_PPC_JMP_SLOT:
#ifdef RESOLVE_CONFLICT_FIND_MAP
diff --git a/libc/sysdeps/powerpc/powerpc32/sysdep.h b/libc/sysdeps/powerpc/powerpc32/sysdep.h
index 8fc624ebd..88cfe71e0 100644
--- a/libc/sysdeps/powerpc/powerpc32/sysdep.h
+++ b/libc/sysdeps/powerpc/powerpc32/sysdep.h
@@ -96,7 +96,7 @@
#endif
#if defined SHARED && defined DO_VERSIONING && defined PIC \
- && !defined HAVE_BROKEN_ALIAS_ATTRIBUTE && !defined NO_HIDDEN
+ && !defined NO_HIDDEN
# undef HIDDEN_JUMPTARGET
# define HIDDEN_JUMPTARGET(name) __GI_##name##@local
#endif
diff --git a/libc/sysdeps/powerpc/powerpc64/dl-machine.h b/libc/sysdeps/powerpc/powerpc64/dl-machine.h
index cec271bb3..89a69e1a2 100644
--- a/libc/sysdeps/powerpc/powerpc64/dl-machine.h
+++ b/libc/sysdeps/powerpc/powerpc64/dl-machine.h
@@ -1,7 +1,6 @@
/* Machine-dependent ELF dynamic relocation inline functions.
PowerPC64 version.
- Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
- Free Software Foundation, Inc.
+ Copyright 1995-2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -260,7 +259,7 @@ BODY_PREFIX "_dl_start_user:\n" \
ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one
of the main executable's symbols, as for a COPY reloc. */
-#if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD)
+#if !defined RTLD_BOOTSTRAP || USE___THREAD
#define elf_machine_type_class(type) \
/* This covers all the TLS relocs, though most won't appear. */ \
(((((type) >= R_PPC64_DTPMOD64 && (type) <= R_PPC64_TPREL16_HIGHESTA) \
@@ -495,7 +494,7 @@ elf_machine_rela_relative (Elf64_Addr l_addr, const Elf64_Rela *reloc,
*reloc_addr = l_addr + reloc->r_addend;
}
-#if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD)
+#if !defined RTLD_BOOTSTRAP || USE___THREAD
/* This computes the value used by TPREL* relocs. */
auto inline Elf64_Addr __attribute__ ((always_inline, const))
elf_machine_tprel (struct link_map *map,
@@ -562,7 +561,7 @@ elf_machine_rela (struct link_map *map,
#endif
return;
-#if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD)
+#if !defined RTLD_BOOTSTRAP || USE___THREAD
case R_PPC64_DTPMOD64:
# ifdef RTLD_BOOTSTRAP
/* During startup the dynamic linker is always index 1. */
@@ -645,7 +644,7 @@ elf_machine_rela (struct link_map *map,
value = elf_machine_tprel (map, sym_map, sym, reloc);
*(Elf64_Half *) reloc_addr = PPC_HIGHESTA (value);
break;
-#endif /* USE_TLS etc. */
+#endif
#ifndef RTLD_BOOTSTRAP /* None of the following appear in ld.so */
case R_PPC64_ADDR16_LO_DS:
diff --git a/libc/sysdeps/s390/libc-tls.c b/libc/sysdeps/s390/libc-tls.c
index f177f436e..766d565a9 100644
--- a/libc/sysdeps/s390/libc-tls.c
+++ b/libc/sysdeps/s390/libc-tls.c
@@ -1,5 +1,5 @@
/* Thread-local storage handling in the ELF dynamic linker. S390 version.
- Copyright (C) 2003, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -20,11 +20,9 @@
#include <stdlib.h>
#include <csu/libc-tls.c>
-#if USE_TLS
-
/* On s390, the literal pool entry that refers to __tls_get_offset
is not removed, even if all branches that use the literal pool
- entry gets removed by TLS optimizations. To get binaries
+ entry gets removed by TLS optimizations. To get binaries
statically linked __tls_get_offset is defined here but
aborts if it is used. */
@@ -33,5 +31,3 @@ __tls_get_offset (size_t m, size_t offset)
{
abort ();
}
-
-#endif
diff --git a/libc/sysdeps/s390/s390-32/dl-machine.h b/libc/sysdeps/s390/s390-32/dl-machine.h
index 8bbf858fb..64bf3423b 100644
--- a/libc/sysdeps/s390/s390-32/dl-machine.h
+++ b/libc/sysdeps/s390/s390-32/dl-machine.h
@@ -1,5 +1,5 @@
/* Machine-dependent ELF dynamic relocation inline functions. S390 Version.
- Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005
+ Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
Contributed by Carl Pederson & Martin Schwidefsky.
This file is part of the GNU C Library.
@@ -209,17 +209,11 @@ _dl_start_user:\n\
define the value.
ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one
of the main executable's symbols, as for a COPY reloc. */
-#ifdef USE_TLS
-# define elf_machine_type_class(type) \
+#define elf_machine_type_class(type) \
((((type) == R_390_JMP_SLOT || (type) == R_390_TLS_DTPMOD \
|| (type) == R_390_TLS_DTPOFF || (type) == R_390_TLS_TPOFF) \
* ELF_RTYPE_CLASS_PLT) \
| (((type) == R_390_COPY) * ELF_RTYPE_CLASS_COPY))
-#else
-# define elf_machine_type_class(type) \
- ((((type) == R_390_JMP_SLOT) * ELF_RTYPE_CLASS_PLT) \
- | (((type) == R_390_COPY) * ELF_RTYPE_CLASS_COPY))
-#endif
/* A reloc type used for ld.so cmdline arg lookups to reject PLT entries. */
#define ELF_MACHINE_JMP_SLOT R_390_JMP_SLOT
@@ -315,7 +309,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
*reloc_addr = value + reloc->r_addend;
break;
-#if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD) \
+#if (!defined RTLD_BOOTSTRAP || USE___THREAD) \
&& !defined RESOLVE_CONFLICT_FIND_MAP
case R_390_TLS_DTPMOD:
# ifdef RTLD_BOOTSTRAP
diff --git a/libc/sysdeps/s390/s390-64/dl-machine.h b/libc/sysdeps/s390/s390-64/dl-machine.h
index 5026a2eda..fa893befd 100644
--- a/libc/sysdeps/s390/s390-64/dl-machine.h
+++ b/libc/sysdeps/s390/s390-64/dl-machine.h
@@ -1,6 +1,6 @@
/* Machine-dependent ELF dynamic relocation inline functions.
64 bit S/390 Version.
- Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2001-2005, 2006 Free Software Foundation, Inc.
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
This file is part of the GNU C Library.
@@ -192,17 +192,11 @@ _dl_start_user:\n\
define the value.
ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one
of the main executable's symbols, as for a COPY reloc. */
-#ifdef USE_TLS
-# define elf_machine_type_class(type) \
+#define elf_machine_type_class(type) \
((((type) == R_390_JMP_SLOT || (type) == R_390_TLS_DTPMOD \
|| (type) == R_390_TLS_DTPOFF || (type) == R_390_TLS_TPOFF) \
* ELF_RTYPE_CLASS_PLT) \
| (((type) == R_390_COPY) * ELF_RTYPE_CLASS_COPY))
-#else
-# define elf_machine_type_class(type) \
- ((((type) == R_390_JMP_SLOT) * ELF_RTYPE_CLASS_PLT) \
- | (((type) == R_390_COPY) * ELF_RTYPE_CLASS_COPY))
-#endif
/* A reloc type used for ld.so cmdline arg lookups to reject PLT entries. */
#define ELF_MACHINE_JMP_SLOT R_390_JMP_SLOT
@@ -294,7 +288,7 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc,
*reloc_addr = value + reloc->r_addend;
break;
-#if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD) \
+#if (!defined RTLD_BOOTSTRAP || USE___THREAD) \
&& !defined RESOLVE_CONFLICT_FIND_MAP
case R_390_TLS_DTPMOD:
# ifdef RTLD_BOOTSTRAP
diff --git a/libc/sysdeps/sh/dl-machine.h b/libc/sysdeps/sh/dl-machine.h
index e73c6d79c..78f70e388 100644
--- a/libc/sysdeps/sh/dl-machine.h
+++ b/libc/sysdeps/sh/dl-machine.h
@@ -1,5 +1,5 @@
/* Machine-dependent ELF dynamic relocation inline functions. SH version.
- Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
+ Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -208,7 +208,7 @@ __fpscr_values:\n\
define the value.
ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one
of the main executable's symbols, as for a COPY reloc. */
-#if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD)
+#if !defined RTLD_BOOTSTRAP || USE___THREAD
# define elf_machine_type_class(type) \
((((type) == R_SH_JMP_SLOT || (type) == R_SH_TLS_DTPMOD32 \
|| (type) == R_SH_TLS_DTPOFF32 || (type) == R_SH_TLS_TPOFF32) \
@@ -354,7 +354,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
/* These addresses are always aligned. */
*reloc_addr = value;
break;
-#if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD)
+#if !defined RTLD_BOOTSTRAP || USE___THREAD
/* XXX Remove TLS relocations which are not needed. */
case R_SH_TLS_DTPMOD32:
# ifdef RTLD_BOOTSTRAP
diff --git a/libc/sysdeps/sparc/sparc32/dl-machine.h b/libc/sysdeps/sparc/sparc32/dl-machine.h
index 02dabaabb..19aac6a7f 100644
--- a/libc/sysdeps/sparc/sparc32/dl-machine.h
+++ b/libc/sysdeps/sparc/sparc32/dl-machine.h
@@ -188,7 +188,7 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
PLT entries should not be allowed to define the value.
ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one
of the main executable's symbols, as for a COPY reloc. */
-#if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD)
+#if !defined RTLD_BOOTSTRAP || USE___THREAD
# define elf_machine_type_class(type) \
((((type) == R_SPARC_JMP_SLOT \
|| ((type) >= R_SPARC_TLS_GD_HI22 && (type) <= R_SPARC_TLS_TPOFF64)) \
@@ -459,7 +459,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
so we can optimize the first instruction of .plt out. */
sparc_fixup_plt (reloc, reloc_addr, value, 0);
break;
-#if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD) \
+#if (!defined RTLD_BOOTSTRAP || USE___THREAD) \
&& !defined RESOLVE_CONFLICT_FIND_MAP
case R_SPARC_TLS_DTPMOD32:
/* Get the information from the link map returned by the
diff --git a/libc/sysdeps/sparc/sparc64/dl-machine.h b/libc/sysdeps/sparc/sparc64/dl-machine.h
index 314a784db..3eee67291 100644
--- a/libc/sysdeps/sparc/sparc64/dl-machine.h
+++ b/libc/sysdeps/sparc/sparc64/dl-machine.h
@@ -240,7 +240,7 @@ elf_machine_plt_value (struct link_map *map, const Elf64_Rela *reloc,
PLT entries should not be allowed to define the value.
ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one
of the main executable's symbols, as for a COPY reloc. */
-#if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD)
+#if !defined RTLD_BOOTSTRAP || USE___THREAD
# define elf_machine_type_class(type) \
((((type) == R_SPARC_JMP_SLOT \
|| ((type) >= R_SPARC_TLS_GD_HI22 && (type) <= R_SPARC_TLS_TPOFF64)) \
@@ -589,7 +589,7 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc,
sparc64_fixup_plt (map, reloc, reloc_addr, value, reloc->r_addend, 0);
#endif
break;
-#if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD) \
+#if (!defined RTLD_BOOTSTRAP || USE___THREAD) \
&& !defined RESOLVE_CONFLICT_FIND_MAP
case R_SPARC_TLS_DTPMOD64:
/* Get the information from the link map returned by the
diff --git a/libc/sysdeps/unix/sysv/linux/i386/sigaction.c b/libc/sysdeps/unix/sysv/linux/i386/sigaction.c
index 299574dac..b5c1b9857 100644
--- a/libc/sysdeps/unix/sysv/linux/i386/sigaction.c
+++ b/libc/sysdeps/unix/sysv/linux/i386/sigaction.c
@@ -1,5 +1,5 @@
/* POSIX.1 `sigaction' call for Linux/i386.
- Copyright (C) 1991,1995-2000,2002-2004,2005 Free Software Foundation, Inc.
+ Copyright (C) 1991,1995-2000,2002-2005,2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -46,18 +46,10 @@ int __libc_missing_rt_sigs;
/* Using the hidden attribute here does not change the code but it
helps to avoid warnings. */
-#if defined HAVE_HIDDEN && defined HAVE_VISIBILITY_ATTRIBUTE \
- && !defined HAVE_BROKEN_VISIBILITY_ATTRIBUTE
-# ifdef __NR_rt_sigaction
+#ifdef __NR_rt_sigaction
extern void restore_rt (void) asm ("__restore_rt") attribute_hidden;
-# endif
-extern void restore (void) asm ("__restore") attribute_hidden;
-#else
-# ifdef __NR_rt_sigaction
-static void restore_rt (void) asm ("__restore_rt");
-# endif
-static void restore (void) asm ("__restore");
#endif
+extern void restore (void) asm ("__restore") attribute_hidden;
/* If ACT is not NULL, change the action for SIG to *ACT.
diff --git a/libc/sysdeps/unix/sysv/linux/i386/sysconf.c b/libc/sysdeps/unix/sysv/linux/i386/sysconf.c
index 25b9ba734..c9d7f77a0 100644
--- a/libc/sysdeps/unix/sysv/linux/i386/sysconf.c
+++ b/libc/sysdeps/unix/sysv/linux/i386/sysconf.c
@@ -97,7 +97,7 @@ static const struct intel_02_cache_info
{ 0x45, _SC_LEVEL2_CACHE_SIZE, 2097152, 4, 32 },
{ 0x46, _SC_LEVEL3_CACHE_SIZE, 4194304, 4, 64 },
{ 0x47, _SC_LEVEL3_CACHE_SIZE, 8388608, 8, 64 },
- { 0x49, _SC_LEVEL3_CACHE_SIZE, 4194304, 16, 64 },
+ { 0x49, _SC_LEVEL2_CACHE_SIZE, 4194304, 16, 64 },
{ 0x4a, _SC_LEVEL3_CACHE_SIZE, 6291456, 12, 64 },
{ 0x4b, _SC_LEVEL3_CACHE_SIZE, 8388608, 16, 64 },
{ 0x4c, _SC_LEVEL3_CACHE_SIZE, 12582912, 12, 64 },
@@ -166,6 +166,33 @@ intel_check_word (int name, unsigned int value, bool *has_level_2,
}
else
{
+ if (byte == 0x49 && folded_name == _SC_LEVEL3_CACHE_SIZE)
+ {
+ /* Intel reused this value. For family 15, model 6 it
+ specifies the 3rd level cache. Otherwise the 2nd
+ level cache. */
+ unsigned int eax;
+ unsigned int ebx;
+ unsigned int ecx;
+ unsigned int edx;
+ asm volatile ("xchgl %%ebx, %1; cpuid; xchgl %%ebx, %1"
+ : "=a" (eax), "=r" (ebx), "=c" (ecx), "=d" (edx)
+ : "0" (1));
+
+ unsigned int family = ((eax >> 20) & 0xff) + ((eax >> 8) & 0xf);
+ unsigned int model = ((((eax >>16) & 0xf) << 4)
+ + ((eax >> 4) & 0xf));
+ if (family == 15 && model == 6)
+ {
+ /* The level 3 cache is encoded for this model like
+ the level 2 cache is for other models. Pretend
+ the caller asked for the level 2 cache. */
+ name = (_SC_LEVEL2_CACHE_SIZE
+ + (name - _SC_LEVEL3_CACHE_SIZE));
+ folded_name = _SC_LEVEL3_CACHE_SIZE;
+ }
+ }
+
struct intel_02_cache_info *found;
struct intel_02_cache_info search;
diff --git a/libc/sysdeps/unix/sysv/linux/x86_64/sigaction.c b/libc/sysdeps/unix/sysv/linux/x86_64/sigaction.c
index d6f4558ce..b83e98a77 100644
--- a/libc/sysdeps/unix/sysv/linux/x86_64/sigaction.c
+++ b/libc/sysdeps/unix/sysv/linux/x86_64/sigaction.c
@@ -1,5 +1,5 @@
/* POSIX.1 `sigaction' call for Linux/x86-64.
- Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002, 2003, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -38,12 +38,7 @@
/* Using the hidden attribute here does not change the code but it
helps to avoid warnings. */
-#if defined HAVE_HIDDEN && defined HAVE_VISIBILITY_ATTRIBUTE \
- && !defined HAVE_BROKEN_VISIBILITY_ATTRIBUTE
extern void restore_rt (void) asm ("__restore_rt") attribute_hidden;
-#else
-static void restore_rt (void) asm ("__restore_rt");
-#endif
/* If ACT is not NULL, change the action for SIG to *ACT.
diff --git a/libc/sysdeps/unix/sysv/linux/x86_64/sysconf.c b/libc/sysdeps/unix/sysv/linux/x86_64/sysconf.c
index 726c5e33a..80c982aa3 100644
--- a/libc/sysdeps/unix/sysv/linux/x86_64/sysconf.c
+++ b/libc/sysdeps/unix/sysv/linux/x86_64/sysconf.c
@@ -58,7 +58,7 @@ static const struct intel_02_cache_info
{ 0x45, _SC_LEVEL2_CACHE_SIZE, 2097152, 4, 32 },
{ 0x46, _SC_LEVEL3_CACHE_SIZE, 4194304, 4, 64 },
{ 0x47, _SC_LEVEL3_CACHE_SIZE, 8388608, 8, 64 },
- { 0x49, _SC_LEVEL3_CACHE_SIZE, 4194304, 16, 64 },
+ { 0x49, _SC_LEVEL2_CACHE_SIZE, 4194304, 16, 64 },
{ 0x4a, _SC_LEVEL3_CACHE_SIZE, 6291456, 12, 64 },
{ 0x4b, _SC_LEVEL3_CACHE_SIZE, 8388608, 16, 64 },
{ 0x4c, _SC_LEVEL3_CACHE_SIZE, 12582912, 12, 64 },
@@ -127,6 +127,33 @@ intel_check_word (int name, unsigned int value, bool *has_level_2,
}
else
{
+ if (byte == 0x49 && folded_name == _SC_LEVEL3_CACHE_SIZE)
+ {
+ /* Intel reused this value. For family 15, model 6 it
+ specifies the 3rd level cache. Otherwise the 2nd
+ level cache. */
+ unsigned int eax;
+ unsigned int ebx;
+ unsigned int ecx;
+ unsigned int edx;
+ asm volatile ("xchgl %%ebx, %1; cpuid; xchgl %%ebx, %1"
+ : "=a" (eax), "=r" (ebx), "=c" (ecx), "=d" (edx)
+ : "0" (1));
+
+ unsigned int family = ((eax >> 20) & 0xff) + ((eax >> 8) & 0xf);
+ unsigned int model = ((((eax >>16) & 0xf) << 4)
+ + ((eax >> 4) & 0xf));
+ if (family == 15 && model == 6)
+ {
+ /* The level 3 cache is encoded for this model like
+ the level 2 cache is for other models. Pretend
+ the caller asked for the level 2 cache. */
+ name = (_SC_LEVEL2_CACHE_SIZE
+ + (name - _SC_LEVEL3_CACHE_SIZE));
+ folded_name = _SC_LEVEL3_CACHE_SIZE;
+ }
+ }
+
struct intel_02_cache_info *found;
struct intel_02_cache_info search;
diff --git a/libc/sysdeps/x86_64/bits/atomic.h b/libc/sysdeps/x86_64/bits/atomic.h
index e1981e94d..65d6b0200 100644
--- a/libc/sysdeps/x86_64/bits/atomic.h
+++ b/libc/sysdeps/x86_64/bits/atomic.h
@@ -81,8 +81,8 @@ typedef uintmax_t uatomic_max_t;
({ __typeof (*mem) ret; \
__asm __volatile (LOCK_PREFIX "cmpxchgq %q2, %1" \
: "=a" (ret), "=m" (*mem) \
- : "r" ((long) (newval)), "m" (*mem), \
- "0" ((long) (oldval))); \
+ : "r" ((long int) (newval)), "m" (*mem), \
+ "0" ((long int) (oldval))); \
ret; })
@@ -121,12 +121,13 @@ typedef uintmax_t uatomic_max_t;
#define __arch_c_compare_and_exchange_val_64_acq(mem, newval, oldval) \
({ __typeof (*mem) ret; \
- __asm __volatile ("cmpl $0, %%fs:%P5\n\t" \
- "je 0f\n\t" \
- "lock\n" \
+ __asm __volatile ("cmpl $0, %%fs:%P5\n\t" \
+ "je 0f\n\t" \
+ "lock\n" \
"0:\tcmpxchgq %q2, %1" \
: "=a" (ret), "=m" (*mem) \
- : "q" (newval), "m" (*mem), "0" (oldval), \
+ : "q" ((long int) (newval)), "m" (*mem), \
+ "0" ((long int)oldval), \
"i" (offsetof (tcbhead_t, multiple_threads))); \
ret; })
@@ -351,7 +352,7 @@ typedef uintmax_t uatomic_max_t;
"cmpl $0, %%fs:%P2\n\tje 0f\n\tlock\n0:\t"
#define catomic_decrement(mem) \
- __arch_increment_body (__arch_decrement_cprefix, mem)
+ __arch_decrement_body (__arch_decrement_cprefix, mem)
#define atomic_decrement_and_test(mem) \
diff --git a/libc/sysdeps/x86_64/dl-machine.h b/libc/sysdeps/x86_64/dl-machine.h
index 73e271775..31a7013d5 100644
--- a/libc/sysdeps/x86_64/dl-machine.h
+++ b/libc/sysdeps/x86_64/dl-machine.h
@@ -1,5 +1,5 @@
/* Machine-dependent ELF dynamic relocation inline functions. x86-64 version.
- Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2001-2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Jaeger <aj@suse.de>.
@@ -190,7 +190,7 @@ _dl_start_user:\n\
define the value.
ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one
of the main executable's symbols, as for a COPY reloc. */
-#if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD)
+#if !defined RTLD_BOOTSTRAP || USE___THREAD
# define elf_machine_type_class(type) \
((((type) == R_X86_64_JUMP_SLOT \
|| (type) == R_X86_64_DTPMOD64 \
@@ -300,7 +300,7 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc,
*reloc_addr = value + reloc->r_addend;
break;
-#if defined USE_TLS && !defined RESOLVE_CONFLICT_FIND_MAP
+#ifndef RESOLVE_CONFLICT_FIND_MAP
case R_X86_64_DTPMOD64:
# ifdef RTLD_BOOTSTRAP
/* During startup the dynamic linker is always the module
@@ -339,7 +339,7 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc,
- sym_map->l_tls_offset);
}
break;
-#endif /* use TLS */
+#endif
#ifndef RTLD_BOOTSTRAP
case R_X86_64_64:
diff --git a/libc/tls.make.c b/libc/tls.make.c
index 778d8ef0b..6bcd2479c 100644
--- a/libc/tls.make.c
+++ b/libc/tls.make.c
@@ -2,12 +2,6 @@
#include <tls.h>
-#if USE_TLS
-@@@ use-tls = yes @@@
-#else
-@@@ use-tls = no @@@
-#endif
-
#if USE___THREAD
@@@ use-thread = yes @@@
#else