public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] SINGLE_THREAD_P in ld.so
@ 2006-10-27  8:29 Jakub Jelinek
  0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2006-10-27  8:29 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: Glibc hackers

Hi!

When trying to optimize the {_dl_{,profile_}fixup,dl{,v}sym} vs.
dlopen/dlclose locking, I missed the fact that SINGLE_THREAD_P is
unconditionally defined to 1 in ld.so.  The result is that al the
__rtld_mrlock_* stuff is ATM optimized out in ld.so.
This patch fixes that.

2006-10-27  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h (SINGLE_THREAD_P):
	Define to THREAD_SELF->header.multiple_threads.
	* sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h (SINGLE_THREAD_P):
	Likewise.
	* sysdeps/unix/sysv/linux/i386/sysdep-cancel.h (SINGLE_THREAD_P):
	Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/sysdep-cancel.h
	(SINGLE_THREAD_P): Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/sysdep-cancel.h
	(SINGLE_THREAD_P): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h
	(SINGLE_THREAD_P): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h
	(SINGLE_THREAD_P): Likewise.
	* sysdeps/unix/sysv/linux/x86_64/sysdep-cancel.h (SINGLE_THREAD_P):
	Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/sysdep-cancel.h
	(SINGLE_THREAD_P): Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/sysdep-cancel.h
	(SINGLE_THREAD_P): Likewise.
	* sysdeps/unix/sysv/linux/sh/sysdep-cancel.h (SINGLE_THREAD_P):
	Likewise.

--- libc/nptl/sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h.jj	2004-09-06 03:12:02.000000000 +0200
+++ libc/nptl/sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h	2006-10-24 10:22:00.000000000 +0200
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -163,7 +163,13 @@ extern int __local_multiple_threads attr
 
 #else
 
-# define SINGLE_THREAD_P (1)
+# ifdef IS_IN_rtld
+#  define SINGLE_THREAD_P \
+  __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
+				   header.multiple_threads) == 0, 1)
+# else
+#  define SINGLE_THREAD_P (1)
+# endif
 # define NO_CANCELLATION 1
 
 #endif
--- libc/nptl/sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h.jj	2004-07-06 06:25:45.000000000 +0200
+++ libc/nptl/sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h	2006-10-24 10:22:11.000000000 +0200
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@redhat.com>, 2002.
 
@@ -216,7 +216,13 @@ __GC_##name:								      \
 
 #elif !defined __ASSEMBLER__
 
-# define SINGLE_THREAD_P (1)
+# ifdef IS_IN_rtld
+#  define SINGLE_THREAD_P \
+  __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
+				   header.multiple_threads) == 0, 1)
+# else
+#  define SINGLE_THREAD_P (1)
+# endif
 # define NO_CANCELLATION 1
 
 #endif
--- libc/nptl/sysdeps/unix/sysv/linux/i386/sysdep-cancel.h.jj	2006-10-17 11:21:51.000000000 +0200
+++ libc/nptl/sysdeps/unix/sysv/linux/i386/sysdep-cancel.h	2006-10-24 10:22:11.000000000 +0200
@@ -143,7 +143,13 @@
 
 #elif !defined __ASSEMBLER__
 
-# define SINGLE_THREAD_P (1)
+# ifdef IS_IN_rtld
+#  define SINGLE_THREAD_P \
+  __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
+		    		   header.multiple_threads) == 0, 1)
+# else
+#  define SINGLE_THREAD_P (1)
+# endif
 # define NO_CANCELLATION 1
 
 #endif
--- libc/nptl/sysdeps/unix/sysv/linux/s390/s390-32/sysdep-cancel.h.jj	2004-07-06 06:25:44.000000000 +0200
+++ libc/nptl/sysdeps/unix/sysv/linux/s390/s390-32/sysdep-cancel.h	2006-10-24 10:22:00.000000000 +0200
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
 
@@ -109,7 +109,13 @@ L(pseudo_end):
 
 #elif !defined __ASSEMBLER__
 
-# define SINGLE_THREAD_P (1)
+# ifdef IS_IN_rtld
+#  define SINGLE_THREAD_P \
+  __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
+				   header.multiple_threads) == 0, 1)
+# else
+#  define SINGLE_THREAD_P (1)
+# endif
 # define NO_CANCELLATION 1
 
 #endif
--- libc/nptl/sysdeps/unix/sysv/linux/s390/s390-64/sysdep-cancel.h.jj	2004-07-06 06:25:44.000000000 +0200
+++ libc/nptl/sysdeps/unix/sysv/linux/s390/s390-64/sysdep-cancel.h	2006-10-24 10:22:00.000000000 +0200
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
 
