[commit: ghc] master: configure: Ensure that we don't set LD to unusable linker (fcd2db1)

git at git.haskell.org git at git.haskell.org
Tue Jul 11 19:26:52 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/fcd2db14368fc6e0d35b13535a9663cfab7080a7/ghc

>---------------------------------------------------------------

commit fcd2db14368fc6e0d35b13535a9663cfab7080a7
Author: Ben Gamari <bgamari.foss at gmail.com>
Date:   Tue Jul 11 14:42:04 2017 -0400

    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


>---------------------------------------------------------------

fcd2db14368fc6e0d35b13535a9663cfab7080a7
 aclocal.m4 | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/aclocal.m4 b/aclocal.m4
index 1d9c09b..c31c881 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -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])



More information about the ghc-commits mailing list