Commit fcd2db14 authored by Ben Gamari's avatar Ben Gamari Committed by Ben Gamari

configure: Ensure that we don't set LD to unusable linker

Previously if we found an unusable linker in PATH (e.g. ld.lld on OS X)
we would notice the -fuse-ld=... was broken, but neglected to reset LD
to a usable linker. This resulted in brokenness on OS X when lld is in
PATH.

Test Plan: Validate on OS X with lld in PATH

Reviewers: austin, hvr, angerman

Reviewed By: angerman

Subscribers: rwbarton, thomie, erikd, angerman

GHC Trac Issues: #13541

Differential Revision: https://phabricator.haskell.org/D3713
parent d3bdd6c4
......@@ -2272,18 +2272,20 @@ AC_DEFUN([FIND_LD],[
[enable_ld_override=yes])
if test "x$enable_ld_override" = "xyes"; then
AC_CHECK_TARGET_TOOLS([LD], [ld.gold ld.lld ld])
UseLd=''
AC_CHECK_TARGET_TOOLS([TmpLd], [ld.gold ld.lld ld])
out=`$LD --version`
out=`$TmpLd --version`
case $out in
"GNU ld"*) FP_CC_LINKER_FLAG_TRY(bfd, $2) ;;
"GNU gold"*) FP_CC_LINKER_FLAG_TRY(gold, $2) ;;
"LLD"*) FP_CC_LINKER_FLAG_TRY(lld, $2) ;;
*) AC_MSG_NOTICE([unknown linker version $out]) ;;
esac
if test "z$2" = "z"; then
AC_MSG_NOTICE([unable to convince '$CC' to use linker '$LD'])
if test "z$$2" = "z"; then
AC_MSG_NOTICE([unable to convince '$CC' to use linker '$TmpLd'])
AC_CHECK_TARGET_TOOL([LD], [ld])
else
LD="$TmpLd"
fi
else
AC_CHECK_TARGET_TOOL([LD], [ld])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment