[coreboot-gerrit] Patch set updated for coreboot: buildgcc: enable biarch support for x86_64-elf

Stefan Reinauer (stefan.reinauer@coreboot.org) gerrit at coreboot.org
Wed Jun 17 20:50:45 CEST 2015


Stefan Reinauer (stefan.reinauer at coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/10497

-gerrit

commit 2eb3adfb68c62190fa8c381fd73a4ea10984a42c
Author: Stefan Reinauer <stefan.reinauer at coreboot.org>
Date:   Tue Jun 9 14:59:58 2015 -0700

    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 at coreboot.org>
---
 util/crossgcc/buildgcc                           | 13 ++--
 util/crossgcc/patches/gcc-4.9.2_elf_biarch.patch | 76 ++++++++++++++++++++++++
 2 files changed, 84 insertions(+), 5 deletions(-)

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_LIBELF() {
 }
 
 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
 }
diff --git a/util/crossgcc/patches/gcc-4.9.2_elf_biarch.patch b/util/crossgcc/patches/gcc-4.9.2_elf_biarch.patch
new file mode 100644
index 0000000..25749ef
--- /dev/null
+++ b/util/crossgcc/patches/gcc-4.9.2_elf_biarch.patch
@@ -0,0 +1,76 @@
+diff -urN gcc-4.9.2/gcc/config/i386/t-elf64 gcc-4.9.2/gcc/config/i386/t-elf64
+--- gcc-4.9.2/gcc/config/i386/t-elf64	1969-12-31 16:00:00.000000000 -0800
++++ gcc-4.9.2/gcc/config/i386/t-elf64	2015-06-17 11:20:08.032513005 -0700
+@@ -0,0 +1,38 @@
++# Copyright (C) 2002-2014 Free Software Foundation, Inc.
++#
++# This file is part of GCC.
++#
++# GCC is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3, or (at your option)
++# any later version.
++#
++# GCC is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with GCC; see the file COPYING3.  If not see
++# <http://www.gnu.org/licenses/>.
++
++# On Debian, Ubuntu and other derivative distributions, the 32bit libraries
++# are found in /lib32 and /usr/lib32, /lib64 and /usr/lib64 are symlinks to
++# /lib and /usr/lib, while other distributions install libraries into /lib64
++# and /usr/lib64.  The LSB does not enforce the use of /lib64 and /usr/lib64,
++# it doesn't tell anything about the 32bit libraries on those systems.  Set
++# MULTILIB_OSDIRNAMES according to what is found on the target.
++
++# To support i386, x86-64 and x32 libraries, the directory structrue
++# should be:
++#
++# 	/lib has i386 libraries.
++# 	/lib64 has x86-64 libraries.
++# 	/libx32 has x32 libraries.
++#
++comma=,
++MULTILIB_OPTIONS    = $(subst $(comma),/,$(TM_MULTILIB_CONFIG))
++MULTILIB_DIRNAMES   = $(patsubst m%, %, $(subst /, ,$(MULTILIB_OPTIONS)))
++MULTILIB_OSDIRNAMES = m64=../lib64$(call if_multiarch,:x86_64-elf)
++MULTILIB_OSDIRNAMES+= m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:i386-elf)
++MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-elf-x32)
+diff -urN gcc-4.9.2/gcc/config.gcc gcc-4.9.2/gcc/config.gcc
+--- gcc-4.9.2/gcc/config.gcc	2015-06-17 11:20:57.841008182 -0700
++++ gcc-4.9.2/gcc/config.gcc	2015-06-17 11:17:24.818890200 -0700
+@@ -1353,6 +1353,30 @@
+ 	;;
+ x86_64-*-elf*)
+ 	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h i386/x86-64.h"
++	tmake_file="${tmake_file} i386/t-elf64"
++	x86_multilibs="${with_multilib_list}"
++	if test "$x86_multilibs" = "default"; then
++		case ${with_abi} in
++		x32 | mx32)
++			x86_multilibs="mx32"
++			;;
++		*)
++			x86_multilibs="m64,m32"
++			;;
++		esac
++	fi
++	x86_multilibs=`echo $x86_multilibs | sed -e 's/,/ /g'`
++	for x86_multilib in ${x86_multilibs}; do
++		case ${x86_multilib} in
++		m32 | m64 | mx32)
++			TM_MULTILIB_CONFIG="${TM_MULTILIB_CONFIG},${x86_multilib}"
++			;;
++		*)
++			echo "--with-multilib-list=${x86_with_multilib} not supported."
++			exit 1
++		esac
++	done
++	TM_MULTILIB_CONFIG=`echo $TM_MULTILIB_CONFIG | sed 's/^,//'`
+ 	;;
+ i[34567]86-*-rdos*)
+     tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h i386/rdos.h"



More information about the coreboot-gerrit mailing list