[patch] Rework CPP_BUILTINS_SPEC for powerpc-vxworks

Olivier Hainque hainque@adacore.com
Mon Oct 5 17:27:48 GMT 2020


Hi Segher,

> On 3 Oct 2020, at 00:43, Segher Boessenkool <segher@kernel.crashing.org> wrote:
> 
> Hi Olivier,
> 
> On Thu, Oct 01, 2020 at 11:30:55AM +0200, Olivier Hainque wrote:
>> This change reworks CPP_BUILTINS_SPEC for powerpc-vxworks to
>> prepare for the upcoming addition of 32 and 64 bit ports for
>> VxWorks 7r2.
> 
> Cool, looking forward to it!

:-)

> Your attachment is not quotable (it is application/octet-stream),

Ah, I thought I has addressed that. Will review.

> so
> I'll paste it in here, hopefully correct:
> 
> --- 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()                \
> 
> Hrm, you changed a lot of white space, was that on purpose?

Not really, I was just refactoring the whole block and thought
that seeing the entire new block as one piece was of possible
interest.

I can adjust to keep the few unchanged pieces unchanged.

> +  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__");     \
> +	}					\
> 
> Are all those new names actually defined by your ABIs?  If not, this is
> counter-productive: it does not help anyone if there are six ways to
> write things, where not all ways are supported by all compilers!
> (Including older versions of the same compilers.)

This is inspired from a mix of what the system compilers do
and what we can find in the system headers across the two versions
(vx6 and 7), with the intent to come up with a consistent and
not too convoluted overall logic.

I'll see if I differentiating 6 and 7 can tighten at least
some of the subsets.

> -      /* C89 namespace violation! */		\
> -      builtin_define ("CPU_FAMILY=PPC");	\
> 
> +          builtin_define ("CPU_FAMILY=PPC");	\
> 
> You removed the comment, but it is rather important still?  Of course
> the "C89" part of it is dated, but it is true for all newer language
> standards just the same.

I'm happy to add the comment back, even without the C89 specialization.
It's just one macro that the VxWorks header files rely on pretty
heavily.

I'll post an updated version, thanks for the comments.

Cheers,

Olivier



More information about the Gcc-patches mailing list