aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Hainque <hainque@adacore.com>2019-12-30 21:42:26 +0000
committerOlivier Hainque <hainque@gcc.gnu.org>2019-12-30 21:42:26 +0000
commitabb6c3eecf6680814624bd1fe454844002dfc892 (patch)
treea612594b95661ae744ec614c6c14e93bf6723fa0
parentc62f986a37898b5ebd36bd8f184d9e8d969d7ab4 (diff)
downloadgcc-abb6c3eecf6680814624bd1fe454844002dfc892.zip
gcc-abb6c3eecf6680814624bd1fe454844002dfc892.tar.gz
gcc-abb6c3eecf6680814624bd1fe454844002dfc892.tar.bz2
Introduce an internal API for VxWorks version checks
This changes introduces an internal API for VxWorks version checks within runtime files, a prerequisite to a few fixes coming up for libstdc++ builds on more recent versions of the OS. 2019-12-30 Olivier Hainque <hainque@adacore.com> gcc/ * config/vxworks/_vxworks-versions.h: New file. * config.gcc (*-*-vxworks*): Add it to extra_headers. libgcc/ * config/gthr-vxworks.h: Use _vxworks-versions.h. * config/gthr-vxworks-tls.c: Likewise. From-SVN: r279783
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/config.gcc7
-rw-r--r--libgcc/ChangeLog5
-rw-r--r--libgcc/config/gthr-vxworks-tls.c10
-rw-r--r--libgcc/config/gthr-vxworks.h12
5 files changed, 26 insertions, 13 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 7fc3463..ee7346a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
2019-12-30 Olivier Hainque <hainque@adacore.com>
+ * config/vxworks/_vxworks-versions.h: New file.
+ * config.gcc (*-*-vxworks*): Add it to extra_headers.
+
+2019-12-30 Olivier Hainque <hainque@adacore.com>
+
* config/t-vxworks: Rework the vxworks.o compilation
rules to use $(COMPILE).
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 1110f7b..f4f58d2 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -961,6 +961,13 @@ case ${target} in
target_has_targetcm="yes"
use_gcc_stdint=provide
tm_file="${tm_file} vxworks-stdint.h"
+
+ # This private header exposes a consistent interface for checks on
+ # the VxWorks version our runtime header files need to perform, based on
+ # what the system headers adverstise:
+
+ extra_headers="${extra_headers} ../vxworks/_vxworks-versions.h"
+
case ${enable_threads} in
no) ;;
"" | yes | vxworks) thread_file='vxworks' ;;
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog
index cb94bfb..3b7c4b0 100644
--- a/libgcc/ChangeLog
+++ b/libgcc/ChangeLog
@@ -1,5 +1,10 @@
2019-12-30 Olivier Hainque <hainque@adacore.com>
+ * config/gthr-vxworks.h: Use _vxworks-versions.h.
+ * config/gthr-vxworks-tls.c: Likewise.
+
+2019-12-30 Olivier Hainque <hainque@adacore.com>
+
* config/gthr-vxworks.h (GTHREAD_ONCE_INIT): Use
standard zero-initializer syntax.
diff --git a/libgcc/config/gthr-vxworks-tls.c b/libgcc/config/gthr-vxworks-tls.c
index 96b6bfb..63715e6 100644
--- a/libgcc/config/gthr-vxworks-tls.c
+++ b/libgcc/config/gthr-vxworks-tls.c
@@ -45,6 +45,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include <errno.h>
#endif
+#include <_vxworks-versions.h>
+
/* Thread-local storage.
A gthread TLS key is simply an offset in an array, the address of which
@@ -91,10 +93,10 @@ static int self_owner;
it is only removed when unloading this module. */
static volatile int delete_hook_installed;
-/* TLS data access internal API. A straight __thread variable on VxWorks 7,
- a pointer returned by kernel provided routines otherwise. */
+/* TLS data access internal API. A straight __thread variable starting with
+ VxWorks 7, a pointer returned by kernel provided routines otherwise. */
-#ifdef __VXWORKS7__
+#if _VXWORKS_MAJOR_GE(7)
static __thread struct tls_data *__gthread_tls_data;
@@ -118,7 +120,7 @@ extern void __gthread_leave_tls_dtor_context (void);
#define VX_ENTER_TLS_DTOR() __gthread_enter_tls_dtor_context ()
#define VX_LEAVE_TLS_DTOR() __gthread_leave_tls_dtor_context ()
-#endif /* __VXWORKS7__ */
+#endif
/* This is a global structure which records all of the active keys.
diff --git a/libgcc/config/gthr-vxworks.h b/libgcc/config/gthr-vxworks.h
index 70205ce..65c5096 100644
--- a/libgcc/config/gthr-vxworks.h
+++ b/libgcc/config/gthr-vxworks.h
@@ -35,13 +35,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#else
#include <vxWorks.h>
-#include <version.h>
-
-/* Conditional compilation directives are easier to read when they fit on a
- single line, which is helped by macros with shorter names. */
-#define _VXW_MAJOR _WRS_VXWORKS_MAJOR
-#define _VXW_MINOR _WRS_VXWORKS_MINOR
-#define _VXW_PRE_69 (_VXW_MAJOR < 6 || (_VXW_MAJOR == 6 && _VXW_MINOR < 9))
+#include <_vxworks-versions.h>
/* Some VxWorks headers profusely use typedefs of a pointer to a function with
undefined number of arguments. */
@@ -62,7 +56,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
/* RTP, pre 6.9. */
-#if defined(__RTP__) && _VXW_PRE_69
+#if defined(__RTP__) && _VXWORKS_PRE(6,9)
#define __TAS(x) vxCas ((x), 0, 1)
typedef volatile unsigned char __vx_tas_t;
@@ -71,7 +65,7 @@ typedef volatile unsigned char __vx_tas_t;
/* RTP, 6.9 and beyond. */
-#if defined(__RTP__) && !_VXW_PRE_69
+#if defined(__RTP__) && !_VXWORKS_PRE(6,9)
#define __TAS(x) vxAtomicCas ((x), 0, 1)
typedef atomic_t __vx_tas_t;