[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commits] r22462 - in /fsf/trunk/libc: ./ catgets/ elf/ iconv/ include/ include/programs/ include/sys/ locale/programs/ misc/ misc/sys...
- To: commits@xxxxxxxxxx
- Subject: [Commits] r22462 - in /fsf/trunk/libc: ./ catgets/ elf/ iconv/ include/ include/programs/ include/sys/ locale/programs/ misc/ misc/sys...
- From: eglibc@xxxxxxxxxx
- Date: Tue, 19 Feb 2013 00:01:52 -0000
Author: eglibc
Date: Tue Feb 19 00:01:50 2013
New Revision: 22462
Log:
Import glibc-mainline for 2013-02-19
Added:
fsf/trunk/libc/include/programs/
fsf/trunk/libc/include/programs/xmalloc.h
fsf/trunk/libc/stdlib/cxa_thread_atexit_impl.c
fsf/trunk/libc/stdlib/tst-tls-atexit-lib.c
fsf/trunk/libc/stdlib/tst-tls-atexit.c
Modified:
fsf/trunk/libc/ChangeLog
fsf/trunk/libc/NEWS
fsf/trunk/libc/Versions.def
fsf/trunk/libc/catgets/gencat.c
fsf/trunk/libc/elf/Versions
fsf/trunk/libc/elf/dl-addr.c
fsf/trunk/libc/elf/dl-open.c
fsf/trunk/libc/elf/dl-sym.c
fsf/trunk/libc/elf/pldd.c
fsf/trunk/libc/iconv/iconv_charmap.c
fsf/trunk/libc/iconv/iconvconfig.c
fsf/trunk/libc/iconv/strtab.c
fsf/trunk/libc/include/link.h
fsf/trunk/libc/include/stdlib.h
fsf/trunk/libc/include/sys/cdefs.h
fsf/trunk/libc/locale/programs/locale.c
fsf/trunk/libc/locale/programs/localedef.h
fsf/trunk/libc/locale/programs/simple-hash.c
fsf/trunk/libc/misc/sys/cdefs.h
fsf/trunk/libc/misc/tst-pselect.c
fsf/trunk/libc/nptl/ChangeLog
fsf/trunk/libc/nptl/pthreadP.h
fsf/trunk/libc/nptl/pthread_cond_broadcast.c
fsf/trunk/libc/nptl/pthread_cond_signal.c
fsf/trunk/libc/nptl/pthread_cond_timedwait.c
fsf/trunk/libc/nptl/pthread_cond_wait.c
fsf/trunk/libc/nptl/pthread_create.c
fsf/trunk/libc/nptl/sysdeps/pthread/tst-timer.c
fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h
fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/s390/lowlevellock.h
fsf/trunk/libc/nptl/tst-barrier4.c
fsf/trunk/libc/nptl/tst-robust7.c
fsf/trunk/libc/nscd/nscd.h
fsf/trunk/libc/nss/makedb.c
fsf/trunk/libc/ports/ChangeLog.aarch64
fsf/trunk/libc/ports/ChangeLog.alpha
fsf/trunk/libc/ports/ChangeLog.arm
fsf/trunk/libc/ports/ChangeLog.ia64
fsf/trunk/libc/ports/ChangeLog.m68k
fsf/trunk/libc/ports/ChangeLog.mips
fsf/trunk/libc/ports/ChangeLog.powerpc
fsf/trunk/libc/ports/ChangeLog.tile
fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/aarch64/nptl/libc.abilist
fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/alpha/nptl/libc.abilist
fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/libc.abilist
fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h
fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/ia64/nptl/libc.abilist
fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/m68k/coldfire/nptl/libc.abilist
fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/m68k/m680x0/nptl/libc.abilist
fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/nptl/libc.abilist
fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/nptl/libc.abilist
fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/nptl/libc.abilist
fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libc.abilist
fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/nptl/libc.abilist
fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/nptl/libc.abilist
fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/tile/tilepro/nptl/libc.abilist
fsf/trunk/libc/stdlib/Makefile
fsf/trunk/libc/stdlib/Versions
fsf/trunk/libc/stdlib/exit.c
fsf/trunk/libc/stdlib/stdlib.h
fsf/trunk/libc/sysdeps/generic/ldconfig.h
fsf/trunk/libc/sysdeps/generic/ldsodefs.h
fsf/trunk/libc/sysdeps/s390/s390-64/dl-trampoline.S
fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/nptl/libc.abilist
fsf/trunk/libc/sysdeps/unix/sysv/linux/kernel-features.h
fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/nptl/libc.abilist
fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/nptl/libc.abilist
fsf/trunk/libc/sysdeps/unix/sysv/linux/s390/s390-32/nptl/libc.abilist
fsf/trunk/libc/sysdeps/unix/sysv/linux/s390/s390-64/nptl/libc.abilist
fsf/trunk/libc/sysdeps/unix/sysv/linux/sh/nptl/libc.abilist
fsf/trunk/libc/sysdeps/unix/sysv/linux/sparc/sparc32/nptl/libc.abilist
fsf/trunk/libc/sysdeps/unix/sysv/linux/sparc/sparc64/nptl/libc.abilist
fsf/trunk/libc/sysdeps/unix/sysv/linux/x86_64/64/nptl/libc.abilist
fsf/trunk/libc/sysdeps/unix/sysv/linux/x86_64/x32/nptl/libc.abilist
Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Tue Feb 19 00:01:50 2013
@@ -1,3 +1,81 @@
+2013-02-18 Mike Frysinger <vapier@xxxxxxxxxx>
+
+ * stdlib/stdlib.h (aligned_alloc): Use __attribute_malloc__
+ and __attribute_alloc_size__.
+
+2013-02-18 Mike Frysinger <vapier@xxxxxxxxxx>
+
+ * include/programs/xmalloc.h: Change __attribute_alloc_size to
+ __attribute_alloc_size__.
+ * include/sys/cdefs.h (__attribute_alloc_size): Macro removed.
+ * misc/sys/cdefs.h (__attribute_alloc_size__): New macro.
+
+2013-02-18 Mike Frysinger <vapier@xxxxxxxxxx>
+
+ * include/programs/xmalloc.h: New file.
+ * catgets/gencat.c: Include it.
+ (xmalloc, xcalloc, xrealloc, xstrdup): Don't declare them.
+ * elf/pldd.c: Likewise.
+ * iconv/iconv_charmap.c: Likewise.
+ * iconv/iconvconfig.c: Likewise.
+ * iconv/strtab.c: Likewise.
+ * locale/programs/locale.c: Likewise.
+ * locale/programs/localedef.h: Likewise.
+ * locale/programs/simple-hash.c: Likewise.
+ * nscd/nscd.h: Likewise.
+ * nss/makedb.c: Likewise.
+ * sysdeps/generic/ldconfig.h: Likewise.
+
+2013-02-18 Siddhesh Poyarekar <siddhesh@xxxxxxxxxx>
+
+ * Versions.def: Add GLIBC_2.18.
+ * include/link.h (struct link_map): New member l_tls_dtor_count.
+ * include/stdlib.h (__cxa_thread_atexit_impl): Declare.
+ (__call_tls_dtors): Likewise.
+ * sysdeps/unix/sysv/linux/i386/nptl/libc.abilist: Add
+ __cxa_thread_atexit_impl.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/nptl/libc.abilist:
+ Likewise.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc64/nptl/libc.abilist:
+ Likewise.
+ * sysdeps/unix/sysv/linux/s390/s390-32/nptl/libc.abilist:
+ Likewise.
+ * sysdeps/unix/sysv/linux/s390/s390-64/nptl/libc.abilist:
+ Likewise.
+ * sysdeps/unix/sysv/linux/sh/nptl/libc.abilist: Likewise.
+ * sysdeps/unix/sysv/linux/sparc/sparc32/nptl/libc.abilist:
+ Likewise.
+ * sysdeps/unix/sysv/linux/sparc/sparc64/nptl/libc.abilist:
+ Likewise.
+ * sysdeps/unix/sysv/linux/x86_64/64/nptl/libc.abilist: Likewise.
+ * sysdeps/unix/sysv/linux/x86_64/x32/nptl/libc.abilist:
+ Likewise.
+ * stdlib/Makefile (routines): Add __cxa_thread_atexit_impl.
+ (tests): Add test case tst-tls-atexit.
+ (modules-names): Add shared library for tst-tls-atexit.
+ * stdlib/Versions (GLIBC_2.17): Add __cxa_thread_atexit_impl.
+ (GLIBC_PRIVATE): Add __call_tls_dtors.
+ * stdlib/cxa_thread_atexit_impl.c: New file with helper function
+ for libstdc++.
+ * stdlib/exit.c (__run_exit_handlers): Call __call_tls_dtors.
+ * stdlib/tst-tls-atexit.c: New test case.
+ * stdlib/tst-tls-atexit-lib.c: New test case.
+
+ * misc/tst-pselect.c: Include stdlib.h for declaration of exit.
+
+ * elf/Versions (ld): Add _dl_find_dso_for_object.
+ * elf/dl-addr.c (_dl_addr): Use _dl_find_dso_for_object.
+ * elf/dl-open.c (_dl_find_dso_for_object): New function.
+ (dl_open_worker): Use _dl_find_dso_for_object.
+ * elf/dl-sym.c (do_sym): Likewise.
+ * sysdeps/generic/ldsodefs.h: Declare _dl_find_dso_for_object.
+
+2013-02-18 Andreas Krebbel <Andreas.Krebbel@xxxxxxxxxx>
+
+ * sysdeps/s390/s390-64/dl-trampoline.S (_dl_runtime_resolve):
+ Syntactic changes only.
+ (_dl_runtime_profile): Do a tail-call to the resolved function.
+
2013-02-17 Joseph Myers <joseph@xxxxxxxxxxxxxxxx>
[BZ #13550]
Modified: fsf/trunk/libc/NEWS
==============================================================================
--- fsf/trunk/libc/NEWS (original)
+++ fsf/trunk/libc/NEWS Tue Feb 19 00:01:50 2013
@@ -9,9 +9,9 @@
* The following bugs are resolved with this release:
- 11561, 13951, 14142, 14200, 14317, 14327, 14496, 14964, 14981, 14982,
- 14985, 14994, 14996, 15003, 15006, 15020, 15023, 15036, 15054, 15062,
- 15078.
+ 11561, 13951, 14142, 14200, 14317, 14327, 14496, 14920, 14964, 14981,
+ 14982, 14985, 14994, 14996, 15003, 15006, 15020, 15023, 15036, 15054,
+ 15062, 15078.
Version 2.17
Modified: fsf/trunk/libc/Versions.def
==============================================================================
--- fsf/trunk/libc/Versions.def (original)
+++ fsf/trunk/libc/Versions.def Tue Feb 19 00:01:50 2013
@@ -34,6 +34,7 @@
GLIBC_2.15
GLIBC_2.16
GLIBC_2.17
+ GLIBC_2.18
HURD_CTHREADS_0.3
%ifdef EXPORT_UNWIND_FIND_FDE
GCC_3.0
Modified: fsf/trunk/libc/catgets/gencat.c
==============================================================================
--- fsf/trunk/libc/catgets/gencat.c (original)
+++ fsf/trunk/libc/catgets/gencat.c Tue Feb 19 00:01:50 2013
@@ -137,13 +137,7 @@
/* Wrapper functions with error checking for standard functions. */
-extern void *xmalloc (size_t n)
- __attribute_malloc__ __attribute_alloc_size (1);
-extern void *xcalloc (size_t n, size_t s)
- __attribute_malloc__ __attribute_alloc_size (1, 2);
-extern void *xrealloc (void *o, size_t n)
- __attribute_malloc__ __attribute_alloc_size (2);
-extern char *xstrdup (const char *) __attribute_malloc__;
+#include <programs/xmalloc.h>
/* Prototypes for local functions. */
static void error_print (void);
Modified: fsf/trunk/libc/elf/Versions
==============================================================================
--- fsf/trunk/libc/elf/Versions (original)
+++ fsf/trunk/libc/elf/Versions Tue Feb 19 00:01:50 2013
@@ -51,8 +51,8 @@
# Those are in the dynamic linker, but used by libc.so.
__libc_enable_secure;
_dl_allocate_tls; _dl_allocate_tls_init;
- _dl_argv; _dl_get_tls_static_info; _dl_deallocate_tls;
- _dl_make_stack_executable; _dl_out_of_memory;
+ _dl_argv; _dl_find_dso_for_object; _dl_get_tls_static_info;
+ _dl_deallocate_tls; _dl_make_stack_executable; _dl_out_of_memory;
_dl_rtld_di_serinfo; _dl_starting_up; _dl_tls_setup;
_rtld_global; _rtld_global_ro;
Modified: fsf/trunk/libc/elf/dl-addr.c
==============================================================================
--- fsf/trunk/libc/elf/dl-addr.c (original)
+++ fsf/trunk/libc/elf/dl-addr.c Tue Feb 19 00:01:50 2013
@@ -130,18 +130,14 @@
/* Protect against concurrent loads and unloads. */
__rtld_lock_lock_recursive (GL(dl_load_lock));
- /* Find the highest-addressed object that ADDRESS is not below. */
- for (Lmid_t ns = 0; ns < GL(dl_nns); ++ns)
- for (struct link_map *l = GL(dl_ns)[ns]._ns_loaded; l; l = l->l_next)
- if (addr >= l->l_map_start && addr < l->l_map_end
- && (l->l_contiguous || _dl_addr_inside_object (l, addr)))
- {
- determine_info (addr, l, info, mapp, symbolp);
- result = 1;
- goto out;
- }
+ struct link_map *l = _dl_find_dso_for_object (addr);
- out:
+ if (l)
+ {
+ determine_info (addr, l, info, mapp, symbolp);
+ result = 1;
+ }
+
__rtld_lock_unlock_recursive (GL(dl_load_lock));
return result;
Modified: fsf/trunk/libc/elf/dl-open.c
==============================================================================
--- fsf/trunk/libc/elf/dl-open.c (original)
+++ fsf/trunk/libc/elf/dl-open.c Tue Feb 19 00:01:50 2013
@@ -165,6 +165,29 @@
return 0;
}
+/* Search link maps in all namespaces for the DSO that containes the object at
+ address ADDR. Returns the pointer to the link map of the matching DSO, or
+ NULL if a match is not found. */
+struct link_map *
+internal_function
+_dl_find_dso_for_object (const ElfW(Addr) addr)
+{
+ struct link_map *l;
+
+ /* Find the highest-addressed object that ADDR is not below. */
+ for (Lmid_t ns = 0; ns < GL(dl_nns); ++ns)
+ for (l = GL(dl_ns)[ns]._ns_loaded; l != NULL; l = l->l_next)
+ if (addr >= l->l_map_start && addr < l->l_map_end
+ && (l->l_contiguous
+ || _dl_addr_inside_object (l, (ElfW(Addr)) addr)))
+ {
+ assert (ns == l->l_ns);
+ return l;
+ }
+ return NULL;
+}
+rtld_hidden_def (_dl_find_dso_for_object);
+
static void
dl_open_worker (void *a)
{
@@ -194,20 +217,11 @@
call_map = GL(dl_ns)[LM_ID_BASE]._ns_loaded;
#endif
- struct link_map *l;
- for (Lmid_t ns = 0; ns < GL(dl_nns); ++ns)
- for (l = GL(dl_ns)[ns]._ns_loaded; l != NULL; l = l->l_next)
- if (caller_dlopen >= (const void *) l->l_map_start
- && caller_dlopen < (const void *) l->l_map_end
- && (l->l_contiguous
- || _dl_addr_inside_object (l, (ElfW(Addr)) caller_dlopen)))
- {
- assert (ns == l->l_ns);
- call_map = l;
- goto found_caller;
- }
-
- found_caller:
+ struct link_map *l = _dl_find_dso_for_object ((ElfW(Addr)) caller_dlopen);
+
+ if (l)
+ call_map = l;
+
if (args->nsid == __LM_ID_CALLER)
{
#ifndef SHARED
Modified: fsf/trunk/libc/elf/dl-sym.c
==============================================================================
--- fsf/trunk/libc/elf/dl-sym.c (original)
+++ fsf/trunk/libc/elf/dl-sym.c Tue Feb 19 00:01:50 2013
@@ -91,20 +91,10 @@
lookup_t result;
ElfW(Addr) caller = (ElfW(Addr)) who;
+ struct link_map *l = _dl_find_dso_for_object (caller);
/* If the address is not recognized the call comes from the main
program (we hope). */
- struct link_map *match = GL(dl_ns)[LM_ID_BASE]._ns_loaded;
-
- /* Find the highest-addressed object that CALLER is not below. */
- for (Lmid_t ns = 0; ns < GL(dl_nns); ++ns)
- for (struct link_map *l = GL(dl_ns)[ns]._ns_loaded; l != NULL;
- l = l->l_next)
- if (caller >= l->l_map_start && caller < l->l_map_end
- && (l->l_contiguous || _dl_addr_inside_object (l, caller)))
- {
- match = l;
- break;
- }
+ struct link_map *match = l ? l : GL(dl_ns)[LM_ID_BASE]._ns_loaded;
if (handle == RTLD_DEFAULT)
{
Modified: fsf/trunk/libc/elf/pldd.c
==============================================================================
--- fsf/trunk/libc/elf/pldd.c (original)
+++ fsf/trunk/libc/elf/pldd.c Tue Feb 19 00:01:50 2013
@@ -43,10 +43,7 @@
#define PACKAGE _libc_intl_domainname
/* External functions. */
-extern void *xmalloc (size_t n)
- __attribute_malloc__ __attribute_alloc_size (1);
-extern void *xrealloc (void *o, size_t n)
- __attribute_malloc__ __attribute_alloc_size (2);
+#include <programs/xmalloc.h>
/* Name and version of program. */
static void print_version (FILE *stream, struct argp_state *state);
Modified: fsf/trunk/libc/iconv/iconv_charmap.c
==============================================================================
--- fsf/trunk/libc/iconv/iconv_charmap.c (original)
+++ fsf/trunk/libc/iconv/iconv_charmap.c Tue Feb 19 00:01:50 2013
@@ -32,10 +32,7 @@
/* Prototypes for a few program-wide used functions. */
-extern void *xmalloc (size_t n)
- __attribute_malloc__ __attribute_alloc_size (1);
-extern void *xcalloc (size_t n, size_t s)
- __attribute_malloc__ __attribute_alloc_size (1, 2);
+#include <programs/xmalloc.h>
struct convtable
Modified: fsf/trunk/libc/iconv/iconvconfig.c
==============================================================================
--- fsf/trunk/libc/iconv/iconvconfig.c (original)
+++ fsf/trunk/libc/iconv/iconvconfig.c Tue Feb 19 00:01:50 2013
@@ -247,12 +247,7 @@
static const char gconv_module_ext[] = MODULE_EXT;
-extern void *xmalloc (size_t n)
- __attribute_malloc__ __attribute_alloc_size (1);
-extern void *xcalloc (size_t n, size_t s)
- __attribute_malloc__ __attribute_alloc_size (1, 2);
-extern void *xrealloc (void *o, size_t n)
- __attribute_malloc__ __attribute_alloc_size (2);
+#include <programs/xmalloc.h>
/* C string table handling. */
Modified: fsf/trunk/libc/iconv/strtab.c
==============================================================================
--- fsf/trunk/libc/iconv/strtab.c (original)
+++ fsf/trunk/libc/iconv/strtab.c Tue Feb 19 00:01:50 2013
@@ -65,8 +65,7 @@
static size_t ps;
-extern void *xmalloc (size_t n)
- __attribute_malloc__ __attribute_alloc_size (1);
+#include <programs/xmalloc.h>
/* Prototypes for our functions that are used from iconvconfig.c. If
you change these, change also iconvconfig.c. */
Modified: fsf/trunk/libc/include/link.h
==============================================================================
--- fsf/trunk/libc/include/link.h (original)
+++ fsf/trunk/libc/include/link.h Tue Feb 19 00:01:50 2013
@@ -302,6 +302,9 @@
/* Index of the module in the dtv array. */
size_t l_tls_modid;
+ /* Number of thread_local objects constructed by this DSO. */
+ size_t l_tls_dtor_count;
+
/* Information used to change permission after the relocations are
done. */
ElfW(Addr) l_relro_addr;
Added: fsf/trunk/libc/include/programs/xmalloc.h
==============================================================================
--- fsf/trunk/libc/include/programs/xmalloc.h (added)
+++ fsf/trunk/libc/include/programs/xmalloc.h Tue Feb 19 00:01:50 2013
@@ -1,0 +1,33 @@
+/* Memory related definitions for program modules.
+ Copyright (C) 1998-2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; version 2 of the License, or
+ (at your option) any later version.
+
+ This program 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 General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef _XMALLOC_H
+#define _XMALLOC_H 1
+
+#include <sys/cdefs.h>
+#include <stddef.h>
+
+/* Prototypes for a few program-wide used functions. */
+extern void *xmalloc (size_t n)
+ __attribute_malloc__ __attribute_alloc_size__ ((1));
+extern void *xcalloc (size_t n, size_t s)
+ __attribute_malloc__ __attribute_alloc_size__ ((1, 2));
+extern void *xrealloc (void *o, size_t n)
+ __attribute_malloc__ __attribute_alloc_size__ ((2));
+extern char *xstrdup (const char *) __attribute_malloc__;
+
+#endif /* xmalloc.h */
Modified: fsf/trunk/libc/include/stdlib.h
==============================================================================
--- fsf/trunk/libc/include/stdlib.h (original)
+++ fsf/trunk/libc/include/stdlib.h Tue Feb 19 00:01:50 2013
@@ -100,6 +100,11 @@
extern int __cxa_atexit_internal (void (*func) (void *), void *arg, void *d)
attribute_hidden;
+extern int __cxa_thread_atexit_impl (void (*func) (void *), void *arg,
+ void *d);
+extern void __call_tls_dtors (void);
+libc_hidden_proto (__call_tls_dtors);
+
extern void __cxa_finalize (void *d);
extern int __posix_memalign (void **memptr, size_t alignment, size_t size);
Modified: fsf/trunk/libc/include/sys/cdefs.h
==============================================================================
--- fsf/trunk/libc/include/sys/cdefs.h (original)
+++ fsf/trunk/libc/include/sys/cdefs.h Tue Feb 19 00:01:50 2013
@@ -13,8 +13,6 @@
libc_hidden_proto (__chk_fail)
rtld_hidden_proto (__chk_fail)
-
-# define __attribute_alloc_size(...) __attribute__ ((alloc_size (__VA_ARGS__)))
#endif
#endif
Modified: fsf/trunk/libc/locale/programs/locale.c
==============================================================================
--- fsf/trunk/libc/locale/programs/locale.c (original)
+++ fsf/trunk/libc/locale/programs/locale.c Tue Feb 19 00:01:50 2013
@@ -42,10 +42,7 @@
#include "localeinfo.h"
#include "charmap-dir.h"
#include "../locarchive.h"
-
-extern void *xmalloc (size_t n)
- __attribute_malloc__ __attribute_alloc_size (1);
-extern char *xstrdup (const char *) __attribute_malloc__;
+#include <programs/xmalloc.h>
#define ARCHIVE_NAME LOCALEDIR "/locale-archive"
Modified: fsf/trunk/libc/locale/programs/localedef.h
==============================================================================
--- fsf/trunk/libc/locale/programs/localedef.h (original)
+++ fsf/trunk/libc/locale/programs/localedef.h Tue Feb 19 00:01:50 2013
@@ -120,13 +120,7 @@
/* Prototypes for a few program-wide used functions. */
-extern void *xmalloc (size_t n)
- __attribute_malloc__ __attribute_alloc_size (1);
-extern void *xcalloc (size_t n, size_t s)
- __attribute_malloc__ __attribute_alloc_size (1, 2);
-extern void *xrealloc (void *o, size_t n)
- __attribute_malloc__ __attribute_alloc_size (2);
-extern char *xstrdup (const char *) __attribute_malloc__;
+#include <programs/xmalloc.h>
/* Wrapper to switch LC_CTYPE back to the locale specified in the
Modified: fsf/trunk/libc/locale/programs/simple-hash.c
==============================================================================
--- fsf/trunk/libc/locale/programs/simple-hash.c (original)
+++ fsf/trunk/libc/locale/programs/simple-hash.c Tue Feb 19 00:01:50 2013
@@ -52,10 +52,7 @@
#define hashval_t uint32_t
#include "hashval.h"
-extern void *xmalloc (size_t n)
- __attribute_malloc__ __attribute_alloc_size (1);
-extern void *xcalloc (size_t n, size_t s)
- __attribute_malloc__ __attribute_alloc_size (1, 2);
+#include <programs/xmalloc.h>
typedef struct hash_entry
{
Modified: fsf/trunk/libc/misc/sys/cdefs.h
==============================================================================
--- fsf/trunk/libc/misc/sys/cdefs.h (original)
+++ fsf/trunk/libc/misc/sys/cdefs.h Tue Feb 19 00:01:50 2013
@@ -212,6 +212,15 @@
# define __attribute_malloc__ __attribute__ ((__malloc__))
#else
# define __attribute_malloc__ /* Ignore */
+#endif
+
+/* Tell the compiler which arguments to an allocation function
+ indicate the size of the allocation. */
+#if __GNUC_PREREQ (4, 3)
+# define __attribute_alloc_size__(params) \
+ __attribute__ ((__alloc_size__ params))
+#else
+# define __attribute_alloc_size__(params) /* Ignore. */
#endif
/* At some point during the gcc 2.96 development the `pure' attribute
Modified: fsf/trunk/libc/misc/tst-pselect.c
==============================================================================
--- fsf/trunk/libc/misc/tst-pselect.c (original)
+++ fsf/trunk/libc/misc/tst-pselect.c Tue Feb 19 00:01:50 2013
@@ -4,6 +4,7 @@
#include <unistd.h>
#include <sys/select.h>
#include <sys/wait.h>
+#include <stdlib.h>
static volatile int handler_called;
Modified: fsf/trunk/libc/nptl/ChangeLog
==============================================================================
--- fsf/trunk/libc/nptl/ChangeLog (original)
+++ fsf/trunk/libc/nptl/ChangeLog Tue Feb 19 00:01:50 2013
@@ -1,3 +1,38 @@
+2013-02-18 Siddhesh Poyarekar <siddhesh@xxxxxxxxxx>
+
+ * sysdeps/pthread/tst-timer.c: Include stdlib.h for declaration
+ of exit.
+ * tst-barrier4.c: Likewise.
+ * tst-robust7.c: Likewise.
+
+ [BZ #14920]
+ * pthreadP.h (USE_REQUEUE_PI): New macro to check if mutex is
+ PI-aware.
+ * pthread_cond_broadcast.c (__pthread_cond_broadcast): Use
+ PI-aware futex operations if available and mutex is PI-aware.
+ * pthread_cond_signal.c (__pthread_cond_signal): Likewise.
+ * nptl/pthread_cond_timedwait.c (__pthread_cond_timedwait):
+ Likewise.
+ * pthread_cond_wait.c (__condvar_cleanup): Adjust lock if
+ cancellation occurred just after futex returned successfully
+ from a PI operation with the mutex held.
+ (__pthread_cond_wait): Use PI-aware futex operations if
+ available and mutex is PI-aware.
+ * sysdeps/unix/sysv/linux/powerpc/lowlevellock.h
+ (FUTEX_WAIT_REQUEUE_PI): Define.
+ (FUTEX_CMP_REQUEUE_PI): Likewise.
+ (lll_futex_wait_requeue_pi): Likewise.
+ (lll_futex_timed_wait_requeue_pi): Likewise.
+ (lll_futex_cmp_requeue_pi): Likewise.
+ * nptl/sysdeps/unix/sysv/linux/s390/lowlevellock.h
+ (FUTEX_WAIT_REQUEUE_PI): Define.
+ (FUTEX_CMP_REQUEUE_PI): Likewise.
+ (lll_futex_wait_requeue_pi): Likewise.
+ (lll_futex_timed_wait_requeue_pi): Likewise.
+ (lll_futex_cmp_requeue_pi): Likewise.
+ * sysdeps/unix/sysv/linux/kernel-features.h: Define
+ __ASSUME_REQUEUE_PI for Linux version higher than 2.6.31.
+
2013-02-04 Andreas Schwab <schwab@xxxxxxx>
[BZ #14142]
Modified: fsf/trunk/libc/nptl/pthreadP.h
==============================================================================
--- fsf/trunk/libc/nptl/pthreadP.h (original)
+++ fsf/trunk/libc/nptl/pthreadP.h Tue Feb 19 00:01:50 2013
@@ -577,4 +577,16 @@
# define PTHREAD_STATIC_FN_REQUIRE(name) __asm (".globl " #name);
#endif
+/* Test if the mutex is suitable for the FUTEX_WAIT_REQUEUE_PI operation. */
+#if (defined lll_futex_wait_requeue_pi \
+ && defined __ASSUME_REQUEUE_PI)
+# define USE_REQUEUE_PI(mut) \
+ ((mut) && (mut) != (void *) ~0l \
+ && (((mut)->__data.__kind \
+ & (PTHREAD_MUTEX_PRIO_INHERIT_NP | PTHREAD_MUTEX_ROBUST_NORMAL_NP)) \
+ == PTHREAD_MUTEX_PRIO_INHERIT_NP))
+#else
+# define USE_REQUEUE_PI(mut) 0
+#endif
+
#endif /* pthreadP.h */
Modified: fsf/trunk/libc/nptl/pthread_cond_broadcast.c
==============================================================================
--- fsf/trunk/libc/nptl/pthread_cond_broadcast.c (original)
+++ fsf/trunk/libc/nptl/pthread_cond_broadcast.c Tue Feb 19 00:01:50 2013
@@ -53,34 +53,37 @@
/* We are done. */
lll_unlock (cond->__data.__lock, pshared);
- /* Do not use requeue for pshared condvars. */
- if (cond->__data.__mutex == (void *) ~0l)
- goto wake_all;
-
/* Wake everybody. */
pthread_mutex_t *mut = (pthread_mutex_t *) cond->__data.__mutex;
- /* XXX: Kernel so far doesn't support requeue to PI futex. */
- /* XXX: Kernel so far can only requeue to the same type of futex,
- in this case private (we don't requeue for pshared condvars). */
- if (__builtin_expect (mut->__data.__kind
- & (PTHREAD_MUTEX_PRIO_INHERIT_NP
- | PTHREAD_MUTEX_PSHARED_BIT), 0))
+ /* Do not use requeue for pshared condvars. */
+ if (mut == (void *) ~0l
+ || PTHREAD_MUTEX_PSHARED (mut) & PTHREAD_MUTEX_PSHARED_BIT)
goto wake_all;
- /* lll_futex_requeue returns 0 for success and non-zero
- for errors. */
- if (__builtin_expect (lll_futex_requeue (&cond->__data.__futex, 1,
- INT_MAX, &mut->__data.__lock,
- futex_val, LLL_PRIVATE), 0))
+#if (defined lll_futex_cmp_requeue_pi \
+ && defined __ASSUME_REQUEUE_PI)
+ int pi_flag = PTHREAD_MUTEX_PRIO_INHERIT_NP | PTHREAD_MUTEX_ROBUST_NP;
+ pi_flag &= mut->__data.__kind;
+
+ if (pi_flag == PTHREAD_MUTEX_PRIO_INHERIT_NP)
{
- /* The requeue functionality is not available. */
- wake_all:
- lll_futex_wake (&cond->__data.__futex, INT_MAX, pshared);
+ if (lll_futex_cmp_requeue_pi (&cond->__data.__futex, 1, INT_MAX,
+ &mut->__data.__lock, futex_val,
+ LLL_PRIVATE) == 0)
+ return 0;
}
+ else
+#endif
+ /* lll_futex_requeue returns 0 for success and non-zero
+ for errors. */
+ if (!__builtin_expect (lll_futex_requeue (&cond->__data.__futex, 1,
+ INT_MAX, &mut->__data.__lock,
+ futex_val, LLL_PRIVATE), 0))
+ return 0;
- /* That's all. */
- return 0;
+wake_all:
+ lll_futex_wake (&cond->__data.__futex, INT_MAX, pshared);
}
/* We are done. */
Modified: fsf/trunk/libc/nptl/pthread_cond_signal.c
==============================================================================
--- fsf/trunk/libc/nptl/pthread_cond_signal.c (original)
+++ fsf/trunk/libc/nptl/pthread_cond_signal.c Tue Feb 19 00:01:50 2013
@@ -47,12 +47,35 @@
++cond->__data.__wakeup_seq;
++cond->__data.__futex;
- /* Wake one. */
- if (! __builtin_expect (lll_futex_wake_unlock (&cond->__data.__futex, 1,
- 1, &cond->__data.__lock,
- pshared), 0))
- return 0;
+#if (defined lll_futex_cmp_requeue_pi \
+ && defined __ASSUME_REQUEUE_PI)
+ int pi_flag = PTHREAD_MUTEX_PRIO_INHERIT_NP | PTHREAD_MUTEX_ROBUST_NP;
+ pthread_mutex_t *mut = cond->__data.__mutex;
+ /* Do not use requeue for pshared condvars. */
+ if (mut != (void *) ~0l)
+ pi_flag &= mut->__data.__kind;
+
+ if (__builtin_expect (pi_flag == PTHREAD_MUTEX_PRIO_INHERIT_NP, 0)
+ /* This can only really fail with a ENOSYS, since nobody can modify
+ futex while we have the cond_lock. */
+ && lll_futex_cmp_requeue_pi (&cond->__data.__futex, 1, 0,
+ &mut->__data.__lock,
+ cond->__data.__futex, pshared) == 0)
+ {
+ lll_unlock (cond->__data.__lock, pshared);
+ return 0;
+ }
+ else
+#endif
+ /* Wake one. */
+ if (! __builtin_expect (lll_futex_wake_unlock (&cond->__data.__futex,
+ 1, 1,
+ &cond->__data.__lock,
+ pshared), 0))
+ return 0;
+
+ /* Fallback if neither of them work. */
lll_futex_wake (&cond->__data.__futex, 1, pshared);
}
Modified: fsf/trunk/libc/nptl/pthread_cond_timedwait.c
==============================================================================
--- fsf/trunk/libc/nptl/pthread_cond_timedwait.c (original)
+++ fsf/trunk/libc/nptl/pthread_cond_timedwait.c Tue Feb 19 00:01:50 2013
@@ -63,6 +63,11 @@
int pshared = (cond->__data.__mutex == (void *) ~0l)
? LLL_SHARED : LLL_PRIVATE;
+
+#if (defined lll_futex_timed_wait_requeue_pi \
+ && defined __ASSUME_REQUEUE_PI)
+ int pi_flag = 0;
+#endif
/* Make sure we are alone. */
lll_lock (cond->__data.__lock, pshared);
@@ -155,17 +160,46 @@
/* Enable asynchronous cancellation. Required by the standard. */
cbuffer.oldtype = __pthread_enable_asynccancel ();
+/* REQUEUE_PI was implemented after FUTEX_CLOCK_REALTIME, so it is sufficient
+ to check just the former. */
+#if (defined lll_futex_timed_wait_requeue_pi \
+ && defined __ASSUME_REQUEUE_PI)
+ /* If pi_flag remained 1 then it means that we had the lock and the mutex
+ but a spurious waker raced ahead of us. Give back the mutex before
+ going into wait again. */
+ if (pi_flag)
+ {
+ __pthread_mutex_cond_lock_adjust (mutex);
+ __pthread_mutex_unlock_usercnt (mutex, 0);
+ }
+ pi_flag = USE_REQUEUE_PI (mutex);
+
+ if (pi_flag)
+ {
+ unsigned int clockbit = (cond->__data.__nwaiters & 1
+ ? 0 : FUTEX_CLOCK_REALTIME);
+ err = lll_futex_timed_wait_requeue_pi (&cond->__data.__futex,
+ futex_val, abstime, clockbit,
+ &mutex->__data.__lock,
+ pshared);
+ pi_flag = (err == 0);
+ }
+ else
+#endif
+
+ {
#if (!defined __ASSUME_FUTEX_CLOCK_REALTIME \
|| !defined lll_futex_timed_wait_bitset)
- /* Wait until woken by signal or broadcast. */
- err = lll_futex_timed_wait (&cond->__data.__futex,
- futex_val, &rt, pshared);
+ /* Wait until woken by signal or broadcast. */
+ err = lll_futex_timed_wait (&cond->__data.__futex,
+ futex_val, &rt, pshared);
#else
- unsigned int clockbit = (cond->__data.__nwaiters & 1
- ? 0 : FUTEX_CLOCK_REALTIME);
- err = lll_futex_timed_wait_bitset (&cond->__data.__futex, futex_val,
- abstime, clockbit, pshared);
-#endif
+ unsigned int clockbit = (cond->__data.__nwaiters & 1
+ ? 0 : FUTEX_CLOCK_REALTIME);
+ err = lll_futex_timed_wait_bitset (&cond->__data.__futex, futex_val,
+ abstime, clockbit, pshared);
+#endif
+ }
/* Disable asynchronous cancellation. */
__pthread_disable_asynccancel (cbuffer.oldtype);
@@ -217,7 +251,16 @@
__pthread_cleanup_pop (&buffer, 0);
/* Get the mutex before returning. */
- err = __pthread_mutex_cond_lock (mutex);
+#if (defined lll_futex_timed_wait_requeue_pi \
+ && defined __ASSUME_REQUEUE_PI)
+ if (pi_flag)
+ {
+ __pthread_mutex_cond_lock_adjust (mutex);
+ err = 0;
+ }
+ else
+#endif
+ err = __pthread_mutex_cond_lock (mutex);
return err ?: result;
}
Modified: fsf/trunk/libc/nptl/pthread_cond_wait.c
==============================================================================
--- fsf/trunk/libc/nptl/pthread_cond_wait.c (original)
+++ fsf/trunk/libc/nptl/pthread_cond_wait.c Tue Feb 19 00:01:50 2013
@@ -25,7 +25,6 @@
#include <shlib-compat.h>
#include <stap-probe.h>
-
struct _condvar_cleanup_buffer
{
@@ -85,8 +84,15 @@
lll_futex_wake (&cbuffer->cond->__data.__futex, INT_MAX, pshared);
/* Get the mutex before returning unless asynchronous cancellation
- is in effect. */
- __pthread_mutex_cond_lock (cbuffer->mutex);
+ is in effect. We don't try to get the mutex if we already own it. */
+ if (!(USE_REQUEUE_PI (cbuffer->mutex))
+ || ((cbuffer->mutex->__data.__lock & FUTEX_TID_MASK)
+ != THREAD_GETMEM (THREAD_SELF, tid)))
+ {
+ __pthread_mutex_cond_lock (cbuffer->mutex);
+ }
+ else
+ __pthread_mutex_cond_lock_adjust (cbuffer->mutex);
}
@@ -101,6 +107,11 @@
int pshared = (cond->__data.__mutex == (void *) ~0l)
? LLL_SHARED : LLL_PRIVATE;
+#if (defined lll_futex_wait_requeue_pi \
+ && defined __ASSUME_REQUEUE_PI)
+ int pi_flag = 0;
+#endif
+
LIBC_PROBE (cond_wait, 2, cond, mutex);
/* Make sure we are alone. */
@@ -144,15 +155,36 @@
do
{
unsigned int futex_val = cond->__data.__futex;
-
/* Prepare to wait. Release the condvar futex. */
lll_unlock (cond->__data.__lock, pshared);
/* Enable asynchronous cancellation. Required by the standard. */
cbuffer.oldtype = __pthread_enable_asynccancel ();
- /* Wait until woken by signal or broadcast. */
- lll_futex_wait (&cond->__data.__futex, futex_val, pshared);
+#if (defined lll_futex_wait_requeue_pi \
+ && defined __ASSUME_REQUEUE_PI)
+ /* If pi_flag remained 1 then it means that we had the lock and the mutex
+ but a spurious waker raced ahead of us. Give back the mutex before
+ going into wait again. */
+ if (pi_flag)
+ {
+ __pthread_mutex_cond_lock_adjust (mutex);
+ __pthread_mutex_unlock_usercnt (mutex, 0);
+ }
+ pi_flag = USE_REQUEUE_PI (mutex);
+
+ if (pi_flag)
+ {
+ err = lll_futex_wait_requeue_pi (&cond->__data.__futex,
+ futex_val, &mutex->__data.__lock,
+ pshared);
+
+ pi_flag = (err == 0);
+ }
+ else
+#endif
+ /* Wait until woken by signal or broadcast. */
+ lll_futex_wait (&cond->__data.__futex, futex_val, pshared);
/* Disable asynchronous cancellation. */
__pthread_disable_asynccancel (cbuffer.oldtype);
@@ -189,8 +221,17 @@
/* The cancellation handling is back to normal, remove the handler. */
__pthread_cleanup_pop (&buffer, 0);
- /* Get the mutex before returning. */
- return __pthread_mutex_cond_lock (mutex);
+ /* Get the mutex before returning. Not needed for PI. */
+#if (defined lll_futex_wait_requeue_pi \
+ && defined __ASSUME_REQUEUE_PI)
+ if (pi_flag)
+ {
+ __pthread_mutex_cond_lock_adjust (mutex);
+ return 0;
+ }
+ else
+#endif
+ return __pthread_mutex_cond_lock (mutex);
}
versioned_symbol (libpthread, __pthread_cond_wait, pthread_cond_wait,
Modified: fsf/trunk/libc/nptl/pthread_create.c
==============================================================================
--- fsf/trunk/libc/nptl/pthread_create.c (original)
+++ fsf/trunk/libc/nptl/pthread_create.c Tue Feb 19 00:01:50 2013
@@ -311,6 +311,9 @@
#endif
}
+ /* Call destructors for the thread_local TLS variables. */
+ __call_tls_dtors ();
+
/* Run the destructor for the thread-local data. */
__nptl_deallocate_tsd ();
Modified: fsf/trunk/libc/nptl/sysdeps/pthread/tst-timer.c
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/pthread/tst-timer.c (original)
+++ fsf/trunk/libc/nptl/sysdeps/pthread/tst-timer.c Tue Feb 19 00:01:50 2013
@@ -22,6 +22,7 @@
#include <stdio.h>
#include <time.h>
#include <unistd.h>
+#include <stdlib.h>
static void
Modified: fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h (original)
+++ fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h Tue Feb 19 00:01:50 2013
@@ -39,6 +39,8 @@
#define FUTEX_TRYLOCK_PI 8
#define FUTEX_WAIT_BITSET 9
#define FUTEX_WAKE_BITSET 10
+#define FUTEX_WAIT_REQUEUE_PI 11
+#define FUTEX_CMP_REQUEUE_PI 12
#define FUTEX_PRIVATE_FLAG 128
#define FUTEX_CLOCK_REALTIME 256
@@ -149,6 +151,34 @@
INTERNAL_SYSCALL_ERROR_P (__ret, __err); \
})
+/* Priority Inheritance support. */
+#define lll_futex_wait_requeue_pi(futexp, val, mutex, private) \
+ lll_futex_timed_wait_requeue_pi (futexp, val, NULL, 0, mutex, private)
+
+#define lll_futex_timed_wait_requeue_pi(futexp, val, timespec, clockbit, \
+ mutex, private) \
+ ({ \
+ INTERNAL_SYSCALL_DECL (__err); \
+ long int __ret; \
+ int __op = FUTEX_WAIT_REQUEUE_PI | clockbit; \
+ \
+ __ret = INTERNAL_SYSCALL (futex, __err, 5, (futexp), \
+ __lll_private_flag (__op, private), \
+ (val), (timespec), mutex); \
+ INTERNAL_SYSCALL_ERROR_P (__ret, __err) ? -__ret : __ret; \
+ })
+
+#define lll_futex_cmp_requeue_pi(futexp, nr_wake, nr_move, mutex, val, priv) \
+ ({ \
+ INTERNAL_SYSCALL_DECL (__err); \
+ long int __ret; \
+ \
+ __ret = INTERNAL_SYSCALL (futex, __err, 6, (futexp), \
+ __lll_private_flag (FUTEX_CMP_REQUEUE_PI, priv),\
+ (nr_wake), (nr_move), (mutex), (val)); \
+ INTERNAL_SYSCALL_ERROR_P (__ret, __err); \
+ })
+
#ifdef UP
# define __lll_acq_instr ""
Modified: fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/s390/lowlevellock.h
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/s390/lowlevellock.h (original)
+++ fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/s390/lowlevellock.h Tue Feb 19 00:01:50 2013
@@ -37,6 +37,8 @@
#define FUTEX_TRYLOCK_PI 8
#define FUTEX_WAIT_BITSET 9
#define FUTEX_WAKE_BITSET 10
+#define FUTEX_WAIT_REQUEUE_PI 11
+#define FUTEX_CMP_REQUEUE_PI 12
#define FUTEX_PRIVATE_FLAG 128
#define FUTEX_CLOCK_REALTIME 256
@@ -141,6 +143,32 @@
INTERNAL_SYSCALL_ERROR_P (__ret, __err); \
})
+/* Priority Inheritance support. */
+#define lll_futex_wait_requeue_pi(futexp, val, mutex, private) \
+ lll_futex_timed_wait_requeue_pi (futexp, val, NULL, 0, mutex, private)
+
+#define lll_futex_timed_wait_requeue_pi(futexp, val, timespec, clockbit, \
+ mutex, private) \
+ ({ \
+ INTERNAL_SYSCALL_DECL (__err); \
+ int __op = FUTEX_WAIT_REQUEUE_PI | clockbit; \
+ \
+ INTERNAL_SYSCALL (futex, __err, 5, (futexp), \
+ __lll_private_flag (__op, private), \
+ (val), (timespec), mutex); \
+ })
+
+#define lll_futex_cmp_requeue_pi(futexp, nr_wake, nr_move, mutex, val, priv) \
+ ({ \
+ INTERNAL_SYSCALL_DECL (__err); \
+ long int __ret; \
+ \
+ __ret = INTERNAL_SYSCALL (futex, __err, 6, (futexp), \
+ __lll_private_flag (FUTEX_CMP_REQUEUE_PI, priv),\
+ (nr_wake), (nr_move), (mutex), (val)); \
+ INTERNAL_SYSCALL_ERROR_P (__ret, __err); \
+ })
+
#define lll_compare_and_swap(futex, oldval, newval, operation) \
do { \
__typeof (futex) __futex = (futex); \
Modified: fsf/trunk/libc/nptl/tst-barrier4.c
==============================================================================
--- fsf/trunk/libc/nptl/tst-barrier4.c (original)
+++ fsf/trunk/libc/nptl/tst-barrier4.c Tue Feb 19 00:01:50 2013
@@ -20,6 +20,7 @@
#include <errno.h>
#include <pthread.h>
#include <stdio.h>
+#include <stdlib.h>
static pthread_barrier_t b1;
Modified: fsf/trunk/libc/nptl/tst-robust7.c
==============================================================================
--- fsf/trunk/libc/nptl/tst-robust7.c (original)
+++ fsf/trunk/libc/nptl/tst-robust7.c Tue Feb 19 00:01:50 2013
@@ -20,6 +20,7 @@
#include <pthread.h>
#include <stdbool.h>
#include <stdio.h>
+#include <stdlib.h>
static pthread_barrier_t b;
Modified: fsf/trunk/libc/nscd/nscd.h
==============================================================================
--- fsf/trunk/libc/nscd/nscd.h (original)
+++ fsf/trunk/libc/nscd/nscd.h Tue Feb 19 00:01:50 2013
@@ -200,12 +200,7 @@
/* Prototypes for global functions. */
/* Wrapper functions with error checking for standard functions. */
-extern void *xmalloc (size_t n)
- __attribute_malloc__ __attribute_alloc_size (1);
-extern void *xcalloc (size_t n, size_t s)
- __attribute_malloc__ __attribute_alloc_size (1, 2);
-extern void *xrealloc (void *o, size_t n)
- __attribute_malloc__ __attribute_alloc_size (2);
+#include <programs/xmalloc.h>
/* nscd.c */
extern void termination_handler (int signum) __attribute__ ((__noreturn__));
Modified: fsf/trunk/libc/nss/makedb.c
==============================================================================
--- fsf/trunk/libc/nss/makedb.c (original)
+++ fsf/trunk/libc/nss/makedb.c Tue Feb 19 00:01:50 2013
@@ -173,10 +173,7 @@
/* External functions. */
-extern void *xmalloc (size_t n)
- __attribute_malloc__ __attribute_alloc_size (1);
-extern void *xcalloc (size_t n, size_t s)
- __attribute_malloc__ __attribute_alloc_size (1, 2);
+#include <programs/xmalloc.h>
int
Modified: fsf/trunk/libc/ports/ChangeLog.aarch64
==============================================================================
--- fsf/trunk/libc/ports/ChangeLog.aarch64 (original)
+++ fsf/trunk/libc/ports/ChangeLog.aarch64 Tue Feb 19 00:01:50 2013
@@ -1,3 +1,8 @@
+2013-02-18 Siddhesh Poyarekar <siddhesh@xxxxxxxxxx>
+
+ * sysdeps/unix/sysv/linux/aarch64/nptl/libc.abilist: Add
+ __cxa_thread_atexit_impl.
+
2013-02-14 Marcus Shawcroft <marcus.shawcroft@xxxxxxxxxx>
* sysdeps/aarch64/libm-test-ulps: Regenerate.
Modified: fsf/trunk/libc/ports/ChangeLog.alpha
==============================================================================
--- fsf/trunk/libc/ports/ChangeLog.alpha (original)
+++ fsf/trunk/libc/ports/ChangeLog.alpha Tue Feb 19 00:01:50 2013
@@ -1,3 +1,8 @@
+2013-02-18 Siddhesh Poyarekar <siddhesh@xxxxxxxxxx>
+
+ * sysdeps/unix/sysv/linux/alpha/nptl/libc.abilist: Add
+ __cxa_thread_atexit_impl.
+
2013-02-14 Joseph Myers <joseph@xxxxxxxxxxxxxxxx>
[BZ #13550]
Modified: fsf/trunk/libc/ports/ChangeLog.arm
==============================================================================
--- fsf/trunk/libc/ports/ChangeLog.arm (original)
+++ fsf/trunk/libc/ports/ChangeLog.arm Tue Feb 19 00:01:50 2013
@@ -1,3 +1,18 @@
+2013-02-18 Joseph Myers <joseph@xxxxxxxxxxxxxxxx>
+
+ [BZ #14920]
+ * sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h
+ (FUTEX_WAIT_REQUEUE_PI): Define.
+ (FUTEX_CMP_REQUEUE_PI): Likewise.
+ (lll_futex_wait_requeue_pi): Likewise.
+ (lll_futex_timed_wait_requeue_pi): Likewise.
+ (lll_futex_cmp_requeue_pi): Likewise.
+
+2013-02-18 Siddhesh Poyarekar <siddhesh@xxxxxxxxxx>
+
+ * sysdeps/unix/sysv/linux/arm/nptl/libc.abilist: Add
+ __cxa_thread_atexit_impl.
+
2013-02-13 Joseph Myers <joseph@xxxxxxxxxxxxxxxx>
[BZ #13550]
Modified: fsf/trunk/libc/ports/ChangeLog.ia64
==============================================================================
--- fsf/trunk/libc/ports/ChangeLog.ia64 (original)
+++ fsf/trunk/libc/ports/ChangeLog.ia64 Tue Feb 19 00:01:50 2013
@@ -1,3 +1,8 @@
+2013-02-18 Siddhesh Poyarekar <siddhesh@xxxxxxxxxx>
+
+ * sysdeps/unix/sysv/linux/ia64/nptl/libc.abilist: Add
+ __cxa_thread_atexit_impl.
+
2013-02-08 Joseph Myers <joseph@xxxxxxxxxxxxxxxx>
[BZ #13550]
Modified: fsf/trunk/libc/ports/ChangeLog.m68k
==============================================================================
--- fsf/trunk/libc/ports/ChangeLog.m68k (original)
+++ fsf/trunk/libc/ports/ChangeLog.m68k Tue Feb 19 00:01:50 2013
@@ -1,3 +1,10 @@
+2013-02-18 Siddhesh Poyarekar <siddhesh@xxxxxxxxxx>
+
+ * sysdeps/unix/sysv/linux/m68k/coldfire/nptl/libc.abilist: Add
+ __cxa_thread_atexit_impl.
+ * sysdeps/unix/sysv/linux/m68k/m680x0/nptl/libc.abilist:
+ Likewise.
+
2013-02-08 Andreas Schwab <schwab@xxxxxxxxxxxxxx>
* sysdeps/unix/sysv/linux/m68k/kernel-features.h
Modified: fsf/trunk/libc/ports/ChangeLog.mips
==============================================================================
--- fsf/trunk/libc/ports/ChangeLog.mips (original)
+++ fsf/trunk/libc/ports/ChangeLog.mips Tue Feb 19 00:01:50 2013
@@ -1,3 +1,12 @@
+2013-02-18 Siddhesh Poyarekar <siddhesh@xxxxxxxxxx>
+
+ * sysdeps/unix/sysv/linux/mips/mips32/nptl/libc.abilist: Add
+ __cxa_thread_atexit_impl.
+ * sysdeps/unix/sysv/linux/mips/mips64/n32/nptl/libc.abilist:
+ Likewise.
+ * sysdeps/unix/sysv/linux/mips/mips64/n64/nptl/libc.abilist:
+ Likewise.
+
2013-02-13 Joseph Myers <joseph@xxxxxxxxxxxxxxxx>
[BZ #13550]
Modified: fsf/trunk/libc/ports/ChangeLog.powerpc
==============================================================================
--- fsf/trunk/libc/ports/ChangeLog.powerpc (original)
+++ fsf/trunk/libc/ports/ChangeLog.powerpc Tue Feb 19 00:01:50 2013
@@ -1,3 +1,10 @@
+2013-02-18 Siddhesh Poyarekar <siddhesh@xxxxxxxxxx>
+
+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libc.abilist:
+ Add __cxa_thread_atexit_impl.
+ * sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/nptl/libc.abilist:
+ Likewise.
+
2013-02-14 Joseph Myers <joseph@xxxxxxxxxxxxxxxx>
[BZ #13550]
Modified: fsf/trunk/libc/ports/ChangeLog.tile
==============================================================================
--- fsf/trunk/libc/ports/ChangeLog.tile (original)
+++ fsf/trunk/libc/ports/ChangeLog.tile Tue Feb 19 00:01:50 2013
@@ -1,3 +1,10 @@
+2013-02-18 Siddhesh Poyarekar <siddhesh@xxxxxxxxxx>
+
+ * sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/nptl/libc.abilist:
+ Add __cxa_thread_atexit_impl.
+ * sysdeps/unix/sysv/linux/tile/tilepro/nptl/libc.abilist:
+ Likewise.
+
2013-01-10 Chris Metcalf <cmetcalf@xxxxxxxxxx>
* sysdeps/unix/sysv/linux/tile/tilegx/ldd-rewrite.sed: New file.
Modified: fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/aarch64/nptl/libc.abilist
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/aarch64/nptl/libc.abilist (original)
+++ fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/aarch64/nptl/libc.abilist Tue Feb 19 00:01:50 2013
@@ -2077,3 +2077,6 @@
xencrypt F
xprt_register F
xprt_unregister F
+GLIBC_2.18
+ GLIBC_2.18 A
+ __cxa_thread_atexit_impl F
Modified: fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/alpha/nptl/libc.abilist
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/alpha/nptl/libc.abilist (original)
+++ fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/alpha/nptl/libc.abilist Tue Feb 19 00:01:50 2013
@@ -1819,6 +1819,9 @@
clock_nanosleep F
clock_settime F
secure_getenv F
+GLIBC_2.18
+ GLIBC_2.18 A
+ __cxa_thread_atexit_impl F
GLIBC_2.2
GLIBC_2.2 A
_IO_adjust_wcolumn F
Modified: fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/libc.abilist
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/libc.abilist (original)
+++ fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/libc.abilist Tue Feb 19 00:01:50 2013
@@ -86,6 +86,9 @@
clock_nanosleep F
clock_settime F
secure_getenv F
+GLIBC_2.18
+ GLIBC_2.18 A
+ __cxa_thread_atexit_impl F
GLIBC_2.4
GLIBC_2.4 A
_Exit F
Modified: fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h (original)
+++ fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h Tue Feb 19 00:01:50 2013
@@ -36,6 +36,8 @@
#define FUTEX_TRYLOCK_PI 8
#define FUTEX_WAIT_BITSET 9
#define FUTEX_WAKE_BITSET 10
+#define FUTEX_WAIT_REQUEUE_PI 11
+#define FUTEX_CMP_REQUEUE_PI 12
#define FUTEX_PRIVATE_FLAG 128
#define FUTEX_CLOCK_REALTIME 256
@@ -141,6 +143,32 @@
INTERNAL_SYSCALL_ERROR_P (__ret, __err); \
})
+/* Priority Inheritance support. */
+#define lll_futex_wait_requeue_pi(futexp, val, mutex, private) \
+ lll_futex_timed_wait_requeue_pi (futexp, val, NULL, 0, mutex, private)
+
+#define lll_futex_timed_wait_requeue_pi(futexp, val, timespec, clockbit, \
+ mutex, private) \
+ ({ \
+ INTERNAL_SYSCALL_DECL (__err); \
+ int __op = FUTEX_WAIT_REQUEUE_PI | clockbit; \
+ \
+ INTERNAL_SYSCALL (futex, __err, 5, (futexp), \
+ __lll_private_flag (__op, private), \
+ (val), (timespec), mutex); \
+ })
+
+#define lll_futex_cmp_requeue_pi(futexp, nr_wake, nr_move, mutex, val, priv) \
+ ({ \
+ INTERNAL_SYSCALL_DECL (__err); \
+ long int __ret; \
+ \
+ __ret = INTERNAL_SYSCALL (futex, __err, 6, (futexp), \
+ __lll_private_flag (FUTEX_CMP_REQUEUE_PI, priv),\
+ (nr_wake), (nr_move), (mutex), (val)); \
+ INTERNAL_SYSCALL_ERROR_P (__ret, __err); \
+ })
+
#define lll_trylock(lock) \
atomic_compare_and_exchange_val_acq(&(lock), 1, 0)
Modified: fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/ia64/nptl/libc.abilist
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/ia64/nptl/libc.abilist (original)
+++ fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/ia64/nptl/libc.abilist Tue Feb 19 00:01:50 2013
@@ -86,6 +86,9 @@
clock_nanosleep F
clock_settime F
secure_getenv F
+GLIBC_2.18
+ GLIBC_2.18 A
+ __cxa_thread_atexit_impl F
GLIBC_2.2
GLIBC_2.2 A
_Exit F
Modified: fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/m68k/coldfire/nptl/libc.abilist
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/m68k/coldfire/nptl/libc.abilist (original)
+++ fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/m68k/coldfire/nptl/libc.abilist Tue Feb 19 00:01:50 2013
@@ -87,6 +87,9 @@
clock_nanosleep F
clock_settime F
secure_getenv F
+GLIBC_2.18
+ GLIBC_2.18 A
+ __cxa_thread_atexit_impl F
GLIBC_2.4
GLIBC_2.4 A
_Exit F
Modified: fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/m68k/m680x0/nptl/libc.abilist
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/m68k/m680x0/nptl/libc.abilist (original)
+++ fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/m68k/m680x0/nptl/libc.abilist Tue Feb 19 00:01:50 2013
@@ -1775,6 +1775,9 @@
clock_nanosleep F
clock_settime F
secure_getenv F
+GLIBC_2.18
+ GLIBC_2.18 A
+ __cxa_thread_atexit_impl F
GLIBC_2.2
GLIBC_2.2 A
_IO_adjust_wcolumn F
Modified: fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/nptl/libc.abilist
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/nptl/libc.abilist (original)
+++ fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/nptl/libc.abilist Tue Feb 19 00:01:50 2013
@@ -2250,3 +2250,6 @@
clock_nanosleep F
clock_settime F
secure_getenv F
+GLIBC_2.18
+ GLIBC_2.18 A
+ __cxa_thread_atexit_impl F
Modified: fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/nptl/libc.abilist
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/nptl/libc.abilist (original)
+++ fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/nptl/libc.abilist Tue Feb 19 00:01:50 2013
@@ -1398,6 +1398,9 @@
clock_nanosleep F
clock_settime F
secure_getenv F
+GLIBC_2.18
+ GLIBC_2.18 A
+ __cxa_thread_atexit_impl F
GLIBC_2.2
GLIBC_2.2 A
_Exit F
Modified: fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/nptl/libc.abilist
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/nptl/libc.abilist (original)
+++ fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/nptl/libc.abilist Tue Feb 19 00:01:50 2013
@@ -1396,6 +1396,9 @@
clock_nanosleep F
clock_settime F
secure_getenv F
+GLIBC_2.18
+ GLIBC_2.18 A
+ __cxa_thread_atexit_impl F
GLIBC_2.2
GLIBC_2.2 A
_Exit F
Modified: fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libc.abilist
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libc.abilist (original)
+++ fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libc.abilist Tue Feb 19 00:01:50 2013
@@ -1781,6 +1781,9 @@
clock_nanosleep F
clock_settime F
secure_getenv F
+GLIBC_2.18
+ GLIBC_2.18 A
+ __cxa_thread_atexit_impl F
GLIBC_2.2
GLIBC_2.2 A
_IO_adjust_wcolumn F
Modified: fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/nptl/libc.abilist
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/nptl/libc.abilist (original)
+++ fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/nptl/libc.abilist Tue Feb 19 00:01:50 2013
@@ -2088,3 +2088,6 @@
clock_nanosleep F
clock_settime F
secure_getenv F
+GLIBC_2.18
+ GLIBC_2.18 A
+ __cxa_thread_atexit_impl F
Modified: fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/nptl/libc.abilist
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/nptl/libc.abilist (original)
+++ fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/nptl/libc.abilist Tue Feb 19 00:01:50 2013
@@ -2088,3 +2088,6 @@
clock_nanosleep F
clock_settime F
secure_getenv F
+GLIBC_2.18
+ GLIBC_2.18 A
+ __cxa_thread_atexit_impl F
Modified: fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/tile/tilepro/nptl/libc.abilist
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/tile/tilepro/nptl/libc.abilist (original)
+++ fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/tile/tilepro/nptl/libc.abilist Tue Feb 19 00:01:50 2013
@@ -2088,3 +2088,6 @@
clock_nanosleep F
clock_settime F
secure_getenv F
+GLIBC_2.18
+ GLIBC_2.18 A
+ __cxa_thread_atexit_impl F
Modified: fsf/trunk/libc/stdlib/Makefile
==============================================================================
--- fsf/trunk/libc/stdlib/Makefile (original)
+++ fsf/trunk/libc/stdlib/Makefile Tue Feb 19 00:01:50 2013
@@ -34,7 +34,7 @@
bsearch qsort msort \
getenv putenv setenv secure-getenv \
exit on_exit atexit cxa_atexit cxa_finalize old_atexit \
- quick_exit at_quick_exit cxa_at_quick_exit \
+ quick_exit at_quick_exit cxa_at_quick_exit cxa_thread_atexit_impl \
abs labs llabs \
div ldiv lldiv \
mblen mbstowcs mbtowc wcstombs wctomb \
@@ -71,8 +71,10 @@
tst-makecontext2 tst-strtod6 tst-unsetenv1 \
tst-makecontext3 bug-getcontext bug-fmtmsg1 \
tst-secure-getenv tst-strtod-overflow tst-strtod-round \
- tst-tininess tst-strtod-underflow
+ tst-tininess tst-strtod-underflow tst-tls-atexit
tests-static := tst-secure-getenv
+
+modules-names = tst-tls-atexit-lib
include ../Makeconfig
@@ -155,3 +157,9 @@
$(objpfx)tst-strtod-round: $(link-libm)
$(objpfx)tst-tininess: $(link-libm)
$(objpfx)tst-strtod-underflow: $(link-libm)
+
+tst-tls-atexit-lib.so-no-z-defs = yes
+
+LDFLAGS-tst-tls-atexit = $(common-objpfx)nptl/libpthread.so \
+ $(common-objpfx)dlfcn/libdl.so
+$(objpfx)tst-tls-atexit.out: $(objpfx)tst-tls-atexit-lib.so
Modified: fsf/trunk/libc/stdlib/Versions
==============================================================================
--- fsf/trunk/libc/stdlib/Versions (original)
+++ fsf/trunk/libc/stdlib/Versions Tue Feb 19 00:01:50 2013
@@ -106,6 +106,9 @@
GLIBC_2.17 {
secure_getenv;
}
+ GLIBC_2.18 {
+ __cxa_thread_atexit_impl;
+ }
GLIBC_PRIVATE {
# functions which have an additional interface since they are
# are cancelable.
@@ -114,5 +117,6 @@
__abort_msg;
# Used from other libraries
__libc_secure_getenv;
+ __call_tls_dtors;
}
}
Added: fsf/trunk/libc/stdlib/cxa_thread_atexit_impl.c
==============================================================================
--- fsf/trunk/libc/stdlib/cxa_thread_atexit_impl.c (added)
+++ fsf/trunk/libc/stdlib/cxa_thread_atexit_impl.c Tue Feb 19 00:01:50 2013
@@ -1,0 +1,102 @@
+/* Register destructors for C++ TLS variables declared with thread_local.
+ Copyright (C) 2012 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <stdlib.h>
+#include <ldsodefs.h>
+
+typedef void (*dtor_func) (void *);
+
+struct dtor_list
+{
+ dtor_func func;
+ void *obj;
+ struct link_map *map;
+ struct dtor_list *next;
+};
+
+static __thread struct dtor_list *tls_dtor_list;
+static __thread void *dso_symbol_cache;
+static __thread struct link_map *lm_cache;
+
+/* Register a destructor for TLS variables declared with the 'thread_local'
+ keyword. This function is only called from code generated by the C++
+ compiler. FUNC is the destructor function and OBJ is the object to be
+ passed to the destructor. DSO_SYMBOL is the __dso_handle symbol that each
+ DSO has at a unique address in its map, added from crtbegin.o during the
+ linking phase. */
+int
+__cxa_thread_atexit_impl (dtor_func func, void *obj, void *dso_symbol)
+{
+ /* Prepend. */
+ struct dtor_list *new = calloc (1, sizeof (struct dtor_list));
+ new->func = func;
+ new->obj = obj;
+ new->next = tls_dtor_list;
+ tls_dtor_list = new;
+
+ /* See if we already encountered the DSO. */
+ __rtld_lock_lock_recursive (GL(dl_load_lock));
+
+ if (__builtin_expect (dso_symbol_cache != dso_symbol, 0))
+ {
+ ElfW(Addr) caller = (ElfW(Addr)) dso_symbol;
+
+ struct link_map *l = _dl_find_dso_for_object (caller);
+
+ /* If the address is not recognized the call comes from the main
+ program (we hope). */
+ lm_cache = l ? l : GL(dl_ns)[LM_ID_BASE]._ns_loaded;
+ }
+ /* A destructor could result in a thread_local construction and the former
+ could have cleared the flag. */
+ if (lm_cache->l_type == lt_loaded && lm_cache->l_tls_dtor_count == 0)
+ lm_cache->l_flags_1 |= DF_1_NODELETE;
+
+ new->map = lm_cache;
+ new->map->l_tls_dtor_count++;
+
+ __rtld_lock_unlock_recursive (GL(dl_load_lock));
+
+ return 0;
+}
+
+/* Call the destructors. This is called either when a thread returns from the
+ initial function or when the process exits via the exit(3) function. */
+void
+__call_tls_dtors (void)
+{
+ while (tls_dtor_list)
+ {
+ struct dtor_list *cur = tls_dtor_list;
+ tls_dtor_list = tls_dtor_list->next;
+
+ cur->func (cur->obj);
+
+ __rtld_lock_lock_recursive (GL(dl_load_lock));
+
+ /* Allow DSO unload if count drops to zero. */
+ cur->map->l_tls_dtor_count--;
+ if (cur->map->l_tls_dtor_count == 0 && cur->map->l_type == lt_loaded)
+ cur->map->l_flags_1 &= ~DF_1_NODELETE;
+
+ __rtld_lock_unlock_recursive (GL(dl_load_lock));
+
+ free (cur);
+ }
+}
+libc_hidden_def (__call_tls_dtors)
Modified: fsf/trunk/libc/stdlib/exit.c
==============================================================================
--- fsf/trunk/libc/stdlib/exit.c (original)
+++ fsf/trunk/libc/stdlib/exit.c Tue Feb 19 00:01:50 2013
@@ -33,6 +33,9 @@
__run_exit_handlers (int status, struct exit_function_list **listp,
bool run_list_atexit)
{
+ /* First, call the TLS destructors. */
+ __call_tls_dtors ();
+
/* We do it this way to handle recursive calls to exit () made by
the functions registered with `atexit' and `on_exit'. We call
everyone on the list and use the status value in the last
Modified: fsf/trunk/libc/stdlib/stdlib.h
==============================================================================
--- fsf/trunk/libc/stdlib/stdlib.h (original)
+++ fsf/trunk/libc/stdlib/stdlib.h Tue Feb 19 00:01:50 2013
@@ -507,7 +507,7 @@
#ifdef __USE_ISOC11
/* ISO C variant of aligned allocation. */
extern void *aligned_alloc (size_t __alignment, size_t __size)
- __THROW __wur __attribute__ ((__malloc__, __alloc_size__ (2)));
+ __THROW __attribute_malloc__ __attribute_alloc_size__ ((2)) __wur;
#endif
__BEGIN_NAMESPACE_STD
Added: fsf/trunk/libc/stdlib/tst-tls-atexit-lib.c
==============================================================================
--- fsf/trunk/libc/stdlib/tst-tls-atexit-lib.c (added)
+++ fsf/trunk/libc/stdlib/tst-tls-atexit-lib.c Tue Feb 19 00:01:50 2013
@@ -1,0 +1,36 @@
+/* Verify that DSO is unloaded only if its TLS objects are destroyed - the DSO.
+ Copyright (C) 2012 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ 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, see
+ <http://www.gnu.org/licenses/>. */
+
+extern void *__dso_handle;
+
+typedef struct
+{
+ void *val;
+} A;
+
+/* We only care about the destructor. */
+void A_dtor (void *obj)
+{
+ ((A *)obj)->val = obj;
+}
+
+void do_foo (void)
+{
+ static __thread A b;
+ __cxa_thread_atexit_impl (A_dtor, &b, __dso_handle);
+}
Added: fsf/trunk/libc/stdlib/tst-tls-atexit.c
==============================================================================
--- fsf/trunk/libc/stdlib/tst-tls-atexit.c (added)
+++ fsf/trunk/libc/stdlib/tst-tls-atexit.c Tue Feb 19 00:01:50 2013
@@ -1,0 +1,111 @@
+/* Verify that DSO is unloaded only if its TLS objects are destroyed.
+ Copyright (C) 2012 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ 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, see
+ <http://www.gnu.org/licenses/>. */
+
+/* There are two tests in this test case. The first is implicit where it is
+ assumed that the destructor call on exit of the LOAD function does not
+ segfault. The other is a verification that after the thread has exited, a
+ dlclose will unload the DSO. */
+
+#include <dlfcn.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+
+void *handle;
+pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER;
+
+void *
+load (void *u)
+{
+ pthread_mutex_lock (&m);
+ handle = dlopen ("$ORIGIN/tst-tls-atexit-lib.so", RTLD_LAZY);
+ if (!handle)
+ {
+ printf ("Unable to load DSO: %s\n", dlerror ());
+ return (void *) (uintptr_t) 1;
+ }
+
+ void (*foo) (void) = (void (*) (void)) dlsym(handle, "do_foo");
+
+ if (!foo)
+ {
+ printf ("Unable to find symbol: %s\n", dlerror ());
+ exit (1);
+ }
+
+ foo ();
+
+ /* This should not unload the DSO. If it does, then the thread exit will
+ result in a segfault. */
+ dlclose (handle);
+ pthread_mutex_unlock (&m);
+
+ return NULL;
+}
+
+int
+main (void)
+{
+ pthread_t t;
+ int ret;
+ void *thr_ret;
+
+ if ((ret = pthread_create (&t, NULL, load, NULL)) != 0)
+ {
+ printf ("pthread_create failed: %s\n", strerror (ret));
+ return 1;
+ }
+
+ if ((ret = pthread_join (t, &thr_ret)) != 0)
+ {
+ printf ("pthread_create failed: %s\n", strerror (ret));
+ return 1;
+ }
+
+ if (thr_ret != NULL)
+ return 1;
+
+ /* Now this should unload the DSO. */
+ dlclose (handle);
+
+ /* Run through our maps and ensure that the DSO is unloaded. */
+ FILE *f = fopen ("/proc/self/maps", "r");
+
+ if (f == NULL)
+ {
+ perror ("Failed to open /proc/self/maps");
+ fprintf (stderr, "Skipping verification of DSO unload\n");
+ return 0;
+ }
+
+ char *line = NULL;
+ size_t s = 0;
+ while (getline (&line, &s, f) > 0)
+ {
+ if (strstr (line, "tst-tls-atexit-lib.so"))
+ {
+ printf ("DSO not unloaded yet:\n%s", line);
+ return 1;
+ }
+ }
+ free (line);
+
+ return 0;
+}
Modified: fsf/trunk/libc/sysdeps/generic/ldconfig.h
==============================================================================
--- fsf/trunk/libc/sysdeps/generic/ldconfig.h (original)
+++ fsf/trunk/libc/sysdeps/generic/ldconfig.h Tue Feb 19 00:01:50 2013
@@ -84,12 +84,6 @@
extern int opt_format;
/* Prototypes for a few program-wide used functions. */
-extern void *xmalloc (size_t n)
- __attribute_malloc__ __attribute_alloc_size (1);
-extern void *xcalloc (size_t n, size_t s)
- __attribute_malloc__ __attribute_alloc_size (1, 2);
-extern void *xrealloc (void *o, size_t n)
- __attribute_malloc__ __attribute_alloc_size (2);
-extern char *xstrdup (const char *) __attribute_malloc__;
+#include <programs/xmalloc.h>
#endif /* ! _LDCONFIG_H */
Modified: fsf/trunk/libc/sysdeps/generic/ldsodefs.h
==============================================================================
--- fsf/trunk/libc/sysdeps/generic/ldsodefs.h (original)
+++ fsf/trunk/libc/sysdeps/generic/ldsodefs.h Tue Feb 19 00:01:50 2013
@@ -1006,6 +1006,10 @@
/* Show show of an object. */
extern void _dl_show_scope (struct link_map *new, int from);
+extern struct link_map *_dl_find_dso_for_object (const ElfW(Addr) addr)
+ internal_function;
+rtld_hidden_proto (_dl_find_dso_for_object)
+
__END_DECLS
#endif /* ldsodefs.h */
Modified: fsf/trunk/libc/sysdeps/s390/s390-64/dl-trampoline.S
==============================================================================
--- fsf/trunk/libc/sysdeps/s390/s390-64/dl-trampoline.S (original)
+++ fsf/trunk/libc/sysdeps/s390/s390-64/dl-trampoline.S Tue Feb 19 00:01:50 2013
@@ -1,4 +1,4 @@
-/* PLT trampolines. s390 version.
+/* PLT trampolines. s390x version.
Copyright (C) 2005-2013 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -20,8 +20,8 @@
* with the following linkage:
* r2 - r6 : parameter registers
* f0, f2, f4, f6 : floating point parameter registers
- * 24(r15), 28(r15) : PLT arguments PLT1, PLT2
- * 96(r15) : additional stack parameters
+ * 48(r15), 56(r15) : PLT arguments PLT1, PLT2
+ * 160(r15) : additional stack parameters
* The normal clobber rules for function calls apply:
* r0 - r5 : call clobbered
* r6 - r13 : call saved
@@ -39,21 +39,21 @@
cfi_startproc
.align 16
_dl_runtime_resolve:
- stmg 2,5,64(15) # save registers
- stg 14,96(15)
+ stmg %r2,%r5,64(15) # save call-clobbered argument registers
+ stg %r14,96(15)
cfi_offset (r14, -64)
- lgr 0,15 # create stack frame
- aghi 15,-160
+ lgr %r0,%r15
+ aghi %r15,-160 # create stack frame
cfi_adjust_cfa_offset (160)
- stg 0,0(15)
- lmg 2,3,208(15) # load args saved by PLT
- brasl 14,_dl_fixup # call fixup
- lgr 1,2 # function addr returned in r2
- aghi 15,160 # remove stack frame
+ stg %r0,0(%r15) # write backchain
+ lmg %r2,%r3,208(%r15)# load args saved by PLT
+ brasl %r14,_dl_fixup # call fixup
+ lgr %r1,%r2 # function addr returned in r2
+ aghi %r15,160 # remove stack frame
cfi_adjust_cfa_offset (-160)
- lg 14,96(15) # restore registers
- lmg 2,5,64(15)
- br 1
+ lg %r14,96(15) # restore registers
+ lmg %r2,%r5,64(15)
+ br %r1
cfi_endproc
.size _dl_runtime_resolve, .-_dl_runtime_resolve
@@ -64,13 +64,12 @@
cfi_startproc
.align 16
_dl_runtime_profile:
- stmg %r2,%r6,64(%r15) # save registers
- std %f0,104(%r15)
- std %f2,112(%r15)
+ stmg %r2,%r6,64(%r15) # save call-clobbered arg regs
+ std %f0,104(%r15) # + r6 needed as arg for
+ std %f2,112(%r15) # _dl_profile_fixup
std %f4,120(%r15)
std %f6,128(%r15)
- stg %r6,16(%r15)
- stg %r12,24(%r15)
+ stg %r12,24(%r15) # r12 is used as backup of r15
stg %r14,32(%r15)
cfi_offset (r6, -96)
cfi_offset (f0, -56)
@@ -79,10 +78,10 @@
cfi_offset (f6, -32)
cfi_offset (r12, -136)
cfi_offset (r14, -128)
- lgr %r12,%r15 # create stack frame
+ lgr %r12,%r15 # backup stack pointer
cfi_def_cfa_register (12)
- aghi %r15,-160
- stg %r12,0(%r15)
+ aghi %r15,-160 # create stack frame
+ stg %r12,0(%r15) # save backchain
lmg %r2,%r3,48(%r12) # load arguments saved by PLT
lgr %r4,%r14 # return address as third parameter
la %r5,64(%r12) # pointer to struct La_s390_32_regs
@@ -92,18 +91,19 @@
lg %r0,40(%r12) # load framesize
ltgr %r0,%r0
jnm 1f
- lmg %r2,%r6,64(%r12)
- ld %f0,104(%r12)
- ld %f2,112(%r12)
+
+ lmg %r2,%r6,64(%r12) # framesize < 0 means no pltexit call
+ ld %f0,104(%r12) # so we can do a tail call without
+ ld %f2,112(%r12) # copying the arg overflow area
ld %f4,120(%r12)
ld %f6,128(%r12)
- basr %r14,%r1 # call resolved function
-0: lgr %r15,%r12 # remove stack frame
+
+ lgr %r15,%r12 # remove stack frame
cfi_def_cfa_register (15)
lg %r14,32(%r15) # restore registers
lg %r12,24(%r15)
- lg %r6,16(%r15)
- br %r14
+ br %r1 # tail-call to resolved function
+
cfi_def_cfa_register (12)
1: jz 4f # framesize == 0 ?
aghi %r0,7 # align framesize to 8
@@ -118,7 +118,7 @@
la %r3,8(%r3)
brctg %r0,3b
4: lmg %r2,%r6,64(%r12) # load register parameters
- ld %f0,104(%r12)
+ ld %f0,104(%r12) # restore call-clobbered arg regs
ld %f2,112(%r12)
ld %f4,120(%r12)
ld %f6,128(%r12)
@@ -129,7 +129,13 @@
la %r4,32(%r12) # pointer to struct La_s390_32_regs
la %r5,72(%r12) # pointer to struct La_s390_32_retval
brasl %r14,_dl_call_pltexit
- j 0b
+
+ lgr %r15,%r12 # remove stack frame
+ cfi_def_cfa_register (15)
+ lg %r14,32(%r15) # restore registers
+ lg %r12,24(%r15)
+ br %r14
+
cfi_endproc
.size _dl_runtime_profile, .-_dl_runtime_profile
#endif
Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/nptl/libc.abilist
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/nptl/libc.abilist (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/nptl/libc.abilist Tue Feb 19 00:01:50 2013
@@ -1819,6 +1819,9 @@
clock_nanosleep F
clock_settime F
secure_getenv F
+GLIBC_2.18
+ GLIBC_2.18 A
+ __cxa_thread_atexit_impl F
GLIBC_2.2
GLIBC_2.2 A
_IO_adjust_wcolumn F
Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/kernel-features.h
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/kernel-features.h (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/kernel-features.h Tue Feb 19 00:01:50 2013
@@ -187,6 +187,11 @@
# define __ASSUME_PWRITEV 1
#endif
+/* Support for FUTEX_*_REQUEUE_PI was added in 2.6.31. */
+#if __LINUX_KERNEL_VERSION >= 0x02061f
+# define __ASSUME_REQUEUE_PI 1
+#endif
+
/* Support for F_GETOWN_EX was introduced in 2.6.32. */
#if __LINUX_KERNEL_VERSION >= 0x020620
# define __ASSUME_F_GETOWN_EX 1
Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/nptl/libc.abilist
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/nptl/libc.abilist (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/nptl/libc.abilist Tue Feb 19 00:01:50 2013
@@ -1781,6 +1781,9 @@
clock_nanosleep F
clock_settime F
secure_getenv F
+GLIBC_2.18
+ GLIBC_2.18 A
+ __cxa_thread_atexit_impl F
GLIBC_2.2
GLIBC_2.2 A
_IO_adjust_wcolumn F
Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/nptl/libc.abilist
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/nptl/libc.abilist (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/nptl/libc.abilist Tue Feb 19 00:01:50 2013
@@ -87,6 +87,9 @@
clock_nanosleep F
clock_settime F
secure_getenv F
+GLIBC_2.18
+ GLIBC_2.18 A
+ __cxa_thread_atexit_impl F
GLIBC_2.3
GLIBC_2.3 A
_Exit F
Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/s390/s390-32/nptl/libc.abilist
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/s390/s390-32/nptl/libc.abilist (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/s390/s390-32/nptl/libc.abilist Tue Feb 19 00:01:50 2013
@@ -1771,6 +1771,9 @@
clock_nanosleep F
clock_settime F
secure_getenv F
+GLIBC_2.18
+ GLIBC_2.18 A
+ __cxa_thread_atexit_impl F
GLIBC_2.2
GLIBC_2.2 A
_IO_adjust_wcolumn F
Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/s390/s390-64/nptl/libc.abilist
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/s390/s390-64/nptl/libc.abilist (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/s390/s390-64/nptl/libc.abilist Tue Feb 19 00:01:50 2013
@@ -92,6 +92,9 @@
clock_nanosleep F
clock_settime F
secure_getenv F
+GLIBC_2.18
+ GLIBC_2.18 A
+ __cxa_thread_atexit_impl F
GLIBC_2.2
GLIBC_2.2 A
_Exit F
Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/sh/nptl/libc.abilist
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/sh/nptl/libc.abilist (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/sh/nptl/libc.abilist Tue Feb 19 00:01:50 2013
@@ -92,6 +92,9 @@
clock_nanosleep F
clock_settime F
secure_getenv F
+GLIBC_2.18
+ GLIBC_2.18 A
+ __cxa_thread_atexit_impl F
GLIBC_2.2
GLIBC_2.2 A
_Exit F
Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/sparc/sparc32/nptl/libc.abilist
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/sparc/sparc32/nptl/libc.abilist (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/sparc/sparc32/nptl/libc.abilist Tue Feb 19 00:01:50 2013
@@ -1776,6 +1776,9 @@
clock_nanosleep F
clock_settime F
secure_getenv F
+GLIBC_2.18
+ GLIBC_2.18 A
+ __cxa_thread_atexit_impl F
GLIBC_2.2
GLIBC_2.2 A
_IO_adjust_wcolumn F
Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/sparc/sparc64/nptl/libc.abilist
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/sparc/sparc64/nptl/libc.abilist (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/sparc/sparc64/nptl/libc.abilist Tue Feb 19 00:01:50 2013
@@ -97,6 +97,9 @@
clock_nanosleep F
clock_settime F
secure_getenv F
+GLIBC_2.18
+ GLIBC_2.18 A
+ __cxa_thread_atexit_impl F
GLIBC_2.2
GLIBC_2.2 A
_Exit F
Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/x86_64/64/nptl/libc.abilist
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/x86_64/64/nptl/libc.abilist (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/x86_64/64/nptl/libc.abilist Tue Feb 19 00:01:50 2013
@@ -88,6 +88,9 @@
clock_nanosleep F
clock_settime F
secure_getenv F
+GLIBC_2.18
+ GLIBC_2.18 A
+ __cxa_thread_atexit_impl F
GLIBC_2.2.5
GLIBC_2.2.5 A
_Exit F
Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/x86_64/x32/nptl/libc.abilist
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/x86_64/x32/nptl/libc.abilist (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/x86_64/x32/nptl/libc.abilist Tue Feb 19 00:01:50 2013
@@ -2086,3 +2086,6 @@
clock_nanosleep F
clock_settime F
secure_getenv F
+GLIBC_2.18
+ GLIBC_2.18 A
+ __cxa_thread_atexit_impl F
_______________________________________________
Commits mailing list
Commits@xxxxxxxxxx
http://eglibc.org/cgi-bin/mailman/listinfo/commits