@@ -122,7 +122,13 @@ extern int __local_multiple_threads attr
 
 #elif !defined __ASSEMBLER__
 
-# define SINGLE_THREAD_P (1)
+# ifdef IS_IN_rtld
+#  define SINGLE_THREAD_P \
+  __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
+				   header.multiple_threads) == 0, 1)
+# else
+#  define SINGLE_THREAD_P (1)
+# endif
 # define NO_CANCELLATION 1
 
 #endif
--- libc/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h.jj	2006-01-04 21:03:07.000000000 +0100
+++ libc/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h	2006-10-24 10:22:00.000000000 +0200
@@ -113,7 +113,13 @@
 
 #elif !defined __ASSEMBLER__
 
-# define SINGLE_THREAD_P (1)
+# ifdef IS_IN_rtld
+#  define SINGLE_THREAD_P \
+  __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
+				   header.multiple_threads) == 0, 1)
+# else
+#  define SINGLE_THREAD_P (1)
+# endif
 # define NO_CANCELLATION 1
 
 #endif
--- libc/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h.jj	2006-01-04 21:03:07.000000000 +0100
+++ libc/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h	2006-10-24 10:22:00.000000000 +0200
@@ -124,7 +124,13 @@
 
 #elif !defined __ASSEMBLER__
 
-# define SINGLE_THREAD_P (1)
+# ifdef IS_IN_rtld
+#  define SINGLE_THREAD_P \
+  __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
+				   header.multiple_threads) == 0, 1)
+# else
+#  define SINGLE_THREAD_P (1)
+# endif
 # define NO_CANCELLATION 1
 
 #endif
--- libc/nptl/sysdeps/unix/sysv/linux/x86_64/sysdep-cancel.h.jj	2005-03-31 12:00:15.000000000 +0200
+++ libc/nptl/sysdeps/unix/sysv/linux/x86_64/sysdep-cancel.h	2006-10-24 10:22:11.000000000 +0200
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@redhat.com>, 2002.
 
@@ -132,7 +132,13 @@ extern int __local_multiple_threads attr
 
 #elif !defined __ASSEMBLER__
 
-# define SINGLE_THREAD_P (1)
+# ifdef IS_IN_rtld
+#  define SINGLE_THREAD_P \
+  __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
+				   header.multiple_threads) == 0, 1)
+# else
+#  define SINGLE_THREAD_P (1)
+# endif
 # define NO_CANCELLATION 1
 
 #endif
--- libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep-cancel.h.jj	2006-03-06 02:34:01.000000000 +0100
+++ libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep-cancel.h	2006-10-24 10:22:00.000000000 +0200
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@redhat.com>, 2002.
 
@@ -100,7 +100,13 @@ __##syscall_name##_nocancel:			\
 
 #elif !defined __ASSEMBLER__
 
-# define SINGLE_THREAD_P (1)
+# ifdef IS_IN_rtld
+#  define SINGLE_THREAD_P \
+  __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
+				   header.multiple_threads) == 0, 1)
+# else
+#  define SINGLE_THREAD_P (1)
+# endif
 # define NO_CANCELLATION 1
 
 #endif
--- libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep-cancel.h.jj	2006-03-06 02:34:01.000000000 +0100
+++ libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep-cancel.h	2006-10-24 10:22:00.000000000 +0200
@@ -98,7 +98,13 @@ __##syscall_name##_nocancel:			\
 
 #elif !defined __ASSEMBLER__
 
-# define SINGLE_THREAD_P (1)
+# ifdef IS_IN_rtld
+#  define SINGLE_THREAD_P \
+  __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
+				   header.multiple_threads) == 0, 1)
+# else
+#  define SINGLE_THREAD_P (1)
+# endif
 # define NO_CANCELLATION 1
 
 #endif
--- libc/nptl/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h.jj	2005-12-30 23:18:03.000000000 +0100
+++ libc/nptl/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h	2006-10-24 10:22:00.000000000 +0200
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -157,7 +157,13 @@
 
 #elif !defined __ASSEMBLER__
 
-# define SINGLE_THREAD_P (1)
+# ifdef IS_IN_rtld
+#  define SINGLE_THREAD_P \
+  __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
+				   header.multiple_threads) == 0, 1)
+# else
+#  define SINGLE_THREAD_P (1)
+# endif
 # define NO_CANCELLATION 1
 
 #endif

	Jakub

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-10-27  8:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-27  8:29 [PATCH] SINGLE_THREAD_P in ld.so Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).