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