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 <zbehan@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
This commit is contained in:
Mike Frysinger 2012-03-28 11:07:38 -04:00 committed by Gerrit
parent 51409977a2
commit 7d338f501d

View File

@ -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