diff mbox

[ARM] Fix/revert fallout from machine_mode change

Message ID 5451165B.6050002@arm.com
State New
Headers show

Commit Message

Kyrylo Tkachov Oct. 29, 2014, 4:31 p.m. UTC
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  <kyrylo.tkachov@arm.com>

     * config/arm/arm.h (MACHMODE): Add 'enum' to machine_mode.
     (struct machine_function): Gate definition on
     !defined(USED_FOR_TARGET).

Comments

Christophe Lyon Oct. 29, 2014, 4:34 p.m. UTC | #1
On 29 October 2014 17:31, Kyrill Tkachov <kyrylo.tkachov@arm.com> 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  <kyrylo.tkachov@arm.com>
>
>     * config/arm/arm.h (MACHMODE): Add 'enum' to machine_mode.
>     (struct machine_function): Gate definition on
>     !defined(USED_FOR_TARGET).
Ramana Radhakrishnan Oct. 29, 2014, 5:01 p.m. UTC | #2
On Wed, Oct 29, 2014 at 4:31 PM, Kyrill Tkachov <kyrylo.tkachov@arm.com> 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  <kyrylo.tkachov@arm.com>
>
>     * config/arm/arm.h (MACHMODE): Add 'enum' to machine_mode.
>     (struct machine_function): Gate definition on
>     !defined(USED_FOR_TARGET).
Joseph Myers Oct. 29, 2014, 5:50 p.m. UTC | #3
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 <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.
diff mbox

Patch

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