Re: [PATCH][ARM] Fix/revert fallout from machine_mode change

2014-10-29 Thread Ramana Radhakrishnan
On Wed, Oct 29, 2014 at 5:50 PM, Joseph S. Myers
 wrote:
> On Wed, 29 Oct 2014, Kyrill Tkachov wrote:
>
>> Hi all,
>>
>> This fixes an arm build failure due to removing the 'enum' keyword from
>> machine_mode.
>> Since libgcc2 is compiled with C rather than C++ we need it there for the
>> definition of CUMULATIVE_ARGS.
>
> But why is CUMULATIVE_ARGS needed for libgcc?
>

You are right it shouldn't be required. Thanks for pointing this out.


> It's desirable to eliminate use of host-side headers in target-side code
> (I'd welcome more people picking up pieces of the target macros work
> described at , though
> you shouldn't rely on the distinctions there about where I suggest a
> particular macro should move; it's quite likely there are better choices
> in various cases).  Thus, if something in host-side headers is causing
> problems in target-side code, I'd think the obvious fix is to condition
> out the relevant code when building for the target, rather than fixing it
> to work (although meaningless) for the target.


Sure,  fixed thusly for ARM after verifying a build succeeds for
arm-none-linux-gnueabihf cross (after verifying that reverting
Kyrill's patch breaks the build) . Will have to deal with AArch64 in
the morning unless someone beats me to it.

Ramana

2014-10-29  Ramana Radhakrishnan  

* config/arm/arm.h (MACHMODE): Treat machine_mode as a
scalar typedef.
(CUMULATIVE_ARGS): Guard against target includes.
(machine_function): Likewise.




>
> --
> Joseph S. Myers
> jos...@codesourcery.com
Index: gcc/config/arm/arm.h
===
--- gcc/config/arm/arm.h(revision 216854)
+++ gcc/config/arm/arm.h(working copy)
@@ -36,7 +36,7 @@
 #define MACHMODE int
 #else
 #include "insn-modes.h"
-#define MACHMODE enum machine_mode
+#define MACHMODE machine_mode
 #endif
 
 #include "config/vxworks-dummy.h"
@@ -1510,7 +1510,7 @@
 }
 arm_stack_offsets;
 
-#if !defined(GENERATOR_FILE) && !defined(USED_FOR_TARGET)
+#if !defined(GENERATOR_FILE) && !defined (USED_FOR_TARGET)
 /* A C structure for machine-specific, per-function data.
This is added to the cfun structure.  */
 typedef struct GTY(()) machine_function
@@ -1578,6 +1578,7 @@
 /* Default procedure calling standard of current compilation unit. */
 extern enum arm_pcs arm_pcs_default;
 
+#if !defined (USED_FOR_TARGET)
 /* A C type for declaring a variable that is used as the first argument of
`FUNCTION_ARG' and other related values.  */
 typedef struct
@@ -1611,6 +1612,7 @@
   int aapcs_vfp_rcount;
   MACHMODE aapcs_vfp_rmode;
 } CUMULATIVE_ARGS;
+#endif
 
 #define FUNCTION_ARG_PADDING(MODE, TYPE) \
   (arm_pad_arg_upward (MODE, TYPE) ? upward : downward)


Re: [PATCH][ARM] Fix/revert fallout from machine_mode change

2014-10-29 Thread Joseph S. Myers
On Wed, 29 Oct 2014, Kyrill Tkachov wrote:

> Hi all,
> 
> This fixes an arm build failure due to removing the 'enum' keyword from
> machine_mode.
> Since libgcc2 is compiled with C rather than C++ we need it there for the
> definition of CUMULATIVE_ARGS.

But why is CUMULATIVE_ARGS needed for libgcc?

It's desirable to eliminate use of host-side headers in target-side code 
(I'd welcome more people picking up pieces of the target macros work 
described at , though 
you shouldn't rely on the distinctions there about where I suggest a 
particular macro should move; it's quite likely there are better choices 
in various cases).  Thus, if something in host-side headers is causing 
problems in target-side code, I'd think the obvious fix is to condition 
out the relevant code when building for the target, rather than fixing it 
to work (although meaningless) for the target.

-- 
Joseph S. Myers
jos...@codesourcery.com


Re: [PATCH][ARM] Fix/revert fallout from machine_mode change

2014-10-29 Thread Ramana Radhakrishnan
On Wed, Oct 29, 2014 at 4:31 PM, Kyrill Tkachov  wrote:
> Hi all,
>
> This fixes an arm build failure due to removing the 'enum' keyword from
> machine_mode.
> Since libgcc2 is compiled with C rather than C++ we need it there for the
> definition of CUMULATIVE_ARGS.
>
> Another place where machine_mode is used is machine_function which is not
> needed for libgcc2 so it is gated on !defined(USED_FOR_TARGET)
>
> This allows me to build arm-none-eabi.
>
> Ok for trunk?

Ok.

Ramana

>
> 2014-10-29  Kyrylo Tkachov  
>
> * config/arm/arm.h (MACHMODE): Add 'enum' to machine_mode.
> (struct machine_function): Gate definition on
> !defined(USED_FOR_TARGET).


Re: [PATCH][ARM] Fix/revert fallout from machine_mode change

2014-10-29 Thread Christophe Lyon
On 29 October 2014 17:31, Kyrill Tkachov  wrote:
> Hi all,
>
> This fixes an arm build failure due to removing the 'enum' keyword from
> machine_mode.
> Since libgcc2 is compiled with C rather than C++ we need it there for the
> definition of CUMULATIVE_ARGS.
>
> Another place where machine_mode is used is machine_function which is not
> needed for libgcc2 so it is gated on !defined(USED_FOR_TARGET)
>
> This allows me to build arm-none-eabi.
>

Hi,

We probably need a similar patch for AArch64, I can see the builds
fail for that target too.

Christophe.

> Ok for trunk?
>
> 2014-10-29  Kyrylo Tkachov  
>
> * config/arm/arm.h (MACHMODE): Add 'enum' to machine_mode.
> (struct machine_function): Gate definition on
> !defined(USED_FOR_TARGET).


[PATCH][ARM] Fix/revert fallout from machine_mode change

2014-10-29 Thread Kyrill Tkachov

Hi all,

This fixes an arm build failure due to removing the 'enum' keyword from 
machine_mode.
Since libgcc2 is compiled with C rather than C++ we need it there for 
the definition of CUMULATIVE_ARGS.


Another place where machine_mode is used is machine_function which is 
not needed for libgcc2 so it is gated on !defined(USED_FOR_TARGET)


This allows me to build arm-none-eabi.

Ok for trunk?

2014-10-29  Kyrylo Tkachov  

* config/arm/arm.h (MACHMODE): Add 'enum' to machine_mode.
(struct machine_function): Gate definition on
!defined(USED_FOR_TARGET).diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h
index 02d0a93..fef7e41 100644
--- a/gcc/config/arm/arm.h
+++ b/gcc/config/arm/arm.h
@@ -36,7 +36,7 @@
 #define MACHMODE int
 #else
 #include "insn-modes.h"
-#define MACHMODE machine_mode
+#define MACHMODE enum machine_mode
 #endif
 
 #include "config/vxworks-dummy.h"
@@ -1510,7 +1510,7 @@ typedef struct GTY(()) arm_stack_offsets
 }
 arm_stack_offsets;
 
-#ifndef GENERATOR_FILE
+#if !defined(GENERATOR_FILE) && !defined(USED_FOR_TARGET)
 /* A C structure for machine-specific, per-function data.
This is added to the cfun structure.  */
 typedef struct GTY(()) machine_function