Commit: Fixes for building avr-elf with g++.
Nick Clifton
nickc@redhat.com
Thu Aug 16 09:48:00 GMT 2012
Hi Denis, Hi Anatoly, Hi Eric,
I am applying the patch below as an obvious fix for building the
avr-elf port of gcc with a C++ compiler.
There were two problems:
* t-avr was using $(CC) instead of $(COMPILER) which meant the
targets failed to build because they included C++ style headers
(eg vec.h).
* avr.c was using integer values in places where a specific enum was
required.
The patch below fixes these problems and allows avr-elf-gcc to be
built.
Cheers
Nick
gcc/ChangeLog
2012-08-16 Nick Clifton <nickc@redhat.com>
* config/avr/t-avr: Replace occurrences of $(CC) with $(COMPILER).
* config/avr/avr.c (avr_legitimize_reload_address): Add casts
for reload_type enums.
(DEF_BUILTIN): Cast the icode to enum insn_code.
Index: gcc/config/avr/avr.c
===================================================================
--- gcc/config/avr/avr.c (revision 190438)
+++ gcc/config/avr/avr.c (working copy)
@@ -1741,7 +1741,7 @@
push_reload (XEXP (mem, 0), NULL_RTX, &XEXP (mem, 0), NULL,
POINTER_REGS, Pmode, VOIDmode, 0, 0,
- 1, addr_type);
+ 1, (enum reload_type) addr_type);
if (avr_log.legitimize_reload_address)
avr_edump (" RCLASS.2 = %R\n IN = %r\n OUT = %r\n",
@@ -1749,7 +1749,7 @@
push_reload (mem, NULL_RTX, &XEXP (x, 0), NULL,
BASE_POINTER_REGS, GET_MODE (x), VOIDmode, 0, 0,
- opnum, type);
+ opnum, (enum reload_type) type);
if (avr_log.legitimize_reload_address)
avr_edump (" RCLASS.2 = %R\n IN = %r\n OUT = %r\n",
@@ -1763,7 +1763,7 @@
{
push_reload (x, NULL_RTX, px, NULL,
POINTER_REGS, GET_MODE (x), VOIDmode, 0, 0,
- opnum, type);
+ opnum, (enum reload_type) type);
if (avr_log.legitimize_reload_address)
avr_edump (" RCLASS.3 = %R\n IN = %r\n OUT = %r\n",
@@ -10338,7 +10338,7 @@
{
#define DEF_BUILTIN(NAME, N_ARGS, ID, TYPE, ICODE) \
- { ICODE, NAME, N_ARGS, NULL_TREE },
+ { (enum insn_code) ICODE, NAME, N_ARGS, NULL_TREE },
#include "builtins.def"
#undef DEF_BUILTIN
};
Index: gcc/config/avr/t-avr
===================================================================
--- gcc/config/avr/t-avr (revision 190438)
+++ gcc/config/avr/t-avr (working copy)
@@ -19,20 +19,20 @@
driver-avr.o: $(srcdir)/config/avr/driver-avr.c \
$(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H)
- $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
+ $(COMPILER) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
avr-devices.o: $(srcdir)/config/avr/avr-devices.c \
$(srcdir)/config/avr/avr-mcus.def \
$(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H)
- $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
+ $(COMPILER) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
avr-c.o: $(srcdir)/config/avr/avr-c.c \
$(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(C_COMMON_H)
- $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
+ $(COMPILER) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
avr-log.o: $(srcdir)/config/avr/avr-log.c \
$(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(INPUT_H) dumpfile.h
- $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
+ $(COMPILER) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
avr.o avr-c.o: $(srcdir)/config/avr/builtins.def
@@ -45,7 +45,7 @@
gen-avr-mmcu-texi$(build_exeext): $(srcdir)/config/avr/gen-avr-mmcu-texi.c \
$(TM_H) $(AVR_MCUS) $(srcdir)/config/avr/avr-devices.c
- $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< -o $@
+ $(COMPILER) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< -o $@
# Make sure that the -mmcu= documentation is in sync with the compiler.
$(srcdir)/doc/avr-mmcu.texi: s-avr-mmcu-texi; @true
More information about the Gcc-patches
mailing list