[commit: ghc] ghc-8.2: configure: Ensure that we don't set LD to unusable linker (c23a84d)

git at git.haskell.org git at git.haskell.org
Wed Jul 19 23:24:10 UTC 2017


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

On branch  : ghc-8.2
Link       : http://ghc.haskell.org/trac/ghc/changeset/c23a84d58e348d51632dfcafff81a2c94abcab0b/ghc

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

commit c23a84d58e348d51632dfcafff81a2c94abcab0b
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
    
    (cherry picked from commit fcd2db14368fc6e0d35b13535a9663cfab7080a7)


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

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

diff --git a/aclocal.m4 b/aclocal.m4
index 4ecd1bb..a561a41 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -2338,18 +2338,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