From 7d338f501de9efc3a54c38b5aabc1c9929635941 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Wed, 28 Mar 2012 11:07:38 -0400 Subject: [PATCH] setup_board: use correct toolchain tuple for binutils gold selection The update to support multiple toolchains missed one place -- selection of gold as the linker. It would always handle just the default toolchain. Fix up the logic so it always checks the current toolchain. BUG=chromium-os:28548 TEST=`./setup_board --board=x86-alex` selected gold for x86_64 and i686 toolchains Change-Id: I3c09e3a4fd91b68170fe255e37580a3c9f5f6feb Reviewed-on: https://gerrit.chromium.org/gerrit/19226 Reviewed-by: Zdenek Behan Commit-Ready: Mike Frysinger Tested-by: Mike Frysinger --- setup_board | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/setup_board b/setup_board index 2dfa43c7c4..a524edfc2f 100755 --- a/setup_board +++ b/setup_board @@ -267,15 +267,16 @@ build_toolchain() { # Get the version number of a toolchain package. cross_get_version() { local pkg="$1" + local toolchain="${2:-${FLAGS_toolchain}}" local cpv="" - if [[ "$CHOST" != "$FLAGS_toolchain" ]]; then + if [[ "$CHOST" != "${toolchain}" ]]; then if [[ "$pkg" = "gcc" ]]; then # Users can install multiple versions of gcc at once, so we need to call # gcc-config to find out which installed version is selected. - local path=$(CTARGET=$FLAGS_toolchain gcc-config -B || true) + local path=$(CTARGET=${toolchain} gcc-config -B || true) cpv=$(portageq owners / $path | sed -e '/^\t/d') else - cpv=$(portageq match / cross-$FLAGS_toolchain/$pkg || true) + cpv=$(portageq match / cross-${toolchain}/${pkg} || true) fi else if [[ "$pkg" = binutils ]] ; then @@ -557,8 +558,9 @@ for toolchain in ${all_toolchains[@]} ; do if [[ "${toolchain}" != arm* ]] ; then info "Switching on gold as the default linker." - BINUTILS_VERSION=$(cross_get_version binutils | sed 's/-r[0-9]\+//g') - sudo binutils-config "${FLAGS_toolchain}-${BINUTILS_VERSION}-gold" + BINUTILS_VERSION=$(cross_get_version binutils ${toolchain} | \ + sed 's/-r[0-9]\+//g') + sudo binutils-config "${toolchain}-${BINUTILS_VERSION}-gold" fi fi