nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib, stdenv, llvm_meta
2, buildLlvmTools
3, fetch
4, cmake
5, libllvm
6, version
7}:
8
9stdenv.mkDerivation rec {
10 pname = "lld";
11 inherit version;
12
13 src = fetch "lld" "1ah75rjly6747jk1zbwca3z0svr9b09ylgxd4x9ns721xir6sia6";
14
15 patches = [
16 ./gnu-install-dirs.patch
17 ];
18
19 nativeBuildInputs = [ cmake ];
20 buildInputs = [ libllvm ];
21
22 cmakeFlags = [
23 "-DLLVM_CONFIG_PATH=${libllvm.dev}/bin/llvm-config${lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "-native"}"
24 ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
25 "-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen"
26 ];
27
28 # Musl's default stack size is too small for lld to be able to link Firefox.
29 LDFLAGS = lib.optionalString stdenv.hostPlatform.isMusl "-Wl,-z,stack-size=2097152";
30
31 outputs = [ "out" "lib" "dev" ];
32
33 meta = llvm_meta // {
34 broken = stdenv.isDarwin;
35 homepage = "https://lld.llvm.org/";
36 description = "The LLVM linker (unwrapped)";
37 longDescription = ''
38 LLD is a linker from the LLVM project that is a drop-in replacement for
39 system linkers and runs much faster than them. It also provides features
40 that are useful for toolchain developers.
41 The linker supports ELF (Unix), PE/COFF (Windows), and Mach-O (macOS)
42 in descending order of completeness. Internally, LLD consists
43 of several different linkers.
44 '';
45 };
46}