nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib, stdenv, llvm_meta
2, buildLlvmTools
3, fetch
4, cmake
5, libxml2
6, libllvm
7, version
8}:
9
10stdenv.mkDerivation rec {
11 pname = "lld";
12 inherit version;
13
14 src = fetch pname "10hckfxpapfnh6y9apjiya2jpw9nmbbmh8ayijx89mrg7snjn9l6";
15
16 patches = [
17 ./gnu-install-dirs.patch
18 ];
19
20 nativeBuildInputs = [ cmake ];
21 buildInputs = [ libllvm libxml2 ];
22
23 cmakeFlags = [
24 "-DLLVM_CONFIG_PATH=${libllvm.dev}/bin/llvm-config${lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "-native"}"
25 ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
26 "-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen"
27 ];
28
29 # Musl's default stack size is too small for lld to be able to link Firefox.
30 LDFLAGS = lib.optionalString stdenv.hostPlatform.isMusl "-Wl,-z,stack-size=2097152";
31
32 outputs = [ "out" "lib" "dev" ];
33
34 meta = llvm_meta // {
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), Mach-O (macOS), and
42 WebAssembly in descending order of completeness. Internally, LLD consists
43 of several different linkers.
44 '';
45 };
46}