This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix PR bootstrap/18058
- From: Eric Botcazou <ebotcazou at libertysurf dot fr>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 5 Mar 2006 19:23:10 +0100
- Subject: [PATCH] Fix PR bootstrap/18058
Hi,
Bootstrap is again broken with non-GCC compilers because it relies on the
elimination of functions marked "static inline". The error message is:
cc -erroff -c -g -DIN_GCC -DHAVE_CONFIG_H -DGENERATOR_FILE -I. -Ibuild
-I/home/eric/svn/gcc/gcc -I/home/eric/svn/gcc/gcc/build
-I/home/eric/svn/gcc/gcc/../include -I./../intl
-I/home/eric/svn/gcc/gcc/../libcpp/include -I/opt/build/eric/local/include
-I/opt/build/eric/local/include -I/home/eric/svn/gcc/gcc/../libdecnumber
-I../libdecnumber -o build/print-rtl.o /home/eric/svn/gcc/gcc/print-rtl.c
cc -erroff -g -DIN_GCC -DHAVE_CONFIG_H -DGENERATOR_FILE -o
build/genconstants \
build/genconstants.o build/rtl.o build/read-rtl.o build/ggc-none.o
build/min-insn-modes.o build/gensupport.o build/print-rtl.o build/errors.o
../build-sparc-sun-solaris2.10/libiberty/libiberty.a
Undefined first referenced
symbol in file
vec_assert_fail build/genconstants.o
vec_heap_p_reserve build/genconstants.o
vec_gc_p_reserve build/genconstants.o
ld: fatal: Symbol referencing errors. No output written to build/genconstants
gmake[3]: *** [build/genconstants] Error 1
gmake[3]: Leaving directory `/opt/build/eric/gcc/gcc'
gmake[2]: *** [all-stage1-gcc] Error 2
gmake[2]: Leaving directory `/opt/build/eric/gcc'
gmake[1]: *** [stage1-bubble] Error 2
gmake[1]: Leaving directory `/opt/build/eric/gcc'
gmake: *** [all] Error 2
vec.o is already linked for some generator programs but it seems required for
all of them now because of these lines in rtl.h:
DEF_VEC_P(rtx);
DEF_VEC_ALLOC_P(rtx,heap);
DEF_VEC_ALLOC_P(rtx,gc);
so the patch adds it to BUILD_RTL. The patch also implements the suggestion
exposed at http://gcc.gnu.org/ml/gcc/2006-03/msg00015.html.
Bootstrapped/regtested with Sun CC on SPARC/Solaris and GCC on AMD64/Linux.
2006-03-05 Eric Botcazou <ebotcazou@libertysurf.fr>
PR bootstrap/18058
* configure.in: Add -fkeep-inline-functions to CFLAGS for stage 1
if the bootstrap compiler is a GCC version that supports it.
* configure: Regenerate.
gcc/
* Makefile.in (BUILD_RTL): Add build/vec.o.
(build/gencondmd.o): Filter out -fkeep-inline-functions.
(build/genextract): Delete.
(build/genautomata): Likewise.
--
Eric Botcazou
Index: configure.in
===================================================================
--- configure.in (revision 111596)
+++ configure.in (working copy)
@@ -2382,6 +2382,21 @@ case $build in
stage1_cflags="-g -no-cpp-precomp -DHAVE_DESIGNATED_INITIALIZERS=0"
;;
esac
+
+# This is aimed to mimic bootstrap with a non-GCC compiler to catch problems.
+if test "$GCC" = yes; then
+ saved_CFLAGS="$CFLAGS"
+
+ # Pass -fkeep-inline-functions for stage 1 if the GCC version supports it.
+ CFLAGS="$CFLAGS -fkeep-inline-functions"
+ AC_MSG_CHECKING([whether -fkeep-inline-functions is supported])
+ AC_TRY_COMPILE(,,
+ [AC_MSG_RESULT([yes]); stage1_cflags="$stage1_cflags -fkeep-inline-functions"],
+ [AC_MSG_RESULT([no])])
+
+ CFLAGS="$saved_CFLAGS"
+fi
+
AC_SUBST(stage1_cflags)
# Enable -Werror in bootstrap stage2 and later.
Index: gcc/Makefile.in
===================================================================
--- gcc/Makefile.in (revision 111596)
+++ gcc/Makefile.in (working copy)
@@ -840,7 +840,7 @@ LDEXP_LIB = @LDEXP_LIB@
# even if we are cross-building GCC.
BUILD_LIBS = $(BUILD_LIBIBERTY)
-BUILD_RTL = build/rtl.o build/read-rtl.o build/ggc-none.o \
+BUILD_RTL = build/rtl.o build/read-rtl.o build/ggc-none.o build/vec.o \
build/min-insn-modes.o build/gensupport.o build/print-rtl.o
BUILD_ERRORS = build/errors.o
@@ -2913,6 +2913,11 @@ build/gencondmd.o : build/gencondmd.c $(
coretypes.h $(GTM_H) insn-constants.h $(RTL_H) $(TM_P_H) \
$(FUNCTION_H) $(REGS_H) $(RECOG_H) real.h output.h $(FLAGS_H) \
$(RESOURCE_H) toplev.h reload.h except.h
+# This pulls in tm-pred.h which contains inline functions wrapping up
+# predicates from the back-end so those functions must be discarded.
+# No big deal since gencondmd.c is a dummy file for non-GCC compilers.
+ $(CC_FOR_BUILD) -c $(filter-out -fkeep-inline-functions, $(BUILD_CFLAGS)) \
+ $(BUILD_CPPFLAGS) -o $@ $<
# ...these are the programs themselves.
build/genattr.o : genattr.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) \
@@ -2977,10 +2982,7 @@ genprogmd = attr attrtab automata codes
extract flags mddeps opinit output peep preds recog
$(genprogmd:%=build/gen%$(build_exeext)): $(BUILD_RTL) $(BUILD_ERRORS)
-# These programs need files over and above what they get from the above list.
-build/genextract$(build_exeext) : build/vec.o
-
-build/genautomata$(build_exeext) : build/vec.o
+# These programs need libs over and above what they get from the above list.
build/genautomata$(build_exeext) : BUILD_LIBS += -lm
# These programs are not linked with the MD reader.