]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Adapt libstdc++ os_defines for VxWorks to more recent versions
authorJerome Lambourg <lambourg@adacore.com>
Mon, 30 Dec 2019 22:22:34 +0000 (22:22 +0000)
committerOlivier Hainque <hainque@gcc.gnu.org>
Mon, 30 Dec 2019 22:22:34 +0000 (22:22 +0000)
This change reworks the VxWorks specific os_defines.h internal
lisbstdc++ header to help fix build and runtime failures of various
kinds in environments from 6.4/6.9 to 7 SR640, based on experiments
and observations conducted against real installs of these OSes for
different CPU architectures.

2019-12-30  Jerome Lambourg  <lambourg@adacore.com>
           Olivier Hainque  <hainque@adacore.com>

libstdc++
* config/os/vxworks/os_defines.h
(NOMINMAX): Always redefine to 1.
(_NO_CPP_INLINES): Likewise.
(_GLIBCXX_USE_WEAK_REF): Define to 1 for RTP on
VxWorks >= 7, to 0 otherwise.
(_GLIBCXX_HAVE_TLS): Define to 1.
For VxWorks >= 7:
(_GLIBCXX_USE_C99_MATH): Define to 1.
(_GLIBCXX_USE_C99_MATH_FP_MACROS_DYNAMIC): Define to 0.
(_HAS_TR1_DECLARATIONS): Redefine to 0.
For VxWorks < 7, RTP:
(_GLIBCXX_INCLUDE_NEXT_C_HEADERS): Define to 1.
(_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC): Redefine to 1.
(__CORRECT_ISO_CPP11_MATH_H_PROTO_FP): Define.
For VxWorks < 7, kernel: #include <vxWorks.h>

Co-Authored-By: Olivier Hainque <hainque@adacore.com>
From-SVN: r279792

libstdc++-v3/ChangeLog
libstdc++-v3/config/os/vxworks/os_defines.h

index 947bfd2d92131313877abb7a93c0a4059d8b362a..c9b4922dc96138714906758253e5b3779b8d5ea0 100644 (file)
@@ -1,3 +1,22 @@
+2019-12-30  Jerome Lambourg  <lambourg@adacore.com>
+            Olivier Hainque  <hainque@adacore.com>
+
+       * config/os/vxworks/os_defines.h
+       (NOMINMAX): Always redefine to 1.
+       (_NO_CPP_INLINES): Likewise.
+       (_GLIBCXX_USE_WEAK_REF): Define to 1 for RTP on
+       VxWorks >= 7, to 0 otherwise.
+       (_GLIBCXX_HAVE_TLS): Define to 1.
+       For VxWorks >= 7:
+       (_GLIBCXX_USE_C99_MATH): Define to 1.
+       (_GLIBCXX_USE_C99_MATH_FP_MACROS_DYNAMIC): Define to 0.
+       (_HAS_TR1_DECLARATIONS): Redefine to 0.
+       For VxWorks < 7, RTP:
+       (_GLIBCXX_INCLUDE_NEXT_C_HEADERS): Define to 1.
+       (_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC): Redefine to 1.
+       (__CORRECT_ISO_CPP11_MATH_H_PROTO_FP): Define.
+       For VxWorks < 7, kernel: #include <vxWorks.h>
+
 2019-12-25  Alexandre Oliva <oliva@adacore.com>
 
        * crossconfig.m4 (GLIBCXX_CROSSCONFIG) [*-vxworks*]: Define
index 3a9a9587622f9ce70e9fbc816efe3d5c652398e5..c5573a40b0dcb98d6a801b2ff66ca700504818dd 100644 (file)
 // System-specific #define, typedefs, corrections, etc, go here.  This
 // file will come before all others.
 
-//Keep vxWorks from defining min()/max() as macros
-#ifdef NOMINMAX
-#undef NOMINMAX
+// The system environment we can rely on varies across VxWorks
+// versions.
+#include <_vxworks-versions.h>
+
+// Weak refs are supported starting with VxWorks 7, in RTP mode only
+
+#if _VXWORKS_MAJOR_GE(7) && defined(__RTP__)
+#define _GLIBCXX_USE_WEAK_REF 1
+#else
+#define _GLIBCXX_USE_WEAK_REF 0
 #endif
+
+// We support TLS on VxWorks (either directly or with emutls)
+#define _GLIBCXX_HAVE_TLS 1
+
+// VxWorks7 comes with a DinkumWare library and the system headers which we
+// are going to include for libstdc++ have a few related intrinsic
+// assumptions.  We control our own configuration here to best integrate with
+// this environment: use C99 math headers, do not use the FP macros for
+// dynamic cast by default (overriden for RTPs below) and arrange to disable
+// the system TR1 declarations as we'll provide ours.
+
+#if _VXWORKS_MAJOR_GE(7)
+
+#define _GLIBCXX_USE_C99_MATH 1
+#define _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC 0
+
+#undef _HAS_TR1_DECLARATIONS
+#define _HAS_TR1_DECLARATIONS 0
+
+#else  // VXWORKS_MAJOR < 7
+
+// For RTPs, use the VxWorks headers as a basis, from which we can use
+// C99 dynamic FP macros and expect (after fixincludes) accurate c++11
+// prototypes for FP.
+
+#ifdef __RTP__
+
+#define _GLIBCXX_INCLUDE_NEXT_C_HEADERS 1
+
+#undef _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC
+#define _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC 1
+
+#define __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
+
+#else // !__RTP__
+
+// libstdc++ will include system headers and vxWorks.h ought to have
+// been included ahead for VxWorks kernel modules prior to VxWorks 7
+#include <vxWorks.h>
+
+#endif // __RTP__
+
+#endif // _VXWORKS_MAJOR >= 7
+
+// The min/max "functions" may be refered to with a namespace prefix.
+// Prevent possible redefinitions as macros from VxWorks headers.
+#undef NOMINMAX
 #define NOMINMAX 1
 
-#endif
+// Do not include the inline definitions from VxWorks headers, as we'll
+// want to use the ones from libstdc++ instead.
+#undef _NO_CPP_INLINES
+#define _NO_CPP_INLINES 1
+
+#endif // _GLIBCXX_OS_DEFINES