This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH 06/15] Add internal IFUNC call workaround
- From: Andi Kleen <andi at firstfloor dot org>
- To: libc-alpha at sourceware dot org
- Cc: hjl dot tools at gmail dot com,Andi Kleen <ak at linux dot intel dot com>
- Date: Sat, 22 Dec 2012 19:02:33 -0800
- Subject: [PATCH 06/15] Add internal IFUNC call workaround
- References: <1356231762-23777-1-git-send-email-andi@firstfloor.org>
From: Andi Kleen <ak@linux.intel.com>
Avoid problems with internal hidden IFUNC calls on i386.
See http://www.sourceware.org/bugzilla/show_bug.cgi?id=14961
for more details
This actually improves performance on x86-64 because the
call will go directly instead of through the PLT.
2012-12-22 Hongjiu Lu <hongjiu.lu@intel.com>
* nptl/pthreadP.h (extern void __pthread_disable_asynccancel):
* nptl/sysdeps/unix/sysv/linux/i386/i686/multiarch/Implies:
* nptl/sysdeps/unix/sysv/linux/x86/multiarch/nptl-init.c:
* nptl/sysdeps/unix/sysv/linux/x86_64/multiarch/Implies:
---
nptl/pthreadP.h | 2 ++
.../unix/sysv/linux/i386/i686/multiarch/Implies | 1 +
.../unix/sysv/linux/x86/multiarch/nptl-init.c | 15 +++++++++++++++
.../unix/sysv/linux/x86_64/multiarch/Implies | 1 +
4 files changed, 19 insertions(+), 0 deletions(-)
create mode 100644 nptl/sysdeps/unix/sysv/linux/i386/i686/multiarch/Implies
create mode 100644 nptl/sysdeps/unix/sysv/linux/x86/multiarch/nptl-init.c
create mode 100644 nptl/sysdeps/unix/sysv/linux/x86_64/multiarch/Implies
diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h
index fa89cbf..5cff300 100644
--- a/nptl/pthreadP.h
+++ b/nptl/pthreadP.h
@@ -492,7 +492,9 @@ extern void __pthread_disable_asynccancel (int oldtype)
#if defined NOT_IN_libc && defined IS_IN_libpthread
hidden_proto (__pthread_mutex_init)
hidden_proto (__pthread_mutex_destroy)
+# ifndef __pthread_mutex_lock
hidden_proto (__pthread_mutex_lock)
+# endif
hidden_proto (__pthread_mutex_unlock)
hidden_proto (__pthread_rwlock_rdlock)
hidden_proto (__pthread_rwlock_wrlock)
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i686/multiarch/Implies b/nptl/sysdeps/unix/sysv/linux/i386/i686/multiarch/Implies
new file mode 100644
index 0000000..a8518c7
--- /dev/null
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i686/multiarch/Implies
@@ -0,0 +1 @@
+unix/sysv/linux/x86/multiarch
diff --git a/nptl/sysdeps/unix/sysv/linux/x86/multiarch/nptl-init.c b/nptl/sysdeps/unix/sysv/linux/x86/multiarch/nptl-init.c
new file mode 100644
index 0000000..1d52a68
--- /dev/null
+++ b/nptl/sysdeps/unix/sysv/linux/x86/multiarch/nptl-init.c
@@ -0,0 +1,15 @@
+/* __pthread_initialize_minimal_internal () has
+
+ GL(dl_rtld_lock_recursive) = (void *) __pthread_mutex_lock;
+
+ This doesn't work with hidden IFUNC function. See
+
+ http://www.sourceware.org/bugzilla/show_bug.cgi?id=14961
+
+ for details. The work around is not to mark __pthread_mutex_lock
+ hidden. It also helps x86-64 since we now use the real function
+ address at run-time, instead of its PLT entry. */
+
+#define __pthread_mutex_lock __GI___pthread_mutex_lock
+
+#include <nptl/nptl-init.c>
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/multiarch/Implies b/nptl/sysdeps/unix/sysv/linux/x86_64/multiarch/Implies
new file mode 100644
index 0000000..a8518c7
--- /dev/null
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/multiarch/Implies
@@ -0,0 +1 @@
+unix/sysv/linux/x86/multiarch
--
1.7.7.6