public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Olivier Hainque <hainque@adacore.com>
To: Segher Boessenkool <segher@kernel.crashing.org>
Cc: Olivier Hainque <hainque@adacore.com>,
	GCC Patches <gcc-patches@gcc.gnu.org>,
	Rasmus Villemoes <rv@rasmusvillemoes.dk>
Subject: Re: [patch]  Rework CPP_BUILTINS_SPEC for powerpc-vxworks
Date: Tue, 13 Oct 2020 15:35:11 +0200	[thread overview]
Message-ID: <F52EFDF7-9BC0-4F7A-8D94-956966A8A417@adacore.com> (raw)
In-Reply-To: <FE907FD8-B470-4C90-8301-713B5617D051@adacore.com>

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

Hi Segher,

> On 5 Oct 2020, at 19:27, Olivier Hainque <hainque@adacore.com> 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  <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: ppc_vxworks_cpp_builtins.txt --]
[-- Type: text/plain, Size: 2217 bytes --]

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)
 

  reply	other threads:[~2020-10-13 13:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-01  9:30 Olivier Hainque
2020-10-02 22:43 ` Segher Boessenkool
2020-10-05 17:27   ` Olivier Hainque
2020-10-13 13:35     ` Olivier Hainque [this message]
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=F52EFDF7-9BC0-4F7A-8D94-956966A8A417@adacore.com \
    --to=hainque@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=rv@rasmusvillemoes.dk \
    --cc=segher@kernel.crashing.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).