Hi Segher,
> On 5 Oct 2020, at 19:27, Olivier Hainque <[email protected]> wrote:
>
> I'll post an updated version, thanks for the comments.
Here's an updated version which passed in-house build & tests
with gcc-10 based toolchains for VxWorks 6.9 & 7.2, and with which
I could build mainline for VxWorks 6.9 including libstdc++ (combined
with a few other patches, orthogonal to what is proposed here and
which I'll post shortly).
Same ChangeLog. Patch hopefully quotable if needed now.
Olivier
2020-10-13 Olivier Hainque <[email protected]>
* config/rs6000/vxworks.h (TARGET_OS_CPP_BUILTINS): Accommodate
expectations from different versions of VxWorks, for 32 or 64bit
configurations.
diff --git a/gcc/config/rs6000/vxworks.h b/gcc/config/rs6000/vxworks.h
index 771dddf68bba..60e1ef42390f 100644
--- a/gcc/config/rs6000/vxworks.h
+++ b/gcc/config/rs6000/vxworks.h
@@ -29,17 +29,60 @@ along with GCC; see the file COPYING3. If not see
#define TARGET_OS_CPP_BUILTINS() \
do \
{ \
- builtin_define ("__ppc"); \
- builtin_define ("__PPC__"); \
- builtin_define ("__EABI__"); \
builtin_define ("__ELF__"); \
+ if (!TARGET_VXWORKS7) \
+ builtin_define ("__EABI__"); \
+ \
+ /* CPU macros, based on what the system compilers do. */ \
+ if (!TARGET_VXWORKS7) \
+ { \
+ builtin_define ("__ppc"); \
+ /* Namespace violation below, but the system headers \
+ really depend heavily on this. */ \
+ builtin_define ("CPU_FAMILY=PPC"); \
+ \
+ /* __PPC__ isn't actually emitted by the system compiler \
+ prior to vx7 but has been advertised by us for ages. */ \
+ builtin_define ("__PPC__"); \
+ } \
+ else \
+ { \
+ builtin_define ("__PPC__"); \
+ builtin_define ("__powerpc__"); \
+ if (TARGET_64BIT) \
+ { \
+ builtin_define ("__PPC64__"); \
+ builtin_define ("__powerpc64__"); \
+ } \
+ else \
+ { \
+ builtin_define ("__PPC"); \
+ builtin_define ("__powerpc"); \
+ } \
+ } \
+ \
+ /* Asserts for #cpu and #machine. */ \
+ if (TARGET_64BIT) \
+ { \
+ builtin_assert ("cpu=powerpc64"); \
+ builtin_assert ("machine=powerpc64"); \
+ } \
+ else \
+ { \
+ builtin_assert ("cpu=powerpc"); \
+ builtin_assert ("machine=powerpc"); \
+ } \
+ \
+ /* PowerPC VxWorks specificities. */ \
if (!TARGET_SOFT_FLOAT) \
- builtin_define ("__hardfp"); \
+ { \
+ builtin_define ("__hardfp"); \
+ builtin_define ("_WRS_HARDWARE_FP"); \
+ } \
\
- /* C89 namespace violation! */ \
- builtin_define ("CPU_FAMILY=PPC"); \
- \
+ /* Common VxWorks and port items. */ \
VXWORKS_OS_CPP_BUILTINS (); \
+ TARGET_OS_SYSV_CPP_BUILTINS (); \
} \
while (0)