[PATCH] Fix powerpc*-linux 32-bit bootstrap (P1 PR bootstrap/37739, take 2)

Jakub Jelinek jakub@redhat.com
Fri Dec 19 10:53:00 GMT 2008


On Thu, Dec 18, 2008 at 09:52:26AM +0100, Jakub Jelinek wrote:
> >   if test "${GCC}:${ac_cv_sizeof_long}" = yes:4; then
> 
> Ok, will change.
> 
> > > +ifeq ($(filter-out -O0,$(filter -O%,$(CFLAGS))),)
> > 
> > More easily understood and more precise if written as:
> > 
> >   ifeq ($(lastword $(filter -O%,$(CFLAGS))),-O0)
> 
> This behaves differently.  The filter-out will be true
> if either no -O* option is used at all, or -O0 is present,
> your version is true if the last -O* option is -O0 (that's more precise),
> but won't match the case when no -O* is used (the default).
> Perhaps
> ifeq ($(filter-out -O0,$(lastword $(filter -O%,$(CFLAGS)))),)

Here is the updated patch with the above changes, plus the -O1
host Makefile snippet is moved out of config/rs6000, so that
arm ${host} can use it too (perhaps if test "${enable_checking}" != release
or something similar).

Tested on powerpc64-linux --with-cpu=default32 for all 3 options
(new binutils, old binutils and the whole config.host hunk commented
out to see the cc1-dummy link fail).

Ok for trunk?

2008-12-19  Jakub Jelinek  <jakub@redhat.com>

	PR bootstrap/37739
	* config.host: For powerpc*-*-linux* host with 32-bit GCC,
	use rs6000/x-linux-relax snippet if ld is new enough,
	otherwise use rs6000/x-linux-O1.
	* config/rs6000/x-linux-relax: New file.
	* config/x-cflags-O1: New file.

--- gcc/config.host.jj	2008-10-01 23:16:29.000000000 +0200
+++ gcc/config.host	2008-12-11 17:26:49.000000000 +0100
@@ -124,6 +124,27 @@ case ${host} in
         host_xmake_file="${host_xmake_file} rs6000/x-rs6000"
         ;;
     esac
+    case ${host} in
+      *-*-linux* )
+	if test "${GCC}:${ac_cv_sizeof_long}" = yes:4; then
+	  # On powerpc*-*-linux* use -Wl,--relax to link cc1,
+	  # if ld is new enough, otherwise force -O1 in CFLAGS.
+	  host_ppc_relax_xmake_file=
+	  host_ld_ver=`${CC} -Wl,--version 2>/dev/null | sed 1q`
+	  if echo "$host_ld_ver" | grep GNU > /dev/null; then
+	    host_ld_date=`echo $host_ld_ver \
+			  | sed -n 's,^.*\([2-9][0-9][0-9][0-9]\)[-]*\([01][0-9]\)[-]*\([0-3][0-9]\).*$,\1\2\3,p'`
+	    if test 0"$host_ld_date" -gt 20080806; then
+	      host_ppc_relax_xmake_file=rs6000/x-linux-relax
+	    fi
+	  fi
+	  if test -z "${host_ppc_relax_xmake_file}"; then
+	    host_ppc_relax_xmake_file=x-cflags-O1
+	  fi
+	  host_xmake_file="${host_xmake_file} ${host_ppc_relax_xmake_file}"
+	fi
+	;;
+    esac
     ;;
 esac
 
--- gcc/config/rs6000/x-linux-relax.jj	2008-12-11 15:30:29.000000000 +0100
+++ gcc/config/rs6000/x-linux-relax	2008-12-11 18:07:30.000000000 +0100
@@ -0,0 +1,2 @@
+# At -O0 cc1 etc. are too large and -Wl,--relax is needed
+$(COMPILERS) : override LDFLAGS += -Wl,--relax
--- gcc/config/x-cflags-O1.jj	2008-12-11 15:44:26.000000000 +0100
+++ gcc/config/x-cflags-O1	2008-12-11 16:19:18.000000000 +0100
@@ -0,0 +1,5 @@
+# At -O0 cc1 etc. are too large on some targets for successful
+# link; force building libbackend.a with -O1.
+ifeq ($(filter-out -O0,$(lastword $(filter -O%,$(CFLAGS)))),)
+$(OBJS) : override CFLAGS += -O1
+endif


	Jakub



More information about the Gcc-patches mailing list