summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorro <ro@138bc75d-0d04-0410-961f-82ee72b054a4>2003-07-31 12:01:07 +0000
committerro <ro@138bc75d-0d04-0410-961f-82ee72b054a4>2003-07-31 12:01:07 +0000
commitecd34a083ef758a6a59a9df0a24a7aedfee5cd34 (patch)
tree9da070fa50d61c24f4bb30ee44be274f1103d7fc
parent90e5cba77b5686e7c51d04caf6fab0a8f0523a56 (diff)
downloadgcc-ecd34a083ef758a6a59a9df0a24a7aedfee5cd34.tar.gz
* config.gcc (alpha*-dec-osf[45]*): Enable POSIX thread support by
default. * gthr-posix.c: New file. * gthr-posix.h: Define _REENTRANT if missing. Make _LIBOBJC #pragma weak visible with _LIBOBJC_WEAK. * config/alpha/t-osf4 (SHLIB_LINK): Hide dummy functions provided by gthr-posix.o. * config/alpha/t-osf-pthread: New file. * fixinc/inclhack.def (alpha_pthread): New fix. * fixinc/fixincl.x: Regenerate. * fixinc/tests/base/pthread.h [ALPHA_PTHREAD_CHECK]: New testcase. * doc/install.texi (alpha*-dec-osf*): Remove --enable-threads warning. Fixes PR bootstrap/9330. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@69998 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog21
-rw-r--r--gcc/config.gcc6
-rw-r--r--gcc/config/alpha/t-osf-pthread5
-rw-r--r--gcc/config/alpha/t-osf44
-rw-r--r--gcc/doc/install.texi3
-rw-r--r--gcc/fixinc/fixincl.x55
-rw-r--r--gcc/fixinc/inclhack.def19
-rw-r--r--gcc/fixinc/tests/base/pthread.h7
-rw-r--r--gcc/gthr-posix.c207
-rw-r--r--gcc/gthr-posix.h12
10 files changed, 328 insertions, 11 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 475035d2585..20ea858a735 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,26 @@
2003-07-31 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
+ * config.gcc (alpha*-dec-osf[45]*): Enable POSIX thread support by
+ default.
+
+ * gthr-posix.c: New file.
+ * gthr-posix.h: Define _REENTRANT if missing.
+ Make _LIBOBJC #pragma weak visible with _LIBOBJC_WEAK.
+
+ * config/alpha/t-osf4 (SHLIB_LINK): Hide dummy functions provided
+ by gthr-posix.o.
+ * config/alpha/t-osf-pthread: New file.
+
+ * fixinc/inclhack.def (alpha_pthread): New fix.
+ * fixinc/fixincl.x: Regenerate.
+ * fixinc/tests/base/pthread.h [ALPHA_PTHREAD_CHECK]: New testcase.
+
+ * doc/install.texi (alpha*-dec-osf*): Remove --enable-threads
+ warning.
+ Fixes PR bootstrap/9330.
+
+2003-07-31 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
+
* configure.in (gcc_cv_ld_hidden): Also disable on mips-sgi-irix5*
without GNU ld.
Update comment.
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 427298e7629..c9266a5620c 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -609,6 +609,12 @@ alpha*-dec-osf[45]*)
target_cpu_default=MASK_SUPPORT_ARCH
;;
esac
+ case x${enable_threads} in
+ x | xyes | xpthreads | xposix)
+ thread_file='posix'
+ tmake_file="${tmake_file} alpha/t-osf-pthread"
+ ;;
+ esac
;;
alpha64-dec-*vms*)
tm_file="${tm_file} alpha/vms.h alpha/vms64.h"
diff --git a/gcc/config/alpha/t-osf-pthread b/gcc/config/alpha/t-osf-pthread
new file mode 100644
index 00000000000..968e65cce9e
--- /dev/null
+++ b/gcc/config/alpha/t-osf-pthread
@@ -0,0 +1,5 @@
+# Provide dummy POSIX threads functions
+LIB2FUNCS_EXTRA += $(srcdir)/gthr-posix.c
+
+# Compile libgcc2 with POSIX threads supports
+TARGET_LIBGCC2_CFLAGS=-pthread
diff --git a/gcc/config/alpha/t-osf4 b/gcc/config/alpha/t-osf4
index 0525d617662..fe747a3d521 100644
--- a/gcc/config/alpha/t-osf4
+++ b/gcc/config/alpha/t-osf4
@@ -10,7 +10,11 @@ SHLIB_NAME = @shlib_base_name@.so
SHLIB_SONAME = @shlib_base_name@.so.1
SHLIB_OBJS = @shlib_objs@
+# Hide all POSIX threads related symbols provided by gthr-posix.c. This
+# only has an effect if t-osf-pthread is in use.
SHLIB_LINK = $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \
+ -Wl,-hidden_symbol,pthread\* -Wl,-hidden_symbol,__pthread\* \
+ -Wl,-hidden_symbol,sched_get_\* -Wl,-hidden_symbol,sched_yield \
-Wl,-msym -Wl,-set_version,gcc.1 -Wl,-soname,$(SHLIB_SONAME) \
-o $(SHLIB_NAME) @multilib_flags@ $(SHLIB_OBJS) -lc && \
rm -f $(SHLIB_SONAME) && \
diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index 6f3fbf1dbcb..c1869453f07 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -2030,9 +2030,6 @@ As of GNU binutils 2.11.2, neither GNU @command{as} nor GNU @command{ld}
are supported on Tru64 UNIX, so you must not configure GCC with
@option{--with-gnu-as} or @option{--with-gnu-ld}.
-The @option{--enable-threads} options isn't supported yet. A patch is
-in preparation for a future release.
-
GCC writes a @samp{.verstamp} directive to the assembler output file
unless it is built as a cross-compiler. It gets the version to use from
the system header file @file{/usr/include/stamp.h}. If you install a
diff --git a/gcc/fixinc/fixincl.x b/gcc/fixinc/fixincl.x
index c25527be893..d08f86c3c0b 100644
--- a/gcc/fixinc/fixincl.x
+++ b/gcc/fixinc/fixincl.x
@@ -2,11 +2,11 @@
*
* DO NOT EDIT THIS FILE (fixincl.x)
*
- * It has been AutoGen-ed Thursday July 17, 2003 at 10:34:33 AM PDT
+ * It has been AutoGen-ed Tuesday July 29, 2003 at 08:15:05 PM MEST
* From the definitions inclhack.def
* and the template file fixincl
*/
-/* DO NOT CVS-MERGE THIS FILE, EITHER Thu Jul 17 10:34:33 PDT 2003
+/* DO NOT CVS-MERGE THIS FILE, EITHER Tue Jul 29 20:15:06 MEST 2003
*
* You must regenerate it. Use the ./genfixes script.
*
@@ -15,7 +15,7 @@
* certain ANSI-incompatible system header files which are fixed to work
* correctly with ANSI C and placed in a directory that GNU C will search.
*
- * This file contains 154 fixup descriptions.
+ * This file contains 155 fixup descriptions.
*
* See README for more information.
*
@@ -859,6 +859,45 @@ static const char* apzAlpha_ParensPatch[] = {
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
+ * Description of Alpha_Pthread fix
+ */
+tSCC zAlpha_PthreadName[] =
+ "alpha_pthread";
+
+/*
+ * File name selection pattern
+ */
+tSCC zAlpha_PthreadList[] =
+ "|pthread.h|";
+/*
+ * Machine/OS name selection pattern
+ */
+tSCC* apzAlpha_PthreadMachs[] = {
+ "alpha*-dec-osf*",
+ (const char*)NULL };
+
+/*
+ * content selection pattern - do fix if pattern found
+ */
+tSCC zAlpha_PthreadSelect0[] =
+ "(#[ \t]*if defined \\(_PTHREAD_ENV_DECC\\) || defined \\(_PTHREAD_ENV_EPCC\\))\n\
+(#[ \t]*define _PTHREAD_USE_PTDNAM_)";
+
+#define ALPHA_PTHREAD_TEST_CT 1
+static tTestDesc aAlpha_PthreadTests[] = {
+ { TT_EGREP, zAlpha_PthreadSelect0, (regex_t*)NULL }, };
+
+/*
+ * Fix Command Arguments for Alpha_Pthread
+ */
+static const char* apzAlpha_PthreadPatch[] = {
+ "format",
+ "%1 || defined (__PRAGMA_EXTERN_PREFIX)\n\
+%2",
+ (char*)NULL };
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
* Description of Alpha_Sbrk fix
*/
tSCC zAlpha_SbrkName[] =
@@ -6109,9 +6148,9 @@ static const char* apzX11_SprintfPatch[] = {
*
* List of all fixes
*/
-#define REGEX_COUNT 173
+#define REGEX_COUNT 174
#define MACH_LIST_SIZE_LIMIT 261
-#define FIX_COUNT 154
+#define FIX_COUNT 155
/*
* Enumerate the fixes
@@ -6135,6 +6174,7 @@ typedef enum {
ALPHA_ASSERT_FIXIDX,
ALPHA_GETOPT_FIXIDX,
ALPHA_PARENS_FIXIDX,
+ ALPHA_PTHREAD_FIXIDX,
ALPHA_SBRK_FIXIDX,
AVOID_BOOL_DEFINE_FIXIDX,
AVOID_BOOL_TYPE_FIXIDX,
@@ -6364,6 +6404,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
ALPHA_PARENS_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
aAlpha_ParensTests, apzAlpha_ParensPatch, 0 },
+ { zAlpha_PthreadName, zAlpha_PthreadList,
+ apzAlpha_PthreadMachs,
+ ALPHA_PTHREAD_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+ aAlpha_PthreadTests, apzAlpha_PthreadPatch, 0 },
+
{ zAlpha_SbrkName, zAlpha_SbrkList,
apzAlpha_SbrkMachs,
ALPHA_SBRK_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
diff --git a/gcc/fixinc/inclhack.def b/gcc/fixinc/inclhack.def
index 7fd6f451da0..b593d83d2b9 100644
--- a/gcc/fixinc/inclhack.def
+++ b/gcc/fixinc/inclhack.def
@@ -578,6 +578,25 @@ fix = {
/*
+ * Obey __PRAGMA_EXTERN_PREFIX for Tru64 UNIX <pthread.h>.
+ */
+fix = {
+ hackname = alpha_pthread;
+ files = pthread.h;
+ select = "(#[ \t]*if defined \\(_PTHREAD_ENV_DECC\\) || defined \\(_PTHREAD_ENV_EPCC\\))\n"
+ "(#[ \t]*define _PTHREAD_USE_PTDNAM_)";
+
+ mach = "alpha*-dec-osf*";
+ c_fix = format;
+ c_fix_arg = "%1 || defined (__PRAGMA_EXTERN_PREFIX)\n%2";
+
+ test_text = "# if defined (_PTHREAD_ENV_DECC) || defined (_PTHREAD_ENV_EPCC)\n"
+ "# define _PTHREAD_USE_PTDNAM_\n"
+ "# endif";
+};
+
+
+/*
* Fix return value of sbrk in unistd.h on Alpha OSF/1 V2.0
* And OpenBSD.
*/
diff --git a/gcc/fixinc/tests/base/pthread.h b/gcc/fixinc/tests/base/pthread.h
index ec7ff351f45..95ad2d56c67 100644
--- a/gcc/fixinc/tests/base/pthread.h
+++ b/gcc/fixinc/tests/base/pthread.h
@@ -15,6 +15,13 @@
#endif /* AIX_PTHREAD_CHECK */
+#if defined( ALPHA_PTHREAD_CHECK )
+# if defined (_PTHREAD_ENV_DECC) || defined (_PTHREAD_ENV_EPCC) || defined (__PRAGMA_EXTERN_PREFIX)
+# define _PTHREAD_USE_PTDNAM_
+# endif
+#endif /* ALPHA_PTHREAD_CHECK */
+
+
#if defined( PTHREAD_PAGE_SIZE_CHECK )
extern int __page_size;
#endif /* PTHREAD_PAGE_SIZE_CHECK */
diff --git a/gcc/gthr-posix.c b/gcc/gthr-posix.c
new file mode 100644
index 00000000000..56bbad28301
--- /dev/null
+++ b/gcc/gthr-posix.c
@@ -0,0 +1,207 @@
+/* POSIX threads dummy routines for systems without weak definitions. */
+/* Compile this one with gcc. */
+/* Copyright (C) 2003 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+
+/* As a special exception, if you link this library with other files,
+ some of which are compiled with GCC, to produce an executable,
+ this library does not by itself cause the resulting executable
+ to be covered by the GNU General Public License.
+ This exception does not however invalidate any other reasons why
+ the executable file might be covered by the GNU General Public License. */
+
+#include "tconfig.h"
+#include "tm.h"
+/* Define so we provide weak definitions of functions used by libobjc only. */
+#define _LIBOBJC_WEAK
+#include "gthr.h"
+
+int
+pthread_once (pthread_once_t *once ATTRIBUTE_UNUSED,
+ void (*func) (void) ATTRIBUTE_UNUSED)
+{
+ return -1;
+}
+
+int
+pthread_key_create (pthread_key_t *key ATTRIBUTE_UNUSED,
+ void (*dtor) (void *) ATTRIBUTE_UNUSED)
+{
+ return -1;
+}
+
+int
+pthread_key_delete (pthread_key_t key ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+void *
+pthread_getspecific (pthread_key_t key ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+int
+pthread_setspecific (pthread_key_t key ATTRIBUTE_UNUSED,
+ const void *ptr ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+int
+pthread_create (pthread_t *thread ATTRIBUTE_UNUSED,
+ const pthread_attr_t *attr ATTRIBUTE_UNUSED,
+ void *(*start_routine) (void *) ATTRIBUTE_UNUSED,
+ void *arg ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+int
+pthread_mutex_lock (pthread_mutex_t *mutex ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+int
+pthread_mutex_trylock (pthread_mutex_t *mutex ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+int
+pthread_mutex_unlock (pthread_mutex_t *mutex ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+int
+pthread_cond_broadcast (pthread_cond_t *cond ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+int
+pthread_cond_destroy (pthread_cond_t *cond ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+int
+pthread_cond_init (pthread_cond_t *cond ATTRIBUTE_UNUSED,
+ const pthread_condattr_t *attr ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+int
+pthread_cond_signal (pthread_cond_t *cond ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+int
+pthread_cond_wait (pthread_cond_t *cond ATTRIBUTE_UNUSED,
+ pthread_mutex_t *mutex ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+void
+pthread_exit (void *value_ptr ATTRIBUTE_UNUSED)
+{
+}
+
+int
+pthread_mutex_init (pthread_mutex_t *mutex ATTRIBUTE_UNUSED,
+ const pthread_mutexattr_t *attr ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+int
+pthread_mutex_destroy (pthread_mutex_t *mutex ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+pthread_t
+pthread_self (void)
+{
+ return (pthread_t) 0;
+}
+
+#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
+int
+sched_get_priority_max (int policy ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+int
+sched_get_priority_min (int policy ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
+
+int
+sched_yield (void)
+{
+ return 0;
+}
+
+int
+pthread_attr_destroy (pthread_attr_t *attr ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+int
+pthread_attr_init (pthread_attr_t *attr ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+int
+pthread_attr_setdetachstate (pthread_attr_t *attr ATTRIBUTE_UNUSED,
+ int detachstate ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
+int
+pthread_getschedparam (pthread_t thread ATTRIBUTE_UNUSED,
+ int *policy ATTRIBUTE_UNUSED,
+ struct sched_param *param ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+int
+pthread_setschedparam (pthread_t thread ATTRIBUTE_UNUSED,
+ int policy ATTRIBUTE_UNUSED,
+ const struct sched_param *param ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
+
diff --git a/gcc/gthr-posix.h b/gcc/gthr-posix.h
index 02f70aa9b32..88234daae93 100644
--- a/gcc/gthr-posix.h
+++ b/gcc/gthr-posix.h
@@ -1,6 +1,7 @@
/* Threads compatibility routines for libgcc2 and libobjc. */
/* Compile this one with gcc. */
-/* Copyright (C) 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1999, 2000, 2001, 2002, 2003
+ Free Software Foundation, Inc.
This file is part of GCC.
@@ -34,6 +35,11 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#define __GTHREADS 1
+/* Some implementations of <pthread.h> require this to be defined. */
+#ifndef _REENTRANT
+#define _REENTRANT 1
+#endif
+
#include <pthread.h>
#include <unistd.h>
@@ -57,7 +63,7 @@ typedef pthread_mutex_t __gthread_mutex_t;
#pragma weak pthread_mutex_trylock
#pragma weak pthread_mutex_unlock
-#ifdef _LIBOBJC
+#if defined(_LIBOBJC) || defined(_LIBOBJC_WEAK)
/* Objective-C. */
#pragma weak pthread_cond_broadcast
#pragma weak pthread_cond_destroy
@@ -82,7 +88,7 @@ typedef pthread_mutex_t __gthread_mutex_t;
#pragma weak pthread_getschedparam
#pragma weak pthread_setschedparam
#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
-#endif /* _LIBOBJC */
+#endif /* _LIBOBJC || _LIBOBJC_WEAK */
static inline int
__gthread_active_p (void)