public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Olivier Hainque <hainque@adacore.com>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: [patch]  Rework CPP_BUILTINS_SPEC for powerpc-vxworks
Date: Thu, 1 Oct 2020 11:30:55 +0200	[thread overview]
Message-ID: <EE1575B0-0DA8-461C-971C-E5D41574DC3D@adacore.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 622 bytes --]

This change reworks CPP_BUILTINS_SPEC for powerpc-vxworks to
prepare for the upcoming addition of 32 and 64 bit ports for
VxWorks 7r2.

This has been used in gcc-9 based production compilers for a
year on both vxworks 7 and 6.9. Also passed a build & test sequence
for powerpc-vxworks 7 and 6.9 with gcc-10 and a sanity check build
with a recent mainline.

Will commit to mainline shortly.

Olivier

2020-10-01  Olivier Hainque  <hainque@adacore.com>

        * config/rs6000/vxworks.h (TARGET_OS_CPP_BUILTINS): Accommodate
        expectations from different versions of VxWorks, for 32 or 64bit
        configurations.


[-- Attachment #2: 0006-Augment-CPP_BUILTINS_SPEC-for-powerpc-vxworks.diff --]
[-- Type: application/octet-stream, Size: 2712 bytes --]

--- a/gcc/config/rs6000/vxworks.h
+++ b/gcc/config/rs6000/vxworks.h
@@ -26,21 +26,56 @@ along with GCC; see the file COPYING3.  If not see
 /* CPP predefined macros.  */
 
 #undef TARGET_OS_CPP_BUILTINS
-#define TARGET_OS_CPP_BUILTINS()		\
-  do						\
-    {						\
-      builtin_define ("__ppc");			\
-      builtin_define ("__PPC__");		\
-      builtin_define ("__EABI__");		\
-      builtin_define ("__ELF__");		\
-      if (!TARGET_SOFT_FLOAT)			\
-	builtin_define ("__hardfp");		\
+#define TARGET_OS_CPP_BUILTINS()                \
+  do                                            \
+    {                                           \
+      /* CPU macros.  */			\
+      builtin_define ("__ppc");                 \
+      builtin_define ("__ppc__");               \
+      builtin_define ("__PPC");                 \
+      builtin_define ("__PPC__");               \
+      builtin_define ("__powerpc");             \
+      builtin_define ("__powerpc__");           \
+      if (TARGET_64BIT)                         \
+        {                                       \
+          builtin_define ("__ppc64");           \
+          builtin_define ("__ppc64__");         \
+          builtin_define ("__PPC64");		\
+          builtin_define ("__PPC64__");         \
+          builtin_define ("__powerpc64");	\
+          builtin_define ("__powerpc64__");     \
+	}					\
 						\
-      /* C89 namespace violation! */		\
-      builtin_define ("CPU_FAMILY=PPC");	\
-        					\
-      VXWORKS_OS_CPP_BUILTINS ();		\
-    }		\
+      /* 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 ("_WRS_HARDWARE_FP");  \
+        }                                       \
+						\
+      if (!TARGET_VXWORKS7)			\
+	{					\
+          builtin_define ("__EABI__");          \
+	  builtin_define ("__ELF__");           \
+          builtin_define ("CPU_FAMILY=PPC");	\
+	}					\
+						\
+      /* Common VxWorks and port items.  */	\
+      VXWORKS_OS_CPP_BUILTINS ();               \
+      TARGET_OS_SYSV_CPP_BUILTINS ();           \
+    }                                           \
   while (0)
 
 /* vx6 library path.  */
-- 
2.17.1


[-- Attachment #3: Type: text/plain, Size: 5 bytes --]







             reply	other threads:[~2020-10-01  9:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-01  9:30 Olivier Hainque [this message]
2020-10-02 22:43 ` Segher Boessenkool
2020-10-05 17:27   ` Olivier Hainque
2020-10-13 13:35     ` Olivier Hainque
2020-10-13 15:38       ` Segher Boessenkool
2020-10-14 10:52         ` Olivier Hainque

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=EE1575B0-0DA8-461C-971C-E5D41574DC3D@adacore.com \
    --to=hainque@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).