On Wed, Oct 29, 2014 at 5:50 PM, Joseph S. Myers <jos...@codesourcery.com> 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 <https://gcc.gnu.org/wiki/Top-Level_Libgcc_Migration>, 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 <ramana.radhakrish...@arm.com> * 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)