This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[basic-improvements] Final piece of VxWorks thread support


This patch adds the final piece of VxWorks thread support: a module to
be dropped into the kernel build framework, and some documentation for
how to do that (in the target-specific installation instructions).

The module compiles with a powerpc-wrs-vxworks cross compiler and the
documentation passes makeinfo and install.texi2html.

Applied to branch.

zw

	* contrib/gthr_supp_vxw_5x.c: New file.
	* gcc/doc/install.texi: Add *-*-vxworks* specific installation
	instructions.

===================================================================
Index: contrib/gthr_supp_vxw_5x.c
--- contrib/gthr_supp_vxw_5x.c	1 Jan 1970 00:00:00 -0000
+++ contrib/gthr_supp_vxw_5x.c	10 Nov 2002 01:08:11 -0000
@@ -0,0 +1,92 @@
+/* Kernel-side additional module for the VxWorks threading support
+   logic for GCC.  Written 2002 by Zack Weinberg.
+
+   This file is distributed with GCC, but it is not part of GCC.
+   The contents of this file are in the public domain.  */
+
+/* If you are using the Tornado IDE, copy this file to
+   $WIND_BASE/target/config/comps/src/gthread_supp.c.  Then create a
+   file named 10comp_gthread_supp.cdf in target/config/comps/vxWorks
+   with the following contents:
+
+   Component INCLUDE_GCC_GTHREAD {
+      NAME                GCC 3.x gthread support (required by C++)
+      CONFIGLETTES        gthread_supp.c
+      REQUIRES            INCLUDE_CPLUS
+      INCLUDE_WHEN        INCLUDE_CPLUS
+      _FOLDER             FOLDER_CPLUS
+   }
+
+   If you are using command line builds, instead copy this file to
+   $WIND_BASE/target/src/config/gthread_supp.c, and add the following
+   block to target/src/config/usrExtra.c:
+
+   #ifdef INCLUDE_CPLUS
+   #include "../../src/config/gthread_supp.c"
+   #endif
+
+   You should now be able to rebuild your application using GCC 3.x.  */
+
+#include <vxWorks.h>
+#include <taskLib.h>
+
+/* This file provides these routines:  */
+extern void *__gthread_get_tsd_data (WIND_TCB *tcb);
+extern void __gthread_set_tsd_data (WIND_TCB *tcb, void *data);
+
+extern void __gthread_enter_tsd_dtor_context (WIND_TCB *tcb);
+extern void __gthread_leave_tsd_dtor_context (WIND_TCB *tcb);
+
+/* Set and retrieve the TSD data block for the task TCB.
+
+   Possible choices for TSD_SLOT are:
+     reserved1
+     reserved2
+     spare1
+     spare2
+     spare3
+     spare4
+   (these are all fields of the TCB structure; all have type 'int').
+
+   If you find that the slot chosen by default is already used for
+   something else, simply change the #define below and recompile this
+   file.  No other file should reference TSD_SLOT directly.  */
+
+/* WARNING: This code is not 64-bit clean (it assumes that a pointer
+   can be held in an 'int' without truncation).  As much of the rest
+   of VxWorks also makes this assumption, we can't really avoid it.  */
+
+#define TSD_SLOT reserved1
+
+void *
+__gthread_get_tsd_data (WIND_TCB *tcb)
+{
+  return (void *) (tcb->TSD_SLOT);
+}
+
+void
+__gthread_set_tsd_data (WIND_TCB *tcb, void *data)
+{
+  tcb->TSD_SLOT = (int) data;
+}
+
+/* Enter and leave "TSD destructor context".  This is defined as a
+   state in which it is safe to call free() from a task delete hook
+   on a memory block allocated by the task being deleted.
+   For VxWorks 5.x, nothing needs to be done.  */
+
+#if __GNUC__ >= 2
+#define UNUSED __attribute__((unused))
+#else
+#define UNUSED
+#endif
+
+void
+__gthread_enter_tsd_dtor_context (WIND_TCB *tcb UNUSED)
+{
+}
+
+void
+__gthread_leave_tsd_dtor_context (WIND_TCB *tcb UNUSED)
+{
+}
===================================================================
Index: gcc/doc/install.texi
--- gcc/doc/install.texi	5 Nov 2002 19:12:25 -0000	1.136.2.7
+++ gcc/doc/install.texi	10 Nov 2002 01:08:14 -0000
@@ -1703,6 +1703,8 @@ GNU Compiler Collection on your machine.
 @item
 @uref{#vax-dec-ultrix,,vax-dec-ultrix}
 @item
+@uref{#*-*-vxworks*,,*-*-vxworks*}
+@item
 @uref{#xtensa-*-elf,,xtensa-*-elf}
 @item
 @uref{#xtensa-*-linux*,,xtensa-*-linux*}
@@ -3195,6 +3197,41 @@ On a System V release 4 system, make sur
 @heading @anchor{vax-dec-ultrix}vax-dec-ultrix
 Don't try compiling with VAX C (@code{vcc}).  It produces incorrect code
 in some cases (for example, when @code{alloca} is used).
+
+@html
+<hr />
+@end html
+@heading @anchor{*-*-vxworks*}*-*-vxworks*
+Support for VxWorks is in flux.  At present GCC supports @emph{only} the
+very recent VxWorks 5.5 (aka Tornado 2.2) release, and only on PowerPC.
+We welcome patches for other architectures supported by VxWorks 5.5.
+Support for VxWorks AE would also be welcome; we believe this is merely
+a matter of writing an appropriate ``configlette'' (see below).  We are
+not interested in supporting older, a.out or COFF-based, versions of
+VxWorks in GCC 3.
+
+VxWorks comes with an older version of GCC installed in
+@file{@var{$WIND_BASE}/host}; we recommend you do not overwrite it.
+Choose an installation @var{prefix} entirely outside @var{$WIND_BASE}.
+Before running @command{configure}, create the directories @file{@var{prefix}}
+and @file{@var{prefix}/bin}.  Link or copy the appropriate assembler,
+linker, etc. into @file{@var{prefix}/bin}, and set your @var{PATH} to
+include that directory while running both @command{configure} and
+@command{make}.
+
+You must give @command{configure} the
+@option{--with-headers=@var{$WIND_BASE}/target/h} switch so that it can
+find the VxWorks system headers.  Since VxWorks is a cross compilation
+target only, you must also specify @option{--target=@var{target}}.
+@command{configure} will attempt to create the directory
+@file{@var{prefix}/@var{target}/sys-include} and copy files into it;
+make sure the user running @command{configure} has sufficient privilege
+to do so.
+
+GCC's exception handling runtime requires a special ``configlette''
+module, @file{contrib/gthr_supp_vxw_5x.c}.  Follow the instructions in
+that file to add the module to your kernel build.  (Future versions of
+VxWorks will incorporate this module.)  
 
 @html
 <hr />


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]