From 5b00bcc5432dc494c70f85ee717e4ecc47e7fcae Mon Sep 17 00:00:00 2001 From: Olivier Hainque Date: Tue, 13 Oct 2020 10:31:36 +0000 Subject: [PATCH] Rework CPP_BUILTINS_SPEC for powerpc-vxworks This change reworks CPP_BUILTINS_SPEC for powerpc-vxworks to prepare for the upcoming addition of 32 and 64 bit ports for VxWorks 7r2. 2020-10-14 Olivier Hainque gcc/ * config/rs6000/vxworks.h (TARGET_OS_CPP_BUILTINS): Accommodate expectations from different versions of VxWorks, for 32 or 64bit configurations. --- gcc/config/rs6000/vxworks.h | 57 ++++++++++++++++++++++++++++++++----- 1 file changed, 50 insertions(+), 7 deletions(-) diff --git a/gcc/config/rs6000/vxworks.h b/gcc/config/rs6000/vxworks.h index 771dddf68bb..60e1ef42390 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) -- 2.30.2