Bug 904979 - Force use gold, if possible, when the default linker is BFD ld, for local builds. r=ted

This commit is contained in:
Mike Hommey 2013-08-15 23:45:10 +09:00
parent 4c2f5c8547
commit d7e0172e8c
2 changed files with 48 additions and 0 deletions

View File

@ -115,6 +115,30 @@ if test -z "$GNU_CC"; then
esac esac
fi fi
if test "$GNU_CC" -a -n "$DEVELOPER_OPTIONS"; then
dnl if the default linker is BFD ld, check if gold is available and try to use it
dnl for local builds only.
if $CC -Wl,--version 2>&1 | grep -q "GNU ld"; then
GOLD=$($CC -print-prog-name=ld.gold)
case "$GOLD" in
/*)
;;
*)
GOLD=$(which $GOLD)
;;
esac
if test -n "$GOLD"; then
mkdir -p $_objdir/build/unix/gold
ln -s "$GOLD" $_objdir/build/unix/gold/ld
if $CC -B $_objdir/build/unix/gold -Wl,--version 2>&1 | grep -q "GNU gold"; then
LDFLAGS="$LDFLAGS -B $_objdir/build/unix/gold"
else
rm -rf $_objdir/build/unix/gold
fi
fi
fi
fi
if test "$GNU_CC"; then if test "$GNU_CC"; then
CFLAGS="$CFLAGS -ffunction-sections -fdata-sections" CFLAGS="$CFLAGS -ffunction-sections -fdata-sections"
CXXFLAGS="$CXXFLAGS -ffunction-sections -fdata-sections -fno-exceptions" CXXFLAGS="$CXXFLAGS -ffunction-sections -fdata-sections -fno-exceptions"

View File

@ -115,6 +115,30 @@ if test -z "$GNU_CC"; then
esac esac
fi fi
if test "$GNU_CC" -a -n "$DEVELOPER_OPTIONS"; then
dnl if the default linker is BFD ld, check if gold is available and try to use it
dnl for local builds only.
if $CC -Wl,--version 2>&1 | grep -q "GNU ld"; then
GOLD=$($CC -print-prog-name=ld.gold)
case "$GOLD" in
/*)
;;
*)
GOLD=$(which $GOLD)
;;
esac
if test -n "$GOLD"; then
mkdir -p $_objdir/build/unix/gold
ln -s "$GOLD" $_objdir/build/unix/gold/ld
if $CC -B $_objdir/build/unix/gold -Wl,--version 2>&1 | grep -q "GNU gold"; then
LDFLAGS="$LDFLAGS -B $_objdir/build/unix/gold"
else
rm -rf $_objdir/build/unix/gold
fi
fi
fi
fi
if test "$GNU_CC"; then if test "$GNU_CC"; then
CFLAGS="$CFLAGS -ffunction-sections -fdata-sections" CFLAGS="$CFLAGS -ffunction-sections -fdata-sections"
CXXFLAGS="$CXXFLAGS -ffunction-sections -fdata-sections -fno-exceptions" CXXFLAGS="$CXXFLAGS -ffunction-sections -fdata-sections -fno-exceptions"