Skip to content

Commit

Permalink
Fix lld detection if both gold and lld are found
Browse files Browse the repository at this point in the history
If you have ld.gold and ld.lld, then ld.gold will be selected by the
detection logic. This patch prioritizes lld by changing the order. The
rationale for checking lld first is that it's (right now) not part of,
say, a default Linux distro installation and if it's available, it's
very likely that it was installed explicitly and should be seen as a
sign of preference. On FreeBSD LLVM is the (default) base toolchain and
the changed order makes sense there as well, since ld.gold can be
available in /usr/local via ports/pkg. I don't have access to macOS and
can't say anything about their LLVM toolchain.

At some point we could add a check for LD=ld.lld or LD=ld.gold as an
optional override to explicitly select a linker.

Since I cannot really remove gcc on Linux, this was the only way to
configure GHC to use ld.lld.

Reviewers: austin, hvr, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, erikd

Tags: PHID-PROJ-5azim3sqhsf7wzvlvaag

Differential Revision: https://phabricator.haskell.org/D3790
  • Loading branch information
bgamari committed Jul 28, 2017
1 parent dac4b9d commit 2974f81
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion aclocal.m4
Original file line number Diff line number Diff line change
Expand Up @@ -2283,7 +2283,7 @@ AC_DEFUN([FIND_LD],[
[enable_ld_override=yes])
if test "x$enable_ld_override" = "xyes"; then
AC_CHECK_TARGET_TOOLS([TmpLd], [ld.gold ld.lld ld])
AC_CHECK_TARGET_TOOLS([TmpLd], [ld.lld ld.gold ld])
out=`$TmpLd --version`
case $out in
Expand Down

0 comments on commit 2974f81

Please sign in to comment.