From f508ba97e0627d0439bab5da7c5c0505de738303 Mon Sep 17 00:00:00 2001
From: ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Tue, 4 Jul 2006 07:52:47 +0000
Subject: [PATCH] 	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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@115172 138bc75d-0d04-0410-961f-82ee72b054a4
---
 ChangeLog       |  7 +++++++
 configure       | 31 +++++++++++++++++++++++++++++++
 configure.in    | 15 +++++++++++++++
 gcc/ChangeLog   |  8 ++++++++
 gcc/Makefile.in | 12 +++++++-----
 5 files changed, 68 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index aaacd6c4daf5..946467812639 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-07-04  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.
+
 2006-07-03  Paolo Bonzini  <bonzini@gnu.org>
 
 	* configure.in: Fix thinkos in previous check-in.
diff --git a/configure b/configure
index 1734e2eeb840..03d1e31ee7c6 100755
--- a/configure
+++ b/configure
@@ -7257,6 +7257,37 @@ case $build in
     ;;
 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"
+  echo $ac_n "checking whether -fkeep-inline-functions is supported""... $ac_c" 1>&6
+echo "configure:3894: checking whether -fkeep-inline-functions is supported" >&5
+  cat > conftest.$ac_ext <<EOF
+#line 3896 "configure"
+#include "confdefs.h"
+
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:3903: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  echo "$ac_t""yes" 1>&6; stage1_cflags="$stage1_cflags -fkeep-inline-functions"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  echo "$ac_t""no" 1>&6
+fi
+rm -f conftest*
+
+  CFLAGS="$saved_CFLAGS"
+fi
+
+
 
 # Enable -Werror in bootstrap stage2 and later.
 # Change the default to "no" on release branches.
diff --git a/configure.in b/configure.in
index dd5d21df275a..a67a0a2bc905 100644
--- a/configure.in
+++ b/configure.in
@@ -2411,6 +2411,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.
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index dbc201e6f896..2905deb3a2c1 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2006-07-04  Eric Botcazou  <ebotcazou@libertysurf.fr>
+
+	PR bootstrap/18058
+	* Makefile.in (BUILD_RTL): Add build/vec.o.
+	(build/gencondmd.o): Filter out -fkeep-inline-functions.
+	(build/genextract): Delete.
+	(build/genautomata): Likewise.
+
 2006-07-04  Alan Modra  <amodra@bigpond.net.au>
 
 	PR target/28207
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 9197d4eb88c0..9f29c7bfe4dc 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -854,7 +854,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
 
@@ -2956,6 +2956,11 @@ build/gencondmd.o : build/gencondmd.c $(BCONFIG_H) $(SYSTEM_H)		\
   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 tm-constrs.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.
+build/gencondmd.o : \
+  BUILD_CFLAGS := $(filter-out -fkeep-inline-functions, $(BUILD_CFLAGS))
 
 # ...these are the programs themselves.
 build/genattr.o : genattr.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H)	\
@@ -3020,10 +3025,7 @@ genprogmd = attr attrtab automata codes conditions config constants emit \
 	    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.
-- 
GitLab