This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
[PATCH] PPC sysdep-cancel.h fix for --without-__thread
- From: Steve Munroe <sjmunroe at us dot ibm dot com>
- To: libc-alpha at sources dot redhat dot com
- Date: Fri, 09 Jan 2004 18:53:48 -0600
- Subject: [PATCH] PPC sysdep-cancel.h fix for --without-__thread
- Organization: IBM LTC
- Reply-to: sjmunroe at vnet dot ibm dot com
The current cvs head will not build for ppc32/64 if configured for
--without-__thread --without-tls. This is normally only used during the
early bootstrap of a PPC biarch toolchain but is still necessary.
2004-01-09 Steven Munroe <sjmunroe@us.ibm.com>
* sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h
[!HAVE_TLS_SUPPORT]: Define SINGLE_THREAD_P using static
__lib*_multiple_threads.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h
[!HAVE_TLS_SUPPORT]: Define SINGLE_THREAD_P using static
__lib*_multiple_threads.
diff -urN libc23-cvstip-20040102/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h libc23/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h
--- libc23-cvstip-20040102/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h 2003-06-17 17:22:56.000000000 -0500
+++ libc23/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h 2004-01-09 13:07:48.000000000 -0600
@@ -86,13 +86,41 @@
# define CDISABLE bl JUMPTARGET(__librt_disable_asynccancel)
# endif
-# ifndef __ASSEMBLER__
-# define SINGLE_THREAD_P \
+# ifdef HAVE_TLS_SUPPORT
+# ifndef __ASSEMBLER__
+# define SINGLE_THREAD_P \
__builtin_expect (THREAD_GETMEM (THREAD_SELF, p_multiple_threads) == 0, 1)
-# else
-# define SINGLE_THREAD_P \
+# else
+# define SINGLE_THREAD_P \
lwz 10,MULTIPLE_THREADS_OFFSET(2); \
cmpwi 10,0
+# endif
+# else
+# if !defined NOT_IN_libc
+# define __local_multiple_threads __libc_multiple_threads
+# else
+# define __local_multiple_threads __librt_multiple_threads
+# endif
+# ifndef __ASSEMBLER__
+extern int __local_multiple_threads attribute_hidden;
+# define SINGLE_THREAD_P __builtin_expect (__local_multiple_threads == 0, 1)
+# else
+# if !defined PIC
+# define SINGLE_THREAD_P \
+ lis 10,__local_multiple_threads@ha; \
+ lwz 10,__local_multiple_threads@l(10); \
+ cmpwi 10,0
+# else
+# define SINGLE_THREAD_P \
+ mflr 9; \
+ bl _GLOBAL_OFFSET_TABLE_@local-4; \
+ mflr 10; \
+ mtlr 9; \
+ lwz 10,__local_multiple_threads@got(10); \
+ lwz 10,0(10); \
+ cmpwi 10,0
+# endif
+# endif
# endif
#elif !defined __ASSEMBLER__
diff -urN libc23-cvstip-20040102/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h libc23/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h
--- libc23-cvstip-20040102/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h 2003-12-17 17:02:43.000000000 -0600
+++ libc23/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h 2004-01-09 11:16:48.000000000 -0600
@@ -89,13 +89,34 @@
# define __local_multiple_threads __librt_multiple_threads
# endif
-# ifndef __ASSEMBLER__
-# define SINGLE_THREAD_P \
+# ifdef HAVE_TLS_SUPPORT
+# ifndef __ASSEMBLER__
+# define SINGLE_THREAD_P \
__builtin_expect (THREAD_GETMEM (THREAD_SELF, p_multiple_threads) == 0, 1)
-# else
-# define SINGLE_THREAD_P \
+# else
+# define SINGLE_THREAD_P \
lwz 10,MULTIPLE_THREADS_OFFSET(13); \
cmpwi 10,0
+# endif
+# else /* !HAVE_TLS_SUPPORT */
+# ifndef __ASSEMBLER__
+extern int __local_multiple_threads
+# if !defined NOT_IN_libc || defined IS_IN_libpthread
+ attribute_hidden;
+# else
+ ;
+# endif
+# define SINGLE_THREAD_P __builtin_expect (__local_multiple_threads == 0, 1)
+# else
+# define SINGLE_THREAD_P \
+ .section ".toc","aw"; \
+.LC__local_multiple_threads:; \
+ .tc __local_multiple_threads[TC],__local_multiple_threads; \
+ .previous; \
+ ld 10,.LC__local_multiple_threads@toc(2); \
+ lwz 10,0(10); \
+ cmpwi 10,0
+# endif
# endif
#elif !defined __ASSEMBLER__