This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] PowerPC biarch config


The task: Build a native powerpc-linux biarch compiler using a combined
binutils + gcc source tree.  The compiler should produce 32-bit objects
by default, as non-biarch powerpc-linux compilers do.

The problem: Biarch powerpc compilers are only available with a target
of powerpc64-linux.  We can make a compiler that defaults to 32-bit
objects using --target=powerpc64-linux --with-cpu=default32, but
--target=powerpc64-linux builds "as" and "ld" that default to 64-bit.
The biarch binutils that we want is configured using
--target=powerpc-linux --enable-targets=powerpc64-linux.  So a combined
tree build isn't available.

Solution: Allow --target=powerpc-linux to build biarch compilers.  Of
course, we don't necessarily always want to build a biarch powerpc-linux
compiler.  So there needs to be a configure option to select biarch.  I
figure gcc might as well use binutils --enable-targets option, simply
because it suits a combined tree build.  Another way that makes sense is
to build biarch if --with-cpu specifies a 64-bit cpu.

Bootstrapped etc. powerpc-linux.  I've had patches like this one in my
tree since at least 2003-07, but using --enable-biarch instead of
--enable-targets.

	* config.gcc (cpu_is_64bit): Set for 64-bit powerpc cpus.
	(powerpc64-*-linux*): Use it.  Rearrange tm_file assignment.
	(powerpc-*-linux*): Build a biarch compiler when --enable-targets 
	is given with "powerpc64*" or "all", or when --with-cpu chooses
	a 64-bit cpu.

OK for mainline?  How about 4.0 and 3.4 branch too?

diff -urp -xCVS -x'*~' -x'.#*' gcc-virgin/gcc/config.gcc gcc-current/gcc/config.gcc
--- gcc-virgin/gcc/config.gcc	2005-03-12 10:45:40.000000000 +1030
+++ gcc-current/gcc/config.gcc	2005-03-12 21:15:38.000000000 +1030
@@ -228,6 +228,7 @@ esac
 # machines.
 tm_p_file=
 cpu_type=`echo ${target} | sed 's/-.*$//'`
+cpu_is_64bit=
 case ${target} in
 alpha*-*-*)
 	cpu_type=alpha
@@ -284,6 +285,11 @@ powerpc*-*-*)
 	cpu_type=rs6000
 	extra_headers="ppc-asm.h altivec.h spe.h"
 	need_64bit_hwint=yes
+	case x$with_cpu in
+	    xpowerpc64|xdefault64|x6[23]0|x970|xG5|xpower[345]|xrs64a)
+		cpu_is_64bit=yes
+		;;
+	esac
 	;;
 rs6000*-*-*)
 	need_64bit_hwint=yes
@@ -1528,12 +1534,10 @@ avr-*-*)
 #	extra_headers=
 #	;;
 powerpc64-*-linux*)
-	tm_file="rs6000/biarch64.h ${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h"
-	case x$with_cpu in
-	x|xpowerpc64|xdefault64|x6[23]0|x970|xG5|xpower[345]|xrs64a)
-		tm_file="${tm_file} rs6000/default64.h";;
-	esac
-	tm_file="${tm_file} rs6000/linux64.h"
+	tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h"
+	test x$with_cpu != x || cpu_is_64bit=yes
+	test x$cpu_is_64bit != xyes || tm_file="${tm_file} rs6000/default64.h"
+	tm_file="rs6000/biarch64.h ${tm_file} rs6000/linux64.h"
 	tmake_file="rs6000/t-fprules ${tmake_file} rs6000/t-ppccomm rs6000/t-linux64"
 	;;
 powerpc64-*-gnu*)
@@ -1612,8 +1616,20 @@ powerpc-*-linux*spe*)
 	tmake_file="rs6000/t-fprules rs6000/t-ppcos ${tmake_file} rs6000/t-ppccomm"
 	;;
 powerpc-*-linux*)
-	tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/linux.h"
+	tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h"
 	tmake_file="rs6000/t-fprules rs6000/t-ppcos ${tmake_file} rs6000/t-ppccomm"
+	case ${enable_targets}:${cpu_is_64bit} in
+	    *powerpc64* | all:* | *:yes)
+		if test x$cpu_is_64bit = xyes; then
+		    tm_file="${tm_file} rs6000/default64.h"
+		fi
+		tm_file="rs6000/biarch64.h ${tm_file} rs6000/linux64.h"
+		tmake_file="$tmake_file rs6000/t-linux64"
+		;;
+	    *)
+		tm_file="${tm_file} rs6000/linux.h"
+		;;
+	esac
 	;;
 powerpc-*-gnu-gnualtivec*)
 	tm_file="${cpu_type}/${cpu_type}.h elfos.h svr4.h freebsd-spec.h gnu.h rs6000/sysv4.h rs6000/linux.h rs6000/linuxaltivec.h rs6000/gnu.h"

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]