about summary refs log tree commit diff
path: root/pkgs/development/compilers/llvm/18
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/compilers/llvm/18')
-rw-r--r--pkgs/development/compilers/llvm/18/clang/default.nix139
-rw-r--r--pkgs/development/compilers/llvm/18/compiler-rt/default.nix157
-rw-r--r--pkgs/development/compilers/llvm/18/default.nix59
-rw-r--r--pkgs/development/compilers/llvm/18/libcxx/default.nix130
-rw-r--r--pkgs/development/compilers/llvm/18/libunwind/default.nix54
-rw-r--r--pkgs/development/compilers/llvm/18/lld/default.nix57
-rw-r--r--pkgs/development/compilers/llvm/18/llvm/default.nix2
-rw-r--r--pkgs/development/compilers/llvm/18/openmp/default.nix73
8 files changed, 51 insertions, 620 deletions
diff --git a/pkgs/development/compilers/llvm/18/clang/default.nix b/pkgs/development/compilers/llvm/18/clang/default.nix
deleted file mode 100644
index 1e777c6132e43..0000000000000
--- a/pkgs/development/compilers/llvm/18/clang/default.nix
+++ /dev/null
@@ -1,139 +0,0 @@
-{ lib, stdenv, llvm_meta
-, monorepoSrc, runCommand
-, substituteAll, cmake, ninja, libxml2, libllvm, version, python3
-, buildLlvmTools
-, fixDarwinDylibNames
-, enableManpages ? false
-}:
-
-let
-  self = stdenv.mkDerivation (finalAttrs: rec {
-    pname = "clang";
-    inherit version;
-
-    src = runCommand "${pname}-src-${version}" {} ''
-      mkdir -p "$out"
-      cp -r ${monorepoSrc}/cmake "$out"
-      cp -r ${monorepoSrc}/${pname} "$out"
-      cp -r ${monorepoSrc}/clang-tools-extra "$out"
-    '';
-
-    sourceRoot = "${src.name}/${pname}";
-
-    nativeBuildInputs = [ cmake ninja python3 ]
-      ++ lib.optional (lib.versionAtLeast version "18" && enableManpages) python3.pkgs.myst-parser
-      ++ lib.optional enableManpages python3.pkgs.sphinx
-      ++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
-
-    buildInputs = [ libxml2 libllvm ];
-
-    cmakeFlags = [
-      "-DCLANG_INSTALL_PACKAGE_DIR=${placeholder "dev"}/lib/cmake/clang"
-      "-DCLANGD_BUILD_XPC=OFF"
-      "-DLLVM_ENABLE_RTTI=ON"
-      "-DLLVM_INCLUDE_TESTS=OFF"
-    ] ++ lib.optionals enableManpages [
-      "-DCLANG_INCLUDE_DOCS=ON"
-      "-DLLVM_ENABLE_SPHINX=ON"
-      "-DSPHINX_OUTPUT_MAN=ON"
-      "-DSPHINX_OUTPUT_HTML=OFF"
-      "-DSPHINX_WARNINGS_AS_ERRORS=OFF"
-    ] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [
-      "-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen"
-      "-DCLANG_TABLEGEN=${buildLlvmTools.libclang.dev}/bin/clang-tblgen"
-      # Added in LLVM15:
-      # `clang-tidy-confusable-chars-gen`: https://github.com/llvm/llvm-project/commit/c3574ef739fbfcc59d405985a3a4fa6f4619ecdb
-      # `clang-pseudo-gen`: https://github.com/llvm/llvm-project/commit/cd2292ef824591cc34cc299910a3098545c840c7
-      "-DCLANG_TIDY_CONFUSABLE_CHARS_GEN=${buildLlvmTools.libclang.dev}/bin/clang-tidy-confusable-chars-gen"
-      "-DCLANG_PSEUDO_GEN=${buildLlvmTools.libclang.dev}/bin/clang-pseudo-gen"
-    ];
-
-    patches = [
-      ./purity.patch
-      # https://reviews.llvm.org/D51899
-      ./gnu-install-dirs.patch
-      ../../common/clang/add-nostdlibinc-flag.patch
-      (substituteAll {
-        src = ../../common/clang/clang-at-least-16-LLVMgold-path.patch;
-       libllvmLibdir = "${libllvm.lib}/lib";
-      })
-    ];
-
-    postPatch = ''
-      (cd tools && ln -s ../../clang-tools-extra extra)
-    '' + lib.optionalString stdenv.hostPlatform.isMusl ''
-      sed -i -e 's/lgcc_s/lgcc_eh/' lib/Driver/ToolChains/*.cpp
-    '';
-
-    outputs = [ "out" "lib" "dev" "python" ];
-
-    postInstall = ''
-      ln -sv $out/bin/clang $out/bin/cpp
-
-      # Move libclang to 'lib' output
-      moveToOutput "lib/libclang.*" "$lib"
-      moveToOutput "lib/libclang-cpp.*" "$lib"
-      substituteInPlace $dev/lib/cmake/clang/ClangTargets-release.cmake \
-          --replace "\''${_IMPORT_PREFIX}/lib/libclang." "$lib/lib/libclang." \
-          --replace "\''${_IMPORT_PREFIX}/lib/libclang-cpp." "$lib/lib/libclang-cpp."
-
-      mkdir -p $python/bin $python/share/clang/
-      mv $out/bin/{git-clang-format,scan-view} $python/bin
-      if [ -e $out/bin/set-xcode-analyzer ]; then
-        mv $out/bin/set-xcode-analyzer $python/bin
-      fi
-      mv $out/share/clang/*.py $python/share/clang
-      rm $out/bin/c-index-test
-      patchShebangs $python/bin
-
-      mkdir -p $dev/bin
-      cp bin/{clang-tblgen,clang-tidy-confusable-chars-gen,clang-pseudo-gen} $dev/bin
-    '';
-
-    passthru = {
-      inherit libllvm;
-      isClang = true;
-      hardeningUnsupportedFlags = [
-        "fortify3"
-      ];
-      hardeningUnsupportedFlagsByTargetPlatform = targetPlatform:
-        lib.optional (!(targetPlatform.isx86_64 || targetPlatform.isAarch64)) "zerocallusedregs"
-        ++ (finalAttrs.passthru.hardeningUnsupportedFlags or []);
-    };
-
-    meta = llvm_meta // {
-      homepage = "https://clang.llvm.org/";
-      description = "A C language family frontend for LLVM";
-      longDescription = ''
-        The Clang project provides a language front-end and tooling
-        infrastructure for languages in the C language family (C, C++, Objective
-        C/C++, OpenCL, CUDA, and RenderScript) for the LLVM project.
-        It aims to deliver amazingly fast compiles, extremely useful error and
-        warning messages and to provide a platform for building great source
-        level tools. The Clang Static Analyzer and clang-tidy are tools that
-        automatically find bugs in your code, and are great examples of the sort
-        of tools that can be built using the Clang frontend as a library to
-        parse C/C++ code.
-      '';
-      mainProgram = "clang";
-    };
-  } // lib.optionalAttrs enableManpages {
-    pname = "clang-manpages";
-
-    ninjaFlags = [ "docs-clang-man" ];
-
-    installPhase = ''
-      mkdir -p $out/share/man/man1
-      # Manually install clang manpage
-      cp docs/man/*.1 $out/share/man/man1/
-    '';
-
-    outputs = [ "out" ];
-
-    doCheck = false;
-
-    meta = llvm_meta // {
-      description = "man page for Clang ${version}";
-    };
-  });
-in self
diff --git a/pkgs/development/compilers/llvm/18/compiler-rt/default.nix b/pkgs/development/compilers/llvm/18/compiler-rt/default.nix
deleted file mode 100644
index f51316beb5705..0000000000000
--- a/pkgs/development/compilers/llvm/18/compiler-rt/default.nix
+++ /dev/null
@@ -1,157 +0,0 @@
-{ lib, stdenv, llvm_meta, version
-, monorepoSrc, runCommand
-, cmake, ninja, python3, xcbuild, libllvm, linuxHeaders, libxcrypt
-, doFakeLibgcc ? stdenv.hostPlatform.isFreeBSD
-}:
-
-let
-
-  useLLVM = stdenv.hostPlatform.useLLVM or false;
-  bareMetal = stdenv.hostPlatform.parsed.kernel.name == "none";
-  haveLibc = stdenv.cc.libc != null;
-  isDarwinStatic = stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isStatic;
-  inherit (stdenv.hostPlatform) isMusl;
-
-  baseName = "compiler-rt";
-
-  src = runCommand "${baseName}-src-${version}" {} ''
-    mkdir -p "$out"
-    cp -r ${monorepoSrc}/cmake "$out"
-    cp -r ${monorepoSrc}/${baseName} "$out"
-  '';
-in
-
-stdenv.mkDerivation {
-  pname = baseName + lib.optionalString (haveLibc) "-libc";
-  inherit version;
-
-  inherit src;
-  sourceRoot = "${src.name}/${baseName}";
-
-  nativeBuildInputs = [ cmake ninja python3 libllvm.dev ]
-    ++ lib.optional stdenv.isDarwin xcbuild.xcrun;
-  buildInputs =
-    lib.optional (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isRiscV) linuxHeaders;
-
-  env.NIX_CFLAGS_COMPILE = toString ([
-    "-DSCUDO_DEFAULT_OPTIONS=DeleteSizeMismatch=0:DeallocationTypeMismatch=0"
-  ] ++ lib.optionals (!haveLibc) [
-    # The compiler got stricter about this, and there is a usellvm patch below
-    # which patches out the assert include causing an implicit definition of
-    # assert. It would be nicer to understand why compiler-rt thinks it should
-    # be able to #include <assert.h> in the first place; perhaps it's in the
-    # wrong, or perhaps there is a way to provide an assert.h.
-    "-Wno-error=implicit-function-declaration"
-  ]);
-
-  cmakeFlags = [
-    "-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON"
-    "-DCMAKE_C_COMPILER_TARGET=${stdenv.hostPlatform.config}"
-    "-DCMAKE_ASM_COMPILER_TARGET=${stdenv.hostPlatform.config}"
-  ] ++ lib.optionals (haveLibc && stdenv.hostPlatform.libc == "glibc") [
-    "-DSANITIZER_COMMON_CFLAGS=-I${libxcrypt}/include"
-  ] ++ lib.optionals (useLLVM || bareMetal || isMusl || isDarwinStatic) [
-    "-DCOMPILER_RT_BUILD_SANITIZERS=OFF"
-    "-DCOMPILER_RT_BUILD_XRAY=OFF"
-    "-DCOMPILER_RT_BUILD_LIBFUZZER=OFF"
-    "-DCOMPILER_RT_BUILD_MEMPROF=OFF"
-    "-DCOMPILER_RT_BUILD_ORC=OFF" # may be possible to build with musl if necessary
-  ] ++ lib.optionals (useLLVM || bareMetal) [
-     "-DCOMPILER_RT_BUILD_PROFILE=OFF"
-  ] ++ lib.optionals ((useLLVM && !haveLibc) || bareMetal || isDarwinStatic ) [
-    "-DCMAKE_CXX_COMPILER_WORKS=ON"
-  ] ++ lib.optionals ((useLLVM && !haveLibc) || bareMetal) [
-    "-DCMAKE_C_COMPILER_WORKS=ON"
-    "-DCOMPILER_RT_BAREMETAL_BUILD=ON"
-    "-DCMAKE_SIZEOF_VOID_P=${toString (stdenv.hostPlatform.parsed.cpu.bits / 8)}"
-  ] ++ lib.optionals (useLLVM && !haveLibc) [
-    "-DCMAKE_C_FLAGS=-nodefaultlibs"
-  ] ++ lib.optionals (useLLVM) [
-    "-DCOMPILER_RT_BUILD_BUILTINS=ON"
-    #https://stackoverflow.com/questions/53633705/cmake-the-c-compiler-is-not-able-to-compile-a-simple-test-program
-    "-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY"
-  ] ++ lib.optionals (bareMetal) [
-    "-DCOMPILER_RT_OS_DIR=baremetal"
-  ] ++ lib.optionals (stdenv.hostPlatform.isDarwin) [
-    "-DCMAKE_LIPO=${lib.getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}lipo"
-    "-DDARWIN_macosx_OVERRIDE_SDK_VERSION=ON"
-    "-DDARWIN_osx_ARCHS=${stdenv.hostPlatform.darwinArch}"
-    "-DDARWIN_osx_BUILTIN_ARCHS=${stdenv.hostPlatform.darwinArch}"
-
-    # `COMPILER_RT_DEFAULT_TARGET_ONLY` does not apply to Darwin:
-    # https://github.com/llvm/llvm-project/blob/27ef42bec80b6c010b7b3729ed0528619521a690/compiler-rt/cmake/base-config-ix.cmake#L153
-    "-DCOMPILER_RT_ENABLE_IOS=OFF"
-  ];
-
-  outputs = [ "out" "dev" ];
-
-  patches = [
-    ./X86-support-extension.patch # Add support for i486 i586 i686 by reusing i386 config
-    # ld-wrapper dislikes `-rpath-link //nix/store`, so we normalize away the
-    # extra `/`.
-    ./normalize-var.patch
-    # See: https://github.com/NixOS/nixpkgs/pull/186575
-    ../../common/compiler-rt/darwin-plistbuddy-workaround.patch
-    # See: https://github.com/NixOS/nixpkgs/pull/194634#discussion_r999829893
-    # ../../common/compiler-rt/armv7l-15.patch
-  ];
-
-  # TSAN requires XPC on Darwin, which we have no public/free source files for. We can depend on the Apple frameworks
-  # to get it, but they're unfree. Since LLVM is rather central to the stdenv, we patch out TSAN support so that Hydra
-  # can build this. If we didn't do it, basically the entire nixpkgs on Darwin would have an unfree dependency and we'd
-  # get no binary cache for the entire platform. If you really find yourself wanting the TSAN, make this controllable by
-  # a flag and turn the flag off during the stdenv build.
-  postPatch = lib.optionalString (!stdenv.isDarwin) ''
-    substituteInPlace cmake/builtin-config-ix.cmake \
-      --replace 'set(X86 i386)' 'set(X86 i386 i486 i586 i686)'
-  '' + lib.optionalString stdenv.isDarwin ''
-    substituteInPlace cmake/config-ix.cmake \
-      --replace 'set(COMPILER_RT_HAS_TSAN TRUE)' 'set(COMPILER_RT_HAS_TSAN FALSE)'
-  '' + lib.optionalString (useLLVM && !haveLibc) ''
-    substituteInPlace lib/builtins/aarch64/sme-libc-routines.c \
-      --replace "<stdlib.h>" "<stddef.h>"
-    substituteInPlace lib/builtins/int_util.c \
-      --replace "#include <stdlib.h>" ""
-    substituteInPlace lib/builtins/clear_cache.c \
-      --replace "#include <assert.h>" ""
-    substituteInPlace lib/builtins/cpu_model${lib.optionalString (lib.versionAtLeast version "18") "/x86"}.c \
-      --replace "#include <assert.h>" ""
-  '';
-
-  # Hack around weird upsream RPATH bug
-  postInstall = lib.optionalString (stdenv.hostPlatform.isDarwin) ''
-    ln -s "$out/lib"/*/* "$out/lib"
-  '' + lib.optionalString (useLLVM && stdenv.hostPlatform.isLinux) ''
-    ln -s $out/lib/*/clang_rt.crtbegin-*.o $out/lib/crtbegin.o
-    ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/crtend.o
-    # Note the history of crt{begin,end}S in previous versions of llvm in nixpkg:
-    # The presence of crtbegin_shared has been added and removed; it's possible
-    # people have added/removed it to get it working on their platforms.
-    # Try each in turn for now.
-    ln -s $out/lib/*/clang_rt.crtbegin-*.o $out/lib/crtbeginS.o
-    ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/crtendS.o
-    ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/crtbeginS.o
-    ln -s $out/lib/*/clang_rt.crtend_shared-*.o $out/lib/crtendS.o
-  '' + lib.optionalString doFakeLibgcc ''
-     ln -s $out/lib/freebsd/libclang_rt.builtins-*.a $out/lib/libgcc.a
-  '';
-
-  meta = llvm_meta // {
-    homepage = "https://compiler-rt.llvm.org/";
-    description = "Compiler runtime libraries";
-    longDescription = ''
-      The compiler-rt project provides highly tuned implementations of the
-      low-level code generator support routines like "__fixunsdfdi" and other
-      calls generated when a target doesn't have a short sequence of native
-      instructions to implement a core IR operation. It also provides
-      implementations of run-time libraries for dynamic testing tools such as
-      AddressSanitizer, ThreadSanitizer, MemorySanitizer, and DataFlowSanitizer.
-    '';
-    # "All of the code in the compiler-rt project is dual licensed under the MIT
-    # license and the UIUC License (a BSD-like license)":
-    license = with lib.licenses; [ mit ncsa ];
-    # compiler-rt requires a Clang stdenv on 32-bit RISC-V:
-    # https://reviews.llvm.org/D43106#1019077
-    broken = stdenv.hostPlatform.isRiscV32 && !stdenv.cc.isClang;
-  };
-}
diff --git a/pkgs/development/compilers/llvm/18/default.nix b/pkgs/development/compilers/llvm/18/default.nix
index 5f7f67438f0f3..3c78cd44fdf58 100644
--- a/pkgs/development/compilers/llvm/18/default.nix
+++ b/pkgs/development/compilers/llvm/18/default.nix
@@ -1,6 +1,6 @@
 { lowPrio, newScope, pkgs, lib, stdenv, cmake, ninja
 , preLibcCrossHeaders
-, libxml2, python3, fetchFromGitHub, overrideCC, wrapCCWith, wrapBintoolsWith
+, libxml2, python3, fetchFromGitHub, substituteAll, overrideCC, wrapCCWith, wrapBintoolsWith
 , buildLlvmTools # tools, but from the previous stage, for cross
 , targetLlvmLibraries # libraries, but from the next stage, for cross
 , targetLlvm
@@ -25,7 +25,7 @@
   #   rev-version = /* human readable version; i.e. "unstable-2022-26-07" */;
   #   sha256 = /* checksum for this release, can omit if specifying your own `monorepoSrc` */;
   # }
-, officialRelease ? { version = "18.1.3"; sha256 = "sha256-saQGbpYd95JuudwLcdG80GL8YhadH7TUY1FC0o0ithY="; }
+, officialRelease ? { version = "18.1.4"; sha256 = "sha256-LyQEb4ZJXm2hkPOM9XITIploMT2VKIQWxUFio7SXrc0="; }
   # i.e.:
   # {
   #   version = /* i.e. "15.0.0" */;
@@ -90,7 +90,17 @@ in let
     # we need to reintroduce `outputSpecified` to get the expected behavior e.g. of lib.get*
     llvm = tools.libllvm;
 
-    libclang = callPackage ./clang {
+    libclang = callPackage ../common/clang {
+      patches = [
+        ./clang/purity.patch
+        # https://reviews.llvm.org/D51899
+        ./clang/gnu-install-dirs.patch
+        ../common/clang/add-nostdlibinc-flag.patch
+        (substituteAll {
+          src = ../common/clang/clang-at-least-16-LLVMgold-path.patch;
+          libllvmLibdir = "${tools.libllvm.lib}/lib";
+        })
+      ];
       inherit llvm_meta;
     };
 
@@ -136,7 +146,10 @@ in let
       extraBuildCommands = mkExtraBuildCommands cc;
     };
 
-    lld = callPackage ./lld {
+    lld = callPackage ../common/lld {
+      patches = [
+        ./lld/gnu-install-dirs.patch
+      ];
       inherit llvm_meta;
     };
 
@@ -281,14 +294,34 @@ in let
     callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake ninja libxml2 python3 release_version version monorepoSrc; });
   in {
 
-    compiler-rt-libc = callPackage ./compiler-rt {
+    compiler-rt-libc = callPackage ../common/compiler-rt {
+      patches = [
+        ./compiler-rt/X86-support-extension.patch # Add support for i486 i586 i686 by reusing i386 config
+        # ld-wrapper dislikes `-rpath-link //nix/store`, so we normalize away the
+        # extra `/`.
+        ./compiler-rt/normalize-var.patch
+        # See: https://github.com/NixOS/nixpkgs/pull/186575
+        ../common/compiler-rt/darwin-plistbuddy-workaround.patch
+        # See: https://github.com/NixOS/nixpkgs/pull/194634#discussion_r999829893
+        # ../common/compiler-rt/armv7l-15.patch
+      ];
       inherit llvm_meta;
       stdenv = if stdenv.hostPlatform.useLLVM or false || (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isStatic)
                then overrideCC stdenv buildLlvmTools.clangNoCompilerRtWithLibc
                else stdenv;
     };
 
-    compiler-rt-no-libc = callPackage ./compiler-rt {
+    compiler-rt-no-libc = callPackage ../common/compiler-rt {
+      patches = [
+        ./compiler-rt/X86-support-extension.patch # Add support for i486 i586 i686 by reusing i386 config
+        # ld-wrapper dislikes `-rpath-link //nix/store`, so we normalize away the
+        # extra `/`.
+        ./compiler-rt/normalize-var.patch
+        # See: https://github.com/NixOS/nixpkgs/pull/186575
+        ../common/compiler-rt/darwin-plistbuddy-workaround.patch
+        # See: https://github.com/NixOS/nixpkgs/pull/194634#discussion_r999829893
+        # ../common/compiler-rt/armv7l-15.patch
+      ];
       inherit llvm_meta;
       stdenv = if stdenv.hostPlatform.useLLVM or false
                then overrideCC stdenv buildLlvmTools.clangNoCompilerRt
@@ -307,17 +340,25 @@ in let
     # `libcxx` requires a fairly modern C++ compiler,
     # so: we use the clang from this LLVM package set instead of the regular
     # stdenv's compiler.
-    libcxx = callPackage ./libcxx {
+    libcxx = callPackage ../common/libcxx {
+      patches = lib.optionals (stdenv.isDarwin && lib.versionOlder stdenv.hostPlatform.darwinMinVersion "10.13") [
+        # https://github.com/llvm/llvm-project/issues/64226
+        ./libcxx/0001-darwin-10.12-mbstate_t-fix.patch
+      ];
       inherit llvm_meta;
       stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx;
     };
 
-    libunwind = callPackage ./libunwind {
+    libunwind = callPackage ../common/libunwind {
       inherit llvm_meta;
       stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx;
     };
 
-    openmp = callPackage ./openmp {
+    openmp = callPackage ../common/openmp {
+      patches = [
+        ./openmp/fix-find-tool.patch
+        ./openmp/run-lit-directly.patch
+      ];
       inherit llvm_meta targetLlvm;
     };
   });
diff --git a/pkgs/development/compilers/llvm/18/libcxx/default.nix b/pkgs/development/compilers/llvm/18/libcxx/default.nix
deleted file mode 100644
index d6c304c0b476a..0000000000000
--- a/pkgs/development/compilers/llvm/18/libcxx/default.nix
+++ /dev/null
@@ -1,130 +0,0 @@
-{ lib, stdenv, llvm_meta
-, monorepoSrc, runCommand
-, cmake, lndir, ninja, python3, fixDarwinDylibNames, version
-, cxxabi ? if stdenv.hostPlatform.isFreeBSD then libcxxrt else null
-, libcxxrt, libunwind
-, enableShared ? !stdenv.hostPlatform.isStatic
-}:
-
-# external cxxabi is not supported on Darwin as the build will not link libcxx
-# properly and not re-export the cxxabi symbols into libcxx
-# https://github.com/NixOS/nixpkgs/issues/166205
-# https://github.com/NixOS/nixpkgs/issues/269548
-assert cxxabi == null || !stdenv.hostPlatform.isDarwin;
-let
-  basename = "libcxx";
-  cxxabiName = "lib${if cxxabi == null then "cxxabi" else cxxabi.libName}";
-  runtimes = [ "libcxx" ] ++ lib.optional (cxxabi == null) "libcxxabi";
-
-  # Note: useLLVM is likely false for Darwin but true under pkgsLLVM
-  useLLVM = stdenv.hostPlatform.useLLVM or false;
-
-  cxxabiCMakeFlags = [
-    "-DLIBCXXABI_USE_LLVM_UNWINDER=OFF"
-  ] ++ lib.optionals (useLLVM && !stdenv.hostPlatform.isWasm) [
-    "-DLIBCXXABI_ADDITIONAL_LIBRARIES=unwind"
-    "-DLIBCXXABI_USE_COMPILER_RT=ON"
-  ] ++ lib.optionals stdenv.hostPlatform.isWasm [
-    "-DLIBCXXABI_ENABLE_THREADS=OFF"
-    "-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF"
-  ] ++ lib.optionals (!enableShared) [
-    "-DLIBCXXABI_ENABLE_SHARED=OFF"
-  ];
-
-  cxxCMakeFlags = [
-    "-DLIBCXX_CXX_ABI=${cxxabiName}"
-  ] ++ lib.optionals (cxxabi != null) [
-    "-DLIBCXX_CXX_ABI_INCLUDE_PATHS=${lib.getDev cxxabi}/include"
-  ] ++ lib.optionals (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) [
-    "-DLIBCXX_HAS_MUSL_LIBC=1"
-  ] ++ lib.optionals (lib.versionAtLeast version "18" && !useLLVM && stdenv.hostPlatform.libc == "glibc" && !stdenv.hostPlatform.isStatic) [
-    "-DLIBCXX_ADDITIONAL_LIBRARIES=gcc_s"
-  ] ++ lib.optionals useLLVM [
-    "-DLIBCXX_USE_COMPILER_RT=ON"
-    # There's precedent for this in llvm-project/libcxx/cmake/caches.
-    # In a monorepo build you might do the following in the libcxxabi build:
-    #   -DLLVM_ENABLE_PROJECTS=libcxxabi;libunwinder
-    #   -DLIBCXXABI_STATICALLY_LINK_UNWINDER_IN_STATIC_LIBRARY=On
-    # libcxx appears to require unwind and doesn't pull it in via other means.
-    "-DLIBCXX_ADDITIONAL_LIBRARIES=unwind"
-  ] ++ lib.optionals stdenv.hostPlatform.isWasm [
-    "-DLIBCXX_ENABLE_THREADS=OFF"
-    "-DLIBCXX_ENABLE_FILESYSTEM=OFF"
-    "-DLIBCXX_ENABLE_EXCEPTIONS=OFF"
-  ] ++ lib.optionals (!enableShared) [
-    "-DLIBCXX_ENABLE_SHARED=OFF"
-  ];
-
-  cmakeFlags = [
-    "-DLLVM_ENABLE_RUNTIMES=${lib.concatStringsSep ";" runtimes}"
-  ] ++ lib.optionals stdenv.hostPlatform.isWasm [
-    "-DCMAKE_C_COMPILER_WORKS=ON"
-    "-DCMAKE_CXX_COMPILER_WORKS=ON"
-    "-DUNIX=ON" # Required otherwise libc++ fails to detect the correct linker
-  ] ++ cxxCMakeFlags
-    ++ lib.optionals (cxxabi == null) cxxabiCMakeFlags;
-
-in
-
-stdenv.mkDerivation rec {
-  pname = basename;
-  inherit version cmakeFlags;
-
-  src = runCommand "${pname}-src-${version}" {} (''
-    mkdir -p "$out/llvm"
-    cp -r ${monorepoSrc}/cmake "$out"
-    cp -r ${monorepoSrc}/libcxx "$out"
-    cp -r ${monorepoSrc}/llvm/cmake "$out/llvm"
-    cp -r ${monorepoSrc}/llvm/utils "$out/llvm"
-    cp -r ${monorepoSrc}/third-party "$out"
-    cp -r ${monorepoSrc}/runtimes "$out"
-  '' + lib.optionalString (cxxabi == null) ''
-    cp -r ${monorepoSrc}/libcxxabi "$out"
-  '');
-
-  outputs = [ "out" "dev" ];
-
-  patches = lib.optionals (stdenv.isDarwin && lib.versionOlder stdenv.hostPlatform.darwinMinVersion "10.13") [
-    # https://github.com/llvm/llvm-project/issues/64226
-    ./0001-darwin-10.12-mbstate_t-fix.patch
-  ];
-
-  postPatch = ''
-    cd runtimes
-  '';
-
-  preConfigure = lib.optionalString stdenv.hostPlatform.isMusl ''
-    patchShebangs utils/cat_files.py
-  '';
-
-  nativeBuildInputs = [ cmake ninja python3 ]
-    ++ lib.optional stdenv.isDarwin fixDarwinDylibNames
-    ++ lib.optional (cxxabi != null) lndir;
-
-  buildInputs = [ cxxabi ]
-    ++ lib.optionals (useLLVM && !stdenv.hostPlatform.isWasm) [ libunwind ];
-
-  # libc++.so is a linker script which expands to multiple libraries,
-  # libc++.so.1 and libc++abi.so or the external cxxabi. ld-wrapper doesn't
-  # support linker scripts so the external cxxabi needs to be symlinked in
-  postInstall = lib.optionalString (cxxabi != null) ''
-    lndir ${lib.getDev cxxabi}/include ''${!outputDev}/include/c++/v1
-    lndir ${lib.getLib cxxabi}/lib ''${!outputLib}/lib
-  '';
-
-  passthru = {
-    isLLVM = true;
-  };
-
-  meta = llvm_meta // {
-    homepage = "https://libcxx.llvm.org/";
-    description = "C++ standard library";
-    longDescription = ''
-      libc++ is an implementation of the C++ standard library, targeting C++11,
-      C++14 and above.
-    '';
-    # "All of the code in libc++ is dual licensed under the MIT license and the
-    # UIUC License (a BSD-like license)":
-    license = with lib.licenses; [ mit ncsa ];
-  };
-}
diff --git a/pkgs/development/compilers/llvm/18/libunwind/default.nix b/pkgs/development/compilers/llvm/18/libunwind/default.nix
deleted file mode 100644
index e67823ffb85c2..0000000000000
--- a/pkgs/development/compilers/llvm/18/libunwind/default.nix
+++ /dev/null
@@ -1,54 +0,0 @@
-{ lib, stdenv, llvm_meta, version
-, monorepoSrc, runCommand
-, cmake
-, ninja
-, python3
-, enableShared ? !stdenv.hostPlatform.isStatic
-}:
-
-stdenv.mkDerivation rec {
-  pname = "libunwind";
-  inherit version;
-
-  # I am not so comfortable giving libc++ and friends the whole monorepo as
-  # requested, so I filter it to what is needed.
-  src = runCommand "${pname}-src-${version}" {} ''
-    mkdir -p "$out"
-    cp -r ${monorepoSrc}/cmake "$out"
-    cp -r ${monorepoSrc}/${pname} "$out"
-    mkdir -p "$out/libcxx"
-    cp -r ${monorepoSrc}/libcxx/cmake "$out/libcxx"
-    cp -r ${monorepoSrc}/libcxx/utils "$out/libcxx"
-    mkdir -p "$out/llvm"
-    cp -r ${monorepoSrc}/llvm/cmake "$out/llvm"
-    cp -r ${monorepoSrc}/llvm/utils "$out/llvm"
-    cp -r ${monorepoSrc}/runtimes "$out"
-  '';
-
-  sourceRoot = "${src.name}/runtimes";
-
-  postInstall = lib.optionalString (enableShared && !stdenv.hostPlatform.isDarwin) ''
-    # libcxxabi wants to link to libunwind_shared.so (?).
-    ln -s $out/lib/libunwind.so $out/lib/libunwind_shared.so
-  '';
-
-  outputs = [ "out" "dev" ];
-
-  nativeBuildInputs = [ cmake ninja python3 ];
-
-  cmakeFlags = [
-    "-DLLVM_ENABLE_RUNTIMES=libunwind"
-  ] ++ lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF";
-
-  meta = llvm_meta // {
-    # Details: https://github.com/llvm/llvm-project/blob/main/libunwind/docs/index.rst
-    homepage = "https://clang.llvm.org/docs/Toolchain.html#unwind-library";
-    description = "LLVM's unwinder library";
-    longDescription = ''
-      The unwind library provides a family of _Unwind_* functions implementing
-      the language-neutral stack unwinding portion of the Itanium C++ ABI (Level
-      I). It is a dependency of the C++ ABI library, and sometimes is a
-      dependency of other runtimes.
-    '';
-  };
-}
diff --git a/pkgs/development/compilers/llvm/18/lld/default.nix b/pkgs/development/compilers/llvm/18/lld/default.nix
deleted file mode 100644
index 24ff0933dd1d8..0000000000000
--- a/pkgs/development/compilers/llvm/18/lld/default.nix
+++ /dev/null
@@ -1,57 +0,0 @@
-{ lib, stdenv, llvm_meta
-, buildLlvmTools
-, monorepoSrc, runCommand
-, cmake
-, ninja
-, libxml2
-, libllvm
-, version
-}:
-
-stdenv.mkDerivation rec {
-  pname = "lld";
-  inherit version;
-
-  # Blank llvm dir just so relative path works
-  src = runCommand "${pname}-src-${version}" {} ''
-    mkdir -p "$out"
-    cp -r ${monorepoSrc}/cmake "$out"
-    cp -r ${monorepoSrc}/${pname} "$out"
-    mkdir -p "$out/libunwind"
-    cp -r ${monorepoSrc}/libunwind/include "$out/libunwind"
-    mkdir -p "$out/llvm"
-  '';
-
-  sourceRoot = "${src.name}/${pname}";
-
-  nativeBuildInputs = [ cmake ninja ];
-  buildInputs = [ libllvm libxml2 ];
-
-  patches = [
-    ./gnu-install-dirs.patch
-  ];
-
-  cmakeFlags = [
-    "-DLLD_INSTALL_PACKAGE_DIR=${placeholder "dev"}/lib/cmake/lld"
-  ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
-    "-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen"
-  ];
-
-  # Musl's default stack size is too small for lld to be able to link Firefox.
-  LDFLAGS = lib.optionalString stdenv.hostPlatform.isMusl "-Wl,-z,stack-size=2097152";
-
-  outputs = [ "out" "lib" "dev" ];
-
-  meta = llvm_meta // {
-    homepage = "https://lld.llvm.org/";
-    description = "The LLVM linker (unwrapped)";
-    longDescription = ''
-      LLD is a linker from the LLVM project that is a drop-in replacement for
-      system linkers and runs much faster than them. It also provides features
-      that are useful for toolchain developers.
-      The linker supports ELF (Unix), PE/COFF (Windows), Mach-O (macOS), and
-      WebAssembly in descending order of completeness. Internally, LLD consists
-      of several different linkers.
-    '';
-  };
-}
diff --git a/pkgs/development/compilers/llvm/18/llvm/default.nix b/pkgs/development/compilers/llvm/18/llvm/default.nix
index 670171a707f9c..a9732763e9d7b 100644
--- a/pkgs/development/compilers/llvm/18/llvm/default.nix
+++ b/pkgs/development/compilers/llvm/18/llvm/default.nix
@@ -8,7 +8,7 @@
 , python3
 , python3Packages
 , libffi
-, enableGoldPlugin ? true
+, enableGoldPlugin ? libbfd.hasPluginAPI
 , libbfd
 , libpfm
 , libxml2
diff --git a/pkgs/development/compilers/llvm/18/openmp/default.nix b/pkgs/development/compilers/llvm/18/openmp/default.nix
deleted file mode 100644
index e1c3c2379af2a..0000000000000
--- a/pkgs/development/compilers/llvm/18/openmp/default.nix
+++ /dev/null
@@ -1,73 +0,0 @@
-{ lib
-, stdenv
-, llvm_meta
-, monorepoSrc
-, runCommand
-, cmake
-, ninja
-, llvm
-, targetLlvm
-, lit
-, clang-unwrapped
-, perl
-, pkg-config
-, xcbuild
-, version
-}:
-
-stdenv.mkDerivation rec {
-  pname = "openmp";
-  inherit version;
-
-  src = runCommand "${pname}-src-${version}" {} ''
-    mkdir -p "$out"
-    cp -r ${monorepoSrc}/cmake "$out"
-    cp -r ${monorepoSrc}/${pname} "$out"
-  '';
-
-  sourceRoot = "${src.name}/${pname}";
-
-  patches = [
-    ./fix-find-tool.patch
-    ./run-lit-directly.patch
-  ];
-
-  outputs = [ "out" "dev" ];
-
-  nativeBuildInputs = [ cmake ninja perl pkg-config lit ];
-  buildInputs = [
-    (if stdenv.buildPlatform == stdenv.hostPlatform then llvm else targetLlvm)
-  ];
-
-  nativeCheckInputs = lib.optional stdenv.hostPlatform.isDarwin xcbuild.xcrun;
-
-  # Unsup:Pass:XFail:Fail
-  # 26:267:16:8
-  doCheck = false;
-  checkTarget = "check-openmp";
-
-  preCheck = ''
-    patchShebangs ../tools/archer/tests/deflake.bash
-  '';
-
-  cmakeFlags = [
-    "-DCLANG_TOOL=${clang-unwrapped}/bin/clang"
-    "-DOPT_TOOL=${llvm}/bin/opt"
-    "-DLINK_TOOL=${llvm}/bin/llvm-link"
-  ];
-
-  meta = llvm_meta // {
-    homepage = "https://openmp.llvm.org/";
-    description = "Support for the OpenMP language";
-    longDescription = ''
-      The OpenMP subproject of LLVM contains the components required to build an
-      executable OpenMP program that are outside the compiler itself.
-      Contains the code for the runtime library against which code compiled by
-      "clang -fopenmp" must be linked before it can run and the library that
-      supports offload to target devices.
-    '';
-    # "All of the code is dual licensed under the MIT license and the UIUC
-    # License (a BSD-like license)":
-    license = with lib.licenses; [ mit ncsa ];
-  };
-}