This is the mail archive of the
glibc-cvs@sourceware.org
mailing list for the glibc project.
GNU C Library master sources branch hjl/pthread/2.21 created. glibc-2.21-9-g8de7f51
- From: hjl at sourceware dot org
- To: glibc-cvs at sourceware dot org
- Date: 15 Sep 2015 15:37:12 -0000
- Subject: GNU C Library master sources branch hjl/pthread/2.21 created. glibc-2.21-9-g8de7f51
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".
The branch, hjl/pthread/2.21 has been created
at 8de7f5109fb22e8b53a52fe2fb6b50ff6deaba03 (commit)
- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=8de7f5109fb22e8b53a52fe2fb6b50ff6deaba03
commit 8de7f5109fb22e8b53a52fe2fb6b50ff6deaba03
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Thu Sep 13 06:01:04 2012 -0700
Use STB_SECONDARY on pthread functions in libc
Use STB_SECONDARY binding on pthread functions in libc so that they will
be preempted by definitions in libpthread at link-time as well as at
run-time.
* csu/libc-tls.c (__pthread_initialize_minimal): Mark it
secondary if HAVE_ASM_SECONDARY_DIRECTIVE is defined.
* nptl/Makefile: Include ../Makeconfig.
(libc-libpthread-routines): New macro.
(libc-libpthread-static-only-routines): Likewise.
(static-only-routines): Add $(libc-libpthread-static-only-routines)
if $(have-secondary) is yes.
(routines): Add $(libc-libpthread-routines) if $(have-secondary)
is yes.
(CFLAGS-libc-unwind.c): New.
* nptl/Versions [HAVE_ASM_SECONDARY_DIRECTIVE] (libc:GLIBC_2.0):
Add _pthread_cleanup_pop_restore, _pthread_cleanup_push_defer,
__pthread_getspecific, __pthread_setspecific,
__pthread_key_create, pthread_once, __pthread_once,
__pthread_mutex_lock and __pthread_mutex_unlock.
[HAVE_ASM_SECONDARY_DIRECTIVE] (libc:GLIBC_2.2): Add
__pthread_rwlock_init, __pthread_rwlock_destroy,
__pthread_rwlock_rdlock, __pthread_rwlock_wrlock and
__pthread_rwlock_unlock.
[HAVE_ASM_SECONDARY_DIRECTIVE] (libc:GLIBC_PRIVATE): Add
__pthread_unwind and __pthread_setcancelstate.
[HAVE_ASM_SECONDARY_DIRECTIVE] (libpthread:GLIBC_PRIVATE): Add
__pthread_setcancelstate.
* nptl/forward.c (pthread_attr_destroy): Don't define if
HAVE_ASM_SECONDARY_DIRECTIVE is defined.
(__pthread_attr_init_2_0): Likewise.
(__pthread_attr_init_2_1): Likewise.
(pthread_attr_getdetachstate): Likewise.
(pthread_attr_setdetachstate): Likewise.
(pthread_attr_getinheritsched): Likewise.
(pthread_attr_setinheritsched): Likewise.
(pthread_attr_getschedparam): Likewise.
(pthread_attr_setschedparam): Likewise.
(pthread_attr_getschedpolicy): Likewise.
(pthread_attr_setschedpolicy): Likewise.
(pthread_attr_getscope): Likewise.
(pthread_attr_setscope): Likewise.
(pthread_condattr_destroy): Likewise.
(pthread_condattr_init): Likewise.
(__pthread_cond_broadcast_2_0): Likewise.
(__pthread_cond_broadcast): Likewise.
(__pthread_cond_destroy_2_0): Likewise.
(__pthread_cond_destroy): Likewise.
(__pthread_cond_init_2_0): Likewise.
(__pthread_cond_init): Likewise.
(__pthread_cond_signal_2_0): Likewise.
(__pthread_cond_signal): Likewise.
(__pthread_cond_wait_2_0): Likewise.
(__pthread_cond_wait): Likewise.
(__pthread_cond_timedwait_2_0): Likewise.
(__pthread_cond_timedwait): Likewise.
(pthread_equal): Likewise.
(__pthread_exit): Likewise.
(pthread_getschedparam): Likewise.
(pthread_setschedparam): Likewise.
(pthread_mutex_destroy): Likewise.
(pthread_mutex_init): Likewise.
(pthread_mutex_lock): Likewise.
(pthread_mutex_unlock): Likewise.
(pthread_self): Likewise.
(pthread_setcancelstate): Likewise.
(pthread_setcanceltype): Likewise.
(__pthread_unwind): Likewise.
* nptl/libc-cleanup_defer_compat.c: New file.
* nptl/libc-pthread_attr_destroy.c: Likewise.
* nptl/libc-pthread_attr_getdetachstate.c: Likewise.
* nptl/libc-pthread_attr_getinheritsched.c: Likewise.
* nptl/libc-pthread_attr_getschedparam.c: Likewise.
* nptl/libc-pthread_attr_getschedpolicy.c: Likewise.
* nptl/libc-pthread_attr_getscope.c: Likewise.
* nptl/libc-pthread_attr_init.c: Likewise.
* nptl/libc-pthread_attr_setdetachstate.c: Likewise.
* nptl/libc-pthread_attr_setinheritsched.c: Likewise.
* nptl/libc-pthread_attr_setschedparam.c: Likewise.
* nptl/libc-pthread_attr_setschedpolicy.c: Likewise.
* nptl/libc-pthread_attr_setscope.c: Likewise.
* nptl/libc-pthread_cond_broadcast.c: Likewise.
* nptl/libc-pthread_cond_destroy.c: Likewise.
* nptl/libc-pthread_cond_init.c: Likewise.
* nptl/libc-pthread_cond_signal.c: Likewise.
* nptl/libc-pthread_cond_timedwait.c: Likewise.
* nptl/libc-pthread_cond_wait.c: Likewise.
* nptl/libc-pthread_condattr_destroy.c: Likewise.
* nptl/libc-pthread_condattr_init.c: Likewise.
* nptl/libc-pthread_equal.c: Likewise.
* nptl/libc-pthread_exit.c: Likewise.
* nptl/libc-pthread_getschedparam.c: Likewise.
* nptl/libc-pthread_getspecific.c: Likewise.
* nptl/libc-pthread_key_create.c: Likewise.
* nptl/libc-pthread_mutex_destroy.c: Likewise.
* nptl/libc-pthread_mutex_init.c: Likewise.
* nptl/libc-pthread_mutex_lock.c: Likewise.
* nptl/libc-pthread_mutex_unlock.c: Likewise.
* nptl/libc-pthread_once.c: Likewise.
* nptl/libc-pthread_rwlock_destroy.c: Likewise.
* nptl/libc-pthread_rwlock_init.c: Likewise.
* nptl/libc-pthread_rwlock_rdlock.c: Likewise.
* nptl/libc-pthread_rwlock_unlock.c: Likewise.
* nptl/libc-pthread_self.c: Likewise.
* nptl/libc-pthread_setcancelstate.c: Likewise.
* nptl/libc-pthread_setcanceltype.c: Likewise.
* nptl/libc-pthread_setschedparam.c: Likewise.
* nptl/libc-pthread_setspecific.c: Likewise.
* nptl/libc-unwind.c: Likewise.
* nptl-init.c (pthread_functions): Don't include secondary
pthread functions in libc if HAVE_ASM_SECONDARY_DIRECTIVE is
defined.
* sysdeps/nptl/pthread-functions.h (pthread_functions): Likewise.
* nptl/pthreadP.h (__pthread_unwind): Don't mark it weak if
HAVE_ASM_SECONDARY_DIRECTIVE is defined.
(__pthread_cond_broadcast_2_0): Declare only if not in libc.
(__pthread_cond_destroy_2_0): Likewise.
(__pthread_cond_init_2_0): Likewise.
(__pthread_cond_signal_2_0): Likewise.
(__pthread_cond_timedwait_2_0): Likewise.
(__pthread_cond_wait_2_0): Likewise.
* scripts/abilist.awk: Support secondary symbols.
* sysdeps/generic/localplt.data: Allow pthread functions.
* sysdeps/unix/sysv/linux/i386/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/i386/localplt.data: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist: Likewise.
* sysdeps/nptl/bits/libc-lockP.h (PTFAVAIL): Defined as 1 if
HAVE_ASM_SECONDARY_DIRECTIVE is defined.
(__libc_maybe_call): Always call FUNC if
HAVE_ASM_SECONDARY_DIRECTIVE is defined.
(__libc_ptf_call): Likewise.
(__libc_ptf_call_always): Likewise.
(__pthread_mutex_init): Don't mark it weak if
HAVE_ASM_SECONDARY_DIRECTIVE is defined.
(__pthread_mutex_destroy): Likewise.
(__pthread_mutex_lock): Likewise.
(__pthread_mutex_trylock): Likewise.
(__pthread_mutex_unlock): Likewise.
(__pthread_mutexattr_init): Likewise.
(__pthread_mutexattr_destroy): Likewise.
(__pthread_mutexattr_settype): Likewise.
(__pthread_rwlock_destroy): Likewise.
(__pthread_rwlock_rdlock): Likewise.
(__pthread_rwlock_tryrdlock): Likewise.
(__pthread_rwlock_wrlock): Likewise.
(__pthread_rwlock_trywrlock): Likewise.
(__pthread_rwlock_unlock): Likewise.
(__pthread_key_create): Likewise.
(__pthread_setspecific): Likewise.
(__pthread_getspecific): Likewise.
(__pthread_once): Likewise.
(__pthread_initialize): Likewise.
(__pthread_atfork): Likewise.
(_pthread_cleanup_push_defer): Likewise.
(_pthread_cleanup_pop_restore): Likewise.
(pthread_setcancelstate): Likewise.
* sysdeps/unix/sysv/linux/x86_64/cancellation.S (__pthread_unwind):
Likewise.
* sysdeps/unix/sysv/linux/fatal-prepare.h (FATAL_PREPARE): Always
call __pthread_setcancelstate if HAVE_ASM_SECONDARY_DIRECTIVE is
defined.
* sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S: Make
__lll_lock_wait_private and __lll_unlock_wake_private weak in
libc.a.
* sysdeps/unix/sysv/linux/x86_64/libc-lowlevellock.S: Likewise.
diff --git a/csu/libc-tls.c b/csu/libc-tls.c
index 64d1779..3715ded 100644
--- a/csu/libc-tls.c
+++ b/csu/libc-tls.c
@@ -232,6 +232,11 @@ _dl_tls_setup (void)
}
+#ifdef HAVE_ASM_SECONDARY_DIRECTIVE
+/* Make sure that it is used only when libpthread.a is not used */
+asm (".secondary __pthread_initialize_minimal");
+#endif
+
/* This is the minimal initialization function used when libpthread is
not used. */
void
diff --git a/nptl/Makefile b/nptl/Makefile
index 17d5c2c..38449bd 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -28,9 +28,58 @@ extra-libs := libpthread
extra-libs-others := $(extra-libs)
install-lib-ldscripts := libpthread.so
+include ../Makeconfig
+
routines = alloca_cutoff forward libc-lowlevellock libc-cancellation \
libc-cleanup libc_pthread_init libc_multiple_threads \
register-atfork unregister-atfork
+ifeq (yes,$(have-secondary))
+libc-libpthread-routines = libc-cleanup_defer_compat \
+ libc-pthread_attr_destroy \
+ libc-pthread_attr_getdetachstate \
+ libc-pthread_attr_getinheritsched \
+ libc-pthread_attr_getschedparam \
+ libc-pthread_attr_getschedpolicy \
+ libc-pthread_attr_getscope \
+ libc-pthread_attr_init \
+ libc-pthread_attr_setdetachstate \
+ libc-pthread_attr_setinheritsched \
+ libc-pthread_attr_setschedparam \
+ libc-pthread_attr_setschedpolicy \
+ libc-pthread_attr_setscope \
+ libc-pthread_cond_broadcast \
+ libc-pthread_cond_destroy \
+ libc-pthread_cond_init \
+ libc-pthread_cond_signal \
+ libc-pthread_cond_timedwait \
+ libc-pthread_cond_wait \
+ libc-pthread_condattr_destroy \
+ libc-pthread_condattr_init \
+ libc-pthread_equal \
+ libc-pthread_exit \
+ libc-pthread_getschedparam \
+ libc-pthread_getspecific \
+ libc-pthread_key_create \
+ libc-pthread_once \
+ libc-pthread_mutex_destroy \
+ libc-pthread_mutex_init \
+ libc-pthread_mutex_lock \
+ libc-pthread_mutex_unlock \
+ libc-pthread_rwlock_rdlock \
+ libc-pthread_rwlock_unlock \
+ libc-pthread_rwlock_wrlock \
+ libc-pthread_self \
+ libc-pthread_setcancelstate \
+ libc-pthread_setcanceltype \
+ libc-pthread_setschedparam \
+ libc-pthread_setspecific \
+ libc-unwind
+libc-libpthread-static-only-routines = libc-pthread_rwlock_destroy \
+ libc-pthread_rwlock_init
+static-only-routines += $(libc-libpthread-static-only-routines)
+libc-libpthread-routines += $(libc-libpthread-static-only-routines)
+routines += $(libc-libpthread-routines)
+endif
shared-only-routines = forward
libpthread-routines = nptl-init vars events version \
@@ -424,6 +473,10 @@ endif
# function frequently to get a thread-specific handle.
CFLAGS-pthread_self.os += -fomit-frame-pointer
+# __pthread_unwind can't call abort and GCC doesn't know kill won't
+# return.
+CFLAGS-libc-unwind.c += -Wno-error
+
# Run the cancellation and cleanup tests also for the modern, exception-based
# implementation. For this we have to pass the -fexceptions parameter.
CFLAGS-tst-cancelx2.c += -fexceptions
diff --git a/nptl/Versions b/nptl/Versions
index 4e134fa..d80c6bd 100644
--- a/nptl/Versions
+++ b/nptl/Versions
@@ -16,10 +16,26 @@ libc {
pthread_mutex_lock; pthread_mutex_unlock;
pthread_self;
pthread_setcancelstate; pthread_setcanceltype;
+#if HAVE_ASM_SECONDARY_DIRECTIVE
+ # Provide additional secondary pthread functions.
+ _pthread_cleanup_pop_restore; _pthread_cleanup_push_defer;
+ __pthread_getspecific; __pthread_setspecific;
+ __pthread_key_create;
+ pthread_once;
+ __pthread_once;
+ __pthread_mutex_lock; __pthread_mutex_unlock;
+#endif
}
GLIBC_2.1 {
pthread_attr_init;
}
+#if HAVE_ASM_SECONDARY_DIRECTIVE
+ GLIBC_2.2 {
+ # Provide additional secondary pthread functions.
+ __pthread_rwlock_rdlock; __pthread_rwlock_wrlock;
+ __pthread_rwlock_unlock;
+ }
+#endif
GLIBC_2.3.2 {
__register_atfork;
@@ -36,6 +52,11 @@ libc {
__libc_pthread_init;
__libc_current_sigrtmin_private; __libc_current_sigrtmax_private;
__libc_allocate_rtsig_private;
+#if HAVE_ASM_SECONDARY_DIRECTIVE
+ # Provide additional secondary pthread function.
+ __pthread_unwind;
+ __pthread_setcancelstate;
+#endif
}
}
@@ -270,6 +291,9 @@ libpthread {
__pthread_initialize_minimal;
__pthread_clock_gettime; __pthread_clock_settime;
__pthread_unwind; __pthread_get_minstack;
+#if HAVE_ASM_SECONDARY_DIRECTIVE
+ __pthread_setcancelstate;
+#endif
__shm_directory;
}
}
diff --git a/nptl/forward.c b/nptl/forward.c
index db74f8d..8f11708 100644
--- a/nptl/forward.c
+++ b/nptl/forward.c
@@ -31,6 +31,7 @@ struct pthread_functions __libc_pthread_functions attribute_hidden;
int __libc_pthread_functions_init attribute_hidden;
+#ifndef HAVE_ASM_SECONDARY_DIRECTIVE
#define FORWARD2(name, rettype, decl, params, defaction) \
rettype \
name decl \
@@ -207,3 +208,4 @@ FORWARD_NORETURN (__pthread_unwind,
__cleanup_fct_attribute attribute_compat_text_section,
(__pthread_unwind_buf_t *buf), (buf),
__safe_fatal ())
+#endif
diff --git a/sysdeps/unix/sysv/linux/fatal-prepare.h b/nptl/libc-cleanup_defer_compat.c
similarity index 52%
copy from sysdeps/unix/sysv/linux/fatal-prepare.h
copy to nptl/libc-cleanup_defer_compat.c
index 45d88ce..ae981aa 100644
--- a/sysdeps/unix/sysv/linux/fatal-prepare.h
+++ b/nptl/libc-cleanup_defer_compat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2015 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
@@ -15,23 +15,26 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include <pthread.h>
-
-/* We have to completely disable cancellation. assert() must not be a
- cancellation point but the implementation uses write() etc. */
-#ifdef SHARED
-# include <pthread-functions.h>
-# define FATAL_PREPARE \
- { \
- if (__libc_pthread_functions_init) \
- PTHFCT_CALL (ptr_pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, \
- NULL)); \
- }
-#else
-# pragma weak pthread_setcancelstate
-# define FATAL_PREPARE \
- { \
- if (pthread_setcancelstate != NULL) \
- pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, NULL); \
- }
+#ifdef HAVE_ASM_SECONDARY_DIRECTIVE
+#include "pthreadP.h"
+
+/* Make sure that it is used only when libpthread is not used */
+asm (".secondary _pthread_cleanup_push_defer");
+
+void
+_pthread_cleanup_push_defer (struct _pthread_cleanup_buffer *buffer,
+ void (*routine) (void *), void *arg)
+{
+}
+
+/* Make sure that it is used only when libpthread is not used */
+asm (".secondary _pthread_cleanup_pop_restore");
+
+void
+_pthread_cleanup_pop_restore (struct _pthread_cleanup_buffer *buffer,
+ int execute)
+{
+ if (execute)
+ buffer->__routine (buffer->__arg);
+}
#endif
diff --git a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S b/nptl/libc-pthread_attr_destroy.c
similarity index 71%
copy from sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
copy to nptl/libc-pthread_attr_destroy.c
index 111e9c8..6c56c87 100644
--- a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
+++ b/nptl/libc-pthread_attr_destroy.c
@@ -1,6 +1,5 @@
-/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -16,4 +15,15 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include "lowlevellock.S"
+#ifdef HAVE_ASM_SECONDARY_DIRECTIVE
+#include "pthreadP.h"
+
+/* Make sure that it is used only when libpthread is not used. */
+asm (".secondary pthread_attr_destroy");
+
+int
+pthread_attr_destroy (pthread_attr_t *attr)
+{
+ return 0;
+}
+#endif
diff --git a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S b/nptl/libc-pthread_attr_getdetachstate.c
similarity index 68%
copy from sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
copy to nptl/libc-pthread_attr_getdetachstate.c
index 111e9c8..aa950ad 100644
--- a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
+++ b/nptl/libc-pthread_attr_getdetachstate.c
@@ -1,6 +1,5 @@
-/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -16,4 +15,15 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include "lowlevellock.S"
+#ifdef HAVE_ASM_SECONDARY_DIRECTIVE
+#include "pthreadP.h"
+
+/* Make sure that it is used only when libpthread is not used. */
+asm (".secondary pthread_attr_getdetachstate");
+
+int
+pthread_attr_getdetachstate (const pthread_attr_t *attr, int *detachstate)
+{
+ return 0;
+}
+#endif
diff --git a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S b/nptl/libc-pthread_attr_getinheritsched.c
similarity index 69%
copy from sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
copy to nptl/libc-pthread_attr_getinheritsched.c
index 111e9c8..8a0529c 100644
--- a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
+++ b/nptl/libc-pthread_attr_getinheritsched.c
@@ -1,6 +1,5 @@
-/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -16,4 +15,15 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include "lowlevellock.S"
+#ifdef HAVE_ASM_SECONDARY_DIRECTIVE
+#include "pthreadP.h"
+
+/* Make sure that it is used only when libpthread is not used. */
+asm (".secondary pthread_attr_getinheritsched");
+
+int
+pthread_attr_getinheritsched (const pthread_attr_t *attr, int *inherit)
+{
+ return 0;
+}
+#endif
diff --git a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S b/nptl/libc-pthread_attr_getschedparam.c
similarity index 68%
copy from sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
copy to nptl/libc-pthread_attr_getschedparam.c
index 111e9c8..866e2f0 100644
--- a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
+++ b/nptl/libc-pthread_attr_getschedparam.c
@@ -1,6 +1,5 @@
-/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -16,4 +15,16 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include "lowlevellock.S"
+#ifdef HAVE_ASM_SECONDARY_DIRECTIVE
+#include "pthreadP.h"
+
+/* Make sure that it is used only when libpthread is not used. */
+asm (".secondary pthread_attr_getschedparam");
+
+int
+pthread_attr_getschedparam (const pthread_attr_t *attr,
+ struct sched_param *param)
+{
+ return 0;
+}
+#endif
diff --git a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S b/nptl/libc-pthread_attr_getschedpolicy.c
similarity index 69%
copy from sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
copy to nptl/libc-pthread_attr_getschedpolicy.c
index 111e9c8..241111c 100644
--- a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
+++ b/nptl/libc-pthread_attr_getschedpolicy.c
@@ -1,6 +1,5 @@
-/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -16,4 +15,15 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include "lowlevellock.S"
+#ifdef HAVE_ASM_SECONDARY_DIRECTIVE
+#include "pthreadP.h"
+
+/* Make sure that it is used only when libpthread is not used. */
+asm (".secondary pthread_attr_getschedpolicy");
+
+int
+pthread_attr_getschedpolicy (const pthread_attr_t *attr, int *policy)
+{
+ return 0;
+}
+#endif
diff --git a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S b/nptl/libc-pthread_attr_getscope.c
similarity index 70%
copy from sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
copy to nptl/libc-pthread_attr_getscope.c
index 111e9c8..feaa76f 100644
--- a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
+++ b/nptl/libc-pthread_attr_getscope.c
@@ -1,6 +1,5 @@
-/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -16,4 +15,15 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include "lowlevellock.S"
+#ifdef HAVE_ASM_SECONDARY_DIRECTIVE
+#include "pthreadP.h"
+
+/* Make sure that it is used only when libpthread is not used. */
+asm (".secondary pthread_attr_getscope");
+
+int
+pthread_attr_getscope (const pthread_attr_t *attr, int *scope)
+{
+ return 0;
+}
+#endif
diff --git a/sysdeps/unix/sysv/linux/fatal-prepare.h b/nptl/libc-pthread_attr_init.c
similarity index 51%
copy from sysdeps/unix/sysv/linux/fatal-prepare.h
copy to nptl/libc-pthread_attr_init.c
index 45d88ce..0c2c76d 100644
--- a/sysdeps/unix/sysv/linux/fatal-prepare.h
+++ b/nptl/libc-pthread_attr_init.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2015 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
@@ -15,23 +15,28 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include <pthread.h>
-
-/* We have to completely disable cancellation. assert() must not be a
- cancellation point but the implementation uses write() etc. */
-#ifdef SHARED
-# include <pthread-functions.h>
-# define FATAL_PREPARE \
- { \
- if (__libc_pthread_functions_init) \
- PTHFCT_CALL (ptr_pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, \
- NULL)); \
- }
-#else
-# pragma weak pthread_setcancelstate
-# define FATAL_PREPARE \
- { \
- if (pthread_setcancelstate != NULL) \
- pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, NULL); \
- }
+#ifdef HAVE_ASM_SECONDARY_DIRECTIVE
+#include "pthreadP.h"
+#include <shlib-compat.h>
+
+/* Make sure that it is used only when libpthread is not used. */
+asm (".secondary __pthread_attr_init_2_1");
+
+int
+__pthread_attr_init_2_1 (pthread_attr_t *attr)
+{
+ return 0;
+}
+
+versioned_symbol (libc, __pthread_attr_init_2_1, pthread_attr_init,
+ GLIBC_2_1);
+
+#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_1)
+/* Make sure that it is used only when libpthread is not used. */
+asm (".secondary __pthread_attr_init_2_0");
+
+strong_alias (__pthread_attr_init_2_1, __pthread_attr_init_2_0)
+compat_symbol (libc, __pthread_attr_init_2_0, pthread_attr_init,
+ GLIBC_2_0);
+#endif
#endif
diff --git a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S b/nptl/libc-pthread_attr_setdetachstate.c
similarity index 69%
copy from sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
copy to nptl/libc-pthread_attr_setdetachstate.c
index 111e9c8..28aedf9 100644
--- a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
+++ b/nptl/libc-pthread_attr_setdetachstate.c
@@ -1,6 +1,5 @@
-/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -16,4 +15,15 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include "lowlevellock.S"
+#ifdef HAVE_ASM_SECONDARY_DIRECTIVE
+#include "pthreadP.h"
+
+/* Make sure that it is used only when libpthread is not used. */
+asm (".secondary pthread_attr_setdetachstate");
+
+int
+pthread_attr_setdetachstate (pthread_attr_t *attr, int detachstate)
+{
+ return 0;
+}
+#endif
diff --git a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S b/nptl/libc-pthread_attr_setinheritsched.c
similarity index 69%
copy from sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
copy to nptl/libc-pthread_attr_setinheritsched.c
index 111e9c8..0b6458e 100644
--- a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
+++ b/nptl/libc-pthread_attr_setinheritsched.c
@@ -1,6 +1,5 @@
-/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -16,4 +15,15 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include "lowlevellock.S"
+#ifdef HAVE_ASM_SECONDARY_DIRECTIVE
+#include "pthreadP.h"
+
+/* Make sure that it is used only when libpthread is not used. */
+asm (".secondary pthread_attr_setinheritsched");
+
+int
+pthread_attr_setinheritsched (pthread_attr_t *attr, int inherit)
+{
+ return 0;
+}
+#endif
diff --git a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S b/nptl/libc-pthread_attr_setschedparam.c
similarity index 68%
copy from sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
copy to nptl/libc-pthread_attr_setschedparam.c
index 111e9c8..c61c0f2 100644
--- a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
+++ b/nptl/libc-pthread_attr_setschedparam.c
@@ -1,6 +1,5 @@
-/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -16,4 +15,16 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include "lowlevellock.S"
+#ifdef HAVE_ASM_SECONDARY_DIRECTIVE
+#include "pthreadP.h"
+
+/* Make sure that it is used only when libpthread is not used. */
+asm (".secondary pthread_attr_setschedparam");
+
+int
+pthread_attr_setschedparam (pthread_attr_t *attr,
+ const struct sched_param *param)
+{
+ return 0;
+}
+#endif
diff --git a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S b/nptl/libc-pthread_attr_setschedpolicy.c
similarity index 69%
copy from sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
copy to nptl/libc-pthread_attr_setschedpolicy.c
index 111e9c8..62ce414 100644
--- a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
+++ b/nptl/libc-pthread_attr_setschedpolicy.c
@@ -1,6 +1,5 @@
-/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -16,4 +15,15 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include "lowlevellock.S"
+#ifdef HAVE_ASM_SECONDARY_DIRECTIVE
+#include "pthreadP.h"
+
+/* Make sure that it is used only when libpthread is not used. */
+asm (".secondary pthread_attr_setschedpolicy");
+
+int
+pthread_attr_setschedpolicy (pthread_attr_t *attr, int policy)
+{
+ return 0;
+}
+#endif
diff --git a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S b/nptl/libc-pthread_attr_setscope.c
similarity index 70%
copy from sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
copy to nptl/libc-pthread_attr_setscope.c
index 111e9c8..9560bd8 100644
--- a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
+++ b/nptl/libc-pthread_attr_setscope.c
@@ -1,6 +1,5 @@
-/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -16,4 +15,15 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include "lowlevellock.S"
+#ifdef HAVE_ASM_SECONDARY_DIRECTIVE
+#include "pthreadP.h"
+
+/* Make sure that it is used only when libpthread is not used. */
+asm (".secondary pthread_attr_setscope");
+
+int
+pthread_attr_setscope (pthread_attr_t *attr, int scope)
+{
+ return 0;
+}
+#endif
diff --git a/nptl/libc-pthread_cond_broadcast.c b/nptl/libc-pthread_cond_broadcast.c
new file mode 100644
index 0000000..82ee1fc
--- /dev/null
+++ b/nptl/libc-pthread_cond_broadcast.c
@@ -0,0 +1,42 @@
+/* Copyright (C) 2015 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/>. */
+
+#ifdef HAVE_ASM_SECONDARY_DIRECTIVE
+#include "pthreadP.h"
+#include <shlib-compat.h>
+
+/* Make sure that it is used only when libpthread is not used. */
+asm (".secondary __pthread_cond_broadcast");
+
+int
+__pthread_cond_broadcast (pthread_cond_t *cond)
+{
+ return 0;
+}
+
+versioned_symbol (libc, __pthread_cond_broadcast,
+ pthread_cond_broadcast, GLIBC_2_3_2);
+
+#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
+/* Make sure that it is used only when libpthread is not used. */
+asm (".secondary __pthread_cond_broadcast_2_0");
+
+strong_alias (__pthread_cond_broadcast, __pthread_cond_broadcast_2_0)
+compat_symbol (libc, __pthread_cond_broadcast_2_0,
+ pthread_cond_broadcast, GLIBC_2_0);
+#endif
+#endif
diff --git a/sysdeps/unix/sysv/linux/fatal-prepare.h b/nptl/libc-pthread_cond_destroy.c
similarity index 50%
copy from sysdeps/unix/sysv/linux/fatal-prepare.h
copy to nptl/libc-pthread_cond_destroy.c
index 45d88ce..fbb37c9 100644
--- a/sysdeps/unix/sysv/linux/fatal-prepare.h
+++ b/nptl/libc-pthread_cond_destroy.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2015 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
@@ -15,23 +15,28 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include <pthread.h>
-
-/* We have to completely disable cancellation. assert() must not be a
- cancellation point but the implementation uses write() etc. */
-#ifdef SHARED
-# include <pthread-functions.h>
-# define FATAL_PREPARE \
- { \
- if (__libc_pthread_functions_init) \
- PTHFCT_CALL (ptr_pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, \
- NULL)); \
- }
-#else
-# pragma weak pthread_setcancelstate
-# define FATAL_PREPARE \
- { \
- if (pthread_setcancelstate != NULL) \
- pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, NULL); \
- }
+#ifdef HAVE_ASM_SECONDARY_DIRECTIVE
+#include "pthreadP.h"
+#include <shlib-compat.h>
+
+/* Make sure that it is used only when libpthread is not used. */
+asm (".secondary __pthread_cond_destroy");
+
+int
+__pthread_cond_destroy (pthread_cond_t *cond)
+{
+ return 0;
+}
+
+versioned_symbol (libc, __pthread_cond_destroy, pthread_cond_destroy,
+ GLIBC_2_3_2);
+
+#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
+/* Make sure that it is used only when libpthread is not used. */
+asm (".secondary __pthread_cond_destroy_2_0");
+
+strong_alias (__pthread_cond_destroy, __pthread_cond_destroy_2_0)
+compat_symbol (libc, __pthread_cond_destroy_2_0, pthread_cond_destroy,
+ GLIBC_2_0);
+#endif
#endif
diff --git a/nptl/libc-pthread_cond_init.c b/nptl/libc-pthread_cond_init.c
new file mode 100644
index 0000000..7a0e9d8
--- /dev/null
+++ b/nptl/libc-pthread_cond_init.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 2015 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/>. */
+
+#ifdef HAVE_ASM_SECONDARY_DIRECTIVE
+#include "pthreadP.h"
+#include <shlib-compat.h>
+
+/* Make sure that it is used only when libpthread is not used. */
+asm (".secondary __pthread_cond_init");
+
+int
+__pthread_cond_init (pthread_cond_t *cond,
+ const pthread_condattr_t *cond_attr)
+{
+ return 0;
+}
+
+versioned_symbol (libc, __pthread_cond_init, pthread_cond_init,
+ GLIBC_2_3_2);
+
+#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
+/* Make sure that it is used only when libpthread is not used. */
+asm (".secondary __pthread_cond_init_2_0");
+
+strong_alias (__pthread_cond_init, __pthread_cond_init_2_0)
+compat_symbol (libc, __pthread_cond_init_2_0, pthread_cond_init,
+ GLIBC_2_0);
+#endif
+#endif
diff --git a/sysdeps/unix/sysv/linux/fatal-prepare.h b/nptl/libc-pthread_cond_signal.c
similarity index 50%
copy from sysdeps/unix/sysv/linux/fatal-prepare.h
copy to nptl/libc-pthread_cond_signal.c
index 45d88ce..af55223 100644
--- a/sysdeps/unix/sysv/linux/fatal-prepare.h
+++ b/nptl/libc-pthread_cond_signal.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2015 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
@@ -15,23 +15,28 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include <pthread.h>
-
-/* We have to completely disable cancellation. assert() must not be a
- cancellation point but the implementation uses write() etc. */
-#ifdef SHARED
-# include <pthread-functions.h>
-# define FATAL_PREPARE \
- { \
- if (__libc_pthread_functions_init) \
- PTHFCT_CALL (ptr_pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, \
- NULL)); \
- }
-#else
-# pragma weak pthread_setcancelstate
-# define FATAL_PREPARE \
- { \
- if (pthread_setcancelstate != NULL) \
- pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, NULL); \
- }
+#ifdef HAVE_ASM_SECONDARY_DIRECTIVE
+#include "pthreadP.h"
+#include <shlib-compat.h>
+
+/* Make sure that it is used only when libpthread is not used. */
+asm (".secondary __pthread_cond_signal");
+
+int
+__pthread_cond_signal (pthread_cond_t *cond)
+{
+ return 0;
+}
+
+versioned_symbol (libc, __pthread_cond_signal, pthread_cond_signal,
+ GLIBC_2_3_2);
+
+#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
+/* Make sure that it is used only when libpthread is not used. */
+asm (".secondary __pthread_cond_signal_2_0");
+
+strong_alias (__pthread_cond_signal, __pthread_cond_signal_2_0)
+compat_symbol (libc, __pthread_cond_signal_2_0, pthread_cond_signal,
+ GLIBC_2_0);
+#endif
#endif
diff --git a/nptl/libc-pthread_cond_timedwait.c b/nptl/libc-pthread_cond_timedwait.c
new file mode 100644
index 0000000..2021efd
--- /dev/null
+++ b/nptl/libc-pthread_cond_timedwait.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 2015 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/>. */
+
+#ifdef HAVE_ASM_SECONDARY_DIRECTIVE
+#include "pthreadP.h"
+#include <shlib-compat.h>
+
+/* Make sure that it is used only when libpthread is not used. */
+asm (".secondary __pthread_cond_timedwait");
+
+int
+__pthread_cond_timedwait (pthread_cond_t *cond, pthread_mutex_t *mutex,
+ const struct timespec *abstime)
+{
+ return 0;
+}
+
+versioned_symbol (libc, __pthread_cond_timedwait, pthread_cond_timedwait,
+ GLIBC_2_3_2);
+
+#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
+/* Make sure that it is used only when libpthread is not used. */
+asm (".secondary __pthread_cond_timedwait_2_0");
+
+strong_alias (__pthread_cond_timedwait, __pthread_cond_timedwait_2_0)
+compat_symbol (libc, __pthread_cond_timedwait_2_0, pthread_cond_timedwait,
+ GLIBC_2_0);
+#endif
+#endif
diff --git a/sysdeps/unix/sysv/linux/fatal-prepare.h b/nptl/libc-pthread_cond_wait.c
similarity index 50%
copy from sysdeps/unix/sysv/linux/fatal-prepare.h
copy to nptl/libc-pthread_cond_wait.c
index 45d88ce..ae8c5d1 100644
--- a/sysdeps/unix/sysv/linux/fatal-prepare.h
+++ b/nptl/libc-pthread_cond_wait.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2015 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
@@ -15,23 +15,28 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include <pthread.h>
-
-/* We have to completely disable cancellation. assert() must not be a
- cancellation point but the implementation uses write() etc. */
-#ifdef SHARED
-# include <pthread-functions.h>
-# define FATAL_PREPARE \
- { \
- if (__libc_pthread_functions_init) \
- PTHFCT_CALL (ptr_pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, \
- NULL)); \
- }
-#else
-# pragma weak pthread_setcancelstate
-# define FATAL_PREPARE \
- { \
- if (pthread_setcancelstate != NULL) \
- pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, NULL); \
- }
+#ifdef HAVE_ASM_SECONDARY_DIRECTIVE
+#include "pthreadP.h"
+#include <shlib-compat.h>
+
+/* Make sure that it is used only when libpthread is not used. */
+asm (".secondary __pthread_cond_wait");
+
+int
+__pthread_cond_wait (pthread_cond_t *cond, pthread_mutex_t *mutex)
+{
+ return 0;
+}
+
+versioned_symbol (libc, __pthread_cond_wait, pthread_cond_wait,
+ GLIBC_2_3_2);
+
+#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
+/* Make sure that it is used only when libpthread is not used. */
+asm (".secondary __pthread_cond_wait_2_0");
+
+strong_alias (__pthread_cond_wait, __pthread_cond_wait_2_0)
+compat_symbol (libc, __pthread_cond_wait_2_0, pthread_cond_wait,
+ GLIBC_2_0);
+#endif
#endif
diff --git a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S b/nptl/libc-pthread_condattr_destroy.c
similarity index 70%
copy from sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
copy to nptl/libc-pthread_condattr_destroy.c
index 111e9c8..3bed18b 100644
--- a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
+++ b/nptl/libc-pthread_condattr_destroy.c
@@ -1,6 +1,5 @@
-/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -16,4 +15,15 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include "lowlevellock.S"
+#ifdef HAVE_ASM_SECONDARY_DIRECTIVE
+#include "pthreadP.h"
+
+/* Make sure that it is used only when libpthread is not used. */
+asm (".secondary pthread_condattr_destroy");
+
+int
+pthread_condattr_destroy (pthread_condattr_t *attr)
+{
+ return 0;
+}
+#endif
diff --git a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S b/nptl/libc-pthread_condattr_init.c
similarity index 71%
copy from sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
copy to nptl/libc-pthread_condattr_init.c
index 111e9c8..b82b733 100644
--- a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
+++ b/nptl/libc-pthread_condattr_init.c
@@ -1,6 +1,5 @@
-/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -16,4 +15,15 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include "lowlevellock.S"
+#ifdef HAVE_ASM_SECONDARY_DIRECTIVE
+#include "pthreadP.h"
+
+/* Make sure that it is used only when libpthread is not used. */
+asm (".secondary pthread_condattr_init");
+
+int
+pthread_condattr_init (pthread_condattr_t *attr)
+{
+ return 0;
+}
+#endif
diff --git a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S b/nptl/libc-pthread_equal.c
similarity index 71%
copy from sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
copy to nptl/libc-pthread_equal.c
index 111e9c8..aa275c4 100644
--- a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
+++ b/nptl/libc-pthread_equal.c
@@ -1,6 +1,5 @@
-/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -16,4 +15,15 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include "lowlevellock.S"
+#ifdef HAVE_ASM_SECONDARY_DIRECTIVE
+#include "pthreadP.h"
+
+/* Make sure that it is used only when libpthread is not used. */
+asm (".secondary pthread_equal");
+
+int
+pthread_equal (pthread_t thread1, pthread_t thread2)
+{
+ return 1;
+}
+#endif
diff --git a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S b/nptl/libc-pthread_exit.c
similarity index 65%
copy from sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
copy to nptl/libc-pthread_exit.c
index 111e9c8..db70119 100644
--- a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
+++ b/nptl/libc-pthread_exit.c
@@ -1,6 +1,5 @@
-/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -16,4 +15,19 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include "lowlevellock.S"
+#ifdef HAVE_ASM_SECONDARY_DIRECTIVE
+#include <stdlib.h>
+#include "pthreadP.h"
+
+/* Make sure that it is used only when libpthread is not used. */
+asm (".secondary __pthread_exit");
+asm (".secondary pthread_exit");
+
+void
+__pthread_exit (void *retval)
+{
+ exit (EXIT_SUCCESS);
+}
+
+strong_alias (__pthread_exit, pthread_exit)
+#endif
diff --git a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S b/nptl/libc-pthread_getschedparam.c
similarity index 67%
copy from sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
copy to nptl/libc-pthread_getschedparam.c
index 111e9c8..f4855da 100644
--- a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
+++ b/nptl/libc-pthread_getschedparam.c
@@ -1,6 +1,5 @@
-/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -16,4 +15,16 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include "lowlevellock.S"
+#ifdef HAVE_ASM_SECONDARY_DIRECTIVE
+#include "pthreadP.h"
+
+/* Make sure that it is used only when libpthread is not used. */
+asm (".secondary pthread_getschedparam");
+
+int
+pthread_getschedparam (pthread_t target_thread, int *policy,
+ struct sched_param *param)
+{
+ return 0;
+}
+#endif
diff --git a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S b/nptl/libc-pthread_getspecific.c
similarity index 68%
copy from sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
copy to nptl/libc-pthread_getspecific.c
index 111e9c8..31a0258 100644
--- a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
+++ b/nptl/libc-pthread_getspecific.c
@@ -1,6 +1,5 @@
-/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -16,4 +15,17 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include "lowlevellock.S"
+#ifdef HAVE_ASM_SECONDARY_DIRECTIVE
+#include <stdlib.h>
+#include "pthreadP.h"
+
+/* Make sure that it is used only when libpthread is not used. */
+asm (".secondary __pthread_getspecific");
+
+void *
+__pthread_getspecific (pthread_key_t key)
+{
+ /* Not valid. */
+ return NULL;
+}
+#endif
diff --git a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S b/nptl/libc-pthread_key_create.c
similarity index 68%
copy from sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
copy to nptl/libc-pthread_key_create.c
index 111e9c8..9e28147 100644
--- a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
+++ b/nptl/libc-pthread_key_create.c
@@ -1,6 +1,5 @@
-/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -16,4 +15,16 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include "lowlevellock.S"
+#ifdef HAVE_ASM_SECONDARY_DIRECTIVE
+#include <errno.h>
+#include "pthreadP.h"
+
+/* Make sure that it is used only when libpthread is not used. */
+asm (".secondary __pthread_key_create");
+
+int
+__pthread_key_create (pthread_key_t *key, void (*destr) (void *))
+{
+ return EINVAL;
+}
+#endif
diff --git a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S b/nptl/libc-pthread_mutex_destroy.c
similarity index 71%
copy from sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
copy to nptl/libc-pthread_mutex_destroy.c
index 111e9c8..f9db255 100644
--- a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
+++ b/nptl/libc-pthread_mutex_destroy.c
@@ -1,6 +1,5 @@
-/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -16,4 +15,15 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include "lowlevellock.S"
+#ifdef HAVE_ASM_SECONDARY_DIRECTIVE
+#include "pthreadP.h"
+
+/* Make sure that it is used only when libpthread is not used. */
+asm (".secondary pthread_mutex_destroy");
+
+int
+pthread_mutex_destroy (pthread_mutex_t *mutex)
+{
+ return 0;
+}
+#endif
diff --git a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S b/nptl/libc-pthread_mutex_init.c
similarity index 68%
copy from sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
copy to nptl/libc-pthread_mutex_init.c
index 111e9c8..0e1f729 100644
--- a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
+++ b/nptl/libc-pthread_mutex_init.c
@@ -1,6 +1,5 @@
-/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -16,4 +15,16 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include "lowlevellock.S"
+#ifdef HAVE_ASM_SECONDARY_DIRECTIVE
+#include "pthreadP.h"
+
+/* Make sure that it is used only when libpthread is not used. */
+asm (".secondary pthread_mutex_init");
+
+int
+pthread_mutex_init (pthread_mutex_t *mutex,
+ const pthread_mutexattr_t *mutexattr)
+{
+ return 0;
+}
+#endif
diff --git a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S b/nptl/libc-pthread_mutex_lock.c
similarity index 65%
copy from sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
copy to nptl/libc-pthread_mutex_lock.c
index 111e9c8..4c73afc 100644
--- a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
+++ b/nptl/libc-pthread_mutex_lock.c
@@ -1,6 +1,5 @@
-/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -16,4 +15,18 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include "lowlevellock.S"
+#ifdef HAVE_ASM_SECONDARY_DIRECTIVE
+#include "pthreadP.h"
+
+/* Make sure that it is used only when libpthread is not used. */
+asm (".secondary __pthread_mutex_lock");
+asm (".secondary pthread_mutex_lock");
+
+int
+__pthread_mutex_lock (pthread_mutex_t *mutex)
+{
+ return 0;
+}
+
+strong_alias (__pthread_mutex_lock, pthread_mutex_lock)
+#endif
diff --git a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S b/nptl/libc-pthread_mutex_unlock.c
similarity index 64%
copy from sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
copy to nptl/libc-pthread_mutex_unlock.c
index 111e9c8..7c06b16 100644
--- a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
+++ b/nptl/libc-pthread_mutex_unlock.c
@@ -1,6 +1,5 @@
-/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -16,4 +15,18 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include "lowlevellock.S"
+#ifdef HAVE_ASM_SECONDARY_DIRECTIVE
+#include "pthreadP.h"
+
+/* Make sure that it is used only when libpthread is not used. */
+asm (".secondary __pthread_mutex_unlock");
+asm (".secondary pthread_mutex_unlock");
+
+int
+__pthread_mutex_unlock (pthread_mutex_t *mutex)
+{
+ return 0;
+}
+
+strong_alias (__pthread_mutex_unlock, pthread_mutex_unlock)
+#endif
diff --git a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S b/nptl/libc-pthread_once.c
similarity index 59%
copy from sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
copy to nptl/libc-pthread_once.c
index 111e9c8..ed26e06 100644
--- a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
+++ b/nptl/libc-pthread_once.c
@@ -1,6 +1,5 @@
-/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -16,4 +15,23 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include "lowlevellock.S"
+#ifdef HAVE_ASM_SECONDARY_DIRECTIVE
+#include "pthreadP.h"
+
+/* Make sure that it is used only when libpthread is not used. */
+asm (".secondary __pthread_once");
+asm (".secondary pthread_once");
+
+int
+__pthread_once (pthread_once_t *once_control,
+ void (*init_routine) (void))
+{
+ if (*once_control == PTHREAD_ONCE_INIT)
+ {
+ init_routine ();
+ *once_control |= 2;
+ }
+ return 0;
+}
+strong_alias (__pthread_once, pthread_once)
+#endif
diff --git a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S b/nptl/libc-pthread_rwlock_destroy.c
similarity index 70%
copy from sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
copy to nptl/libc-pthread_rwlock_destroy.c
index 111e9c8..181ba05 100644
--- a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
+++ b/nptl/libc-pthread_rwlock_destroy.c
@@ -1,6 +1,5 @@
-/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -16,4 +15,15 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include "lowlevellock.S"
+#ifdef HAVE_ASM_SECONDARY_DIRECTIVE
+#include "pthreadP.h"
+
+/* Make sure that it is used only when libpthread is not used. */
+asm (".secondary __pthread_rwlock_destroy");
+
+int
+__pthread_rwlock_destroy (pthread_rwlock_t *rwlock)
+{
+ return 0;
+}
+#endif
diff --git a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S b/nptl/libc-pthread_rwlock_init.c
similarity index 68%
copy from sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
copy to nptl/libc-pthread_rwlock_init.c
index 111e9c8..4e50ad9 100644
--- a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
+++ b/nptl/libc-pthread_rwlock_init.c
@@ -1,6 +1,5 @@
-/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -16,4 +15,16 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include "lowlevellock.S"
+#ifdef HAVE_ASM_SECONDARY_DIRECTIVE
+#include "pthreadP.h"
+
+/* Make sure that it is used only when libpthread is not used. */
+asm (".secondary __pthread_rwlock_init");
+
+int
+__pthread_rwlock_init (pthread_rwlock_t *rwlock,
+ const pthread_rwlockattr_t *attr)
+{
+ return 0;
+}
+#endif
diff --git a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S b/nptl/libc-pthread_rwlock_rdlock.c
similarity index 64%
copy from sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
copy to nptl/libc-pthread_rwlock_rdlock.c
index 111e9c8..c3f960b 100644
--- a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
+++ b/nptl/libc-pthread_rwlock_rdlock.c
@@ -1,6 +1,5 @@
-/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -9,11 +8,22 @@
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
+ 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 "lowlevellock.S"
+#ifdef HAVE_ASM_SECONDARY_DIRECTIVE
+#include "pthreadP.h"
+
+/* Make sure that it is used only when libpthread is not used. */
+asm (".secondary __pthread_rwlock_rdlock");
+
+int
+__pthread_rwlock_rdlock (pthread_rwlock_t *rwlock)
+{
+ return 0;
+}
+#endif
diff --git a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S b/nptl/libc-pthread_rwlock_unlock.c
similarity index 64%
copy from sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
copy to nptl/libc-pthread_rwlock_unlock.c
index 111e9c8..75e7ed3 100644
--- a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
+++ b/nptl/libc-pthread_rwlock_unlock.c
@@ -1,6 +1,5 @@
-/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -9,11 +8,22 @@
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
+ 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 "lowlevellock.S"
+#ifdef HAVE_ASM_SECONDARY_DIRECTIVE
+#include "pthreadP.h"
+
+/* Make sure that it is used only when libpthread is not used. */
+asm (".secondary __pthread_rwlock_unlock");
+
+int
+__pthread_rwlock_unlock (pthread_rwlock_t *rwlock)
+{
+ return 0;
+}
+#endif
diff --git a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S b/nptl/libc-pthread_rwlock_wrlock.c
similarity index 60%
copy from sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
copy to nptl/libc-pthread_rwlock_wrlock.c
index 111e9c8..f82deca 100644
--- a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
+++ b/nptl/libc-pthread_rwlock_wrlock.c
@@ -1,6 +1,6 @@
-/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2003-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+ Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -9,11 +9,22 @@
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
+ 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 "lowlevellock.S"
+#ifdef HAVE_ASM_SECONDARY_DIRECTIVE
+#include "pthreadP.h"
+
+/* Make sure that it is used only when libpthread is not used. */
+asm (".secondary __pthread_rwlock_wrlock");
+
+int
+__pthread_rwlock_wrlock (pthread_rwlock_t *rwlock)
+{
+ return 0;
+}
+#endif
diff --git a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S b/nptl/libc-pthread_self.c
similarity index 73%
copy from sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
copy to nptl/libc-pthread_self.c
index 111e9c8..3328f99 100644
--- a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
+++ b/nptl/libc-pthread_self.c
@@ -1,6 +1,5 @@
-/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -16,4 +15,15 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include "lowlevellock.S"
+#ifdef HAVE_ASM_SECONDARY_DIRECTIVE
+#include "pthreadP.h"
+
+/* Make sure that it is used only when libpthread is not used. */
+asm (".secondary pthread_self");
+
+pthread_t
+pthread_self (void)
+{
+ return 0;
+}
+#endif
diff --git a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S b/nptl/libc-pthread_setcancelstate.c
similarity index 62%
copy from sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
copy to nptl/libc-pthread_setcancelstate.c
index 111e9c8..1fb55e0 100644
--- a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
+++ b/nptl/libc-pthread_setcancelstate.c
@@ -1,6 +1,5 @@
-/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -16,4 +15,18 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include "lowlevellock.S"
+#ifdef HAVE_ASM_SECONDARY_DIRECTIVE
+#include <errno.h>
+#include "pthreadP.h"
+
+/* Make sure that it is used only when libpthread is not used. */
+asm (".secondary __pthread_setcancelstate");
+asm (".secondary pthread_setcancelstate");
+
+int
+__pthread_setcancelstate (int state, int *oldstate)
+{
+ return 0;
+}
+strong_alias (__pthread_setcancelstate, pthread_setcancelstate)
+#endif
diff --git a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S b/nptl/libc-pthread_setcanceltype.c
similarity index 71%
copy from sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
copy to nptl/libc-pthread_setcanceltype.c
index 111e9c8..ce6bd86 100644
--- a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
+++ b/nptl/libc-pthread_setcanceltype.c
@@ -1,6 +1,5 @@
-/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -16,4 +15,15 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include "lowlevellock.S"
+#ifdef HAVE_ASM_SECONDARY_DIRECTIVE
+#include "pthreadP.h"
+
+/* Make sure that it is used only when libpthread is not used. */
+asm (".secondary pthread_setcanceltype");
+
+int
+pthread_setcanceltype (int type, int *oldtype)
+{
+ return 0;
+}
+#endif
diff --git a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S b/nptl/libc-pthread_setschedparam.c
similarity index 67%
copy from sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
copy to nptl/libc-pthread_setschedparam.c
index 111e9c8..ea0740c 100644
--- a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
+++ b/nptl/libc-pthread_setschedparam.c
@@ -1,6 +1,5 @@
-/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -16,4 +15,16 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include "lowlevellock.S"
+#ifdef HAVE_ASM_SECONDARY_DIRECTIVE
+#include "pthreadP.h"
+
+/* Make sure that it is used only when libpthread is not used. */
+asm (".secondary pthread_setschedparam");
+
+int
+pthread_setschedparam (pthread_t target_thread, int policy,
+ const struct sched_param *param)
+{
+ return 0;
+}
+#endif
diff --git a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S b/nptl/libc-pthread_setspecific.c
similarity index 67%
copy from sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
copy to nptl/libc-pthread_setspecific.c
index 111e9c8..a904f07 100644
--- a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
+++ b/nptl/libc-pthread_setspecific.c
@@ -1,6 +1,5 @@
-/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -16,4 +15,17 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include "lowlevellock.S"
+#ifdef HAVE_ASM_SECONDARY_DIRECTIVE
+#include <errno.h>
+#include "pthreadP.h"
+
+/* Make sure that it is used only when libpthread is not used. */
+asm (".secondary __pthread_setspecific");
+
+int
+__pthread_setspecific (pthread_key_t key, const void *value)
+{
+ /* Not valid. */
+ return EINVAL;
+}
+#endif
diff --git a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S b/nptl/libc-unwind.c
similarity index 62%
copy from sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
copy to nptl/libc-unwind.c
index 111e9c8..d3ae2e8 100644
--- a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
+++ b/nptl/libc-unwind.c
@@ -1,6 +1,5 @@
-/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -16,4 +15,20 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include "lowlevellock.S"
+#ifdef HAVE_ASM_SECONDARY_DIRECTIVE
+#include <sysdep.h>
+#include <safe-fatal.h>
+
+/* Make sure that it is used only when libpthread is not used */
+asm (".secondary __pthread_unwind");
+
+void
+__attribute ((noreturn))
+__cleanup_fct_attribute
+attribute_compat_text_section
+__pthread_unwind (__pthread_unwind_buf_t *buf)
+{
+ /* We cannot call abort() here. */
+ __safe_fatal ();
+}
+#endif
diff --git a/nptl/nptl-init.c b/nptl/nptl-init.c
index 1ad41c5..fc56971 100644
--- a/nptl/nptl-init.c
+++ b/nptl/nptl-init.c
@@ -85,10 +85,11 @@ static void nptl_freeres (void);
static const struct pthread_functions pthread_functions =
{
+# ifndef HAVE_ASM_SECONDARY_DIRECTIVE
.ptr_pthread_attr_destroy = __pthread_attr_destroy,
-# if SHLIB_COMPAT(libpthread, GLIBC_2_0, GLIBC_2_1)
+# if SHLIB_COMPAT(libpthread, GLIBC_2_0, GLIBC_2_1)
.ptr___pthread_attr_init_2_0 = __pthread_attr_init_2_0,
-# endif
+# endif
.ptr___pthread_attr_init_2_1 = __pthread_attr_init_2_1,
.ptr_pthread_attr_getdetachstate = __pthread_attr_getdetachstate,
.ptr_pthread_attr_setdetachstate = __pthread_attr_setdetachstate,
@@ -127,7 +128,6 @@ static const struct pthread_functions pthread_functions =
.ptr_pthread_self = __pthread_self,
.ptr_pthread_setcancelstate = __pthread_setcancelstate,
.ptr_pthread_setcanceltype = __pthread_setcanceltype,
- .ptr___pthread_cleanup_upto = __pthread_cleanup_upto,
.ptr___pthread_once = __pthread_once,
.ptr___pthread_rwlock_rdlock = __pthread_rwlock_rdlock,
.ptr___pthread_rwlock_wrlock = __pthread_rwlock_wrlock,
@@ -137,8 +137,10 @@ static const struct pthread_functions pthread_functions =
.ptr___pthread_setspecific = __pthread_setspecific,
.ptr__pthread_cleanup_push_defer = __pthread_cleanup_push_defer,
.ptr__pthread_cleanup_pop_restore = __pthread_cleanup_pop_restore,
- .ptr_nthreads = &__nptl_nthreads,
.ptr___pthread_unwind = &__pthread_unwind,
+# endif
+ .ptr___pthread_cleanup_upto = __pthread_cleanup_upto,
+ .ptr_nthreads = &__nptl_nthreads,
.ptr__nptl_deallocate_tsd = __nptl_deallocate_tsd,
# ifdef SIGSETXID
.ptr__nptl_setxid = __nptl_setxid,
diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h
index 84a7105..c09f9d2 100644
--- a/nptl/pthreadP.h
+++ b/nptl/pthreadP.h
@@ -244,7 +244,8 @@ extern int __pthread_debug attribute_hidden;
extern void __pthread_unwind (__pthread_unwind_buf_t *__buf)
__cleanup_fct_attribute __attribute ((__noreturn__))
-#if !defined SHARED && !IS_IN (libpthread)
+#if !defined SHARED && !IS_IN (libpthread) \
+ && !defined HAVE_ASM_SECONDARY_DIRECTIVE
weak_function
#endif
;
@@ -506,6 +507,7 @@ hidden_proto (__pthread_setspecific)
hidden_proto (__pthread_once)
#endif
+#if !IS_IN (libc)
extern int __pthread_cond_broadcast_2_0 (pthread_cond_2_0_t *cond);
extern int __pthread_cond_destroy_2_0 (pthread_cond_2_0_t *cond);
extern int __pthread_cond_init_2_0 (pthread_cond_2_0_t *cond,
@@ -516,6 +518,7 @@ extern int __pthread_cond_timedwait_2_0 (pthread_cond_2_0_t *cond,
const struct timespec *abstime);
extern int __pthread_cond_wait_2_0 (pthread_cond_2_0_t *cond,
pthread_mutex_t *mutex);
+#endif
extern int __pthread_getaffinity_np (pthread_t th, size_t cpusetsize,
cpu_set_t *cpuset);
diff --git a/scripts/abilist.awk b/scripts/abilist.awk
index 52b5b32..cbc2686 100644
--- a/scripts/abilist.awk
+++ b/scripts/abilist.awk
@@ -38,7 +38,7 @@ $4 == "*UND*" { next }
$2 == "l" { next }
# If the target uses ST_OTHER, it will be output before the symbol name.
-$2 == "g" || $2 == "w" && (NF == 7 || NF == 8) {
+$2 == "g" || $2 == "w" || $2 == "s" && (NF == 7 || NF == 8) {
weak = $2;
type = $3;
size = $5;
diff --git a/sysdeps/generic/localplt.data b/sysdeps/generic/localplt.data
index 1a40cf9..ed65301 100644
--- a/sysdeps/generic/localplt.data
+++ b/sysdeps/generic/localplt.data
@@ -1,10 +1,22 @@
# See scripts/check-localplt.awk for how this file is processed.
# PLT use is required for the malloc family and for matherr because
# users can define their own functions and have library internals call them.
+# pthread functions may be preempted by libpthread at run-time.
+libc.so: __pthread_getspecific
+libc.so: __pthread_key_create
+libc.so: __pthread_once
+libc.so: __pthread_rwlock_rdlock
+libc.so: __pthread_rwlock_unlock
+libc.so: __pthread_rwlock_wrlock
+libc.so: __pthread_setspecific
+libc.so: __pthread_unwind
+libc.so: _pthread_cleanup_pop_restore
+libc.so: _pthread_cleanup_push_defer
libc.so: calloc
libc.so: free
libc.so: malloc
libc.so: memalign
+libc.so: pthread_setcancelstate
libc.so: realloc
libm.so: matherr
# The dynamic loader uses __libc_memalign internally to allocate aligned
diff --git a/sysdeps/nptl/bits/libc-lockP.h b/sysdeps/nptl/bits/libc-lockP.h
index f55f621..c5ce3b2 100644
--- a/sysdeps/nptl/bits/libc-lockP.h
+++ b/sysdeps/nptl/bits/libc-lockP.h
@@ -99,39 +99,51 @@ typedef pthread_key_t __libc_key_t;
#define __rtld_lock_initialize(NAME) \
(void) ((NAME) = (__rtld_lock_recursive_t) _RTLD_LOCK_RECURSIVE_INITIALIZER)
+#ifdef HAVE_ASM_SECONDARY_DIRECTIVE
+/* All pthread functions are available. */
+# define PTFAVAIL(NAME) 1
+
+/* When secondary symbols are used, FUNC is implemented to return ELSE so
+ that we can always call FUNC. */
+# define __libc_maybe_call(FUNC, ARGS, ELSE) FUNC ARGS
+# define __libc_ptf_call(FUNC, ARGS, ELSE) FUNC ARGS
+# define __libc_ptf_call_always(FUNC, ARGS) FUNC ARGS
+#else
/* If we check for a weakly referenced symbol and then perform a
normal jump to it te code generated for some platforms in case of
PIC is unnecessarily slow. What would happen is that the function
is first referenced as data and then it is called indirectly
through the PLT. We can make this a direct jump. */
-#ifdef __PIC__
-# define __libc_maybe_call(FUNC, ARGS, ELSE) \
- (__extension__ ({ __typeof (FUNC) *_fn = (FUNC); \
- _fn != NULL ? (*_fn) ARGS : ELSE; }))
-#else
-# define __libc_maybe_call(FUNC, ARGS, ELSE) \
- (FUNC != NULL ? FUNC ARGS : ELSE)
-#endif
+# ifdef __PIC__
+# define __libc_maybe_call(FUNC, ARGS, ELSE) \
+ (__extension__ ({ __typeof (FUNC) *_fn = (FUNC); \
+ _fn != NULL ? (*_fn) ARGS : ELSE; }))
+# else
+# define __libc_maybe_call(FUNC, ARGS, ELSE) \
+ (FUNC != NULL ? FUNC ARGS : ELSE)
+# endif
/* Call thread functions through the function pointer table. */
-#if defined SHARED && IS_IN (libc)
-# define PTFAVAIL(NAME) __libc_pthread_functions_init
-# define __libc_ptf_call(FUNC, ARGS, ELSE) \
+# if defined SHARED && IS_IN (libc) \
+ && !defined HAVE_ASM_SECONDARY_DIRECTIVE
+# define PTFAVAIL(NAME) __libc_pthread_functions_init
+# define __libc_ptf_call(FUNC, ARGS, ELSE) \
(__libc_pthread_functions_init ? PTHFCT_CALL (ptr_##FUNC, ARGS) : ELSE)
-# define __libc_ptf_call_always(FUNC, ARGS) \
+# define __libc_ptf_call_always(FUNC, ARGS) \
PTHFCT_CALL (ptr_##FUNC, ARGS)
-#elif IS_IN (libpthread)
-# define PTFAVAIL(NAME) 1
-# define __libc_ptf_call(FUNC, ARGS, ELSE) \
+# elif IS_IN (libpthread)
+# define PTFAVAIL(NAME) 1
+# define __libc_ptf_call(FUNC, ARGS, ELSE) \
FUNC ARGS
-# define __libc_ptf_call_always(FUNC, ARGS) \
+# define __libc_ptf_call_always(FUNC, ARGS) \
FUNC ARGS
-#else
-# define PTFAVAIL(NAME) (NAME != NULL)
-# define __libc_ptf_call(FUNC, ARGS, ELSE) \
- __libc_maybe_call (FUNC, ARGS, ELSE)
-# define __libc_ptf_call_always(FUNC, ARGS) \
+# else
+# define PTFAVAIL(NAME) (NAME != NULL)
+# define __libc_ptf_call(FUNC, ARGS, ELSE) \
+ __libc_maybe_call (FUNC, ARGS, ELSE)
+# define __libc_ptf_call_always(FUNC, ARGS) \
FUNC ARGS
+# endif
#endif
@@ -379,8 +391,9 @@ extern int __pthread_atfork (void (*__prepare) (void),
/* Make the pthread functions weak so that we can elide them from
- single-threaded processes. */
-#ifndef __NO_WEAK_PTHREAD_ALIASES
+ single-threaded processes unless secondary symbols are used. */
+#if !defined __NO_WEAK_PTHREAD_ALIASES \
+ && !defined HAVE_ASM_SECONDARY_DIRECTIVE
# ifdef weak_extern
weak_extern (__pthread_mutex_init)
weak_extern (__pthread_mutex_destroy)
diff --git a/sysdeps/nptl/pthread-functions.h b/sysdeps/nptl/pthread-functions.h
index 0784c59..8e71e54 100644
--- a/sysdeps/nptl/pthread-functions.h
+++ b/sysdeps/nptl/pthread-functions.h
@@ -30,6 +30,7 @@ struct xid_command;
the thread functions. */
struct pthread_functions
{
+#ifndef HAVE_ASM_SECONDARY_DIRECTIVE
int (*ptr_pthread_attr_destroy) (pthread_attr_t *);
int (*ptr___pthread_attr_init_2_0) (pthread_attr_t *);
int (*ptr___pthread_attr_init_2_1) (pthread_attr_t *);
@@ -77,7 +78,6 @@ struct pthread_functions
pthread_t (*ptr_pthread_self) (void);
int (*ptr_pthread_setcancelstate) (int, int *);
int (*ptr_pthread_setcanceltype) (int, int *);
- void (*ptr___pthread_cleanup_upto) (__jmp_buf, char *);
int (*ptr___pthread_once) (pthread_once_t *, void (*) (void));
int (*ptr___pthread_rwlock_rdlock) (pthread_rwlock_t *);
int (*ptr___pthread_rwlock_wrlock) (pthread_rwlock_t *);
@@ -89,10 +89,12 @@ struct pthread_functions
void (*) (void *), void *);
void (*ptr__pthread_cleanup_pop_restore) (struct _pthread_cleanup_buffer *,
int);
-#define HAVE_PTR_NTHREADS
- unsigned int *ptr_nthreads;
void (*ptr___pthread_unwind) (__pthread_unwind_buf_t *)
__attribute ((noreturn)) __cleanup_fct_attribute;
+#endif
+ void (*ptr___pthread_cleanup_upto) (__jmp_buf, char *);
+#define HAVE_PTR_NTHREADS
+ unsigned int *ptr_nthreads;
void (*ptr__nptl_deallocate_tsd) (void);
int (*ptr__nptl_setxid) (struct xid_command *);
void (*ptr_freeres) (void);
diff --git a/sysdeps/unix/sysv/linux/fatal-prepare.h b/sysdeps/unix/sysv/linux/fatal-prepare.h
index 45d88ce..25f919c 100644
--- a/sysdeps/unix/sysv/linux/fatal-prepare.h
+++ b/sysdeps/unix/sysv/linux/fatal-prepare.h
@@ -19,19 +19,24 @@
/* We have to completely disable cancellation. assert() must not be a
cancellation point but the implementation uses write() etc. */
-#ifdef SHARED
-# include <pthread-functions.h>
-# define FATAL_PREPARE \
- { \
- if (__libc_pthread_functions_init) \
- PTHFCT_CALL (ptr_pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, \
- NULL)); \
- }
+#ifdef HAVE_ASM_SECONDARY_DIRECTIVE
+extern int __pthread_setcancelstate (int __state, int *__oldstate);
+# define FATAL_PREPARE __pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, NULL);
#else
-# pragma weak pthread_setcancelstate
-# define FATAL_PREPARE \
- { \
- if (pthread_setcancelstate != NULL) \
- pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, NULL); \
- }
+# ifdef SHARED
+# include <pthread-functions.h>
+# define FATAL_PREPARE \
+ { \
+ if (__libc_pthread_functions_init) \
+ PTHFCT_CALL (ptr_pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, \
+ NULL)); \
+ }
+# else
+# pragma weak pthread_setcancelstate
+# define FATAL_PREPARE \
+ { \
+ if (pthread_setcancelstate != NULL) \
+ pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, NULL); \
+ }
+# endif
#endif
diff --git a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S b/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
index 111e9c8..cf3f206 100644
--- a/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
+++ b/sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S
@@ -16,4 +16,10 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+#if IS_IN (libc) && !defined SHARED
+/* Allow libpthread.a to override the ones in libc.a. */
+ weak_extern (__lll_lock_wait_private)
+ weak_extern (__lll_unlock_wake_private)
+#endif
+
#include "lowlevellock.S"
diff --git a/sysdeps/unix/sysv/linux/i386/libc.abilist b/sysdeps/unix/sysv/linux/i386/libc.abilist
index 3cb314d..c8a8ebd 100644
--- a/sysdeps/unix/sysv/linux/i386/libc.abilist
+++ b/sysdeps/unix/sysv/linux/i386/libc.abilist
@@ -189,6 +189,12 @@ GLIBC_2.0
__profile_frequency F
__progname D 0x4
__progname_full D 0x4
+ __pthread_getspecific F
+ __pthread_key_create F
+ __pthread_mutex_lock F
+ __pthread_mutex_unlock F
+ __pthread_once F
+ __pthread_setspecific F
__rcmd_errstr D 0x4
__read F
__realloc_hook D 0x4
@@ -269,6 +275,8 @@ GLIBC_2.0
_obstack_free F
_obstack_memory_used F
_obstack_newchunk F
+ _pthread_cleanup_pop_restore F
+ _pthread_cleanup_push_defer F
_res D 0x200
_rpc_dtablesize F
_seterr_reply F
@@ -868,6 +876,7 @@ GLIBC_2.0
pthread_mutex_init F
pthread_mutex_lock F
pthread_mutex_unlock F
+ pthread_once F
pthread_self F
pthread_setcancelstate F
pthread_setcanceltype F
@@ -1882,6 +1891,9 @@ GLIBC_2.2
__lxstat64 F
__nl_langinfo_l F
__open64 F
+ __pthread_rwlock_rdlock F
+ __pthread_rwlock_unlock F
+ __pthread_rwlock_wrlock F
__res_init F
__res_nclose F
__res_ninit F
diff --git a/sysdeps/unix/sysv/linux/i386/localplt.data b/sysdeps/unix/sysv/linux/i386/localplt.data
index b25abf8..e36342a 100644
--- a/sysdeps/unix/sysv/linux/i386/localplt.data
+++ b/sysdeps/unix/sysv/linux/i386/localplt.data
@@ -4,6 +4,18 @@ libc.so: free
libc.so: malloc
libc.so: memalign
libc.so: realloc
+# pthread functions may be preempted by libpthread at run-time.
+libc.so: __pthread_getspecific
+libc.so: __pthread_key_create
+libc.so: __pthread_once
+libc.so: __pthread_rwlock_rdlock
+libc.so: __pthread_rwlock_unlock
+libc.so: __pthread_rwlock_wrlock
+libc.so: __pthread_setspecific
+libc.so: __pthread_unwind
+libc.so: _pthread_cleanup_pop_restore
+libc.so: _pthread_cleanup_push_defer
+libc.so: pthread_setcancelstate
libm.so: matherr
# The dynamic loader uses __libc_memalign internally to allocate aligned
# TLS storage. The other malloc family of functions are expected to allow
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
index 914b590..56d1fe0 100644
--- a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
@@ -377,6 +377,15 @@ GLIBC_2.2.5
__profile_frequency F
__progname D 0x8
__progname_full D 0x8
+ __pthread_getspecific F
+ __pthread_key_create F
+ __pthread_mutex_lock F
+ __pthread_mutex_unlock F
+ __pthread_once F
+ __pthread_rwlock_rdlock F
+ __pthread_rwlock_unlock F
+ __pthread_rwlock_wrlock F
+ __pthread_setspecific F
__pwrite64 F
__rawmemchr F
__rcmd_errstr D 0x8
@@ -527,6 +536,8 @@ GLIBC_2.2.5
_obstack_free F
_obstack_memory_used F
_obstack_newchunk F
+ _pthread_cleanup_pop_restore F
+ _pthread_cleanup_push_defer F
_res D 0x238
_res_hconf D 0x48
_rpc_dtablesize F
@@ -1299,6 +1310,7 @@ GLIBC_2.2.5
pthread_mutex_init F
pthread_mutex_lock F
pthread_mutex_unlock F
+ pthread_once F
pthread_self F
pthread_setcancelstate F
pthread_setcanceltype F
diff --git a/sysdeps/unix/sysv/linux/x86_64/cancellation.S b/sysdeps/unix/sysv/linux/x86_64/cancellation.S
index 4c34beb..52a27dc 100644
--- a/sysdeps/unix/sysv/linux/x86_64/cancellation.S
+++ b/sysdeps/unix/sysv/linux/x86_64/cancellation.S
@@ -26,7 +26,7 @@
# define __pthread_unwind __GI___pthread_unwind
# endif
#else
-# ifndef SHARED
+# if !defined SHARED && !defined HAVE_ASM_SECONDARY_DIRECTIVE
.weak __pthread_unwind
# endif
#endif
diff --git a/sysdeps/unix/sysv/linux/x86_64/libc-lowlevellock.S b/sysdeps/unix/sysv/linux/x86_64/libc-lowlevellock.S
index 111e9c8..cf3f206 100644
--- a/sysdeps/unix/sysv/linux/x86_64/libc-lowlevellock.S
+++ b/sysdeps/unix/sysv/linux/x86_64/libc-lowlevellock.S
@@ -16,4 +16,10 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+#if IS_IN (libc) && !defined SHARED
+/* Allow libpthread.a to override the ones in libc.a. */
+ weak_extern (__lll_lock_wait_private)
+ weak_extern (__lll_unlock_wake_private)
+#endif
+
#include "lowlevellock.S"
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
index 0f64c8d..dacadc0 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
@@ -341,6 +341,15 @@ GLIBC_2.16
__profile_frequency F
__progname D 0x4
__progname_full D 0x4
+ __pthread_getspecific F
+ __pthread_key_create F
+ __pthread_mutex_lock F
+ __pthread_mutex_unlock F
+ __pthread_once F
+ __pthread_rwlock_rdlock F
+ __pthread_rwlock_unlock F
+ __pthread_rwlock_wrlock F
+ __pthread_setspecific F
__ptsname_r_chk F
__pwrite64 F
__rawmemchr F
@@ -543,6 +552,8 @@ GLIBC_2.16
_obstack_free F
_obstack_memory_used F
_obstack_newchunk F
+ _pthread_cleanup_pop_restore F
+ _pthread_cleanup_push_defer F
_res D 0x200
_res_hconf D 0x30
_rpc_dtablesize F
@@ -1448,6 +1459,7 @@ GLIBC_2.16
pthread_mutex_init F
pthread_mutex_lock F
pthread_mutex_unlock F
+ pthread_once F
pthread_self F
pthread_setcancelstate F
pthread_setcanceltype F
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=e5daf5a6ed7e88493ab4c79d8dc444451a7083b7
commit e5daf5a6ed7e88493ab4c79d8dc444451a7083b7
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Tue Sep 11 05:10:03 2012 -0700
Place libpthread.a right before libc.a
GCC driver places -lpthread in --start-group -lgcc -lgcc_eh -lpthread
-lc --end-group. Glibc tests should do the same.
[BZ #14569]
* Makeconfig (+link-static-before-libc): Also filter out
$(common-objpfx)nptl/libpthread%. Remove $(link-libc-static).
(link-libc-static-tests): Place libpthread.a before libc.a.
* nptl/Makefile (tests-static): Add tst-cancelx7-static,
tst-raise1-static and tst-cancel7-static.
(tests): Likewise.
* nptl/tst-cancel7-static.c: New file.
* nptl/tst-cancelx7-static.c: Likewise.
* nptl/tst-raise1-static.c: Likewise.
diff --git a/Makeconfig b/Makeconfig
index 751e9ff..28b6f88 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -414,6 +414,7 @@ ifndef +link-static
$(filter-out $(addprefix $(csu-objpfx),start.o \
$(start-installed-name))\
$(+preinit) $(link-extra-libs-static) \
+ $(common-objpfx)nptl/libpthread% \
$(common-objpfx)libc% $(+postinit),$^) \
$(link-extra-libs-static)
+link-static-after-libc = $(+postctorT) $(+postinit)
@@ -506,7 +507,12 @@ endif
# The static libraries.
link-libc-static = -Wl,--start-group $(common-objpfx)libc.a $(static-gnulib) -Wl,--end-group
-link-libc-static-tests = -Wl,--start-group $(common-objpfx)libc.a $(static-gnulib-tests) -Wl,--end-group
+# libpthread.a must be placed before libc.a between -start-group and
+# --end-group.
+link-libc-static-tests = -Wl,--start-group \
+ $(filter $(common-objpfx)nptl/libpthread.a,$^) \
+ $(common-objpfx)libc.a \
+ $(static-gnulib-tests) -Wl,--end-group
# How to link against libgcc. Some libgcc functions, such as those
# for "long long" arithmetic or software floating point, can always be
diff --git a/nptl/Makefile b/nptl/Makefile
index 43d8510..17d5c2c 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -298,7 +298,8 @@ tests += tst-cancelx2 tst-cancelx3 tst-cancelx4 tst-cancelx5 \
tst-cancelx11 tst-cancelx12 tst-cancelx13 tst-cancelx14 tst-cancelx15 \
tst-cancelx16 tst-cancelx17 tst-cancelx18 tst-cancelx20 tst-cancelx21 \
tst-cleanupx0 tst-cleanupx1 tst-cleanupx2 tst-cleanupx3 tst-cleanupx4 \
- tst-oncex3 tst-oncex4
+ tst-oncex3 tst-oncex4 tst-cancelx7-static
+tests-static += tst-cancelx7-static
endif
ifeq ($(build-shared),yes)
tests += tst-atfork2 tst-tls3 tst-tls4 tst-tls5 tst-_res1 tst-fini1 \
@@ -366,10 +367,12 @@ link-libc-static := $(common-objpfx)libc.a $(static-gnulib) \
tests-static += tst-locale1 tst-locale2 tst-stackguard1-static \
tst-cancel21-static tst-cancel24-static tst-cond8-static \
tst-mutex8-static tst-mutexpi8-static tst-sem11-static \
- tst-sem12-static
+ tst-sem12-static \
+ tst-cancel21-static tst-raise1-static tst-cancel7-static
tests += tst-stackguard1-static tst-cancel21-static tst-cancel24-static \
tst-cond8-static tst-mutex8-static tst-mutexpi8-static \
- tst-sem11-static tst-sem12-static
+ tst-sem11-static tst-sem12-static \
+ tst-cancel21-static tst-raise1-static tst-cancel7-static
xtests-static += tst-setuid1-static
# These tests are linked with libc before libpthread
diff --git a/nptl/tst-cancel7-static.c b/nptl/tst-cancel7-static.c
new file mode 100644
index 0000000..4df1a58
--- /dev/null
+++ b/nptl/tst-cancel7-static.c
@@ -0,0 +1 @@
+#include "tst-cancel7.c"
diff --git a/nptl/tst-cancelx7-static.c b/nptl/tst-cancelx7-static.c
new file mode 100644
index 0000000..a15dfe2
--- /dev/null
+++ b/nptl/tst-cancelx7-static.c
@@ -0,0 +1 @@
+#include "tst-cancelx7.c"
diff --git a/nptl/tst-raise1-static.c b/nptl/tst-raise1-static.c
new file mode 100644
index 0000000..f25ad50
--- /dev/null
+++ b/nptl/tst-raise1-static.c
@@ -0,0 +1 @@
+#include "tst-raise1.c"
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=d8f0433371731d83a754ad173215e6a38d712424
commit d8f0433371731d83a754ad173215e6a38d712424
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Fri Sep 11 06:27:40 2015 -0700
Make pthread_rwlock_destroy/pthread_rwlock_init/weak
* pthread_rwlock_destroy.c (pthread_rwlock_destroy): Replace
strong_alias with weak_alias.
* pthread_rwlock_init.c (pthread_rwlock_init): Likewise.
diff --git a/nptl/pthread_rwlock_destroy.c b/nptl/pthread_rwlock_destroy.c
index 7faf0c3..bc956e4 100644
--- a/nptl/pthread_rwlock_destroy.c
+++ b/nptl/pthread_rwlock_destroy.c
@@ -29,4 +29,4 @@ __pthread_rwlock_destroy (rwlock)
/* Nothing to be done. For now. */
return 0;
}
-strong_alias (__pthread_rwlock_destroy, pthread_rwlock_destroy)
+weak_alias (__pthread_rwlock_destroy, pthread_rwlock_destroy)
diff --git a/nptl/pthread_rwlock_init.c b/nptl/pthread_rwlock_init.c
index 23ee6c6..471a994 100644
--- a/nptl/pthread_rwlock_init.c
+++ b/nptl/pthread_rwlock_init.c
@@ -70,4 +70,4 @@ __pthread_rwlock_init (rwlock, attr)
return 0;
}
-strong_alias (__pthread_rwlock_init, pthread_rwlock_init)
+weak_alias (__pthread_rwlock_init, pthread_rwlock_init)
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=af345c230d3f2d2b810cfec292188e26c3da5a48
commit af345c230d3f2d2b810cfec292188e26c3da5a48
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Thu Sep 10 13:41:43 2015 -0700
Add STB_SECONDARY support to conform/linknamespace.pl
* conform/linknamespace.pl (list_syms): Support STB_SECONDARY.
diff --git a/conform/linknamespace.pl b/conform/linknamespace.pl
index b534746..2280286 100644
--- a/conform/linknamespace.pl
+++ b/conform/linknamespace.pl
@@ -75,7 +75,7 @@ sub list_syms {
my ($bind) = $fields[4];
my ($ndx) = $fields[6];
my ($sym) = $fields[7];
- if ($bind ne "GLOBAL" && $bind ne "WEAK") {
+ if ($bind ne "GLOBAL" && $bind ne "WEAK" && $bind ne "SECOND") {
next;
}
if ($sym !~ /^\w+$/) {
-----------------------------------------------------------------------
hooks/post-receive
--
GNU C Library master sources