Skip to content

lld showing vendor in its version is not detected

Summary

On Debian testing lld version 13 changed output of --version and ghc's ./configure script is unable to detect it. This affects both building development version of ghc and already released ghcs which use ./configure to detect platform capabilities.

Namely, the output of ld.lld --version is now

Debian LLD 13.0.0 (compatible with GNU linkers)

But GHC's detection only recognizes lld if its --version starts with LLD string.

I haven't investigated much of why the string changed, either this is a new capability in recent versions of lld (available via defining LLD_VENDOR when building llvm tools (which Debian does), cf https://github.com/llvm/llvm-project/blob/main/lld/Common/Version.cpp#L26) or an old capability which Debian recently started using. However it's clear that it may be used and in general the output of --version may not start with the LLD string.

Steps to reproduce

  1. Install Debian, enable testing repository
  2. sudo apt-get update && sudo apt-get install lld
  3. Check that outpud of ld.lld --version doesn't start with LLD, see abov
  4. Download GHC https://downloads.haskell.org/~ghc/8.10.7/ghc-8.10.7-x86_64-deb10-linux.tar.xz
  5. Unpack
  6. ./configure
  7. make install

See attached log.txt for output of configure and ghc --info both witnessing that ld.lld was not picked up: log.txt

Expected behavior

Expected to get ghc that will use ld.lld linker.

Observed behavior

Got ghc that uses ld.gold linker even thout I have ld.lld linker available. It's self-reported version is 13 which ghc claims to be compatible with.

The configure scirpt produces following when trying to detect ld.lld:

checking for ld.lld... ld.lld
configure: unknown linker version Debian LLD 13.0.0 (compatible with GNU linkers)
configure: unable to convince 'gcc' to use linker 'ld.lld'
checking for -ld.gold... no
checking for ld.gold... ld.gold
checking whether C compiler supports -fuse-ld=gold... yes

Environment

  • GHC version used: 8.10.7
  • Operating System: Debian Linux
  • System Architecture: x86_64
Edited by Sergey Vinokurov
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information