buildgcc: enable biarch support for x86_64-elf

With this change, the x86_64-elf-gcc can compile i386-elf
binaries by specifying -m32. The patch against GCC is needed
to enable building the 32bit libraries when building x86_64-elf-gcc

Change-Id: Ic86a009eccfdf3e33a398bcdcc13b15c8dfc0d31
Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Reviewed-on: http://review.coreboot.org/10497
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
diff --git a/util/crossgcc/buildgcc b/util/crossgcc/buildgcc
index c27d62c..0ab0a53 100755
--- a/util/crossgcc/buildgcc
+++ b/util/crossgcc/buildgcc
@@ -22,8 +22,8 @@
 
 cd $(dirname $0)
 
-CROSSGCC_DATE="June 9th, 2015"
-CROSSGCC_VERSION="1.30"
+CROSSGCC_DATE="June 17th, 2015"
+CROSSGCC_VERSION="1.31"
 
 # default settings
 PACKAGE=GCC
@@ -380,10 +380,13 @@
 }
 
 build_BINUTILS() {
-	# Now build binutils
+	if [ $TARGETARCH == "x86_64-elf" ]; then
+		ADDITIONALTARGET=",i386-elf"
+	fi
 	CC="$CC" ../binutils-${BINUTILS_VERSION}/configure --prefix=$TARGETDIR \
-		--target=${TARGETARCH} --disable-werror --disable-nls \
-		--enable-lto --enable-gold --enable-plugins CFLAGS="$HOSTCFLAGS" || touch .failed
+		--target=${TARGETARCH} --enable-targets=${TARGETARCH}${ADDITIONALTARGET} \
+		--disable-werror --disable-nls --enable-lto --enable-gold \
+		--enable-plugins --enable-multilibs CFLAGS="$HOSTCFLAGS" || touch .failed
 	$MAKE $JOBS || touch .failed
 	$MAKE install DESTDIR=$DESTDIR || touch .failed
 }