On Thu, May 27, 2010 at 9:49 AM, Paolo Bonzini <bonz...@gnu.org> wrote: > On 05/27/2010 08:25 AM, Steven Bosscher wrote: >> >> On Thu, May 27, 2010 at 7:15 AM, Paolo Bonzini<bonz...@gnu.org> wrote: >> Well, gives me at least one clue so far: the implicit rule .c.o is >> over-ruled by t-i386, which explains why the extra CFLAGS-$file are >> not passed to config/i386/i386-c.c. I'm now restarting the build with >> extra front ends included again, to see if there is something equally >> obvious "wrong" there. > > Hmm, I originally suggested adding the flags to ALL_CFLAGS: > > $(ALL_HOST_FRONTEND_OBJS): ALL_CFLAGS += -DIN_GCC_FRONTEND > > but then changed my mind and switched to adding them to .c.o. > > I suppose you have to add $(CFLAGS-$@) to ALL_CFLAGS. :-) > >> # This lists all host objects for the front ends. >> ALL_HOST_FRONTEND_OBJS = $(C_OBJS) \ >> $(foreach v,$(CONFIG_LANGUAGES),$($(v)_OBJS)) >> >> Any idea what might be wrong? :-( > > Yes, likely the makefile fragments haven't been included when you do the > $(eval).
That helps, yes. Thanks! I'm now bootstrapping the attached patch. Will submit officially if that succeeds. Ciao! Steven gcc/ChangeLog: * Makefile.in (ALL_CFLAGS): Add file-specific CFLAGS. (ALL_HOST_FRONTEND_OBJS): New, for all front-end specific objects. (ALL_HOST_BACKEND_OBJS): New, for all backend and target objects. (ALL_HOST_OBJS): Now a union of the above two. <section "Language makefile fragments">: Add -DIN_GCC_FRONTEND for all files in ALL_HOST_FRONTEND_OBJS. * system.h: Poison GCC_RTL_H if IN_GCC_FRONTEND is defined. * c-common.c: Pretend to be a backend file by undefining IN_GCC_FRONTEND (still need rtl.h here). ada/ChangeLog: * gcc-interface/decl.c: Pretend to be a backend file by undefining IN_GCC_FRONTEND (still need rtl.h here). java/ChangeLog: * buildings.c: Pretend to be a backend file by undefining IN_GCC_FRONTEND (still need rtl.h here).
gcc/ChangeLog: * Makefile.in (ALL_CFLAGS): Add file-specific CFLAGS. (ALL_HOST_FRONTEND_OBJS): New, for all front-end specific objects. (ALL_HOST_BACKEND_OBJS): New, for all backend and target objects. (ALL_HOST_OBJS): Now a union of the above two. <section "Language makefile fragments">: Add -DIN_GCC_FRONTEND for all files in ALL_HOST_FRONTEND_OBJS. * system.h: Poison GCC_RTL_H if IN_GCC_FRONTEND is defined. * c-common.c: Pretend to be a backend file by undefining IN_GCC_FRONTEND (still need rtl.h here). ada/ChangeLog: * gcc-interface/decl.c: Pretend to be a backend file by undefining IN_GCC_FRONTEND (still need rtl.h here). java/ChangeLog: * buildings.c: Pretend to be a backend file by undefining IN_GCC_FRONTEND (still need rtl.h here). Index: Makefile.in =================================================================== --- Makefile.in (revision 159900) +++ Makefile.in (working copy) @@ -974,7 +974,7 @@ INTERNAL_CFLAGS = -DIN_GCC @CROSS@ # This is the variable actually used when we compile. If you change this, # you probably want to update BUILD_CFLAGS in configure.ac -ALL_CFLAGS = $(T_CFLAGS) \ +ALL_CFLAGS = $(T_CFLAGS) $(CFLAGS-$@) \ $(CFLAGS) $(INTERNAL_CFLAGS) $(COVERAGE_FLAGS) $(WARN_CFLAGS) @DEFS@ # The C++ version. @@ -1445,15 +1445,19 @@ OBJS = $(OBJS-common) $(OBJS-md) $(OBJS- OBJS-onestep = libbackend.o $(OBJS-archive) -# This lists all host object files, whether they are included in this -# compilation or not. -ALL_HOST_OBJS = $(GCC_OBJS) $(C_OBJS) $(OBJS) libbackend.o \ +# This lists all host objects for the front ends. +ALL_HOST_FRONTEND_OBJS = $(C_OBJS) \ + $(foreach v,$(CONFIG_LANGUAGES),$($(v)_OBJS)) + +ALL_HOST_BACKEND_OBJS = $(GCC_OBJS) $(OBJS) libbackend.o \ @TREEBROWSER@ main.o gccspec.o version.o intl.o prefix.o cppspec.o \ - $(foreach v,$(CONFIG_LANGUAGES),$($(v)_OBJS)) \ - $(COLLECT2_OBJS) $(EXTRA_GCC_OBJS) \ - mips-tfile.o mips-tdump.o \ + $(COLLECT2_OBJS) $(EXTRA_GCC_OBJS) mips-tfile.o mips-tdump.o \ $(GCOV_OBJS) $(GCOV_DUMP_OBJS) +# This lists all host object files, whether they are included in this +# compilation or not. +ALL_HOST_OBJS = $(ALL_HOST_FRONTEND_OBJS) $(ALL_HOST_BACKEND_OBJS) + BACKEND = main.o @TREEBROWSER@ libbackend.a $(CPPLIB) $(LIBDECNUMBER) MOSTLYCLEANFILES = insn-flags.h insn-config.h insn-codes.h \ @@ -1571,6 +1575,13 @@ s-alltree: Makefile $(SHELL) $(srcdir)/../move-if-change tmp-all-tree.def all-tree.def $(STAMP) s-alltree +# Now that LANG_MAKEFRAGS are included, we can add special flags to the +# objects that belong to the front ends. We add an extra define that +# causes back-end specific include files to be poisoned, in the hope that +# we can avoid introducing dependencies of the front ends on things that +# no front end should ever look at (e.g. everything RTL related). +$(foreach file,$(ALL_HOST_FRONTEND_OBJS),$(eval CFLAGS-$(file) += -DIN_GCC_FRONTEND)) + # # ----------------------------- Index: system.h =================================================================== --- system.h (revision 159900) +++ system.h (working copy) @@ -789,6 +789,10 @@ extern void fancy_abort (const char *, i VA_FIXEDARG VA_CLOSE VA_START #endif /* IN_GCC */ +#ifdef IN_GCC_FRONTEND +#pragma GCC poison GCC_RTL_H +#endif + /* Note: not all uses of the `index' token (e.g. variable names and structure members) have been eliminated. */ #undef bcopy Index: c-common.c =================================================================== --- c-common.c (revision 159900) +++ c-common.c (working copy) @@ -19,6 +19,10 @@ You should have received a copy of the G along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>. */ +/* FIXME: Still need to include rtl.h here (via expr.h) in a front-end file. + Pretend this is a back-end file. */ +#undef IN_GCC_FRONTEND + #include "config.h" #include "system.h" #include "coretypes.h" @@ -47,9 +51,6 @@ along with GCC; see the file COPYING3. #include "target-def.h" #include "libfuncs.h" -/* FIXME: Still need to include rtl.h here (via expr.h) in a front-end file. - Pretend this is a back-end file. */ -#define IN_GCC_BACKEND #include "expr.h" /* For vector_mode_valid_p */ /* FIXME: Needed for TARGET_ENUM_VA_LIST, which should be a target hook. */ Index: ada/gcc-interface/decl.c =================================================================== --- ada/gcc-interface/decl.c (revision 159900) +++ ada/gcc-interface/decl.c (working copy) @@ -23,6 +23,10 @@ * * ****************************************************************************/ +/* FIXME: Still need to include rtl.h here (via expr.h) because this file + actually generates RTL (search for gen_rtx_* in gnat_to_gnu_entity). */ +#undef IN_GCC_FRONTEND + #include "config.h" #include "system.h" #include "coretypes.h" Index: java/builtins.c =================================================================== --- java/builtins.c (revision 159900) +++ java/builtins.c (working copy) @@ -24,6 +24,9 @@ The Free Software Foundation is independ /* Written by Tom Tromey <tro...@redhat.com>. */ +/* FIXME: Still need to include rtl.h here (see below). */ +#undef IN_GCC_FRONTEND + #include "config.h" #include "system.h" #include "coretypes.h"