about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/compilers/llvm
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2024-02-13 12:25:07 +0100
committerAlyssa Ross <hi@alyssa.is>2024-02-13 12:25:07 +0100
commita5e1520e4538e29ecfbd4b168306f890566d7bfd (patch)
tree28099c268b5d4b1e33c2b29f0714c45f0b961382 /nixpkgs/pkgs/development/compilers/llvm
parent822f7c15c04567fbdc27020e862ea2b70cfbf8eb (diff)
parent3560d1c8269d0091b9aae10731b5e85274b7bbc1 (diff)
downloadnixlib-a5e1520e4538e29ecfbd4b168306f890566d7bfd.tar
nixlib-a5e1520e4538e29ecfbd4b168306f890566d7bfd.tar.gz
nixlib-a5e1520e4538e29ecfbd4b168306f890566d7bfd.tar.bz2
nixlib-a5e1520e4538e29ecfbd4b168306f890566d7bfd.tar.lz
nixlib-a5e1520e4538e29ecfbd4b168306f890566d7bfd.tar.xz
nixlib-a5e1520e4538e29ecfbd4b168306f890566d7bfd.tar.zst
nixlib-a5e1520e4538e29ecfbd4b168306f890566d7bfd.zip
Merge branch 'nixos-unstable-small' of https://github.com/NixOS/nixpkgs
Conflicts:
	nixpkgs/nixos/modules/services/mail/rss2email.nix
	nixpkgs/pkgs/build-support/go/module.nix
Diffstat (limited to 'nixpkgs/pkgs/development/compilers/llvm')
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/10/clang/compiler-rt-baremetal.patch53
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/10/clang/default.nix133
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/10/clang/gnu-install-dirs.patch248
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/10/clang/purity.patch30
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/10/compiler-rt/X86-support-extension.patch23
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/10/compiler-rt/armv7l.patch32
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/10/compiler-rt/default.nix131
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/10/compiler-rt/find-darwin-sdk-version.patch62
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/10/compiler-rt/gnu-install-dirs.patch129
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/10/default.nix269
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/10/libcxx/default.nix88
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/10/libcxx/gnu-install-dirs.patch99
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/10/libcxxabi/default.nix85
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/10/libcxxabi/gnu-install-dirs.patch34
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/10/libunwind/default.nix31
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/10/libunwind/gnu-install-dirs.patch34
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/10/lld/default.nix46
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/10/lld/gnu-install-dirs.patch68
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/10/lldb/gnu-install-dirs.patch91
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/10/lldb/procfs.patch31
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/10/llvm/default.nix355
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/10/llvm/gnu-install-dirs-polly.patch106
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/10/llvm/gnu-install-dirs.patch416
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/10/openmp/default.nix37
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/11/clang/default.nix2
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/11/compiler-rt/default.nix2
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/11/default.nix1
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/11/llvm/default.nix2
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/12/clang/default.nix2
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/12/compiler-rt/default.nix3
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/12/default.nix1
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/12/llvm/default.nix2
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/13/clang/default.nix2
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/13/compiler-rt/default.nix3
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/13/default.nix1
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/13/llvm/default.nix2
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/14/clang/default.nix2
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/14/compiler-rt/default.nix3
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/14/default.nix1
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/14/llvm/default.nix2
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/15/clang/default.nix9
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/15/compiler-rt/default.nix3
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/15/default.nix1
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/15/libcxx/default.nix8
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/15/llvm/default.nix2
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/16/clang/default.nix9
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/16/compiler-rt/default.nix3
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/16/default.nix1
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/16/libcxx/default.nix10
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/16/llvm/default.nix2
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/17/clang/default.nix9
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/17/compiler-rt/default.nix3
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/17/libcxx/default.nix21
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/17/libcxxabi/default.nix3
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/17/llvm/default.nix2
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/8/clang/HIP-use-PATH-8.patch80
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/8/clang/compiler-rt-baremetal.patch53
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/8/clang/default.nix145
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/8/clang/gnu-install-dirs.patch290
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/8/clang/static-pie.patch157
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/8/clang/unwindlib.patch372
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/8/clang/xpc.patch41
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/8/compiler-rt/armv7l.patch38
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/8/compiler-rt/crtbegin-and-end.patch595
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/8/compiler-rt/default.nix117
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/8/compiler-rt/gnu-install-dirs.patch117
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/8/default.nix272
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/8/libcxx/default.nix92
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/8/libcxx/gnu-install-dirs.patch72
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/8/libcxxabi/default.nix85
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/8/libcxxabi/gnu-install-dirs.patch28
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/8/libunwind/default.nix40
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/8/libunwind/gnu-install-dirs.patch28
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/8/lld/default.nix46
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/8/lld/gnu-install-dirs.patch68
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/8/lldb/default.nix109
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/8/lldb/gnu-install-dirs.patch120
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/8/lldb/lldb-gdb-remote-no-libcompress.patch30
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/8/llvm/default.nix329
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/8/llvm/gnu-install-dirs-polly.patch106
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/8/llvm/gnu-install-dirs.patch394
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/8/openmp/default.nix37
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/9/clang/default.nix2
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/9/compiler-rt/default.nix5
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/9/default.nix1
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/9/llvm/default.nix2
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/aarch64.patch51
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/common/clang/5-8-purity.patch30
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/common/lldb.nix21
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/git/clang/default.nix12
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/git/clang/purity.patch18
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/git/compiler-rt/default.nix3
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/git/default.nix7
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/git/libcxx/default.nix13
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/git/llvm/default.nix14
-rw-r--r--nixpkgs/pkgs/development/compilers/llvm/llvm-7-musl.patch92
96 files changed, 160 insertions, 6720 deletions
diff --git a/nixpkgs/pkgs/development/compilers/llvm/10/clang/compiler-rt-baremetal.patch b/nixpkgs/pkgs/development/compilers/llvm/10/clang/compiler-rt-baremetal.patch
deleted file mode 100644
index a4a0f21b0fcd..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/10/clang/compiler-rt-baremetal.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-Index: lib/Driver/ToolChains/BareMetal.cpp
-===================================================================
---- a/lib/Driver/ToolChains/BareMetal.cpp
-+++ b/lib/Driver/ToolChains/BareMetal.cpp
-@@ -157,7 +157,7 @@
- void BareMetal::AddLinkRuntimeLib(const ArgList &Args,
-                                   ArgStringList &CmdArgs) const {
-   CmdArgs.push_back(Args.MakeArgString("-lclang_rt.builtins-" +
--                                       getTriple().getArchName() + ".a"));
-+                                       getTriple().getArchName()));
- }
- 
- void baremetal::Linker::ConstructJob(Compilation &C, const JobAction &JA,
-Index: test/Driver/baremetal.cpp
-===================================================================
---- a/test/Driver/baremetal.cpp
-+++ b/test/Driver/baremetal.cpp
-@@ -13,7 +13,7 @@
- // CHECK-V6M-C-NEXT: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" "{{.*}}.o" "-Bstatic"
- // CHECK-V6M-C-SAME: "-L[[RESOURCE_DIR:[^"]+]]{{[/\\]+}}lib{{[/\\]+}}baremetal"
- // CHECK-V6M-C-SAME: "-T" "semihosted.lds" "-Lsome{{[/\\]+}}directory{{[/\\]+}}user{{[/\\]+}}asked{{[/\\]+}}for"
--// CHECK-V6M-C-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a"
-+// CHECK-V6M-C-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m"
- // CHECK-V6M-C-SAME: "-o" "{{.*}}.o"
- 
- // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-@@ -35,7 +35,7 @@
- // CHECK-V6M-DEFAULTCXX: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" "{{.*}}.o" "-Bstatic"
- // CHECK-V6M-DEFAULTCXX-SAME: "-L{{[^"]*}}{{[/\\]+}}lib{{(64)?}}{{[/\\]+}}clang{{[/\\]+}}{{.*}}{{[/\\]+}}lib{{[/\\]+}}baremetal"
- // CHECK-V6M-DEFAULTCXX-SAME: "-lc++" "-lc++abi" "-lunwind"
--// CHECK-V6M-DEFAULTCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a"
-+// CHECK-V6M-DEFAULTCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m"
- // CHECK-V6M-DEFAULTCXX-SAME: "-o" "{{.*}}.o"
- 
- // RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-@@ -48,7 +48,7 @@
- // CHECK-V6M-LIBCXX: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" "{{.*}}.o" "-Bstatic"
- // CHECK-V6M-LIBCXX-SAME: "-L{{[^"]*}}{{[/\\]+}}lib{{(64)?}}{{[/\\]+}}clang{{[/\\]+}}{{.*}}{{[/\\]+}}lib{{[/\\]+}}baremetal"
- // CHECK-V6M-LIBCXX-SAME: "-lc++" "-lc++abi" "-lunwind"
--// CHECK-V6M-LIBCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a"
-+// CHECK-V6M-LIBCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m"
- // CHECK-V6M-LIBCXX-SAME: "-o" "{{.*}}.o"
- 
- // RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-@@ -61,7 +61,7 @@
- // CHECK-V6M-LIBSTDCXX: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" "{{.*}}.o" "-Bstatic"
- // CHECK-V6M-LIBSTDCXX-SAME: "-L{{[^"]*}}{{[/\\]+}}lib{{(64)?}}{{[/\\]+}}clang{{[/\\]+}}{{.*}}{{[/\\]+}}lib{{[/\\]+}}baremetal"
- // CHECK-V6M-LIBSTDCXX-SAME: "-lstdc++" "-lsupc++" "-lunwind"
--// CHECK-V6M-LIBSTDCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a"
-+// CHECK-V6M-LIBSTDCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m"
- // CHECK-V6M-LIBSTDCXX-SAME: "-o" "{{.*}}.o"
- 
- // RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \
diff --git a/nixpkgs/pkgs/development/compilers/llvm/10/clang/default.nix b/nixpkgs/pkgs/development/compilers/llvm/10/clang/default.nix
deleted file mode 100644
index ad4e91304158..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/10/clang/default.nix
+++ /dev/null
@@ -1,133 +0,0 @@
-{ lib, stdenv, llvm_meta, fetch, substituteAll, cmake, libxml2, libllvm, version, clang-tools-extra_src, python3
-, buildLlvmTools
-, fixDarwinDylibNames
-, enableManpages ? false
-}:
-
-let
-  self = stdenv.mkDerivation ({
-    pname = "clang";
-    inherit version;
-
-    src = fetch "clang" "091bvcny2lh32zy8f3m9viayyhb2zannrndni7325rl85cwgr6pr";
-
-    unpackPhase = ''
-      unpackFile $src
-      mv clang-${version}* clang
-      sourceRoot=$PWD/clang
-      unpackFile ${clang-tools-extra_src}
-      mv clang-tools-extra-* $sourceRoot/tools/extra
-    '';
-
-    nativeBuildInputs = [ cmake python3 ]
-      ++ lib.optional enableManpages python3.pkgs.sphinx
-      ++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
-
-    buildInputs = [ libxml2 libllvm ];
-
-    cmakeFlags = [
-      "-DCLANGD_BUILD_XPC=OFF"
-      "-DLLVM_ENABLE_RTTI=ON"
-    ] ++ 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.hostPlatform != stdenv.buildPlatform) [
-      "-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen"
-      "-DCLANG_TABLEGEN=${buildLlvmTools.libclang.dev}/bin/clang-tblgen"
-    ];
-
-    patches = [
-      ./purity.patch
-      # https://reviews.llvm.org/D51899
-      ./compiler-rt-baremetal.patch
-      ./gnu-install-dirs.patch
-      (substituteAll {
-        src = ../../clang-6-10-LLVMgold-path.patch;
-        libllvmLibdir = "${libllvm.lib}/lib";
-      })
-    ];
-
-    postPatch = ''
-      sed -i -e 's/DriverArgs.hasArg(options::OPT_nostdlibinc)/true/' \
-             -e 's/Args.hasArg(options::OPT_nostdlibinc)/true/' \
-             lib/Driver/ToolChains/*.cpp
-    '' + lib.optionalString stdenv.hostPlatform.isMusl ''
-      sed -i -e 's/lgcc_s/lgcc_eh/' lib/Driver/ToolChains/*.cpp
-    '' + lib.optionalString stdenv.hostPlatform.isDarwin ''
-      substituteInPlace tools/extra/clangd/CMakeLists.txt \
-        --replace "NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB" FALSE
-    '';
-
-    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 $out/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,scan-view}
-      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
-      mv $out/share/scan-view/*.py $python/share/scan-view
-      rm $out/bin/c-index-test
-      patchShebangs $python/bin
-
-      mkdir -p $dev/bin
-      cp bin/clang-tblgen $dev/bin
-    '';
-
-    passthru = {
-      inherit libllvm;
-      isClang = true;
-      hardeningUnsupportedFlags = [ "fortify3" ];
-    };
-
-    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";
-
-    buildPhase = ''
-      make 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/nixpkgs/pkgs/development/compilers/llvm/10/clang/gnu-install-dirs.patch b/nixpkgs/pkgs/development/compilers/llvm/10/clang/gnu-install-dirs.patch
deleted file mode 100644
index 454c81875eab..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/10/clang/gnu-install-dirs.patch
+++ /dev/null
@@ -1,248 +0,0 @@
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index dc1413f4b597..c173531e624f 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -9,6 +9,8 @@ endif()
- if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
-   project(Clang)
- 
-+  include(GNUInstallDirs)
-+
-   # Rely on llvm-config.
-   set(CONFIG_OUTPUT)
-   if(LLVM_CONFIG)
-@@ -417,7 +419,7 @@ include_directories(BEFORE
- 
- if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
-   install(DIRECTORY include/clang include/clang-c
--    DESTINATION include
-+    DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
-     COMPONENT clang-headers
-     FILES_MATCHING
-     PATTERN "*.def"
-@@ -427,7 +429,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
-     )
- 
-   install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/clang
--    DESTINATION include
-+    DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
-     COMPONENT clang-headers
-     FILES_MATCHING
-     PATTERN "CMakeFiles" EXCLUDE
-@@ -447,7 +449,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
- 
-   add_custom_target(bash-autocomplete DEPENDS utils/bash-autocomplete.sh)
-   install(PROGRAMS utils/bash-autocomplete.sh
--          DESTINATION share/clang
-+          DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
-           COMPONENT bash-autocomplete)
-   if(NOT LLVM_ENABLE_IDE)
-     add_llvm_install_targets(install-bash-autocomplete
-diff --git a/cmake/modules/AddClang.cmake b/cmake/modules/AddClang.cmake
-index 577cc11ab015..a4f4481d8442 100644
---- a/cmake/modules/AddClang.cmake
-+++ b/cmake/modules/AddClang.cmake
-@@ -114,9 +114,9 @@ macro(add_clang_library name)
-       install(TARGETS ${name}
-         COMPONENT ${name}
-         ${export_to_clangtargets}
--        LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
--        ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
--        RUNTIME DESTINATION bin)
-+        LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
-+        ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
-+        RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
- 
-       if (NOT LLVM_ENABLE_IDE)
-         add_llvm_install_targets(install-${name}
-@@ -160,7 +160,7 @@ macro(add_clang_tool name)
- 
-     install(TARGETS ${name}
-       ${export_to_clangtargets}
--      RUNTIME DESTINATION bin
-+      RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
-       COMPONENT ${name})
- 
-     if(NOT LLVM_ENABLE_IDE)
-@@ -175,7 +175,7 @@ endmacro()
- macro(add_clang_symlink name dest)
-   add_llvm_tool_symlink(${name} ${dest} ALWAYS_GENERATE)
-   # Always generate install targets
--  llvm_install_symlink(${name} ${dest} ALWAYS_GENERATE)
-+  llvm_install_symlink(${name} ${dest} ${CMAKE_INSTALL_FULL_BINDIR} ALWAYS_GENERATE)
- endmacro()
- 
- function(clang_target_link_libraries target type)
-diff --git a/lib/Headers/CMakeLists.txt b/lib/Headers/CMakeLists.txt
-index 85c3124234ad..64c48235d914 100644
---- a/lib/Headers/CMakeLists.txt
-+++ b/lib/Headers/CMakeLists.txt
-@@ -191,7 +191,7 @@ set_target_properties(clang-resource-headers PROPERTIES
-   FOLDER "Misc"
-   RUNTIME_OUTPUT_DIRECTORY "${output_dir}")
- 
--set(header_install_dir lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
-+set(header_install_dir ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
- 
- install(
-   FILES ${files} ${generated_files}
-diff --git a/tools/c-index-test/CMakeLists.txt b/tools/c-index-test/CMakeLists.txt
-index ceef4b08637c..8efad5520ca4 100644
---- a/tools/c-index-test/CMakeLists.txt
-+++ b/tools/c-index-test/CMakeLists.txt
-@@ -54,7 +54,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
-     set_property(TARGET c-index-test APPEND PROPERTY INSTALL_RPATH
-        "@executable_path/../../lib")
-   else()
--    set(INSTALL_DESTINATION bin)
-+    set(INSTALL_DESTINATION ${CMAKE_INSTALL_BINDIR})
-   endif()
- 
-   install(TARGETS c-index-test
-diff --git a/tools/clang-format/CMakeLists.txt b/tools/clang-format/CMakeLists.txt
-index 35ecdb11253c..d77d75de0094 100644
---- a/tools/clang-format/CMakeLists.txt
-+++ b/tools/clang-format/CMakeLists.txt
-@@ -21,20 +21,20 @@ if( LLVM_LIB_FUZZING_ENGINE OR LLVM_USE_SANITIZE_COVERAGE )
- endif()
- 
- install(PROGRAMS clang-format-bbedit.applescript
--  DESTINATION share/clang
-+  DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
-   COMPONENT clang-format)
- install(PROGRAMS clang-format-diff.py
--  DESTINATION share/clang
-+  DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
-   COMPONENT clang-format)
- install(PROGRAMS clang-format-sublime.py
--  DESTINATION share/clang
-+  DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
-   COMPONENT clang-format)
- install(PROGRAMS clang-format.el
--  DESTINATION share/clang
-+  DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
-   COMPONENT clang-format)
- install(PROGRAMS clang-format.py
--  DESTINATION share/clang
-+  DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
-   COMPONENT clang-format)
- install(PROGRAMS git-clang-format
--  DESTINATION bin
-+  DESTINATION ${CMAKE_INSTALL_BINDIR}
-   COMPONENT clang-format)
-diff --git a/tools/clang-rename/CMakeLists.txt b/tools/clang-rename/CMakeLists.txt
-index cda8e29ec5b1..0134d8ccd70b 100644
---- a/tools/clang-rename/CMakeLists.txt
-+++ b/tools/clang-rename/CMakeLists.txt
-@@ -19,8 +19,8 @@ clang_target_link_libraries(clang-rename
-   )
- 
- install(PROGRAMS clang-rename.py
--  DESTINATION share/clang
-+  DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
-   COMPONENT clang-rename)
- install(PROGRAMS clang-rename.el
--  DESTINATION share/clang
-+  DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
-   COMPONENT clang-rename)
-diff --git a/tools/diagtool/CMakeLists.txt b/tools/diagtool/CMakeLists.txt
-index a95444be40ee..136d96d9bf5b 100644
---- a/tools/diagtool/CMakeLists.txt
-+++ b/tools/diagtool/CMakeLists.txt
-@@ -21,7 +21,7 @@ clang_target_link_libraries(diagtool
- if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
-   install(TARGETS diagtool
-     COMPONENT diagtool
--    RUNTIME DESTINATION bin)
-+    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
- 
-   if (NOT LLVM_ENABLE_IDE)
-     add_llvm_install_targets(install-diagtool
-diff --git a/tools/libclang/CMakeLists.txt b/tools/libclang/CMakeLists.txt
-index 973655361f71..0181002e4e3b 100644
---- a/tools/libclang/CMakeLists.txt
-+++ b/tools/libclang/CMakeLists.txt
-@@ -141,7 +141,7 @@ endif()
- if(INTERNAL_INSTALL_PREFIX)
-   set(LIBCLANG_HEADERS_INSTALL_DESTINATION "${INTERNAL_INSTALL_PREFIX}/include")
- else()
--  set(LIBCLANG_HEADERS_INSTALL_DESTINATION include)
-+  set(LIBCLANG_HEADERS_INSTALL_DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
- endif()
- 
- install(DIRECTORY ../../include/clang-c
-@@ -172,7 +172,7 @@ foreach(PythonVersion ${CLANG_PYTHON_BINDINGS_VERSIONS})
-           COMPONENT
-             libclang-python-bindings
-           DESTINATION
--            "lib${LLVM_LIBDIR_SUFFIX}/python${PythonVersion}/site-packages")
-+            "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/python${PythonVersion}/site-packages")
- endforeach()
- if(NOT LLVM_ENABLE_IDE)
-   add_custom_target(libclang-python-bindings)
-diff --git a/tools/scan-build/CMakeLists.txt b/tools/scan-build/CMakeLists.txt
-index 28241245fcb7..d6b59f02fc2a 100644
---- a/tools/scan-build/CMakeLists.txt
-+++ b/tools/scan-build/CMakeLists.txt
-@@ -42,7 +42,7 @@ if(CLANG_INSTALL_SCANBUILD)
-                        DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile})
-     list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${BinFile})
-     install(PROGRAMS bin/${BinFile}
--            DESTINATION bin
-+            DESTINATION ${CMAKE_INSTALL_BINDIR}
-             COMPONENT scan-build)
-   endforeach()
- 
-@@ -56,7 +56,7 @@ if(CLANG_INSTALL_SCANBUILD)
-                        DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libexec/${LibexecFile})
-     list(APPEND Depends ${CMAKE_BINARY_DIR}/libexec/${LibexecFile})
-     install(PROGRAMS libexec/${LibexecFile}
--            DESTINATION libexec
-+            DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}
-             COMPONENT scan-build)
-   endforeach()
- 
-@@ -84,7 +84,7 @@ if(CLANG_INSTALL_SCANBUILD)
-                        DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/share/scan-build/${ShareFile})
-     list(APPEND Depends ${CMAKE_BINARY_DIR}/share/scan-build/${ShareFile})
-     install(FILES share/scan-build/${ShareFile}
--            DESTINATION share/scan-build
-+            DESTINATION ${CMAKE_INSTALL_DATADIR}/scan-build
-             COMPONENT scan-build)
-   endforeach()
- 
-diff --git a/tools/scan-view/CMakeLists.txt b/tools/scan-view/CMakeLists.txt
-index 22edb974bac7..9f140a9a4538 100644
---- a/tools/scan-view/CMakeLists.txt
-+++ b/tools/scan-view/CMakeLists.txt
-@@ -22,7 +22,7 @@ if(CLANG_INSTALL_SCANVIEW)
-                        DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile})
-     list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${BinFile})
-     install(PROGRAMS bin/${BinFile}
--            DESTINATION bin
-+            DESTINATION ${CMAKE_INSTALL_BINDIR}
-             COMPONENT scan-view)
-   endforeach()
- 
-@@ -36,7 +36,7 @@ if(CLANG_INSTALL_SCANVIEW)
-                        DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/share/${ShareFile})
-     list(APPEND Depends ${CMAKE_BINARY_DIR}/share/scan-view/${ShareFile})
-     install(FILES share/${ShareFile}
--            DESTINATION share/scan-view
-+            DESTINATION ${CMAKE_INSTALL_DATADIR}/scan-view
-             COMPONENT scan-view)
-   endforeach()
- 
-diff --git a/utils/hmaptool/CMakeLists.txt b/utils/hmaptool/CMakeLists.txt
-index 62f2de0cb15c..6aa66825b6ec 100644
---- a/utils/hmaptool/CMakeLists.txt
-+++ b/utils/hmaptool/CMakeLists.txt
-@@ -10,7 +10,7 @@ add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/${CLANG_HM
- 
- list(APPEND Depends ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/${CLANG_HMAPTOOL})
- install(PROGRAMS ${CLANG_HMAPTOOL}
--        DESTINATION bin
-+        DESTINATION ${CMAKE_INSTALL_BINDIR}
-         COMPONENT hmaptool)
- 
- add_custom_target(hmaptool ALL DEPENDS ${Depends})
diff --git a/nixpkgs/pkgs/development/compilers/llvm/10/clang/purity.patch b/nixpkgs/pkgs/development/compilers/llvm/10/clang/purity.patch
deleted file mode 100644
index a6729a9b004e..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/10/clang/purity.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From 4add81bba40dcec62c4ea4481be8e35ac53e89d8 Mon Sep 17 00:00:00 2001
-From: Will Dietz <w@wdtz.org>
-Date: Thu, 18 May 2017 11:56:12 -0500
-Subject: [PATCH] "purity" patch for 5.0
-
----
- lib/Driver/ToolChains/Gnu.cpp | 7 -------
- 1 file changed, 7 deletions(-)
-
-diff --git a/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp
-index fe3c0191bb..c6a482bece 100644
---- a/lib/Driver/ToolChains/Gnu.cpp
-+++ b/lib/Driver/ToolChains/Gnu.cpp
-@@ -494,13 +494,6 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
-   if (!IsStatic) {
-     if (Args.hasArg(options::OPT_rdynamic))
-       CmdArgs.push_back("-export-dynamic");
--
--    if (!Args.hasArg(options::OPT_shared) && !IsStaticPIE) {
--      const std::string Loader =
--          D.DyldPrefix + ToolChain.getDynamicLinker(Args);
--      CmdArgs.push_back("-dynamic-linker");
--      CmdArgs.push_back(Args.MakeArgString(Loader));
--    }
-   }
- 
-   CmdArgs.push_back("-o");
--- 
-2.11.0
-
diff --git a/nixpkgs/pkgs/development/compilers/llvm/10/compiler-rt/X86-support-extension.patch b/nixpkgs/pkgs/development/compilers/llvm/10/compiler-rt/X86-support-extension.patch
deleted file mode 100644
index f6f9336ad5ad..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/10/compiler-rt/X86-support-extension.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-diff --git a/lib/builtins/CMakeLists.txt b/lib/builtins/CMakeLists.txt
-index 3a66dd9c3fb..7efc85d9f9f 100644
---- a/lib/builtins/CMakeLists.txt
-+++ b/lib/builtins/CMakeLists.txt
-@@ -301,6 +301,10 @@ if (NOT MSVC)
-     i386/umoddi3.S
-   )
- 
-+  set(i486_SOURCES ${i386_SOURCES})
-+  set(i586_SOURCES ${i386_SOURCES})
-+  set(i686_SOURCES ${i386_SOURCES})
-+
-   if (WIN32)
-     set(i386_SOURCES
-       ${i386_SOURCES}
-@@ -608,6 +612,7 @@ else ()
-   endif()
- 
-   foreach (arch ${BUILTIN_SUPPORTED_ARCH})
-+      message("arch: ${arch}")
-     if (CAN_TARGET_${arch})
-       # For ARM archs, exclude any VFP builtins if VFP is not supported
-       if (${arch} MATCHES "^(arm|armhf|armv7|armv7s|armv7k|armv7m|armv7em)$")
diff --git a/nixpkgs/pkgs/development/compilers/llvm/10/compiler-rt/armv7l.patch b/nixpkgs/pkgs/development/compilers/llvm/10/compiler-rt/armv7l.patch
deleted file mode 100644
index 120cfe6feb2a..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/10/compiler-rt/armv7l.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-diff -ur compiler-rt-10.0.0.src/cmake/builtin-config-ix.cmake compiler-rt-10.0.0.src-patched/cmake/builtin-config-ix.cmake
---- compiler-rt-10.0.0.src/cmake/builtin-config-ix.cmake	2020-03-24 00:01:02.000000000 +0900
-+++ compiler-rt-10.0.0.src-patched/cmake/builtin-config-ix.cmake	2020-05-10 03:42:00.883450706 +0900
-@@ -24,7 +24,7 @@
- 
- 
- set(ARM64 aarch64)
--set(ARM32 arm armhf armv6m armv7m armv7em armv7 armv7s armv7k)
-+set(ARM32 arm armhf armv6m armv7m armv7em armv7 armv7s armv7k armv7l)
- set(HEXAGON hexagon)
- set(X86 i386)
- set(X86_64 x86_64)
-diff -ur compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt compiler-rt-10.0.0.src-patched/lib/builtins/CMakeLists.txt
---- compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt	2020-03-24 00:01:02.000000000 +0900
-+++ compiler-rt-10.0.0.src-patched/lib/builtins/CMakeLists.txt	2020-05-10 03:44:49.468579650 +0900
-@@ -474,6 +474,7 @@
- set(armv7_SOURCES ${arm_SOURCES})
- set(armv7s_SOURCES ${arm_SOURCES})
- set(armv7k_SOURCES ${arm_SOURCES})
-+set(armv7l_SOURCES ${arm_SOURCES})
- set(arm64_SOURCES ${aarch64_SOURCES})
- 
- # macho_embedded archs
-@@ -595,7 +596,7 @@
-   foreach (arch ${BUILTIN_SUPPORTED_ARCH})
-     if (CAN_TARGET_${arch})
-       # For ARM archs, exclude any VFP builtins if VFP is not supported
--      if (${arch} MATCHES "^(arm|armhf|armv7|armv7s|armv7k|armv7m|armv7em)$")
-+      if (${arch} MATCHES "^(arm|armhf|armv7|armv7s|armv7k|armv7l|armv7m|armv7em)$")
-         string(REPLACE ";" " " _TARGET_${arch}_CFLAGS "${TARGET_${arch}_CFLAGS}")
-         check_compile_definition(__VFP_FP__ "${CMAKE_C_FLAGS} ${_TARGET_${arch}_CFLAGS}" COMPILER_RT_HAS_${arch}_VFP)
-         if(NOT COMPILER_RT_HAS_${arch}_VFP)
diff --git a/nixpkgs/pkgs/development/compilers/llvm/10/compiler-rt/default.nix b/nixpkgs/pkgs/development/compilers/llvm/10/compiler-rt/default.nix
deleted file mode 100644
index 3702509d7756..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/10/compiler-rt/default.nix
+++ /dev/null
@@ -1,131 +0,0 @@
-{ lib, stdenv, llvm_meta, version, fetch, cmake, python3, libllvm, libcxxabi, libxcrypt
-, doFakeLibgcc ? stdenv.hostPlatform.isFreeBSD
-}:
-
-let
-
-  useLLVM = stdenv.hostPlatform.useLLVM or false;
-  bareMetal = stdenv.hostPlatform.parsed.kernel.name == "none";
-  haveLibc = stdenv.cc.libc != null;
-  inherit (stdenv.hostPlatform) isMusl;
-
-in
-
-stdenv.mkDerivation {
-  pname = "compiler-rt" + lib.optionalString (haveLibc) "-libc";
-  inherit version;
-  src = fetch "compiler-rt" "1yjqjri753w0fzmxcyz687nvd97sbc9rsqrxzpq720na47hwh3fr";
-
-  nativeBuildInputs = [ cmake python3 libllvm.dev ];
-  buildInputs = lib.optional stdenv.hostPlatform.isDarwin libcxxabi;
-
-  env.NIX_CFLAGS_COMPILE = toString [
-    "-DSCUDO_DEFAULT_OPTIONS=DeleteSizeMismatch=0:DeallocationTypeMismatch=0"
-  ];
-
-  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.isGnu) [
-    "-DSANITIZER_COMMON_CFLAGS=-I${libxcrypt}/include"
-  ] ++ lib.optionals (useLLVM || bareMetal || isMusl) [
-    "-DCOMPILER_RT_BUILD_SANITIZERS=OFF"
-    "-DCOMPILER_RT_BUILD_XRAY=OFF"
-    "-DCOMPILER_RT_BUILD_LIBFUZZER=OFF"
-  ] ++ lib.optionals (useLLVM || bareMetal) [
-    "-DCOMPILER_RT_BUILD_PROFILE=OFF"
-  ] ++ lib.optionals ((useLLVM || bareMetal) && !haveLibc) [
-    "-DCMAKE_C_COMPILER_WORKS=ON"
-    "-DCMAKE_CXX_COMPILER_WORKS=ON"
-    "-DCOMPILER_RT_BAREMETAL_BUILD=ON"
-    "-DCMAKE_SIZEOF_VOID_P=${toString (stdenv.hostPlatform.parsed.cpu.bits / 8)}"
-  ] ++ 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) [
-    "-DDARWIN_macosx_OVERRIDE_SDK_VERSION=ON"
-    "-DDARWIN_osx_ARCHS=${stdenv.hostPlatform.darwinArch}"
-    "-DDARWIN_osx_BUILTIN_ARCHS=${stdenv.hostPlatform.darwinArch}"
-  ];
-
-  outputs = [ "out" "dev" ];
-
-  patches = [
-    ../../common/compiler-rt/7-12-codesign.patch # Revert compiler-rt commit that makes codesign mandatory
-    ./find-darwin-sdk-version.patch # don't test for macOS being >= 10.15
-    ./gnu-install-dirs.patch
-    ../../common/compiler-rt/libsanitizer-no-cyclades-11.patch
-    ./X86-support-extension.patch # backported from LLVM 11
-    # Fix build on armv6l
-    ../../common/compiler-rt/armv6-mcr-dmb.patch
-    ../../common/compiler-rt/armv6-sync-ops-no-thumb.patch
-    ../../common/compiler-rt/armv6-no-ldrexd-strexd.patch
-  ] ++ lib.optional stdenv.hostPlatform.isAarch32 ./armv7l.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)'
-    substituteInPlace cmake/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) ''
-    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.c \
-      --replace "#include <assert.h>" ""
-  '';
-
-  preConfigure = lib.optionalString (useLLVM && !haveLibc) ''
-    cmakeFlagsArray+=(-DCMAKE_C_FLAGS="-nodefaultlibs -ffreestanding")
-  '';
-
-  # Hack around weird upsream RPATH bug
-  postInstall = lib.optionalString (stdenv.hostPlatform.isDarwin || stdenv.hostPlatform.isWasm) ''
-    ln -s "$out/lib"/*/* "$out/lib"
-  '' + lib.optionalString (useLLVM) ''
-    ln -s $out/lib/*/clang_rt.crtbegin-*.o $out/lib/crtbegin.o
-    ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/crtend.o
-    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
-  ''
-  # See https://reviews.llvm.org/D37278 for why android exception
-  + lib.optionalString (stdenv.hostPlatform.isx86_32 && !stdenv.hostPlatform.isAndroid) ''
-    for f in $out/lib/*/*builtins-i?86*; do
-      ln -s "$f" $(echo "$f" | sed -e 's/builtins-i.86/builtins-i386/')
-    done
-  '' + 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 ];
-    broken = stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64;
-  };
-}
diff --git a/nixpkgs/pkgs/development/compilers/llvm/10/compiler-rt/find-darwin-sdk-version.patch b/nixpkgs/pkgs/development/compilers/llvm/10/compiler-rt/find-darwin-sdk-version.patch
deleted file mode 100644
index fc16ddda76b7..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/10/compiler-rt/find-darwin-sdk-version.patch
+++ /dev/null
@@ -1,62 +0,0 @@
---- a/cmake/Modules/CompilerRTDarwinUtils.cmake	2020-01-25 23:13:55.000000000 +0100
-+++ b/cmake/Modules/CompilerRTDarwinUtils.cmake	2020-01-25 23:19:37.000000000 +0100
-@@ -43,41 +43,6 @@
-   set(DARWIN_${sdk_name}_CACHED_SYSROOT ${var_internal} CACHE STRING "Darwin SDK path for SDK ${sdk_name}." FORCE)
- endfunction()
- 
--function(find_darwin_sdk_version var sdk_name)
--  # We deliberately don't cache the result here because
--  # CMake's caching causes too many problems.
--  set(result_process 1)
--  if(NOT DARWIN_PREFER_PUBLIC_SDK)
--    # Let's first try the internal SDK, otherwise use the public SDK.
--    execute_process(
--      COMMAND xcrun --sdk ${sdk_name}.internal --show-sdk-version
--      RESULT_VARIABLE result_process
--      OUTPUT_VARIABLE var_internal
--      OUTPUT_STRIP_TRAILING_WHITESPACE
--      ERROR_FILE /dev/null
--    )
--  endif()
--  if((NOT ${result_process} EQUAL 0) OR "" STREQUAL "${var_internal}")
--    execute_process(
--      COMMAND xcrun --sdk ${sdk_name} --show-sdk-version
--      RESULT_VARIABLE result_process
--      OUTPUT_VARIABLE var_internal
--      OUTPUT_STRIP_TRAILING_WHITESPACE
--      ERROR_FILE /dev/null
--    )
--  endif()
--  if(NOT result_process EQUAL 0)
--    message(FATAL_ERROR
--      "Failed to determine SDK version for \"${sdk_name}\" SDK")
--  endif()
--  # Check reported version looks sane.
--  if (NOT "${var_internal}" MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+)?$")
--    message(FATAL_ERROR
--      "Reported SDK version \"${var_internal}\" does not look like a version")
--  endif()
--  set(${var} ${var_internal} PARENT_SCOPE)
--endfunction()
--
- # There isn't a clear mapping of what architectures are supported with a given
- # target platform, but ld's version output does list the architectures it can
- # link for.
-@@ -119,17 +84,6 @@
-     foreach(flag ${DARWIN_${os}_LINK_FLAGS})
-       set(os_linker_flags "${os_linker_flags} ${flag}")
-     endforeach()
--
--    # Disable building for i386 for macOS SDK >= 10.15. The SDK doesn't support
--    # linking for i386 and the corresponding OS doesn't allow running macOS i386
--    # binaries.
--    if ("${os}" STREQUAL "osx")
--      find_darwin_sdk_version(macosx_sdk_version "macosx")
--      if ("${macosx_sdk_version}" VERSION_GREATER 10.15 OR "${macosx_sdk_version}" VERSION_EQUAL 10.15)
--        message(STATUS "Disabling i386 slice for ${valid_archs}")
--        list(REMOVE_ITEM archs "i386")
--      endif()
--    endif()
-   endif()
- 
-   # The simple program will build for x86_64h on the simulator because it is 
diff --git a/nixpkgs/pkgs/development/compilers/llvm/10/compiler-rt/gnu-install-dirs.patch b/nixpkgs/pkgs/development/compilers/llvm/10/compiler-rt/gnu-install-dirs.patch
deleted file mode 100644
index db0bd006eaf2..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/10/compiler-rt/gnu-install-dirs.patch
+++ /dev/null
@@ -1,129 +0,0 @@
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 8d768a404f21..74551dc5a004 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -12,6 +12,7 @@ endif()
- # Check if compiler-rt is built as a standalone project.
- if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR COMPILER_RT_STANDALONE_BUILD)
-   project(CompilerRT C CXX ASM)
-+  include(GNUInstallDirs)
-   set(COMPILER_RT_STANDALONE_BUILD TRUE)
-   set_property(GLOBAL PROPERTY USE_FOLDERS ON)
- endif()
-diff --git a/cmake/Modules/AddCompilerRT.cmake b/cmake/Modules/AddCompilerRT.cmake
-index 35a48c6af29c..e4300f256091 100644
---- a/cmake/Modules/AddCompilerRT.cmake
-+++ b/cmake/Modules/AddCompilerRT.cmake
-@@ -493,7 +493,7 @@ macro(add_compiler_rt_resource_file target_name file_name component)
-   add_custom_target(${target_name} DEPENDS ${dst_file})
-   # Install in Clang resource directory.
-   install(FILES ${file_name}
--    DESTINATION ${COMPILER_RT_INSTALL_PATH}/share
-+    DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_DATADIR}
-     COMPONENT ${component})
-   add_dependencies(${component} ${target_name})
- 
-@@ -510,7 +510,7 @@ macro(add_compiler_rt_script name)
-   add_custom_target(${name} DEPENDS ${dst})
-   install(FILES ${dst}
-     PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
--    DESTINATION ${COMPILER_RT_INSTALL_PATH}/bin)
-+    DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_BINDIR})
- endmacro(add_compiler_rt_script src name)
- 
- # Builds custom version of libc++ and installs it in <prefix>.
-diff --git a/cmake/Modules/CompilerRTDarwinUtils.cmake b/cmake/Modules/CompilerRTDarwinUtils.cmake
-index 9f501a61c4b6..f9a0d92dbca0 100644
---- a/cmake/Modules/CompilerRTDarwinUtils.cmake
-+++ b/cmake/Modules/CompilerRTDarwinUtils.cmake
-@@ -440,7 +440,7 @@ macro(darwin_add_embedded_builtin_libraries)
-     set(DARWIN_macho_embedded_LIBRARY_OUTPUT_DIR
-       ${COMPILER_RT_OUTPUT_DIR}/lib/macho_embedded)
-     set(DARWIN_macho_embedded_LIBRARY_INSTALL_DIR
--      ${COMPILER_RT_INSTALL_PATH}/lib/macho_embedded)
-+      ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_LIBDIR}/macho_embedded)
-       
-     set(CFLAGS_armv7 "-target thumbv7-apple-darwin-eabi")
-     set(CFLAGS_i386 "-march=pentium")
-diff --git a/cmake/Modules/CompilerRTUtils.cmake b/cmake/Modules/CompilerRTUtils.cmake
-index 6e672b1e1818..64999709958e 100644
---- a/cmake/Modules/CompilerRTUtils.cmake
-+++ b/cmake/Modules/CompilerRTUtils.cmake
-@@ -371,7 +371,7 @@ endfunction()
- function(get_compiler_rt_install_dir arch install_dir)
-   if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
-     get_compiler_rt_target(${arch} target)
--    set(${install_dir} ${COMPILER_RT_INSTALL_PATH}/lib/${target} PARENT_SCOPE)
-+    set(${install_dir} ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_LIBDIR}/${target} PARENT_SCOPE)
-   else()
-     set(${install_dir} ${COMPILER_RT_LIBRARY_INSTALL_DIR} PARENT_SCOPE)
-   endif()
-diff --git a/cmake/base-config-ix.cmake b/cmake/base-config-ix.cmake
-index b4b87aa53073..f1ae8668837c 100644
---- a/cmake/base-config-ix.cmake
-+++ b/cmake/base-config-ix.cmake
-@@ -65,11 +65,11 @@ if (LLVM_TREE_AVAILABLE)
- else()
-     # Take output dir and install path from the user.
-   set(COMPILER_RT_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE PATH
--    "Path where built compiler-rt libraries should be stored.")
-+    "Path where built compiler-rt build artifacts should be stored.")
-   set(COMPILER_RT_EXEC_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/bin CACHE PATH
-     "Path where built compiler-rt executables should be stored.")
--  set(COMPILER_RT_INSTALL_PATH ${CMAKE_INSTALL_PREFIX} CACHE PATH
--    "Path where built compiler-rt libraries should be installed.")
-+  set(COMPILER_RT_INSTALL_PATH "" CACHE PATH
-+    "Prefix where built compiler-rt artifacts should be installed, comes before CMAKE_INSTALL_PREFIX.")
-   option(COMPILER_RT_INCLUDE_TESTS "Generate and build compiler-rt unit tests." OFF)
-   option(COMPILER_RT_ENABLE_WERROR "Fail and stop if warning is triggered" OFF)
-   # Use a host compiler to compile/link tests.
-@@ -97,7 +97,7 @@ else(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR)
-   set(COMPILER_RT_LIBRARY_OUTPUT_DIR
-     ${COMPILER_RT_OUTPUT_DIR}/lib/${COMPILER_RT_OS_DIR})
-   set(COMPILER_RT_LIBRARY_INSTALL_DIR
--    ${COMPILER_RT_INSTALL_PATH}/lib/${COMPILER_RT_OS_DIR})
-+    ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_LIBDIR}/${COMPILER_RT_OS_DIR})
- endif()
- 
- if(APPLE)
-diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
-index d47d7baeb118..507c8e5c713e 100644
---- a/include/CMakeLists.txt
-+++ b/include/CMakeLists.txt
-@@ -62,22 +62,22 @@ set_target_properties(compiler-rt-headers PROPERTIES FOLDER "Compiler-RT Misc")
- install(FILES ${SANITIZER_HEADERS}
-   COMPONENT compiler-rt-headers
-   PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
--  DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/sanitizer)
-+  DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_INCLUDEDIR}/sanitizer)
- # Install fuzzer headers.
- install(FILES ${FUZZER_HEADERS}
-   COMPONENT compiler-rt-headers
-   PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
--  DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/fuzzer)
-+  DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_INCLUDEDIR}/fuzzer)
- # Install xray headers.
- install(FILES ${XRAY_HEADERS}
-   COMPONENT compiler-rt-headers
-   PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
--  DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/xray)
-+  DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_INCLUDEDIR}/xray)
- # Install profile headers.
- install(FILES ${PROFILE_HEADERS}
-   COMPONENT compiler-rt-headers
-   PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
--  DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/profile)
-+  DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_INCLUDEDIR}/profile)
- 
- if (NOT CMAKE_CONFIGURATION_TYPES) # don't add this for IDEs.
-   add_custom_target(install-compiler-rt-headers
-diff --git a/lib/dfsan/CMakeLists.txt b/lib/dfsan/CMakeLists.txt
-index 051215edbeb7..ecce1f52efb0 100644
---- a/lib/dfsan/CMakeLists.txt
-+++ b/lib/dfsan/CMakeLists.txt
-@@ -56,4 +56,4 @@ add_custom_command(OUTPUT ${dfsan_abilist_filename}
-                    DEPENDS done_abilist.txt libc_ubuntu1404_abilist.txt)
- add_dependencies(dfsan dfsan_abilist)
- install(FILES ${dfsan_abilist_filename}
--        DESTINATION ${COMPILER_RT_INSTALL_PATH}/share)
-+        DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_DATADIR})
diff --git a/nixpkgs/pkgs/development/compilers/llvm/10/default.nix b/nixpkgs/pkgs/development/compilers/llvm/10/default.nix
deleted file mode 100644
index bc72be0ce7a1..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/10/default.nix
+++ /dev/null
@@ -1,269 +0,0 @@
-{ lowPrio, newScope, pkgs, lib, stdenv, cmake
-, preLibcCrossHeaders
-, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith
-, buildLlvmTools # tools, but from the previous stage, for cross
-, targetLlvmLibraries # libraries, but from the next stage, for cross
-, targetLlvm
-# This is the default binutils, but with *this* version of LLD rather
-# than the default LLVM version's, if LLD is the choice. We use these for
-# the `useLLVM` bootstrapping below.
-, bootBintoolsNoLibc ?
-    if stdenv.targetPlatform.linker == "lld"
-    then null
-    else pkgs.bintoolsNoLibc
-, bootBintools ?
-    if stdenv.targetPlatform.linker == "lld"
-    then null
-    else pkgs.bintools
-}:
-
-let
-  release_version = "10.0.1";
-  version = release_version; # differentiating these (variables) is important for RCs
-
-  fetch = name: sha256: fetchurl {
-    url = "https://github.com/llvm/llvm-project/releases/download/llvmorg-${release_version}/${name}-${version}.src.tar.xz";
-    inherit sha256;
-  };
-
-  clang-tools-extra_src = fetch "clang-tools-extra" "06n1yp638rh24xdxv9v2df0qajxbjz4w59b7dd4ky36drwmpi4yh";
-
-  inherit (import ../common/common-let.nix { inherit lib release_version; }) llvm_meta;
-
-  tools = lib.makeExtensible (tools: let
-    callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch buildLlvmTools; });
-    mkExtraBuildCommands0 = cc: ''
-      rsrc="$out/resource-root"
-      mkdir "$rsrc"
-      ln -s "${cc.lib}/lib/clang/${release_version}/include" "$rsrc"
-      echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
-    '';
-    mkExtraBuildCommands = cc: mkExtraBuildCommands0 cc + ''
-      ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib"
-      ln -s "${targetLlvmLibraries.compiler-rt.out}/share" "$rsrc/share"
-    '';
-
-  bintoolsNoLibc' =
-    if bootBintoolsNoLibc == null
-    then tools.bintoolsNoLibc
-    else bootBintoolsNoLibc;
-  bintools' =
-    if bootBintools == null
-    then tools.bintools
-    else bootBintools;
-
-  in {
-
-    libllvm = callPackage ./llvm {
-      inherit llvm_meta;
-    };
-
-    # `llvm` historically had the binaries.  When choosing an output explicitly,
-    # we need to reintroduce `outputSpecified` to get the expected behavior e.g. of lib.get*
-    llvm = tools.libllvm;
-
-    libclang = callPackage ./clang {
-      inherit clang-tools-extra_src llvm_meta;
-    };
-
-    clang-unwrapped = tools.libclang;
-
-    # disabled until recommonmark supports sphinx 3
-    #Llvm-manpages = lowPrio (tools.libllvm.override {
-    #  enableManpages = true;
-    #  python3 = pkgs.python3;  # don't use python-boot
-    #});
-
-    clang-manpages = lowPrio (tools.libclang.override {
-      enableManpages = true;
-      python3 = pkgs.python3;  # don't use python-boot
-    });
-
-    # disabled until recommonmark supports sphinx 3
-    # lldb-manpages = lowPrio (tools.lldb.override {
-    #   enableManpages = true;
-    #   python3 = pkgs.python3;  # don't use python-boot
-    # });
-
-    # pick clang appropriate for package set we are targeting
-    clang =
-      /**/ if stdenv.targetPlatform.libc == null then tools.clangNoLibc
-      else if stdenv.targetPlatform.useLLVM or false then tools.clangUseLLVM
-      else if (pkgs.targetPackages.stdenv or stdenv).cc.isGNU then tools.libstdcxxClang
-      else tools.libcxxClang;
-
-    libstdcxxClang = wrapCCWith rec {
-      cc = tools.clang-unwrapped;
-      # libstdcxx is taken from gcc in an ad-hoc way in cc-wrapper.
-      libcxx = null;
-      extraPackages = [
-        targetLlvmLibraries.compiler-rt
-      ];
-      extraBuildCommands = mkExtraBuildCommands cc;
-    };
-
-    libcxxClang = wrapCCWith rec {
-      cc = tools.clang-unwrapped;
-      libcxx = targetLlvmLibraries.libcxx;
-      extraPackages = [
-        libcxx.cxxabi
-        targetLlvmLibraries.compiler-rt
-      ];
-      extraBuildCommands = mkExtraBuildCommands cc;
-    };
-
-    lld = callPackage ./lld {
-      inherit llvm_meta;
-    };
-
-    lldb = callPackage ../common/lldb.nix {
-      src = fetch "lldb" "051p5b04y6z3g730rmc2n2v71lipbw7k69riww3a6sl74myfiaq7";
-      patches = [
-        ./lldb/procfs.patch
-        ./lldb/gnu-install-dirs.patch
-      ];
-      inherit llvm_meta;
-    };
-
-    # Below, is the LLVM bootstrapping logic. It handles building a
-    # fully LLVM toolchain from scratch. No GCC toolchain should be
-    # pulled in. As a consequence, it is very quick to build different
-    # targets provided by LLVM and we can also build for what GCC
-    # doesn’t support like LLVM. Probably we should move to some other
-    # file.
-
-    bintools-unwrapped = callPackage ../common/bintools.nix { };
-
-    bintoolsNoLibc = wrapBintoolsWith {
-      bintools = tools.bintools-unwrapped;
-      libc = preLibcCrossHeaders;
-    };
-
-    bintools = wrapBintoolsWith {
-      bintools = tools.bintools-unwrapped;
-    };
-
-    clangUseLLVM = wrapCCWith rec {
-      cc = tools.clang-unwrapped;
-      libcxx = targetLlvmLibraries.libcxx;
-      bintools = bintools';
-      extraPackages = [
-        libcxx.cxxabi
-        targetLlvmLibraries.compiler-rt
-      ] ++ lib.optionals (!stdenv.targetPlatform.isWasm) [
-        targetLlvmLibraries.libunwind
-      ];
-      extraBuildCommands = ''
-        echo "-rtlib=compiler-rt -Wno-unused-command-line-argument" >> $out/nix-support/cc-cflags
-        echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
-      '' + lib.optionalString (!stdenv.targetPlatform.isWasm) ''
-        echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags
-      '' + lib.optionalString (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false) ''
-        echo "-lunwind" >> $out/nix-support/cc-ldflags
-      '' + lib.optionalString stdenv.targetPlatform.isWasm ''
-        echo "-fno-exceptions" >> $out/nix-support/cc-cflags
-      '' + mkExtraBuildCommands cc;
-    };
-
-    clangNoLibcxx = wrapCCWith rec {
-      cc = tools.clang-unwrapped;
-      libcxx = null;
-      bintools = bintools';
-      extraPackages = [
-        targetLlvmLibraries.compiler-rt
-      ];
-      extraBuildCommands = ''
-        echo "-rtlib=compiler-rt" >> $out/nix-support/cc-cflags
-        echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
-        echo "-nostdlib++" >> $out/nix-support/cc-cflags
-      '' + mkExtraBuildCommands cc;
-    };
-
-    clangNoLibc = wrapCCWith rec {
-      cc = tools.clang-unwrapped;
-      libcxx = null;
-      bintools = bintoolsNoLibc';
-      extraPackages = [
-        targetLlvmLibraries.compiler-rt
-      ];
-      extraBuildCommands = ''
-        echo "-rtlib=compiler-rt" >> $out/nix-support/cc-cflags
-        echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
-      '' + mkExtraBuildCommands cc;
-    };
-
-    clangNoCompilerRt = wrapCCWith rec {
-      cc = tools.clang-unwrapped;
-      libcxx = null;
-      bintools = bintoolsNoLibc';
-      extraPackages = [ ];
-      extraBuildCommands = ''
-        echo "-nostartfiles" >> $out/nix-support/cc-cflags
-      '' + mkExtraBuildCommands0 cc;
-    };
-
-    clangNoCompilerRtWithLibc = wrapCCWith rec {
-      cc = tools.clang-unwrapped;
-      libcxx = null;
-      bintools = bintools';
-      extraPackages = [ ];
-      extraBuildCommands = mkExtraBuildCommands0 cc;
-    };
-
-  });
-
-  libraries = lib.makeExtensible (libraries: let
-    callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; });
-  in {
-
-    compiler-rt-libc = callPackage ./compiler-rt {
-      inherit llvm_meta;
-      stdenv = if stdenv.hostPlatform.useLLVM or false
-               then overrideCC stdenv buildLlvmTools.clangNoCompilerRtWithLibc
-               else stdenv;
-    };
-
-    compiler-rt-no-libc = callPackage ./compiler-rt {
-      inherit llvm_meta;
-      stdenv = if stdenv.hostPlatform.useLLVM or false
-               then overrideCC stdenv buildLlvmTools.clangNoCompilerRt
-               else stdenv;
-    };
-
-    # N.B. condition is safe because without useLLVM both are the same.
-    compiler-rt = if stdenv.hostPlatform.isAndroid
-      then libraries.compiler-rt-libc
-      else libraries.compiler-rt-no-libc;
-
-    stdenv = overrideCC stdenv buildLlvmTools.clang;
-
-    libcxxStdenv = overrideCC stdenv buildLlvmTools.libcxxClang;
-
-    libcxx = callPackage ./libcxx {
-      inherit llvm_meta;
-      stdenv = if stdenv.hostPlatform.useLLVM or false
-               then overrideCC stdenv buildLlvmTools.clangNoLibcxx
-               else stdenv;
-    };
-
-    libcxxabi = callPackage ./libcxxabi {
-      inherit llvm_meta;
-      stdenv = if stdenv.hostPlatform.useLLVM or false
-               then overrideCC stdenv buildLlvmTools.clangNoLibcxx
-               else stdenv;
-    };
-
-    libunwind = callPackage ./libunwind {
-      inherit llvm_meta;
-      stdenv = if stdenv.hostPlatform.useLLVM or false
-               then overrideCC stdenv buildLlvmTools.clangNoLibcxx
-               else stdenv;
-    };
-
-    openmp = callPackage ./openmp {
-      inherit llvm_meta targetLlvm;
-    };
-  });
-  noExtend = extensible: lib.attrsets.removeAttrs extensible [ "extend" ];
-
-in { inherit tools libraries release_version; } // (noExtend libraries) // (noExtend tools)
diff --git a/nixpkgs/pkgs/development/compilers/llvm/10/libcxx/default.nix b/nixpkgs/pkgs/development/compilers/llvm/10/libcxx/default.nix
deleted file mode 100644
index cc029ea657cd..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/10/libcxx/default.nix
+++ /dev/null
@@ -1,88 +0,0 @@
-{ lib, stdenv, llvm_meta, fetch, cmake, python3, fixDarwinDylibNames, version
-, cxxabi ? if stdenv.hostPlatform.isFreeBSD then libcxxrt else libcxxabi
-, libcxxabi, libcxxrt
-, enableShared ? !stdenv.hostPlatform.isStatic
-}:
-
-assert stdenv.isDarwin -> cxxabi.pname == "libcxxabi";
-
-stdenv.mkDerivation {
-  pname = "libcxx";
-  inherit version;
-
-  src = fetch "libcxx" "0v78bfr6h2zifvdqnj2wlfk4pvxzrqn3hg1v6lqk3y12bx9p9xny";
-
-  postUnpack = ''
-    unpackFile ${libcxxabi.src}
-    export LIBCXXABI_INCLUDE_DIR="$PWD/$(ls -d libcxxabi-${version}*)/include"
-  '';
-
-  outputs = [ "out" "dev" ];
-
-  patches = [
-    ./gnu-install-dirs.patch
-  ] ++ lib.optionals stdenv.hostPlatform.isMusl [
-    ../../libcxx-0001-musl-hacks.patch
-  ];
-
-  # Prevent errors like "error: 'foo' is unavailable: introduced in macOS yy.zz"
-  postPatch = ''
-    substituteInPlace include/__config \
-      --replace "#    define _LIBCPP_USE_AVAILABILITY_APPLE" ""
-  '';
-
-  preConfigure = ''
-    # Get headers from the cxxabi source so we can see private headers not installed by the cxxabi package
-    cmakeFlagsArray=($cmakeFlagsArray -DLIBCXX_CXX_ABI_INCLUDE_PATHS="$LIBCXXABI_INCLUDE_DIR")
-  '' + lib.optionalString stdenv.hostPlatform.isMusl ''
-    patchShebangs utils/cat_files.py
-  '';
-  nativeBuildInputs = [ cmake ]
-    ++ lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) python3
-    ++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
-
-  buildInputs = [ cxxabi ];
-
-  cmakeFlags = [
-    "-DLIBCXX_LIBCPPABI_VERSION=2"
-    "-DLIBCXX_CXX_ABI=${cxxabi.pname}"
-  ] ++ lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) "-DLIBCXX_HAS_MUSL_LIBC=1"
-    ++ lib.optional (cxxabi.pname == "libcxxabi") "-DLIBCXX_LIBCXXABI_LIB_PATH=${cxxabi}/lib"
-    ++ lib.optional (stdenv.hostPlatform.useLLVM or false) "-DLIBCXX_USE_COMPILER_RT=ON"
-    ++ lib.optionals stdenv.hostPlatform.isWasm [
-      "-DLIBCXX_ENABLE_THREADS=OFF"
-      "-DLIBCXX_ENABLE_FILESYSTEM=OFF"
-      "-DLIBCXX_ENABLE_EXCEPTIONS=OFF"
-    ] ++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF";
-
-  preInstall = lib.optionalString (stdenv.isDarwin) ''
-    for file in lib/*.dylib; do
-      if [ -L "$file" ]; then continue; fi
-
-      baseName=$(basename $(${stdenv.cc.targetPrefix}otool -D $file | tail -n 1))
-      installName="$out/lib/$baseName"
-      abiName=$(echo "$baseName" | sed -e 's/libc++/libc++abi/')
-
-      for other in $(${stdenv.cc.targetPrefix}otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
-        ${stdenv.cc.targetPrefix}install_name_tool -change $other ${cxxabi}/lib/$abiName $file
-      done
-    done
-  '';
-
-  passthru = {
-    isLLVM = true;
-    inherit cxxabi;
-  };
-
-  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/nixpkgs/pkgs/development/compilers/llvm/10/libcxx/gnu-install-dirs.patch b/nixpkgs/pkgs/development/compilers/llvm/10/libcxx/gnu-install-dirs.patch
deleted file mode 100644
index 4b031e90bdd5..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/10/libcxx/gnu-install-dirs.patch
+++ /dev/null
@@ -1,99 +0,0 @@
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 60564dc96c7b..77d832ad5a44 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -26,6 +26,8 @@ set(CMAKE_MODULE_PATH
- if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR LIBCXX_STANDALONE_BUILD)
-   project(libcxx CXX C)
- 
-+  include(GNUInstallDirs)
-+
-   set(PACKAGE_NAME libcxx)
-   set(PACKAGE_VERSION 10.0.1)
-   set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
-@@ -415,7 +417,7 @@ string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION
- if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
-   set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
-   set(LIBCXX_HEADER_DIR ${LLVM_BINARY_DIR})
--  set(LIBCXX_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
-+  set(LIBCXX_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
-   if(LIBCXX_LIBDIR_SUBDIR)
-     string(APPEND LIBCXX_LIBRARY_DIR /${LIBCXX_LIBDIR_SUBDIR})
-     string(APPEND LIBCXX_INSTALL_LIBRARY_DIR /${LIBCXX_LIBDIR_SUBDIR})
-@@ -423,10 +425,10 @@ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
- elseif(LLVM_LIBRARY_OUTPUT_INTDIR)
-   set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
-   set(LIBCXX_HEADER_DIR  ${LLVM_BINARY_DIR})
--  set(LIBCXX_INSTALL_LIBRARY_DIR lib${LIBCXX_LIBDIR_SUFFIX})
-+  set(LIBCXX_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXX_LIBDIR_SUFFIX})
- else()
-   set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX})
--  set(LIBCXX_INSTALL_LIBRARY_DIR lib${LIBCXX_LIBDIR_SUFFIX})
-+  set(LIBCXX_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXX_LIBDIR_SUFFIX})
- endif()
- 
- file(MAKE_DIRECTORY "${LIBCXX_BINARY_INCLUDE_DIR}")
-diff --git a/cmake/Modules/HandleLibCXXABI.cmake b/cmake/Modules/HandleLibCXXABI.cmake
-index 10f100f7f0fb..95ed3978ab73 100644
---- a/cmake/Modules/HandleLibCXXABI.cmake
-+++ b/cmake/Modules/HandleLibCXXABI.cmake
-@@ -61,7 +61,7 @@ macro(setup_abi_lib abidefines abishared abistatic abifiles abidirs)
- 
-         if (LIBCXX_INSTALL_HEADERS)
-           install(FILES "${LIBCXX_BINARY_INCLUDE_DIR}/${fpath}"
--            DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1/${dstdir}
-+            DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}${CMAKE_INSTALL_INCLUDEDIR}/c++/v1/${dstdir}
-             COMPONENT cxx-headers
-             PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
-             )
-diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
-index 302da8a131b4..4c6ab463f564 100644
---- a/include/CMakeLists.txt
-+++ b/include/CMakeLists.txt
-@@ -244,7 +244,7 @@ if (LIBCXX_INSTALL_HEADERS)
-   foreach(file ${files})
-     get_filename_component(dir ${file} DIRECTORY)
-     install(FILES ${file}
--      DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1/${dir}
-+      DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}${CMAKE_INSTALL_INCLUDEDIR}/c++/v1/${dir}
-       COMPONENT ${CXX_HEADER_TARGET}
-       PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
-     )
-@@ -253,7 +253,7 @@ if (LIBCXX_INSTALL_HEADERS)
-   if (LIBCXX_NEEDS_SITE_CONFIG)
-     # Install the generated header as __config.
-     install(FILES ${LIBCXX_BINARY_DIR}/__generated_config
--      DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1
-+      DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}${CMAKE_INSTALL_INCLUDEDIR}/c++/v1
-       PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
-       RENAME __config
-       COMPONENT ${CXX_HEADER_TARGET})
-diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
-index 120505fe18da..9b8456d8405a 100644
---- a/src/CMakeLists.txt
-+++ b/src/CMakeLists.txt
-@@ -341,21 +341,21 @@ if (LIBCXX_INSTALL_LIBRARY)
-     install(TARGETS cxx_shared
-       ARCHIVE DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
-       LIBRARY DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
--      RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}bin COMPONENT cxx)
-+      RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_BINDIR} COMPONENT cxx)
-   endif()
- 
-   if (LIBCXX_INSTALL_STATIC_LIBRARY)
-     install(TARGETS cxx_static
-       ARCHIVE DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
-       LIBRARY DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
--      RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}bin COMPONENT cxx)
-+      RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_BINDIR} COMPONENT cxx)
-   endif()
- 
-   if(LIBCXX_INSTALL_EXPERIMENTAL_LIBRARY)
-     install(TARGETS ${LIBCXX_INSTALL_TARGETS} ${experimental_lib}
-       LIBRARY DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
-       ARCHIVE DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
--      RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}bin COMPONENT cxx)
-+      RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_BINDIR} COMPONENT cxx)
-   endif()
- 
-   # NOTE: This install command must go after the cxx install command otherwise
diff --git a/nixpkgs/pkgs/development/compilers/llvm/10/libcxxabi/default.nix b/nixpkgs/pkgs/development/compilers/llvm/10/libcxxabi/default.nix
deleted file mode 100644
index c4eba56a6b81..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/10/libcxxabi/default.nix
+++ /dev/null
@@ -1,85 +0,0 @@
-{ lib, stdenv, llvm_meta, cmake, fetch, libcxx, libunwind, llvm, version
-, enableShared ? !stdenv.hostPlatform.isStatic
-}:
-
-stdenv.mkDerivation {
-  pname = "libcxxabi";
-  inherit version;
-
-  src = fetch "libcxxabi" "0yqs722y76cwvmfsq0lb917r9m3fci7bf5z3yzl71yz9n88ghzm9";
-
-  outputs = [ "out" "dev" ];
-
-  postUnpack = ''
-    unpackFile ${libcxx.src}
-    unpackFile ${llvm.src}
-    cmakeFlags+=" -DLLVM_PATH=$PWD/$(ls -d llvm-*) -DLIBCXXABI_LIBCXX_PATH=$PWD/$(ls -d libcxx-*)"
-  '' + lib.optionalString stdenv.isDarwin ''
-    export TRIPLE=x86_64-apple-darwin
-  '' + lib.optionalString stdenv.hostPlatform.isMusl ''
-    patch -p1 -d $(ls -d libcxx-*) -i ${../../libcxx-0001-musl-hacks.patch}
-  '' + lib.optionalString stdenv.hostPlatform.isWasm ''
-    patch -p1 -d $(ls -d llvm-*) -i ${../../common/libcxxabi/wasm.patch}
-  '';
-
-  patches = [
-    ../../common/libcxxabi/no-threads.patch
-    ./gnu-install-dirs.patch
-  ];
-
-  nativeBuildInputs = [ cmake ];
-  buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.hostPlatform.isWasm) libunwind;
-
-  cmakeFlags = lib.optionals (stdenv.hostPlatform.useLLVM or false) [
-    "-DLLVM_ENABLE_LIBCXX=ON"
-    "-DLIBCXXABI_USE_LLVM_UNWINDER=ON"
-  ] ++ lib.optionals stdenv.hostPlatform.isWasm [
-    "-DLIBCXXABI_ENABLE_THREADS=OFF"
-    "-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF"
-  ] ++ lib.optionals (!enableShared) [
-    "-DLIBCXXABI_ENABLE_SHARED=OFF"
-  ];
-
-  preInstall = lib.optionalString stdenv.isDarwin ''
-    for file in lib/*.dylib; do
-      if [ -L "$file" ]; then continue; fi
-
-      # Fix up the install name. Preserve the basename, just replace the path.
-      installName="$out/lib/$(basename $(${stdenv.cc.targetPrefix}otool -D $file | tail -n 1))"
-
-      # this should be done in CMake, but having trouble figuring out
-      # the magic combination of necessary CMake variables
-      # if you fancy a try, take a look at
-      # https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling
-      ${stdenv.cc.targetPrefix}install_name_tool -id $installName $file
-
-      # cc-wrapper passes '-lc++abi' to all c++ link steps, but that causes
-      # libcxxabi to sometimes link against a different version of itself.
-      # Here we simply make that second reference point to ourselves.
-      for other in $(${stdenv.cc.targetPrefix}otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
-        ${stdenv.cc.targetPrefix}install_name_tool -change $other $installName $file
-      done
-    done
-  '';
-
-  postInstall = ''
-    mkdir -p "$dev/include"
-    install -m 644 ../include/${if stdenv.isDarwin then "*" else "cxxabi.h"} "$dev/include"
-  '';
-
-  passthru = {
-    libName = "c++abi";
-  };
-
-  meta = llvm_meta // {
-    homepage = "https://libcxxabi.llvm.org/";
-    description = "Provides C++ standard library support";
-    longDescription = ''
-      libc++abi is a new implementation of low level support for a standard C++ library.
-    '';
-    # "All of the code in libc++abi is dual licensed under the MIT license and
-    # the UIUC License (a BSD-like license)":
-    license = with lib.licenses; [ mit ncsa ];
-    maintainers = llvm_meta.maintainers ++ [ lib.maintainers.vlstill ];
-  };
-}
diff --git a/nixpkgs/pkgs/development/compilers/llvm/10/libcxxabi/gnu-install-dirs.patch b/nixpkgs/pkgs/development/compilers/llvm/10/libcxxabi/gnu-install-dirs.patch
deleted file mode 100644
index 0f80ade7c389..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/10/libcxxabi/gnu-install-dirs.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 8f9572586b4a..bf0e41dfc751 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -20,6 +20,8 @@ set(CMAKE_MODULE_PATH
- if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR LIBCXXABI_STANDALONE_BUILD)
-   project(libcxxabi CXX C)
- 
-+  include(GNUInstallDirs)
-+
-   set(PACKAGE_NAME libcxxabi)
-   set(PACKAGE_VERSION 10.0.1)
-   set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
-@@ -214,17 +216,17 @@ string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION
- 
- if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
-   set(LIBCXXABI_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
--  set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
-+  set(LIBCXXABI_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
-   if(LIBCXX_LIBDIR_SUBDIR)
-     string(APPEND LIBCXXABI_LIBRARY_DIR /${LIBCXXABI_LIBDIR_SUBDIR})
-     string(APPEND LIBCXXABI_INSTALL_LIBRARY_DIR /${LIBCXXABI_LIBDIR_SUBDIR})
-   endif()
- elseif(LLVM_LIBRARY_OUTPUT_INTDIR)
-   set(LIBCXXABI_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
--  set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LIBCXXABI_LIBDIR_SUFFIX})
-+  set(LIBCXXABI_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXXABI_LIBDIR_SUFFIX})
- else()
-   set(LIBCXXABI_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXXABI_LIBDIR_SUFFIX})
--  set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LIBCXXABI_LIBDIR_SUFFIX})
-+  set(LIBCXXABI_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXXABI_LIBDIR_SUFFIX})
- endif()
- 
- set(LIBCXXABI_INSTALL_PREFIX "" CACHE STRING "Define libc++abi destination prefix.")
diff --git a/nixpkgs/pkgs/development/compilers/llvm/10/libunwind/default.nix b/nixpkgs/pkgs/development/compilers/llvm/10/libunwind/default.nix
deleted file mode 100644
index 2941dca35bf6..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/10/libunwind/default.nix
+++ /dev/null
@@ -1,31 +0,0 @@
-{ lib, stdenv, llvm_meta, version, fetch, cmake, enableShared ? !stdenv.hostPlatform.isStatic
-}:
-
-stdenv.mkDerivation rec {
-  pname = "libunwind";
-  inherit version;
-
-  src = fetch pname "09syx66idnm2pr46x2vmk0jn3iwdv0lkd04xy4zjbwmz3vn066bl";
-
-  patches = [
-    ./gnu-install-dirs.patch
-  ];
-
-  outputs = [ "out" "dev" ];
-
-  nativeBuildInputs = [ cmake ];
-
-  cmakeFlags = 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/nixpkgs/pkgs/development/compilers/llvm/10/libunwind/gnu-install-dirs.patch b/nixpkgs/pkgs/development/compilers/llvm/10/libunwind/gnu-install-dirs.patch
deleted file mode 100644
index 8cea7d3e3341..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/10/libunwind/gnu-install-dirs.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index c033069ef1d0..e2846896eece 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -18,6 +18,8 @@ set(CMAKE_MODULE_PATH
- if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR LIBUNWIND_STANDALONE_BUILD)
-   project(libunwind)
- 
-+  include(GNUInstallDirs)
-+
-   # Rely on llvm-config.
-   set(CONFIG_OUTPUT)
-   if(NOT LLVM_CONFIG_PATH)
-@@ -189,17 +191,17 @@ string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION
- 
- if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
-   set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
--  set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
-+  set(LIBUNWIND_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
-   if(LIBCXX_LIBDIR_SUBDIR)
-     string(APPEND LIBUNWIND_LIBRARY_DIR /${LIBUNWIND_LIBDIR_SUBDIR})
-     string(APPEND LIBUNWIND_INSTALL_LIBRARY_DIR /${LIBUNWIND_LIBDIR_SUBDIR})
-   endif()
- elseif(LLVM_LIBRARY_OUTPUT_INTDIR)
-   set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
--  set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LIBUNWIND_LIBDIR_SUFFIX})
-+  set(LIBUNWIND_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBUNWIND_LIBDIR_SUFFIX})
- else()
-   set(LIBUNWIND_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBUNWIND_LIBDIR_SUFFIX})
--  set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LIBUNWIND_LIBDIR_SUFFIX})
-+  set(LIBUNWIND_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBUNWIND_LIBDIR_SUFFIX})
- endif()
- 
- set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIBUNWIND_LIBRARY_DIR})
diff --git a/nixpkgs/pkgs/development/compilers/llvm/10/lld/default.nix b/nixpkgs/pkgs/development/compilers/llvm/10/lld/default.nix
deleted file mode 100644
index d4c686a0f4db..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/10/lld/default.nix
+++ /dev/null
@@ -1,46 +0,0 @@
-{ lib, stdenv, llvm_meta
-, buildLlvmTools
-, fetch
-, cmake
-, libxml2
-, libllvm
-, version
-}:
-
-stdenv.mkDerivation rec {
-  pname = "lld";
-  inherit version;
-
-  src = fetch pname "0ynzi35r4fckvp6842alpd43qr810j3728yfslc66fk2mbh4j52r";
-
-  patches = [
-    ./gnu-install-dirs.patch
-  ];
-
-  nativeBuildInputs = [ cmake ];
-  buildInputs = [ libllvm libxml2 ];
-
-  cmakeFlags = [
-    "-DLLVM_CONFIG_PATH=${libllvm.dev}/bin/llvm-config${lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "-native"}"
-  ] ++ 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/nixpkgs/pkgs/development/compilers/llvm/10/lld/gnu-install-dirs.patch b/nixpkgs/pkgs/development/compilers/llvm/10/lld/gnu-install-dirs.patch
deleted file mode 100644
index 232f5cbac9dd..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/10/lld/gnu-install-dirs.patch
+++ /dev/null
@@ -1,68 +0,0 @@
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 641f71c114ae..9d44c1463aff 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -6,6 +6,8 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
-   set(CMAKE_INCLUDE_CURRENT_DIR ON)
-   set(LLD_BUILT_STANDALONE TRUE)
- 
-+  include(GNUInstallDirs)
-+
-   find_program(LLVM_CONFIG_PATH "llvm-config" DOC "Path to llvm-config binary")
-   if(NOT LLVM_CONFIG_PATH)
-     message(FATAL_ERROR "llvm-config not found: specify LLVM_CONFIG_PATH")
-@@ -202,7 +204,7 @@ include_directories(BEFORE
- 
- if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
-   install(DIRECTORY include/
--    DESTINATION include
-+    DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
-     FILES_MATCHING
-     PATTERN "*.h"
-     PATTERN ".svn" EXCLUDE
-diff --git a/cmake/modules/AddLLD.cmake b/cmake/modules/AddLLD.cmake
-index fa48b428d26b..e7967aad3ceb 100644
---- a/cmake/modules/AddLLD.cmake
-+++ b/cmake/modules/AddLLD.cmake
-@@ -20,9 +20,9 @@ macro(add_lld_library name)
-     install(TARGETS ${name}
-       COMPONENT ${name}
-       ${export_to_lldtargets}
--      LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
--      ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
--      RUNTIME DESTINATION bin)
-+      LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
-+      ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
-+      RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
- 
-     if (${ARG_SHARED} AND NOT CMAKE_CONFIGURATION_TYPES)
-       add_llvm_install_targets(install-${name}
-@@ -54,7 +54,7 @@ macro(add_lld_tool name)
- 
-     install(TARGETS ${name}
-       ${export_to_lldtargets}
--      RUNTIME DESTINATION bin
-+      RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
-       COMPONENT ${name})
- 
-     if(NOT CMAKE_CONFIGURATION_TYPES)
-@@ -69,5 +69,5 @@ endmacro()
- macro(add_lld_symlink name dest)
-   add_llvm_tool_symlink(${name} ${dest} ALWAYS_GENERATE)
-   # Always generate install targets
--  llvm_install_symlink(${name} ${dest} ALWAYS_GENERATE)
-+  llvm_install_symlink(${name} ${dest} ${CMAKE_INSTALL_FULL_BINDIR} ALWAYS_GENERATE)
- endmacro()
-diff --git a/tools/lld/CMakeLists.txt b/tools/lld/CMakeLists.txt
-index a15e296e31df..654c2cfdb9c0 100644
---- a/tools/lld/CMakeLists.txt
-+++ b/tools/lld/CMakeLists.txt
-@@ -17,7 +17,7 @@ target_link_libraries(lld
-   )
- 
- install(TARGETS lld
--  RUNTIME DESTINATION bin)
-+  RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
- 
- if(NOT LLD_SYMLINKS_TO_CREATE)
-   set(LLD_SYMLINKS_TO_CREATE lld-link ld.lld ld64.lld wasm-ld)
diff --git a/nixpkgs/pkgs/development/compilers/llvm/10/lldb/gnu-install-dirs.patch b/nixpkgs/pkgs/development/compilers/llvm/10/lldb/gnu-install-dirs.patch
deleted file mode 100644
index 0a7539db5e6b..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/10/lldb/gnu-install-dirs.patch
+++ /dev/null
@@ -1,91 +0,0 @@
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 573b8556989e..a12cc6f6ba77 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -17,6 +17,8 @@ set(CMAKE_MODULE_PATH
- # If we are not building as part of LLVM, build LLDB as a standalone project,
- # using LLVM as an external library.
- if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
-+  include(GNUInstallDirs)
-+
-   project(lldb)
-   include(LLDBStandalone)
- 
-diff --git a/cmake/modules/AddLLDB.cmake b/cmake/modules/AddLLDB.cmake
-index ecf0b66a41a3..6f2d97af7a11 100644
---- a/cmake/modules/AddLLDB.cmake
-+++ b/cmake/modules/AddLLDB.cmake
-@@ -107,13 +107,13 @@ function(add_lldb_library name)
-   endif()
- 
-   if(PARAM_SHARED)
--    set(install_dest lib${LLVM_LIBDIR_SUFFIX})
-+    set(install_dest ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
-     if(PARAM_INSTALL_PREFIX)
-       set(install_dest ${PARAM_INSTALL_PREFIX})
-     endif()
-     # RUNTIME is relevant for DLL platforms, FRAMEWORK for macOS
-     install(TARGETS ${name} COMPONENT ${name}
--      RUNTIME DESTINATION bin
-+      RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
-       LIBRARY DESTINATION ${install_dest}
-       ARCHIVE DESTINATION ${install_dest}
-       FRAMEWORK DESTINATION ${install_dest})
-diff --git a/cmake/modules/LLDBConfig.cmake b/cmake/modules/LLDBConfig.cmake
-index 4a15a343ee1d..c74bbb6878d7 100644
---- a/cmake/modules/LLDBConfig.cmake
-+++ b/cmake/modules/LLDBConfig.cmake
-@@ -238,7 +238,7 @@ include_directories(BEFORE
- if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
-   install(DIRECTORY include/
-     COMPONENT lldb-headers
--    DESTINATION include
-+    DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
-     FILES_MATCHING
-     PATTERN "*.h"
-     PATTERN ".svn" EXCLUDE
-@@ -247,7 +247,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
- 
-   install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/
-     COMPONENT lldb-headers
--    DESTINATION include
-+    DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
-     FILES_MATCHING
-     PATTERN "*.h"
-     PATTERN ".svn" EXCLUDE
-diff --git a/tools/intel-features/CMakeLists.txt b/tools/intel-features/CMakeLists.txt
-index aff75d7db334..98a527c5e761 100644
---- a/tools/intel-features/CMakeLists.txt
-+++ b/tools/intel-features/CMakeLists.txt
-@@ -64,4 +64,4 @@ if (LLDB_ENABLE_PYTHON AND LLDB_BUILD_INTEL_PT)
- endif()
- 
- install(TARGETS lldbIntelFeatures
--  LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX})
-+  LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
-diff --git a/cmake/modules/LLDBStandalone.cmake b/cmake/modules/LLDBStandalone.cmake
-index 752113b..010f187 100644
---- a/cmake/modules/LLDBStandalone.cmake
-+++ b/cmake/modules/LLDBStandalone.cmake
-@@ -62,7 +62,7 @@ endif()
-
- # They are used as destination of target generators.
- set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
--set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
-+set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
- if(WIN32 OR CYGWIN)
-   # DLL platform -- put DLLs into bin.
-   set(LLVM_SHLIB_OUTPUT_INTDIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index bf74802..1c98cae 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -222,7 +222,7 @@ if (LLDB_ENABLE_PYTHON)
-   if(LLDB_BUILD_FRAMEWORK)
-     set(LLDB_PYTHON_INSTALL_PATH ${LLDB_FRAMEWORK_INSTALL_DIR}/LLDB.framework/Resources/Python)
-   else()
--    set(LLDB_PYTHON_INSTALL_PATH ${LLDB_PYTHON_RELATIVE_PATH})
-+    set(LLDB_PYTHON_INSTALL_PATH ${CMAKE_INSTALL_LIBDIR}/../${LLDB_PYTHON_RELATIVE_PATH})
-   endif()
-   if (NOT CMAKE_CFG_INTDIR STREQUAL  ".")
-     string(REPLACE ${CMAKE_CFG_INTDIR} "\$\{CMAKE_INSTALL_CONFIG_NAME\}" LLDB_PYTHON_INSTALL_PATH ${LLDB_PYTHON_INSTALL_PATH})
diff --git a/nixpkgs/pkgs/development/compilers/llvm/10/lldb/procfs.patch b/nixpkgs/pkgs/development/compilers/llvm/10/lldb/procfs.patch
deleted file mode 100644
index b075dbaeee0a..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/10/lldb/procfs.patch
+++ /dev/null
@@ -1,31 +0,0 @@
---- a/source/Plugins/Process/Linux/Procfs.h
-+++ b/source/Plugins/Process/Linux/Procfs.h
-@@ -11,21 +11,12 @@
- // sys/procfs.h on Android/Linux for all supported architectures.
- 
- #include <sys/ptrace.h>
-+#include <asm/ptrace.h>
- 
--#ifdef __ANDROID__
--#if defined(__arm64__) || defined(__aarch64__)
--typedef unsigned long elf_greg_t;
--typedef elf_greg_t
--    elf_gregset_t[(sizeof(struct user_pt_regs) / sizeof(elf_greg_t))];
--typedef struct user_fpsimd_state elf_fpregset_t;
--#ifndef NT_FPREGSET
--#define NT_FPREGSET NT_PRFPREG
--#endif // NT_FPREGSET
--#elif defined(__mips__)
--#ifndef NT_FPREGSET
--#define NT_FPREGSET NT_PRFPREG
--#endif // NT_FPREGSET
--#endif
--#else // __ANDROID__
-+#if !defined(__GLIBC__) && defined(__powerpc__)
-+#define pt_regs musl_pt_regs
-+#include <sys/procfs.h>
-+#undef pt_regs
-+#else
- #include <sys/procfs.h>
--#endif // __ANDROID__
-+#endif
diff --git a/nixpkgs/pkgs/development/compilers/llvm/10/llvm/default.nix b/nixpkgs/pkgs/development/compilers/llvm/10/llvm/default.nix
deleted file mode 100644
index c09ec676e9ea..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/10/llvm/default.nix
+++ /dev/null
@@ -1,355 +0,0 @@
-{ lib, stdenv, llvm_meta
-, pkgsBuildBuild
-, fetch
-, fetchpatch
-, cmake
-, python3
-, libffi
-, enableGoldPlugin ? libbfd.hasPluginAPI
-, libbfd
-, libpfm
-, libxml2
-, ncurses
-, version
-, release_version
-, zlib
-, buildLlvmTools
-, debugVersion ? false
-, doCheck ? stdenv.isLinux && (!stdenv.isx86_32)
-  && (stdenv.hostPlatform == stdenv.buildPlatform)
-, enableManpages ? false
-, enableSharedLibraries ? !stdenv.hostPlatform.isStatic
-# broken for Ampere eMAG 8180 (c2.large.arm on Packet) #56245
-# broken for the armv7l builder
-, enablePFM ? stdenv.isLinux && !stdenv.hostPlatform.isAarch
-, enablePolly ? true
-}:
-
-let
-  inherit (lib) optional optionals optionalString;
-
-  # Used when creating a version-suffixed symlink of libLLVM.dylib
-  shortVersion = with lib;
-    concatStringsSep "." (take 1 (splitString "." release_version));
-
-  # Ordinarily we would just the `doCheck` and `checkDeps` functionality
-  # `mkDerivation` gives us to manage our test dependencies (instead of breaking
-  # out `doCheck` as a package level attribute).
-  #
-  # Unfortunately `lit` does not forward `$PYTHONPATH` to children processes, in
-  # particular the children it uses to do feature detection.
-  #
-  # This means that python deps we add to `checkDeps` (which the python
-  # interpreter is made aware of via `$PYTHONPATH` – populated by the python
-  # setup hook) are not picked up by `lit` which causes it to skip tests.
-  #
-  # Adding `python3.withPackages (ps: [ ... ])` to `checkDeps` also doesn't work
-  # because this package is shadowed in `$PATH` by the regular `python3`
-  # package.
-  #
-  # So, we "manually" assemble one python derivation for the package to depend
-  # on, taking into account whether checks are enabled or not:
-  python = if doCheck then
-    let
-      checkDeps = ps: with ps; [ psutil ];
-    in python3.withPackages checkDeps
-  else python3;
-
-in stdenv.mkDerivation (rec {
-  pname = "llvm";
-  inherit version;
-
-  src = fetch pname "1wydhbp9kyjp5y0rc627imxgkgqiv3dfirbqil9dgpnbaw5y7n65";
-  polly_src = fetch "polly" "0nm2d8niz47yjsa3r17v3p13b70igkd338ib8191znr1dfw0pyyj";
-
-  unpackPhase = ''
-    unpackFile $src
-    mv llvm-${version}* llvm
-    sourceRoot=$PWD/llvm
-  '' + optionalString enablePolly ''
-    unpackFile $polly_src
-    mv polly-* $sourceRoot/tools/polly
-  '';
-
-  outputs = [ "out" "lib" "dev" "python" ];
-
-  nativeBuildInputs = [ cmake python ]
-    ++ optionals enableManpages [ python3.pkgs.sphinx python3.pkgs.recommonmark ];
-
-  buildInputs = [ libxml2 libffi ]
-    ++ optional enablePFM libpfm; # exegesis
-
-  propagatedBuildInputs = [ ncurses zlib ];
-
-  patches = [
-    # When cross-compiling we configure llvm-config-native with an approximation
-    # of the flags used for the normal LLVM build. To avoid the need for building
-    # a native libLLVM.so (which would fail) we force llvm-config to be linked
-    # statically against the necessary LLVM components always.
-    ../../llvm-config-link-static.patch
-
-    ./gnu-install-dirs.patch
-    # On older CPUs (e.g. Hydra/wendy) we'd be getting an error in this test.
-    (fetchpatch {
-      name = "uops-CMOV16rm-noreg.diff";
-      url = "https://github.com/llvm/llvm-project/commit/9e9f991ac033.diff";
-      sha256 = "sha256:12s8vr6ibri8b48h2z38f3afhwam10arfiqfy4yg37bmc054p5hi";
-      stripLen = 1;
-    })
-
-    # Fix missing includes for GCC 11
-    (fetchpatch {
-      name = "headers-gcc-11.patch";
-      url = "https://github.com/llvm/llvm-project/commit/b498303066a63a203d24f739b2d2e0e56dca70d1.patch";
-      sha256 = "0nh123kld0dgz2h941lng331dkj3wbm5lfxm375k1f569gv83hlk";
-      stripLen = 1;
-    })
-
-    # Fix invalid std::string(nullptr) for GCC 12
-    (fetchpatch {
-      name = "nvptx-gcc-12.patch";
-      url = "https://github.com/llvm/llvm-project/commit/99e64623ec9b31def9375753491cc6093c831809.patch";
-      sha256 = "0zjfjgavqzi2ypqwqnlvy6flyvdz8hi1anwv0ybwnm2zqixg7za3";
-      stripLen = 1;
-    })
-    (fetchpatch {
-      name = "dfaemitter-gcc-12.patch";
-      url = "https://github.com/llvm/llvm-project/commit/0841916e87a39e3c223c986e8da31e4a9a1432e3.patch";
-      sha256 = "1kckghvsngs51mqm82asy0s9vr19h8aqbw43a0w44mccqw6bzrwf";
-      stripLen = 1;
-    })
-
-    # Fix musl build.
-    (fetchpatch {
-      url = "https://github.com/llvm/llvm-project/commit/5cd554303ead0f8891eee3cd6d25cb07f5a7bf67.patch";
-      relative = "llvm";
-      hash = "sha256-XPbvNJ45SzjMGlNUgt/IgEvM2dHQpDOe6woUJY+nUYA=";
-    })
-
-    # Backport gcc-13 fixes with missing includes.
-    (fetchpatch {
-      name = "signals-gcc-13.patch";
-      url = "https://github.com/llvm/llvm-project/commit/ff1681ddb303223973653f7f5f3f3435b48a1983.patch";
-      hash = "sha256-CXwYxQezTq5vdmc8Yn88BUAEly6YZ5VEIA6X3y5NNOs=";
-      stripLen = 1;
-    })
-  ] ++ lib.optionals enablePolly [
-    ./gnu-install-dirs-polly.patch
-    # Add missing isl header includess required to build LLVM 10 + Polly with clang 16.
-    (fetchpatch {
-      name = "polly-ppcg-isl-headers.patch";
-      url = "https://repo.or.cz/ppcg.git/patch/098ba285306114dc71497f7b51c357f69c9b4472";
-      hash = "sha256-c9L30rDROYAMbUSuaK9U/ixyFMlH/Sa1n+VgLODzSCQ=";
-      extraPrefix = "tools/polly/lib/External/ppcg/";
-      stripLen = 1;
-    })
-  ];
-
-  postPatch = optionalString stdenv.isDarwin ''
-    substituteInPlace cmake/modules/AddLLVM.cmake \
-      --replace 'set(_install_name_dir INSTALL_NAME_DIR "@rpath")' "set(_install_name_dir)" \
-      --replace 'set(_install_rpath "@loader_path/../''${CMAKE_INSTALL_LIBDIR}''${LLVM_LIBDIR_SUFFIX}" ''${extra_libdir})' ""
-  '' + ''
-    # FileSystem permissions tests fail with various special bits
-    substituteInPlace unittests/Support/CMakeLists.txt \
-      --replace "Path.cpp" ""
-    rm unittests/Support/Path.cpp
-  '' + optionalString stdenv.hostPlatform.isMusl ''
-    patch -p1 -i ${../../TLI-musl.patch}
-    substituteInPlace unittests/Support/CMakeLists.txt \
-      --replace "add_subdirectory(DynamicLibrary)" ""
-    rm unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp
-    # valgrind unhappy with musl or glibc, but fails w/musl only
-    rm test/CodeGen/AArch64/wineh4.mir
-  '' + optionalString stdenv.hostPlatform.isAarch32 ''
-    # skip failing X86 test cases on 32-bit ARM
-    rm test/DebugInfo/X86/convert-debugloc.ll
-    rm test/DebugInfo/X86/convert-inlined.ll
-    rm test/DebugInfo/X86/convert-linked.ll
-    rm test/DebugInfo/X86/debug_addr.ll
-    rm test/tools/dsymutil/X86/op-convert.test
-  '' + optionalString (stdenv.hostPlatform.system == "armv6l-linux") ''
-    # Seems to require certain floating point hardware (NEON?)
-    rm test/ExecutionEngine/frem.ll
-  '' + ''
-    patchShebangs test/BugPoint/compile-custom.ll.py
-  '' + ''
-    # Tweak tests to ignore namespace part of type to support
-    # gcc-12: https://gcc.gnu.org/PR103598.
-    # The change below mangles strings like:
-    #    CHECK-NEXT: Starting llvm::Function pass manager run.
-    # to:
-    #    CHECK-NEXT: Starting {{.*}}Function pass manager run.
-    for f in \
-      test/Other/new-pass-manager.ll \
-      test/Other/new-pm-defaults.ll \
-      test/Other/new-pm-lto-defaults.ll \
-      test/Other/new-pm-thinlto-defaults.ll \
-      test/Other/pass-pipeline-parsing.ll \
-      test/Transforms/Inline/cgscc-incremental-invalidate.ll \
-      test/Transforms/Inline/clear-analyses.ll \
-      test/Transforms/LoopUnroll/unroll-loop-invalidation.ll \
-      test/Transforms/SCCP/ipsccp-preserve-analysis.ll \
-      test/Transforms/SCCP/preserve-analysis.ll \
-      test/Transforms/SROA/dead-inst.ll \
-      test/tools/gold/X86/new-pm.ll \
-      ; do
-      echo "PATCH: $f"
-      substituteInPlace $f \
-        --replace 'Starting llvm::' 'Starting {{.*}}' \
-        --replace 'Finished llvm::' 'Finished {{.*}}'
-    done
-  '';
-
-  preConfigure = ''
-    # Workaround for configure flags that need to have spaces
-    cmakeFlagsArray+=(
-      -DLLVM_LIT_ARGS='-svj''${NIX_BUILD_CORES} --no-progress-bar'
-    )
-  '';
-
-  # hacky fix: created binaries need to be run before installation
-  preBuild = ''
-    mkdir -p $out/
-    ln -sv $PWD/lib $out
-  '';
-
-  cmakeBuildType = if debugVersion then "Debug" else "Release";
-
-  cmakeFlags = with stdenv; let
-    # These flags influence llvm-config's BuildVariables.inc in addition to the
-    # general build. We need to make sure these are also passed via
-    # CROSS_TOOLCHAIN_FLAGS_NATIVE when cross-compiling or llvm-config-native
-    # will return different results from the cross llvm-config.
-    #
-    # Some flags don't need to be repassed because LLVM already does so (like
-    # CMAKE_BUILD_TYPE), others are irrelevant to the result.
-    flagsForLlvmConfig = [
-      "-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
-      "-DLLVM_ENABLE_RTTI=ON"
-    ] ++ optionals enableSharedLibraries [
-      "-DLLVM_LINK_LLVM_DYLIB=ON"
-    ];
-  in flagsForLlvmConfig ++ [
-    "-DLLVM_INSTALL_UTILS=ON"  # Needed by rustc
-    "-DLLVM_BUILD_TESTS=${if doCheck then "ON" else "OFF"}"
-    "-DLLVM_ENABLE_FFI=ON"
-    "-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}"
-    "-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}"
-    "-DLLVM_ENABLE_DUMP=ON"
-  ] ++ optionals enableManpages [
-    "-DLLVM_BUILD_DOCS=ON"
-    "-DLLVM_ENABLE_SPHINX=ON"
-    "-DSPHINX_OUTPUT_MAN=ON"
-    "-DSPHINX_OUTPUT_HTML=OFF"
-    "-DSPHINX_WARNINGS_AS_ERRORS=OFF"
-  ] ++ optionals (enableGoldPlugin) [
-    "-DLLVM_BINUTILS_INCDIR=${libbfd.dev}/include"
-  ] ++ optionals isDarwin [
-    "-DLLVM_ENABLE_LIBCXX=ON"
-    "-DCAN_TARGET_i386=false"
-  ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
-    "-DCMAKE_CROSSCOMPILING=True"
-    "-DLLVM_TABLEGEN=${buildLlvmTools.llvm}/bin/llvm-tblgen"
-    (
-      let
-        nativeCC = pkgsBuildBuild.targetPackages.stdenv.cc;
-        nativeBintools = nativeCC.bintools.bintools;
-        nativeToolchainFlags = [
-          "-DCMAKE_C_COMPILER=${nativeCC}/bin/${nativeCC.targetPrefix}cc"
-          "-DCMAKE_CXX_COMPILER=${nativeCC}/bin/${nativeCC.targetPrefix}c++"
-          "-DCMAKE_AR=${nativeBintools}/bin/${nativeBintools.targetPrefix}ar"
-          "-DCMAKE_STRIP=${nativeBintools}/bin/${nativeBintools.targetPrefix}strip"
-          "-DCMAKE_RANLIB=${nativeBintools}/bin/${nativeBintools.targetPrefix}ranlib"
-        ];
-        # We need to repass the custom GNUInstallDirs values, otherwise CMake
-        # will choose them for us, leading to wrong results in llvm-config-native
-        nativeInstallFlags = [
-          "-DCMAKE_INSTALL_PREFIX=${placeholder "out"}"
-          "-DCMAKE_INSTALL_BINDIR=${placeholder "out"}/bin"
-          "-DCMAKE_INSTALL_INCLUDEDIR=${placeholder "dev"}/include"
-          "-DCMAKE_INSTALL_LIBDIR=${placeholder "lib"}/lib"
-          "-DCMAKE_INSTALL_LIBEXECDIR=${placeholder "lib"}/libexec"
-        ];
-      in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list="
-      + lib.concatStringsSep ";" (lib.concatLists [
-        flagsForLlvmConfig
-        nativeToolchainFlags
-        nativeInstallFlags
-      ])
-    )
-  ];
-
-  postBuild = ''
-    rm -fR $out
-  '';
-
-  preCheck = ''
-    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}$PWD/lib
-  '';
-
-  postInstall = ''
-    mkdir -p $python/share
-    mv $out/share/opt-viewer $python/share/opt-viewer
-    moveToOutput "bin/llvm-config*" "$dev"
-    substituteInPlace "$dev/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
-      --replace "\''${_IMPORT_PREFIX}/lib/lib" "$lib/lib/lib" \
-      --replace "$out/bin/llvm-config" "$dev/bin/llvm-config"
-    substituteInPlace "$dev/lib/cmake/llvm/LLVMConfig.cmake" \
-      --replace 'set(LLVM_BINARY_DIR "''${LLVM_INSTALL_PREFIX}")' 'set(LLVM_BINARY_DIR "''${LLVM_INSTALL_PREFIX}'"$lib"'")'
-  ''
-  + optionalString (stdenv.isDarwin && enableSharedLibraries) ''
-    ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${shortVersion}.dylib
-    ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${release_version}.dylib
-  ''
-  + optionalString (stdenv.buildPlatform != stdenv.hostPlatform) ''
-    cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native
-  '';
-
-  inherit doCheck;
-
-  checkTarget = "check-all";
-
-  requiredSystemFeatures = [ "big-parallel" ];
-  meta = llvm_meta // {
-    homepage = "https://llvm.org/";
-    description = "A collection of modular and reusable compiler and toolchain technologies";
-    longDescription = ''
-      The LLVM Project is a collection of modular and reusable compiler and
-      toolchain technologies. Despite its name, LLVM has little to do with
-      traditional virtual machines. The name "LLVM" itself is not an acronym; it
-      is the full name of the project.
-      LLVM began as a research project at the University of Illinois, with the
-      goal of providing a modern, SSA-based compilation strategy capable of
-      supporting both static and dynamic compilation of arbitrary programming
-      languages. Since then, LLVM has grown to be an umbrella project consisting
-      of a number of subprojects, many of which are being used in production by
-      a wide variety of commercial and open source projects as well as being
-      widely used in academic research. Code in the LLVM project is licensed
-      under the "Apache 2.0 License with LLVM exceptions".
-    '';
-  };
-} // lib.optionalAttrs enableManpages {
-  pname = "llvm-manpages";
-
-  buildPhase = ''
-    make docs-llvm-man
-  '';
-
-  propagatedBuildInputs = [];
-
-  installPhase = ''
-    make -C docs install
-  '';
-
-  postPatch = null;
-  postInstall = null;
-
-  outputs = [ "out" ];
-
-  doCheck = false;
-
-  meta = llvm_meta // {
-    description = "man pages for LLVM ${version}";
-  };
-})
diff --git a/nixpkgs/pkgs/development/compilers/llvm/10/llvm/gnu-install-dirs-polly.patch b/nixpkgs/pkgs/development/compilers/llvm/10/llvm/gnu-install-dirs-polly.patch
deleted file mode 100644
index 3353058d8ab1..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/10/llvm/gnu-install-dirs-polly.patch
+++ /dev/null
@@ -1,106 +0,0 @@
-diff --git a/tools/polly/CMakeLists.txt b/tools/polly/CMakeLists.txt
-index 9939097f743e..8cc538da912a 100644
---- a/tools/polly/CMakeLists.txt
-+++ b/tools/polly/CMakeLists.txt
-@@ -2,7 +2,11 @@
- if (NOT DEFINED LLVM_MAIN_SRC_DIR)
-   project(Polly)
-   cmake_minimum_required(VERSION 3.4.3)
-+endif()
-+
-+include(GNUInstallDirs)
- 
-+if (NOT DEFINED LLVM_MAIN_SRC_DIR)
-   # Where is LLVM installed?
-   find_package(LLVM CONFIG REQUIRED)
-   set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${LLVM_CMAKE_DIR})
-@@ -145,14 +149,14 @@ include_directories(
- 
- if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
-   install(DIRECTORY include/
--    DESTINATION include
-+    DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
-     FILES_MATCHING
-     PATTERN "*.h"
-     PATTERN ".svn" EXCLUDE
-     )
- 
-   install(DIRECTORY ${POLLY_BINARY_DIR}/include/
--    DESTINATION include
-+    DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
-     FILES_MATCHING
-     PATTERN "*.h"
-     PATTERN "CMakeFiles" EXCLUDE
-diff --git a/tools/polly/cmake/CMakeLists.txt b/tools/polly/cmake/CMakeLists.txt
-index 211f95512717..f9e04a4844b6 100644
---- a/tools/polly/cmake/CMakeLists.txt
-+++ b/tools/polly/cmake/CMakeLists.txt
-@@ -79,18 +79,18 @@ file(GENERATE
- 
- # Generate PollyConfig.cmake for the install tree.
- unset(POLLY_EXPORTS)
--set(POLLY_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
-+set(POLLY_INSTALL_PREFIX "")
- set(POLLY_CONFIG_LLVM_CMAKE_DIR "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}")
--set(POLLY_CONFIG_CMAKE_DIR "${POLLY_INSTALL_PREFIX}/${POLLY_INSTALL_PACKAGE_DIR}")
--set(POLLY_CONFIG_LIBRARY_DIRS "${POLLY_INSTALL_PREFIX}/lib${LLVM_LIBDIR_SUFFIX}")
-+set(POLLY_CONFIG_CMAKE_DIR "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_PREFIX}/${POLLY_INSTALL_PACKAGE_DIR}")
-+set(POLLY_CONFIG_LIBRARY_DIRS "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_LIBDIR}${LLVM_LIBDIR_SUFFIX}")
- if (POLLY_BUNDLED_ISL)
-   set(POLLY_CONFIG_INCLUDE_DIRS
--    "${POLLY_INSTALL_PREFIX}/include"
--    "${POLLY_INSTALL_PREFIX}/include/polly"
-+    "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_LIBDIR}"
-+    "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_LIBDIR}/polly"
-     )
- else()
-   set(POLLY_CONFIG_INCLUDE_DIRS
--    "${POLLY_INSTALL_PREFIX}/include"
-+    "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_INCLUDEDIR}"
-     ${ISL_INCLUDE_DIRS}
-     )
- endif()
-@@ -100,12 +100,12 @@ endif()
- foreach(tgt IN LISTS POLLY_CONFIG_EXPORTED_TARGETS)
-   get_target_property(tgt_type ${tgt} TYPE)
-   if (tgt_type STREQUAL "EXECUTABLE")
--    set(tgt_prefix "bin/")
-+    set(tgt_prefix "${CMAKE_INSTALL_BINDIR}/")
-   else()
--    set(tgt_prefix "lib/")
-+    set(tgt_prefix "${CMAKE_INSTALL_LIBDIR}/")
-   endif()
- 
--  set(tgt_path "${CMAKE_INSTALL_PREFIX}/${tgt_prefix}$<TARGET_FILE_NAME:${tgt}>")
-+  set(tgt_path "${tgt_prefix}$<TARGET_FILE_NAME:${tgt}>")
-   file(RELATIVE_PATH tgt_path ${POLLY_CONFIG_CMAKE_DIR} ${tgt_path})
- 
-   if (NOT tgt_type STREQUAL "INTERFACE_LIBRARY")
-diff --git a/tools/polly/cmake/polly_macros.cmake b/tools/polly/cmake/polly_macros.cmake
-index 86de6f10686e..91f30891ccbe 100644
---- a/tools/polly/cmake/polly_macros.cmake
-+++ b/tools/polly/cmake/polly_macros.cmake
-@@ -44,8 +44,8 @@ macro(add_polly_library name)
-   if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "LLVMPolly")
-     install(TARGETS ${name}
-       EXPORT LLVMExports
--      LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
--      ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
-+	  LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
-+      ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
-   endif()
-   set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
- endmacro(add_polly_library)
-diff --git a/tools/polly/lib/External/CMakeLists.txt b/tools/polly/lib/External/CMakeLists.txt
-index 8ffd984e542b..261cc19f3238 100644
---- a/tools/polly/lib/External/CMakeLists.txt
-+++ b/tools/polly/lib/External/CMakeLists.txt
-@@ -274,7 +274,7 @@ if (POLLY_BUNDLED_ISL)
-     install(DIRECTORY
-       ${ISL_SOURCE_DIR}/include/
-       ${ISL_BINARY_DIR}/include/
--      DESTINATION include/polly
-+      DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/polly
-       FILES_MATCHING
-       PATTERN "*.h"
-       PATTERN "CMakeFiles" EXCLUDE
diff --git a/nixpkgs/pkgs/development/compilers/llvm/10/llvm/gnu-install-dirs.patch b/nixpkgs/pkgs/development/compilers/llvm/10/llvm/gnu-install-dirs.patch
deleted file mode 100644
index 155bab32f439..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/10/llvm/gnu-install-dirs.patch
+++ /dev/null
@@ -1,416 +0,0 @@
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 0e85afa82c76..3e700d9c5fae 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -253,15 +253,21 @@ if (CMAKE_BUILD_TYPE AND
-   message(FATAL_ERROR "Invalid value for CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
- endif()
- 
-+include(GNUInstallDirs)
-+
- set(LLVM_LIBDIR_SUFFIX "" CACHE STRING "Define suffix of library directory name (32/64)" )
- 
--set(LLVM_TOOLS_INSTALL_DIR "bin" CACHE STRING "Path for binary subdirectory (defaults to 'bin')")
-+set(LLVM_TOOLS_INSTALL_DIR "${CMAKE_INSTALL_BINDIR}" CACHE STRING
-+    "Path for binary subdirectory (defaults to 'bin')")
- mark_as_advanced(LLVM_TOOLS_INSTALL_DIR)
- 
- set(LLVM_UTILS_INSTALL_DIR "${LLVM_TOOLS_INSTALL_DIR}" CACHE STRING
-     "Path to install LLVM utilities (enabled by LLVM_INSTALL_UTILS=ON) (defaults to LLVM_TOOLS_INSTALL_DIR)")
- mark_as_advanced(LLVM_UTILS_INSTALL_DIR)
- 
-+set(LLVM_INSTALL_CMAKE_DIR "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/cmake/llvm" CACHE STRING
-+	"Path for CMake subdirectory (defaults to lib/cmake/llvm)" )
-+
- # They are used as destination of target generators.
- set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
- set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
-@@ -527,9 +533,9 @@ option (LLVM_ENABLE_SPHINX "Use Sphinx to generate llvm documentation." OFF)
- option (LLVM_ENABLE_OCAMLDOC "Build OCaml bindings documentation." ON)
- option (LLVM_ENABLE_BINDINGS "Build bindings." ON)
- 
--set(LLVM_INSTALL_DOXYGEN_HTML_DIR "share/doc/llvm/doxygen-html"
-+set(LLVM_INSTALL_DOXYGEN_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/${project}/doxygen-html"
-     CACHE STRING "Doxygen-generated HTML documentation install directory")
--set(LLVM_INSTALL_OCAMLDOC_HTML_DIR "share/doc/llvm/ocaml-html"
-+set(LLVM_INSTALL_OCAMLDOC_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/${project}/ocaml-html"
-     CACHE STRING "OCamldoc-generated HTML documentation install directory")
- 
- option (LLVM_BUILD_EXTERNAL_COMPILER_RT
-@@ -993,7 +999,7 @@ endif()
- 
- if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
-   install(DIRECTORY include/llvm include/llvm-c
--    DESTINATION include
-+    DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
-     COMPONENT llvm-headers
-     FILES_MATCHING
-     PATTERN "*.def"
-@@ -1005,7 +1011,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
-     )
- 
-   install(DIRECTORY ${LLVM_INCLUDE_DIR}/llvm ${LLVM_INCLUDE_DIR}/llvm-c
--    DESTINATION include
-+    DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
-     COMPONENT llvm-headers
-     FILES_MATCHING
-     PATTERN "*.def"
-@@ -1020,13 +1026,13 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
- 
-   if (LLVM_INSTALL_MODULEMAPS)
-     install(DIRECTORY include/llvm include/llvm-c
--            DESTINATION include
-+            DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
-             COMPONENT llvm-headers
-             FILES_MATCHING
-             PATTERN "module.modulemap"
-             )
-     install(FILES include/llvm/module.install.modulemap
--            DESTINATION include/llvm
-+            DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/llvm
-             COMPONENT llvm-headers
-             RENAME "module.extern.modulemap"
-             )
-diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake
-index f5a1b0d6f238..a7387224d68f 100644
---- a/cmake/modules/AddLLVM.cmake
-+++ b/cmake/modules/AddLLVM.cmake
-@@ -729,9 +729,9 @@ macro(add_llvm_library name)
- 
-       install(TARGETS ${name}
-               ${export_to_llvmexports}
--              LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT ${name}
--              ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT ${name}
--              RUNTIME DESTINATION bin COMPONENT ${name})
-+              LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX} COMPONENT ${name}
-+              ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX} COMPONENT ${name}
-+              RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT ${name})
- 
-       if (NOT LLVM_ENABLE_IDE)
-         add_llvm_install_targets(install-${name}
-@@ -934,7 +934,7 @@ function(process_llvm_pass_plugins)
-           "set(LLVM_STATIC_EXTENSIONS ${LLVM_STATIC_EXTENSIONS})")
-       install(FILES
-           ${llvm_cmake_builddir}/LLVMConfigExtensions.cmake
--          DESTINATION ${LLVM_INSTALL_PACKAGE_DIR}
-+          DESTINATION ${LLVM_INSTALL_CMAKE_DIR}
-           COMPONENT cmake-exports)
- 
-       set(ExtensionDef "${LLVM_BINARY_DIR}/include/llvm/Support/Extension.def")
-@@ -1147,7 +1147,7 @@ macro(add_llvm_example name)
-   endif()
-   add_llvm_executable(${name} ${ARGN})
-   if( LLVM_BUILD_EXAMPLES )
--    install(TARGETS ${name} RUNTIME DESTINATION examples)
-+    install(TARGETS ${name} RUNTIME DESTINATION ${CMAKE_INSTALL_DOCDIR}/examples)
-   endif()
-   set_target_properties(${name} PROPERTIES FOLDER "Examples")
- endmacro(add_llvm_example name)
-@@ -1713,7 +1713,7 @@ function(llvm_install_library_symlink name dest type)
-   set(full_name ${CMAKE_${type}_LIBRARY_PREFIX}${name}${CMAKE_${type}_LIBRARY_SUFFIX})
-   set(full_dest ${CMAKE_${type}_LIBRARY_PREFIX}${dest}${CMAKE_${type}_LIBRARY_SUFFIX})
- 
--  set(output_dir lib${LLVM_LIBDIR_SUFFIX})
-+  set(output_dir ${CMAKE_INSTALL_FULL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
-   if(WIN32 AND "${type}" STREQUAL "SHARED")
-     set(output_dir bin)
-   endif()
-@@ -1730,7 +1730,7 @@ function(llvm_install_library_symlink name dest type)
-   endif()
- endfunction()
- 
--function(llvm_install_symlink name dest)
-+function(llvm_install_symlink name dest output_dir)
-   cmake_parse_arguments(ARG "ALWAYS_GENERATE" "COMPONENT" "" ${ARGN})
-   foreach(path ${CMAKE_MODULE_PATH})
-     if(EXISTS ${path}/LLVMInstallSymlink.cmake)
-@@ -1753,7 +1753,7 @@ function(llvm_install_symlink name dest)
-   set(full_dest ${dest}${CMAKE_EXECUTABLE_SUFFIX})
- 
-   install(SCRIPT ${INSTALL_SYMLINK}
--          CODE "install_symlink(${full_name} ${full_dest} ${LLVM_TOOLS_INSTALL_DIR})"
-+          CODE "install_symlink(${full_name} ${full_dest} ${output_dir})"
-           COMPONENT ${component})
- 
-   if (NOT LLVM_ENABLE_IDE AND NOT ARG_ALWAYS_GENERATE)
-@@ -1836,7 +1836,8 @@ function(add_llvm_tool_symlink link_name target)
-     endif()
- 
-     if ((TOOL_IS_TOOLCHAIN OR NOT LLVM_INSTALL_TOOLCHAIN_ONLY) AND LLVM_BUILD_TOOLS)
--      llvm_install_symlink(${link_name} ${target})
-+      GNUInstallDirs_get_absolute_install_dir(output_dir LLVM_TOOLS_INSTALL_DIR)
-+      llvm_install_symlink(${link_name} ${target} ${output_dir})
-     endif()
-   endif()
- endfunction()
-@@ -1958,9 +1959,9 @@ function(llvm_setup_rpath name)
- 
-   if (APPLE)
-     set(_install_name_dir INSTALL_NAME_DIR "@rpath")
--    set(_install_rpath "@loader_path/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
-+    set(_install_rpath "@loader_path/../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
-   elseif(UNIX)
--    set(_install_rpath "\$ORIGIN/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
-+    set(_install_rpath "\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
-     if(${CMAKE_SYSTEM_NAME} MATCHES "(FreeBSD|DragonFly)")
-       set_property(TARGET ${name} APPEND_STRING PROPERTY
-                    LINK_FLAGS " -Wl,-z,origin ")
-diff --git a/cmake/modules/AddOCaml.cmake b/cmake/modules/AddOCaml.cmake
-index 554046b20edf..4d1ad980641e 100644
---- a/cmake/modules/AddOCaml.cmake
-+++ b/cmake/modules/AddOCaml.cmake
-@@ -144,9 +144,9 @@ function(add_ocaml_library name)
-   endforeach()
- 
-   if( APPLE )
--    set(ocaml_rpath "@executable_path/../../../lib${LLVM_LIBDIR_SUFFIX}")
-+    set(ocaml_rpath "@executable_path/../../../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}")
-   elseif( UNIX )
--    set(ocaml_rpath "\\$ORIGIN/../../../lib${LLVM_LIBDIR_SUFFIX}")
-+    set(ocaml_rpath "\\$ORIGIN/../../../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}")
-   endif()
-   list(APPEND ocaml_flags "-ldopt" "-Wl,-rpath,${ocaml_rpath}")
- 
-diff --git a/cmake/modules/AddSphinxTarget.cmake b/cmake/modules/AddSphinxTarget.cmake
-index 2bf654b60c44..450ee45d86e6 100644
---- a/cmake/modules/AddSphinxTarget.cmake
-+++ b/cmake/modules/AddSphinxTarget.cmake
-@@ -78,7 +78,7 @@ function (add_sphinx_target builder project)
-         endif()
-       elseif (builder STREQUAL html)
-         string(TOUPPER "${project}" project_upper)
--        set(${project_upper}_INSTALL_SPHINX_HTML_DIR "share/doc/${project}/html"
-+        set(${project_upper}_INSTALL_SPHINX_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/${project}/html"
-             CACHE STRING "HTML documentation install directory for ${project}")
- 
-         # '/.' indicates: copy the contents of the directory directly into
-diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt
-index af757d6199a8..b0fb7e7705d1 100644
---- a/cmake/modules/CMakeLists.txt
-+++ b/cmake/modules/CMakeLists.txt
-@@ -1,4 +1,4 @@
--set(LLVM_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm)
-+set(LLVM_INSTALL_PACKAGE_DIR ${LLVM_INSTALL_CMAKE_DIR} CACHE STRING "Path for CMake subdirectory (defaults to 'cmake/llvm')")
- set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}")
- 
- # First for users who use an installed LLVM, create the LLVMExports.cmake file.
-@@ -96,13 +96,13 @@ foreach(p ${_count})
-   set(LLVM_CONFIG_CODE "${LLVM_CONFIG_CODE}
- get_filename_component(LLVM_INSTALL_PREFIX \"\${LLVM_INSTALL_PREFIX}\" PATH)")
- endforeach(p)
--set(LLVM_CONFIG_INCLUDE_DIRS "\${LLVM_INSTALL_PREFIX}/include")
-+set(LLVM_CONFIG_INCLUDE_DIRS "\${LLVM_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}")
- set(LLVM_CONFIG_INCLUDE_DIR "${LLVM_CONFIG_INCLUDE_DIRS}")
- set(LLVM_CONFIG_MAIN_INCLUDE_DIR "${LLVM_CONFIG_INCLUDE_DIRS}")
--set(LLVM_CONFIG_LIBRARY_DIRS "\${LLVM_INSTALL_PREFIX}/lib\${LLVM_LIBDIR_SUFFIX}")
-+set(LLVM_CONFIG_LIBRARY_DIRS "\${LLVM_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}\${LLVM_LIBDIR_SUFFIX}")
- set(LLVM_CONFIG_CMAKE_DIR "\${LLVM_INSTALL_PREFIX}/${LLVM_INSTALL_PACKAGE_DIR}")
- set(LLVM_CONFIG_BINARY_DIR "\${LLVM_INSTALL_PREFIX}")
--set(LLVM_CONFIG_TOOLS_BINARY_DIR "\${LLVM_INSTALL_PREFIX}/bin")
-+set(LLVM_CONFIG_TOOLS_BINARY_DIR "\${LLVM_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}")
- set(LLVM_CONFIG_EXPORTS_FILE "\${LLVM_CMAKE_DIR}/LLVMExports.cmake")
- set(LLVM_CONFIG_EXPORTS "${LLVM_EXPORTS}")
- configure_file(
-diff --git a/cmake/modules/LLVMInstallSymlink.cmake b/cmake/modules/LLVMInstallSymlink.cmake
-index 09fed8085c23..aa79f192abf0 100644
---- a/cmake/modules/LLVMInstallSymlink.cmake
-+++ b/cmake/modules/LLVMInstallSymlink.cmake
-@@ -10,7 +10,7 @@ function(install_symlink name target outdir)
-     set(LINK_OR_COPY copy)
-   endif()
- 
--  set(bindir "${DESTDIR}${CMAKE_INSTALL_PREFIX}/${outdir}/")
-+  set(bindir "${DESTDIR}${outdir}/")
- 
-   message(STATUS "Creating ${name}")
- 
-diff --git a/docs/CMake.rst b/docs/CMake.rst
-index a86ebb3a37bd..e720711e2b3c 100644
---- a/docs/CMake.rst
-+++ b/docs/CMake.rst
-@@ -196,7 +196,7 @@ CMake manual, or execute ``cmake --help-variable VARIABLE_NAME``.
- **LLVM_LIBDIR_SUFFIX**:STRING
-   Extra suffix to append to the directory where libraries are to be
-   installed. On a 64-bit architecture, one could use ``-DLLVM_LIBDIR_SUFFIX=64``
--  to install libraries to ``/usr/lib64``.
-+  to install libraries to ``/usr/lib64``. See also ``CMAKE_INSTALL_LIBDIR``.
- 
- **CMAKE_C_FLAGS**:STRING
-   Extra flags to use when compiling C source files.
-@@ -516,8 +516,8 @@ LLVM-specific variables
- 
- **LLVM_INSTALL_DOXYGEN_HTML_DIR**:STRING
-   The path to install Doxygen-generated HTML documentation to. This path can
--  either be absolute or relative to the CMAKE_INSTALL_PREFIX. Defaults to
--  `share/doc/llvm/doxygen-html`.
-+  either be absolute or relative to the ``CMAKE_INSTALL_PREFIX``. Defaults to
-+  `${CMAKE_INSTALL_DOCDIR}/${project}/doxygen-html`.
- 
- **LLVM_ENABLE_SPHINX**:BOOL
-   If specified, CMake will search for the ``sphinx-build`` executable and will make
-@@ -548,13 +548,33 @@ LLVM-specific variables
- 
- **LLVM_INSTALL_SPHINX_HTML_DIR**:STRING
-   The path to install Sphinx-generated HTML documentation to. This path can
--  either be absolute or relative to the CMAKE_INSTALL_PREFIX. Defaults to
--  `share/doc/llvm/html`.
-+  either be absolute or relative to the ``CMAKE_INSTALL_PREFIX``. Defaults to
-+  `${CMAKE_INSTALL_DOCDIR}/${project}/html`.
- 
- **LLVM_INSTALL_OCAMLDOC_HTML_DIR**:STRING
-   The path to install OCamldoc-generated HTML documentation to. This path can
--  either be absolute or relative to the CMAKE_INSTALL_PREFIX. Defaults to
--  `share/doc/llvm/ocaml-html`.
-+  either be absolute or relative to the ``CMAKE_INSTALL_PREFIX``. Defaults to
-+  `${CMAKE_INSTALL_DOCDIR}/${project}/ocaml-html`.
-+
-+**CMAKE_INSTALL_BINDIR**:STRING
-+  The path to install binary tools, relative to the ``CMAKE_INSTALL_PREFIX``.
-+  Defaults to `bin`.
-+
-+**CMAKE_INSTALL_LIBDIR**:STRING
-+  The path to install libraries, relative to the ``CMAKE_INSTALL_PREFIX``.
-+  Defaults to `lib`.
-+
-+**CMAKE_INSTALL_INCLUDEDIR**:STRING
-+  The path to install header files, relative to the ``CMAKE_INSTALL_PREFIX``.
-+  Defaults to `include`.
-+
-+**CMAKE_INSTALL_DOCDIR**:STRING
-+  The path to install documentation, relative to the ``CMAKE_INSTALL_PREFIX``.
-+  Defaults to `share/doc`.
-+
-+**CMAKE_INSTALL_MANDIR**:STRING
-+  The path to install manpage files, relative to the ``CMAKE_INSTALL_PREFIX``.
-+  Defaults to `share/man`.
- 
- **LLVM_CREATE_XCODE_TOOLCHAIN**:BOOL
-   macOS Only: If enabled CMake will generate a target named
-@@ -740,9 +760,11 @@ the ``cmake`` command or by setting it directly in ``ccmake`` or ``cmake-gui``).
- 
- This file is available in two different locations.
- 
--* ``<INSTALL_PREFIX>/lib/cmake/llvm/LLVMConfig.cmake`` where
--  ``<INSTALL_PREFIX>`` is the install prefix of an installed version of LLVM.
--  On Linux typically this is ``/usr/lib/cmake/llvm/LLVMConfig.cmake``.
-+* ``<LLVM_INSTALL_PACKAGE_DIR>LLVMConfig.cmake`` where
-+  ``<LLVM_INSTALL_PACKAGE_DIR>`` is the location where LLVM CMake modules are
-+  installed as part of an installed version of LLVM. This is typically
-+  ``cmake/llvm/`` within the lib directory. On Linux, this is typically
-+  ``/usr/lib/cmake/llvm/LLVMConfig.cmake``.
- 
- * ``<LLVM_BUILD_ROOT>/lib/cmake/llvm/LLVMConfig.cmake`` where
-   ``<LLVM_BUILD_ROOT>`` is the root of the LLVM build tree. **Note: this is only
-diff --git a/examples/Bye/CMakeLists.txt b/examples/Bye/CMakeLists.txt
-index 3206f90d0916..1822965fc35f 100644
---- a/examples/Bye/CMakeLists.txt
-+++ b/examples/Bye/CMakeLists.txt
-@@ -9,5 +9,5 @@ add_llvm_pass_plugin(Bye
-   BUILDTREE_ONLY
-  )
- 
--install(TARGETS ${name} RUNTIME DESTINATION examples)
-+install(TARGETS ${name} RUNTIME DESTINATION ${CMAKE_INSTALL_DOCDIR}/examples)
- set_target_properties(${name} PROPERTIES FOLDER "Examples")
-diff --git a/include/llvm/CMakeLists.txt b/include/llvm/CMakeLists.txt
-index 1d5ca3ba92b0..026f5453c1da 100644
---- a/include/llvm/CMakeLists.txt
-+++ b/include/llvm/CMakeLists.txt
-@@ -4,5 +4,5 @@ add_subdirectory(Support)
- # If we're doing an out-of-tree build, copy a module map for generated
- # header files into the build area.
- if (NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
--  configure_file(module.modulemap.build module.modulemap COPYONLY)
-+  configure_file(module.modulemap.build ${LLVM_INCLUDE_DIR}/module.modulemap COPYONLY)
- endif (NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
-diff --git a/tools/llvm-config/BuildVariables.inc.in b/tools/llvm-config/BuildVariables.inc.in
-index 63cef75368b7..6295478b1f3d 100644
---- a/tools/llvm-config/BuildVariables.inc.in
-+++ b/tools/llvm-config/BuildVariables.inc.in
-@@ -23,6 +23,10 @@
- #define LLVM_CXXFLAGS "@LLVM_CXXFLAGS@"
- #define LLVM_BUILDMODE "@LLVM_BUILDMODE@"
- #define LLVM_LIBDIR_SUFFIX "@LLVM_LIBDIR_SUFFIX@"
-+#define LLVM_INSTALL_BINDIR "@CMAKE_INSTALL_BINDIR@"
-+#define LLVM_INSTALL_LIBDIR "@CMAKE_INSTALL_LIBDIR@"
-+#define LLVM_INSTALL_INCLUDEDIR "@CMAKE_INSTALL_INCLUDEDIR@"
-+#define LLVM_INSTALL_CMAKEDIR "@LLVM_INSTALL_CMAKE_DIR@"
- #define LLVM_TARGETS_BUILT "@LLVM_TARGETS_BUILT@"
- #define LLVM_SYSTEM_LIBS "@LLVM_SYSTEM_LIBS@"
- #define LLVM_BUILD_SYSTEM "@LLVM_BUILD_SYSTEM@"
-diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
-index fb12e29a36a8..dbb6c2b90332 100644
---- a/tools/llvm-config/llvm-config.cpp
-+++ b/tools/llvm-config/llvm-config.cpp
-@@ -358,12 +358,26 @@ int main(int argc, char **argv) {
-         ("-I" + ActiveIncludeDir + " " + "-I" + ActiveObjRoot + "/include");
-   } else {
-     ActivePrefix = CurrentExecPrefix;
--    ActiveIncludeDir = ActivePrefix + "/include";
--    SmallString<256> path(StringRef(LLVM_TOOLS_INSTALL_DIR));
--    sys::fs::make_absolute(ActivePrefix, path);
--    ActiveBinDir = path.str();
--    ActiveLibDir = ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX;
--    ActiveCMakeDir = ActiveLibDir + "/cmake/llvm";
-+    {
-+      SmallString<256> path(StringRef(LLVM_INSTALL_INCLUDEDIR));
-+      sys::fs::make_absolute(ActivePrefix, path);
-+      ActiveIncludeDir = std::string(path.str());
-+    }
-+    {
-+      SmallString<256> path(StringRef(LLVM_INSTALL_BINDIR));
-+      sys::fs::make_absolute(ActivePrefix, path);
-+      ActiveBinDir = std::string(path.str());
-+    }
-+    {
-+      SmallString<256> path(StringRef(LLVM_INSTALL_LIBDIR LLVM_LIBDIR_SUFFIX));
-+      sys::fs::make_absolute(ActivePrefix, path);
-+      ActiveLibDir = std::string(path.str());
-+    }
-+    {
-+      SmallString<256> path(StringRef(LLVM_INSTALL_CMAKEDIR));
-+      sys::fs::make_absolute(ActivePrefix, path);
-+      ActiveCMakeDir = std::string(path.str());
-+    }
-     ActiveIncludeOption = "-I" + ActiveIncludeDir;
-   }
- 
-diff --git a/tools/lto/CMakeLists.txt b/tools/lto/CMakeLists.txt
-index b86e4abd01a7..02ce5773f17d 100644
---- a/tools/lto/CMakeLists.txt
-+++ b/tools/lto/CMakeLists.txt
-@@ -23,7 +23,7 @@ set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/lto.exports)
- add_llvm_library(LTO SHARED INSTALL_WITH_TOOLCHAIN ${SOURCES} DEPENDS intrinsics_gen)
- 
- install(FILES ${LLVM_MAIN_INCLUDE_DIR}/llvm-c/lto.h
--  DESTINATION include/llvm-c
-+  DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/llvm-c
-   COMPONENT LTO)
- 
- if (APPLE)
-diff --git a/tools/opt-viewer/CMakeLists.txt b/tools/opt-viewer/CMakeLists.txt
-index ead73ec13a8f..250362021f17 100644
---- a/tools/opt-viewer/CMakeLists.txt
-+++ b/tools/opt-viewer/CMakeLists.txt
-@@ -8,7 +8,7 @@ set (files
- 
- foreach (file ${files})
-   install(PROGRAMS ${file}
--    DESTINATION share/opt-viewer
-+    DESTINATION ${CMAKE_INSTALL_DATADIR}/opt-viewer
-     COMPONENT opt-viewer)
- endforeach (file)
- 
-diff --git a/tools/remarks-shlib/CMakeLists.txt b/tools/remarks-shlib/CMakeLists.txt
-index e948496c603a..1f4df8a98b10 100644
---- a/tools/remarks-shlib/CMakeLists.txt
-+++ b/tools/remarks-shlib/CMakeLists.txt
-@@ -11,7 +11,7 @@ set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/Remarks.exports)
- add_llvm_library(Remarks SHARED INSTALL_WITH_TOOLCHAIN ${SOURCES})
- 
- install(FILES ${LLVM_MAIN_INCLUDE_DIR}/llvm-c/Remarks.h
--  DESTINATION include/llvm-c
-+  DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/llvm-c
-   COMPONENT Remarks)
- 
- if (APPLE)
diff --git a/nixpkgs/pkgs/development/compilers/llvm/10/openmp/default.nix b/nixpkgs/pkgs/development/compilers/llvm/10/openmp/default.nix
deleted file mode 100644
index 012f882e5871..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/10/openmp/default.nix
+++ /dev/null
@@ -1,37 +0,0 @@
-{ lib
-, stdenv
-, llvm_meta
-, fetch
-, cmake
-, llvm
-, targetLlvm
-, perl
-, version
-}:
-
-stdenv.mkDerivation rec {
-  pname = "openmp";
-  inherit version;
-
-  src = fetch pname "0i4bn84lkpm5w3qkpvwm5z6jdj8fynp7d3bcasa1xyq4is6757yi";
-
-  nativeBuildInputs = [ cmake perl ];
-  buildInputs = [
-    (if stdenv.buildPlatform == stdenv.hostPlatform then llvm else targetLlvm)
-  ];
-
-  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 ];
-  };
-}
diff --git a/nixpkgs/pkgs/development/compilers/llvm/11/clang/default.nix b/nixpkgs/pkgs/development/compilers/llvm/11/clang/default.nix
index 0e61930f1c0e..5ddecd1f47e9 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/11/clang/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/11/clang/default.nix
@@ -95,7 +95,7 @@ let
     passthru = {
       inherit libllvm;
       isClang = true;
-      hardeningUnsupportedFlags = [ "fortify3" ];
+      hardeningUnsupportedFlags = [ "fortify3" "zerocallusedregs" ];
     };
 
     meta = llvm_meta // {
diff --git a/nixpkgs/pkgs/development/compilers/llvm/11/compiler-rt/default.nix b/nixpkgs/pkgs/development/compilers/llvm/11/compiler-rt/default.nix
index 38dc7a0fbdc8..7fddc6e924b9 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/11/compiler-rt/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/11/compiler-rt/default.nix
@@ -135,6 +135,6 @@ stdenv.mkDerivation {
     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.isRiscV && stdenv.hostPlatform.is32bit && !stdenv.cc.isClang;
+    broken = stdenv.hostPlatform.isRiscV32 && !stdenv.cc.isClang;
   };
 }
diff --git a/nixpkgs/pkgs/development/compilers/llvm/11/default.nix b/nixpkgs/pkgs/development/compilers/llvm/11/default.nix
index 2d9790fe61ac..3044199e2811 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/11/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/11/default.nix
@@ -173,6 +173,7 @@ let
         echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
       '' + lib.optionalString (!stdenv.targetPlatform.isWasm) ''
         echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags
+        echo "-L${targetLlvmLibraries.libunwind}/lib" >> $out/nix-support/cc-ldflags
       '' + lib.optionalString (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false) ''
         echo "-lunwind" >> $out/nix-support/cc-ldflags
       '' + lib.optionalString stdenv.targetPlatform.isWasm ''
diff --git a/nixpkgs/pkgs/development/compilers/llvm/11/llvm/default.nix b/nixpkgs/pkgs/development/compilers/llvm/11/llvm/default.nix
index 01e6483ad640..423b08396666 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/11/llvm/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/11/llvm/default.nix
@@ -256,7 +256,7 @@ in stdenv.mkDerivation (rec {
   ] ++ optionals isDarwin [
     "-DLLVM_ENABLE_LIBCXX=ON"
     "-DCAN_TARGET_i386=false"
-  ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+  ] ++ optionals ((stdenv.hostPlatform != stdenv.buildPlatform) && !(stdenv.buildPlatform.canExecute stdenv.hostPlatform)) [
     "-DCMAKE_CROSSCOMPILING=True"
     "-DLLVM_TABLEGEN=${buildLlvmTools.llvm}/bin/llvm-tblgen"
     (
diff --git a/nixpkgs/pkgs/development/compilers/llvm/12/clang/default.nix b/nixpkgs/pkgs/development/compilers/llvm/12/clang/default.nix
index c46776d38ac3..28f976a26bdb 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/12/clang/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/12/clang/default.nix
@@ -89,7 +89,7 @@ let
     passthru = {
       inherit libllvm;
       isClang = true;
-      hardeningUnsupportedFlags = [ "fortify3" ];
+      hardeningUnsupportedFlags = [ "fortify3" "zerocallusedregs" ];
     };
 
     meta = llvm_meta // {
diff --git a/nixpkgs/pkgs/development/compilers/llvm/12/compiler-rt/default.nix b/nixpkgs/pkgs/development/compilers/llvm/12/compiler-rt/default.nix
index 9362ee8d1147..4b2bdad454ae 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/12/compiler-rt/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/12/compiler-rt/default.nix
@@ -124,5 +124,8 @@ stdenv.mkDerivation {
     # "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/nixpkgs/pkgs/development/compilers/llvm/12/default.nix b/nixpkgs/pkgs/development/compilers/llvm/12/default.nix
index 4de048827071..a38e35e91f6d 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/12/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/12/default.nix
@@ -173,6 +173,7 @@ let
         echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
       '' + lib.optionalString (!stdenv.targetPlatform.isWasm) ''
         echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags
+        echo "-L${targetLlvmLibraries.libunwind}/lib" >> $out/nix-support/cc-ldflags
       '' + lib.optionalString (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false) ''
         echo "-lunwind" >> $out/nix-support/cc-ldflags
       '' + lib.optionalString stdenv.targetPlatform.isWasm ''
diff --git a/nixpkgs/pkgs/development/compilers/llvm/12/llvm/default.nix b/nixpkgs/pkgs/development/compilers/llvm/12/llvm/default.nix
index 97d8f27672e3..3263c4ddaf35 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/12/llvm/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/12/llvm/default.nix
@@ -244,7 +244,7 @@ in stdenv.mkDerivation (rec {
   ] ++ optionals isDarwin [
     "-DLLVM_ENABLE_LIBCXX=ON"
     "-DCAN_TARGET_i386=false"
-  ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+  ] ++ optionals ((stdenv.hostPlatform != stdenv.buildPlatform) && !(stdenv.buildPlatform.canExecute stdenv.hostPlatform)) [
     "-DCMAKE_CROSSCOMPILING=True"
     "-DLLVM_TABLEGEN=${buildLlvmTools.llvm}/bin/llvm-tblgen"
     (
diff --git a/nixpkgs/pkgs/development/compilers/llvm/13/clang/default.nix b/nixpkgs/pkgs/development/compilers/llvm/13/clang/default.nix
index 6604ae0efc3f..7673c903e71c 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/13/clang/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/13/clang/default.nix
@@ -83,7 +83,7 @@ let
     passthru = {
       inherit libllvm;
       isClang = true;
-      hardeningUnsupportedFlags = [ "fortify3" ];
+      hardeningUnsupportedFlags = [ "fortify3" "zerocallusedregs" ];
     };
 
     meta = llvm_meta // {
diff --git a/nixpkgs/pkgs/development/compilers/llvm/13/compiler-rt/default.nix b/nixpkgs/pkgs/development/compilers/llvm/13/compiler-rt/default.nix
index e36aec42e905..b6a9c13ba943 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/13/compiler-rt/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/13/compiler-rt/default.nix
@@ -131,5 +131,8 @@ stdenv.mkDerivation {
     # "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/nixpkgs/pkgs/development/compilers/llvm/13/default.nix b/nixpkgs/pkgs/development/compilers/llvm/13/default.nix
index c46ebee1d0db..c811b24c48ef 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/13/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/13/default.nix
@@ -213,6 +213,7 @@ in let
         echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
       '' + lib.optionalString (!stdenv.targetPlatform.isWasm) ''
         echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags
+        echo "-L${targetLlvmLibraries.libunwind}/lib" >> $out/nix-support/cc-ldflags
       '' + lib.optionalString (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false) ''
         echo "-lunwind" >> $out/nix-support/cc-ldflags
       '' + lib.optionalString stdenv.targetPlatform.isWasm ''
diff --git a/nixpkgs/pkgs/development/compilers/llvm/13/llvm/default.nix b/nixpkgs/pkgs/development/compilers/llvm/13/llvm/default.nix
index 2a7c1c1867cb..1e71cdd89c6c 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/13/llvm/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/13/llvm/default.nix
@@ -206,7 +206,7 @@ in stdenv.mkDerivation (rec {
   ] ++ optionals isDarwin [
     "-DLLVM_ENABLE_LIBCXX=ON"
     "-DCAN_TARGET_i386=false"
-  ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+  ] ++ optionals ((stdenv.hostPlatform != stdenv.buildPlatform) && !(stdenv.buildPlatform.canExecute stdenv.hostPlatform)) [
     "-DCMAKE_CROSSCOMPILING=True"
     "-DLLVM_TABLEGEN=${buildLlvmTools.llvm}/bin/llvm-tblgen"
     (
diff --git a/nixpkgs/pkgs/development/compilers/llvm/14/clang/default.nix b/nixpkgs/pkgs/development/compilers/llvm/14/clang/default.nix
index 9f0da7a9f46c..f63f55cfa546 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/14/clang/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/14/clang/default.nix
@@ -86,7 +86,7 @@ let
     passthru = {
       inherit libllvm;
       isClang = true;
-      hardeningUnsupportedFlags = [ "fortify3" ];
+      hardeningUnsupportedFlags = [ "fortify3" "zerocallusedregs" ];
     };
 
     meta = llvm_meta // {
diff --git a/nixpkgs/pkgs/development/compilers/llvm/14/compiler-rt/default.nix b/nixpkgs/pkgs/development/compilers/llvm/14/compiler-rt/default.nix
index 3aa91bc953b2..1652b3a7fac0 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/14/compiler-rt/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/14/compiler-rt/default.nix
@@ -139,5 +139,8 @@ stdenv.mkDerivation {
     # "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/nixpkgs/pkgs/development/compilers/llvm/14/default.nix b/nixpkgs/pkgs/development/compilers/llvm/14/default.nix
index 3513833c6f56..090eec234886 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/14/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/14/default.nix
@@ -216,6 +216,7 @@ in let
           (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false)
           "-lunwind"
         ++ lib.optional stdenv.targetPlatform.isWasm "-fno-exceptions";
+      nixSupport.cc-ldflags = lib.optionals (!stdenv.targetPlatform.isWasm) [ "-L${targetLlvmLibraries.libunwind}/lib" ];
     };
 
     clangNoLibcxx = wrapCCWith rec {
diff --git a/nixpkgs/pkgs/development/compilers/llvm/14/llvm/default.nix b/nixpkgs/pkgs/development/compilers/llvm/14/llvm/default.nix
index 6eec4c563f9c..eab49d326ad4 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/14/llvm/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/14/llvm/default.nix
@@ -205,7 +205,7 @@ in stdenv.mkDerivation (rec {
   ] ++ optionals isDarwin [
     "-DLLVM_ENABLE_LIBCXX=ON"
     "-DCAN_TARGET_i386=false"
-  ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+  ] ++ optionals ((stdenv.hostPlatform != stdenv.buildPlatform) && !(stdenv.buildPlatform.canExecute stdenv.hostPlatform)) [
     "-DCMAKE_CROSSCOMPILING=True"
     "-DLLVM_TABLEGEN=${buildLlvmTools.llvm}/bin/llvm-tblgen"
     (
diff --git a/nixpkgs/pkgs/development/compilers/llvm/15/clang/default.nix b/nixpkgs/pkgs/development/compilers/llvm/15/clang/default.nix
index c49d6368cb97..9ec15a393004 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/15/clang/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/15/clang/default.nix
@@ -7,7 +7,7 @@
 }:
 
 let
-  self = stdenv.mkDerivation (rec {
+  self = stdenv.mkDerivation (finalAttrs: rec {
     pname = "clang";
     inherit version;
 
@@ -97,7 +97,12 @@ let
     passthru = {
       inherit libllvm;
       isClang = true;
-      hardeningUnsupportedFlags = [ "fortify3" ];
+      hardeningUnsupportedFlags = [
+        "fortify3"
+      ];
+      hardeningUnsupportedFlagsByTargetPlatform = targetPlatform:
+        lib.optional (!(targetPlatform.isx86_64 || targetPlatform.isAarch64)) "zerocallusedregs"
+        ++ (finalAttrs.passthru.hardeningUnsupportedFlags or []);
     };
 
     meta = llvm_meta // {
diff --git a/nixpkgs/pkgs/development/compilers/llvm/15/compiler-rt/default.nix b/nixpkgs/pkgs/development/compilers/llvm/15/compiler-rt/default.nix
index 9817899345a9..fbf25786efee 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/15/compiler-rt/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/15/compiler-rt/default.nix
@@ -138,5 +138,8 @@ stdenv.mkDerivation {
     # "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/nixpkgs/pkgs/development/compilers/llvm/15/default.nix b/nixpkgs/pkgs/development/compilers/llvm/15/default.nix
index 307198b5e9a3..d9ca0819f2e0 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/15/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/15/default.nix
@@ -221,6 +221,7 @@ in let
           (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false)
           "-lunwind"
         ++ lib.optional stdenv.targetPlatform.isWasm "-fno-exceptions";
+      nixSupport.cc-ldflags = lib.optionals (!stdenv.targetPlatform.isWasm) [ "-L${targetLlvmLibraries.libunwind}/lib" ];
     };
 
     clangNoLibcxx = wrapCCWith rec {
diff --git a/nixpkgs/pkgs/development/compilers/llvm/15/libcxx/default.nix b/nixpkgs/pkgs/development/compilers/llvm/15/libcxx/default.nix
index ed5f48e8c38f..be56770039d8 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/15/libcxx/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/15/libcxx/default.nix
@@ -56,6 +56,14 @@ stdenv.mkDerivation rec {
       hash = "sha256-AaM9A6tQ4YAw7uDqCIV4VaiUyLZv+unwcOqbakwW9/k=";
       relative = "libcxx";
     })
+    # fix for https://github.com/NixOS/nixpkgs/issues/269548
+    # https://github.com/llvm/llvm-project/pull/77218
+    (fetchpatch {
+      name = "darwin-system-libcxxabi-link-flags.patch";
+      url = "https://github.com/llvm/llvm-project/commit/c5b89b29ee6e3c444a355fd1cf733ce7ab2e316a.patch";
+      hash = "sha256-LNoPg1KCoP8RWxU/AzHR52f4Dww24I9BGQJedMhFxyQ=";
+      relative = "libcxx";
+    })
   ] ++ lib.optionals stdenv.hostPlatform.isMusl [
     ../../libcxx-0001-musl-hacks.patch
   ];
diff --git a/nixpkgs/pkgs/development/compilers/llvm/15/llvm/default.nix b/nixpkgs/pkgs/development/compilers/llvm/15/llvm/default.nix
index 0b9e83259b2c..4f17678ba14f 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/15/llvm/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/15/llvm/default.nix
@@ -343,7 +343,7 @@ in stdenv.mkDerivation (rec {
   ] ++ optionals isDarwin [
     "-DLLVM_ENABLE_LIBCXX=ON"
     "-DCAN_TARGET_i386=false"
-  ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+  ] ++ optionals ((stdenv.hostPlatform != stdenv.buildPlatform) && !(stdenv.buildPlatform.canExecute stdenv.hostPlatform)) [
     "-DCMAKE_CROSSCOMPILING=True"
     "-DLLVM_TABLEGEN=${buildLlvmTools.llvm}/bin/llvm-tblgen"
     (
diff --git a/nixpkgs/pkgs/development/compilers/llvm/16/clang/default.nix b/nixpkgs/pkgs/development/compilers/llvm/16/clang/default.nix
index 5f28e810f603..43c497b92761 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/16/clang/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/16/clang/default.nix
@@ -7,7 +7,7 @@
 }:
 
 let
-  self = stdenv.mkDerivation (rec {
+  self = stdenv.mkDerivation (finalAttrs: rec {
     pname = "clang";
     inherit version;
 
@@ -91,7 +91,12 @@ let
     passthru = {
       inherit libllvm;
       isClang = true;
-      hardeningUnsupportedFlags = [ "fortify3" ];
+      hardeningUnsupportedFlags = [
+        "fortify3"
+      ];
+      hardeningUnsupportedFlagsByTargetPlatform = targetPlatform:
+        lib.optional (!(targetPlatform.isx86_64 || targetPlatform.isAarch64)) "zerocallusedregs"
+        ++ (finalAttrs.passthru.hardeningUnsupportedFlags or []);
     };
 
     meta = llvm_meta // {
diff --git a/nixpkgs/pkgs/development/compilers/llvm/16/compiler-rt/default.nix b/nixpkgs/pkgs/development/compilers/llvm/16/compiler-rt/default.nix
index 808df140e772..0f15a9e12cde 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/16/compiler-rt/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/16/compiler-rt/default.nix
@@ -152,5 +152,8 @@ stdenv.mkDerivation {
     # "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/nixpkgs/pkgs/development/compilers/llvm/16/default.nix b/nixpkgs/pkgs/development/compilers/llvm/16/default.nix
index 878806ff85ab..db9385043be2 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/16/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/16/default.nix
@@ -226,6 +226,7 @@ in let
           (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false)
           "-lunwind"
         ++ lib.optional stdenv.targetPlatform.isWasm "-fno-exceptions";
+      nixSupport.cc-ldflags = lib.optionals (!stdenv.targetPlatform.isWasm) [ "-L${targetLlvmLibraries.libunwind}/lib" ];
     };
 
     clangNoLibcxx = wrapCCWith rec {
diff --git a/nixpkgs/pkgs/development/compilers/llvm/16/libcxx/default.nix b/nixpkgs/pkgs/development/compilers/llvm/16/libcxx/default.nix
index 78cd632024cd..d6c8c57c1743 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/16/libcxx/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/16/libcxx/default.nix
@@ -1,5 +1,5 @@
 { lib, stdenv, llvm_meta
-, monorepoSrc, runCommand
+, monorepoSrc, runCommand, fetchpatch
 , cmake, ninja, python3, fixDarwinDylibNames, version
 , cxxabi ? if stdenv.hostPlatform.isFreeBSD then libcxxrt else libcxxabi
 , libcxxabi, libcxxrt, libunwind
@@ -47,6 +47,14 @@ stdenv.mkDerivation rec {
 
   patches = [
     ./gnu-install-dirs.patch
+    # fix for https://github.com/NixOS/nixpkgs/issues/269548
+    # https://github.com/llvm/llvm-project/pull/77218
+    (fetchpatch {
+      name = "darwin-system-libcxxabi-link-flags.patch";
+      url = "https://github.com/llvm/llvm-project/commit/c5b89b29ee6e3c444a355fd1cf733ce7ab2e316a.patch";
+      hash = "sha256-LNoPg1KCoP8RWxU/AzHR52f4Dww24I9BGQJedMhFxyQ=";
+      relative = "libcxx";
+    })
   ];
 
   postPatch = ''
diff --git a/nixpkgs/pkgs/development/compilers/llvm/16/llvm/default.nix b/nixpkgs/pkgs/development/compilers/llvm/16/llvm/default.nix
index a6faf9fd635d..73fb6a785413 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/16/llvm/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/16/llvm/default.nix
@@ -331,7 +331,7 @@ in
   ] ++ optionals isDarwin [
     "-DLLVM_ENABLE_LIBCXX=ON"
     "-DCAN_TARGET_i386=false"
-  ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+  ] ++ optionals ((stdenv.hostPlatform != stdenv.buildPlatform) && !(stdenv.buildPlatform.canExecute stdenv.hostPlatform)) [
     "-DCMAKE_CROSSCOMPILING=True"
     "-DLLVM_TABLEGEN=${buildLlvmTools.llvm}/bin/llvm-tblgen"
     (
diff --git a/nixpkgs/pkgs/development/compilers/llvm/17/clang/default.nix b/nixpkgs/pkgs/development/compilers/llvm/17/clang/default.nix
index 3184437830a2..f2f114233c28 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/17/clang/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/17/clang/default.nix
@@ -7,7 +7,7 @@
 }:
 
 let
-  self = stdenv.mkDerivation (rec {
+  self = stdenv.mkDerivation (finalAttrs: rec {
     pname = "clang";
     inherit version;
 
@@ -95,7 +95,12 @@ let
     passthru = {
       inherit libllvm;
       isClang = true;
-      hardeningUnsupportedFlags = [ "fortify3" ];
+      hardeningUnsupportedFlags = [
+        "fortify3"
+      ];
+      hardeningUnsupportedFlagsByTargetPlatform = targetPlatform:
+        lib.optional (!(targetPlatform.isx86_64 || targetPlatform.isAarch64)) "zerocallusedregs"
+        ++ (finalAttrs.passthru.hardeningUnsupportedFlags or []);
     };
 
     meta = llvm_meta // {
diff --git a/nixpkgs/pkgs/development/compilers/llvm/17/compiler-rt/default.nix b/nixpkgs/pkgs/development/compilers/llvm/17/compiler-rt/default.nix
index 808df140e772..0f15a9e12cde 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/17/compiler-rt/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/17/compiler-rt/default.nix
@@ -152,5 +152,8 @@ stdenv.mkDerivation {
     # "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/nixpkgs/pkgs/development/compilers/llvm/17/libcxx/default.nix b/nixpkgs/pkgs/development/compilers/llvm/17/libcxx/default.nix
index 7b9996641663..8f4b0cec8d40 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/17/libcxx/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/17/libcxx/default.nix
@@ -1,5 +1,5 @@
 { lib, stdenv, llvm_meta
-, monorepoSrc, runCommand
+, monorepoSrc, runCommand, fetchpatch
 , cmake, ninja, python3, fixDarwinDylibNames, version
 , cxxabi ? if stdenv.hostPlatform.isFreeBSD then libcxxrt else libcxxabi
 , libcxxabi, libcxxrt, libunwind
@@ -45,6 +45,25 @@ stdenv.mkDerivation rec {
     chmod -R u+w .
   '';
 
+  patches = [
+    # fix for https://github.com/NixOS/nixpkgs/issues/269548
+    # https://github.com/llvm/llvm-project/pull/77218
+    (fetchpatch {
+      name = "darwin-system-libcxxabi-link-flags.patch";
+      url = "https://github.com/llvm/llvm-project/commit/c5b89b29ee6e3c444a355fd1cf733ce7ab2e316a.patch";
+      hash = "sha256-LNoPg1KCoP8RWxU/AzHR52f4Dww24I9BGQJedMhFxyQ=";
+      relative = "libcxx";
+    })
+  ] ++ lib.optionals (stdenv.isDarwin && lib.versionOlder stdenv.hostPlatform.darwinMinVersion "10.13") [
+    # https://github.com/llvm/llvm-project/issues/64226
+    (fetchpatch {
+      name = "0042-mbstate_t-not-defined.patch";
+      url = "https://github.com/macports/macports-ports/raw/acd8acb171f1658596ed1cf25da48d5b932e2d19/lang/llvm-17/files/0042-mbstate_t-not-defined.patch";
+      relative = "libcxx";
+      hash = "sha256-fVbX99W1gQrSaMFeBkzsJmNWNy0xVSw+oFvDe4AYXL0=";
+    })
+  ];
+
   postPatch = ''
     cd ../runtimes
   '';
diff --git a/nixpkgs/pkgs/development/compilers/llvm/17/libcxxabi/default.nix b/nixpkgs/pkgs/development/compilers/llvm/17/libcxxabi/default.nix
index 0a795da44ae4..30ca99b20fd7 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/17/libcxxabi/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/17/libcxxabi/default.nix
@@ -110,8 +110,5 @@ stdenv.mkDerivation rec {
     # the UIUC License (a BSD-like license)":
     license = with lib.licenses; [ mit ncsa ];
     maintainers = llvm_meta.maintainers ++ [ lib.maintainers.vlstill ];
-    # Broken until https://github.com/llvm/llvm-project/issues/64226 is resolved
-    # We should check if the version is not 10.13 but that is currently broken.
-    broken = stdenv.isDarwin && stdenv.isx86_64;
   };
 }
diff --git a/nixpkgs/pkgs/development/compilers/llvm/17/llvm/default.nix b/nixpkgs/pkgs/development/compilers/llvm/17/llvm/default.nix
index b38fef333135..627679ce812f 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/17/llvm/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/17/llvm/default.nix
@@ -330,7 +330,7 @@ stdenv.mkDerivation (rec {
   ] ++ optionals isDarwin [
     "-DLLVM_ENABLE_LIBCXX=ON"
     "-DCAN_TARGET_i386=false"
-  ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+  ] ++ optionals ((stdenv.hostPlatform != stdenv.buildPlatform) && !(stdenv.buildPlatform.canExecute stdenv.hostPlatform)) [
     "-DCMAKE_CROSSCOMPILING=True"
     "-DLLVM_TABLEGEN=${buildLlvmTools.llvm}/bin/llvm-tblgen"
     (
diff --git a/nixpkgs/pkgs/development/compilers/llvm/8/clang/HIP-use-PATH-8.patch b/nixpkgs/pkgs/development/compilers/llvm/8/clang/HIP-use-PATH-8.patch
deleted file mode 100644
index f4be100d1ab9..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/8/clang/HIP-use-PATH-8.patch
+++ /dev/null
@@ -1,80 +0,0 @@
-From d9f1b7d7571b252e0ba2359ae6cfa93a9903c0e7 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Holger=20W=C3=BCnsche?= <holger.o.wuensche@t-online.de>
-Date: Tue, 21 Jan 2020 19:49:44 +0100
-Subject: [PATCH] [HIP] use GetProgramPath for executable discovery
-
-This change replaces the manual building of executable paths
-using llvm::sys::path::append with GetProgramPath.
-This enables adding other paths in case executables reside
-in different directories and makes the code easier to read.
-
-Differential Revision: https://reviews.llvm.org/D72903
----
- clang/lib/Driver/ToolChains/HIP.cpp | 23 ++++++++---------------
- 1 file changed, 8 insertions(+), 15 deletions(-)
-
-diff --git a/lib/Driver/ToolChains/HIP.cpp b/lang/lib/Driver/ToolChains/HIP.cpp
-index 868765cf88e..31f2d68ec6c 100644
---- a/lib/Driver/ToolChains/HIP.cpp
-+++ b/lib/Driver/ToolChains/HIP.cpp
-@@ -104,9 +104,8 @@ const char *AMDGCN::Linker::constructLLVMLinkCommand(
-   const char *OutputFileName =
-       C.addTempFile(C.getArgs().MakeArgString(TmpName));
-   CmdArgs.push_back(OutputFileName);
--  SmallString<128> ExecPath(C.getDriver().Dir);
--  llvm::sys::path::append(ExecPath, "llvm-link");
--  const char *Exec = Args.MakeArgString(ExecPath);
-+  const char *Exec =
-+      Args.MakeArgString(getToolChain().GetProgramPath("llvm-link"));
-   C.addCommand(llvm::make_unique<Command>(JA, *this, Exec, CmdArgs, Inputs));
-   return OutputFileName;
- }
-@@ -147,9 +146,8 @@ const char *AMDGCN::Linker::constructOptCommand(
-   const char *OutputFileName =
-       C.addTempFile(C.getArgs().MakeArgString(TmpFileName));
-   OptArgs.push_back(OutputFileName);
--  SmallString<128> OptPath(C.getDriver().Dir);
--  llvm::sys::path::append(OptPath, "opt");
--  const char *OptExec = Args.MakeArgString(OptPath);
-+  const char *OptExec =
-+      Args.MakeArgString(getToolChain().GetProgramPath("opt"));
-   C.addCommand(llvm::make_unique<Command>(JA, *this, OptExec, OptArgs, Inputs));
-   return OutputFileName;
- }
-@@ -167,9 +165,7 @@ const char *AMDGCN::Linker::constructLlcCommand(
-   const char *LlcOutputFile =
-       C.addTempFile(C.getArgs().MakeArgString(LlcOutputFileName));
-   LlcArgs.push_back(LlcOutputFile);
--  SmallString<128> LlcPath(C.getDriver().Dir);
--  llvm::sys::path::append(LlcPath, "llc");
--  const char *Llc = Args.MakeArgString(LlcPath);
-+  const char *Llc = Args.MakeArgString(getToolChain().GetProgramPath("llc"));
-   C.addCommand(llvm::make_unique<Command>(JA, *this, Llc, LlcArgs, Inputs));
-   return LlcOutputFile;
- }
-@@ -184,9 +180,7 @@ void AMDGCN::Linker::constructLldCommand(Compilation &C, const JobAction &JA,
-   ArgStringList LldArgs{"-flavor",    "gnu", "--no-undefined",
-                         "-shared",    "-o",  Output.getFilename(),
-                         InputFileName};
--  SmallString<128> LldPath(C.getDriver().Dir);
--  llvm::sys::path::append(LldPath, "lld");
--  const char *Lld = Args.MakeArgString(LldPath);
-+  const char *Lld = Args.MakeArgString(getToolChain().GetProgramPath("lld"));
-   C.addCommand(llvm::make_unique<Command>(JA, *this, Lld, LldArgs, Inputs));
- }
- 
-@@ -218,9 +212,8 @@ void AMDGCN::constructHIPFatbinCommand(Compilation &C, const JobAction &JA,
-       Args.MakeArgString(std::string("-outputs=").append(OutputFileName));
-   BundlerArgs.push_back(BundlerOutputArg);
- 
--  SmallString<128> BundlerPath(C.getDriver().Dir);
--  llvm::sys::path::append(BundlerPath, "clang-offload-bundler");
--  const char *Bundler = Args.MakeArgString(BundlerPath);
-+  const char *Bundler = Args.MakeArgString(
-+          T.getToolChain().GetProgramPath("clang-offload-bundler"));
-   C.addCommand(llvm::make_unique<Command>(JA, T, Bundler, BundlerArgs, Inputs));
- }
- 
--- 
-2.23.1
-
diff --git a/nixpkgs/pkgs/development/compilers/llvm/8/clang/compiler-rt-baremetal.patch b/nixpkgs/pkgs/development/compilers/llvm/8/clang/compiler-rt-baremetal.patch
deleted file mode 100644
index a4a0f21b0fcd..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/8/clang/compiler-rt-baremetal.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-Index: lib/Driver/ToolChains/BareMetal.cpp
-===================================================================
---- a/lib/Driver/ToolChains/BareMetal.cpp
-+++ b/lib/Driver/ToolChains/BareMetal.cpp
-@@ -157,7 +157,7 @@
- void BareMetal::AddLinkRuntimeLib(const ArgList &Args,
-                                   ArgStringList &CmdArgs) const {
-   CmdArgs.push_back(Args.MakeArgString("-lclang_rt.builtins-" +
--                                       getTriple().getArchName() + ".a"));
-+                                       getTriple().getArchName()));
- }
- 
- void baremetal::Linker::ConstructJob(Compilation &C, const JobAction &JA,
-Index: test/Driver/baremetal.cpp
-===================================================================
---- a/test/Driver/baremetal.cpp
-+++ b/test/Driver/baremetal.cpp
-@@ -13,7 +13,7 @@
- // CHECK-V6M-C-NEXT: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" "{{.*}}.o" "-Bstatic"
- // CHECK-V6M-C-SAME: "-L[[RESOURCE_DIR:[^"]+]]{{[/\\]+}}lib{{[/\\]+}}baremetal"
- // CHECK-V6M-C-SAME: "-T" "semihosted.lds" "-Lsome{{[/\\]+}}directory{{[/\\]+}}user{{[/\\]+}}asked{{[/\\]+}}for"
--// CHECK-V6M-C-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a"
-+// CHECK-V6M-C-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m"
- // CHECK-V6M-C-SAME: "-o" "{{.*}}.o"
- 
- // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-@@ -35,7 +35,7 @@
- // CHECK-V6M-DEFAULTCXX: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" "{{.*}}.o" "-Bstatic"
- // CHECK-V6M-DEFAULTCXX-SAME: "-L{{[^"]*}}{{[/\\]+}}lib{{(64)?}}{{[/\\]+}}clang{{[/\\]+}}{{.*}}{{[/\\]+}}lib{{[/\\]+}}baremetal"
- // CHECK-V6M-DEFAULTCXX-SAME: "-lc++" "-lc++abi" "-lunwind"
--// CHECK-V6M-DEFAULTCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a"
-+// CHECK-V6M-DEFAULTCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m"
- // CHECK-V6M-DEFAULTCXX-SAME: "-o" "{{.*}}.o"
- 
- // RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-@@ -48,7 +48,7 @@
- // CHECK-V6M-LIBCXX: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" "{{.*}}.o" "-Bstatic"
- // CHECK-V6M-LIBCXX-SAME: "-L{{[^"]*}}{{[/\\]+}}lib{{(64)?}}{{[/\\]+}}clang{{[/\\]+}}{{.*}}{{[/\\]+}}lib{{[/\\]+}}baremetal"
- // CHECK-V6M-LIBCXX-SAME: "-lc++" "-lc++abi" "-lunwind"
--// CHECK-V6M-LIBCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a"
-+// CHECK-V6M-LIBCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m"
- // CHECK-V6M-LIBCXX-SAME: "-o" "{{.*}}.o"
- 
- // RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-@@ -61,7 +61,7 @@
- // CHECK-V6M-LIBSTDCXX: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" "{{.*}}.o" "-Bstatic"
- // CHECK-V6M-LIBSTDCXX-SAME: "-L{{[^"]*}}{{[/\\]+}}lib{{(64)?}}{{[/\\]+}}clang{{[/\\]+}}{{.*}}{{[/\\]+}}lib{{[/\\]+}}baremetal"
- // CHECK-V6M-LIBSTDCXX-SAME: "-lstdc++" "-lsupc++" "-lunwind"
--// CHECK-V6M-LIBSTDCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a"
-+// CHECK-V6M-LIBSTDCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m"
- // CHECK-V6M-LIBSTDCXX-SAME: "-o" "{{.*}}.o"
- 
- // RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \
diff --git a/nixpkgs/pkgs/development/compilers/llvm/8/clang/default.nix b/nixpkgs/pkgs/development/compilers/llvm/8/clang/default.nix
deleted file mode 100644
index 994f9bd967c4..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/8/clang/default.nix
+++ /dev/null
@@ -1,145 +0,0 @@
-{ lib, stdenv, llvm_meta, fetch, substituteAll, cmake, libxml2, libllvm, version, clang-tools-extra_src, python3
-, buildLlvmTools
-, fixDarwinDylibNames
-, enableManpages ? false
-, enablePolly ? false # TODO: get this info from llvm (passthru?)
-}:
-
-let
-  self = stdenv.mkDerivation ({
-    pname = "clang";
-    inherit version;
-
-    src = fetch "cfe" "0ihnbdl058gvl2wdy45p5am55bq8ifx8m9mhcsgj9ax8yxlzvvvh";
-
-    unpackPhase = ''
-      unpackFile $src
-      mv cfe-${version}* clang
-      sourceRoot=$PWD/clang
-      unpackFile ${clang-tools-extra_src}
-      mv clang-tools-extra-* $sourceRoot/tools/extra
-    '';
-
-    nativeBuildInputs = [ cmake python3 ]
-      ++ lib.optional enableManpages python3.pkgs.sphinx
-      ++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
-
-    buildInputs = [ libxml2 libllvm ];
-
-    cmakeFlags = [
-      "-DCMAKE_CXX_FLAGS=-std=c++11"
-      "-DCLANGD_BUILD_XPC=OFF"
-      "-DLLVM_ENABLE_RTTI=ON"
-    ] ++ 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.hostPlatform != stdenv.buildPlatform) [
-      "-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen"
-      "-DCLANG_TABLEGEN=${buildLlvmTools.libclang.dev}/bin/clang-tblgen"
-    ] ++ lib.optionals enablePolly [
-      "-DWITH_POLLY=ON"
-      "-DLINK_POLLY_INTO_TOOLS=ON"
-    ];
-
-    patches = [
-      ../../common/clang/5-8-purity.patch
-      ./xpc.patch
-      # Backport for -static-pie, which the latter touches, and which is nice in
-      # its own right.
-      ./static-pie.patch
-      # Backport for the `--unwindlib=[libgcc|compiler-rt]` flag, which is
-      # needed for our bootstrapping to not interfere with C.
-      ./unwindlib.patch
-      # https://reviews.llvm.org/D51899
-      ./compiler-rt-baremetal.patch
-      # make clang -xhip use $PATH to find executables
-      ./HIP-use-PATH-8.patch
-      ./gnu-install-dirs.patch
-      (substituteAll {
-        src = ../../clang-6-10-LLVMgold-path.patch;
-        libllvmLibdir = "${libllvm.lib}/lib";
-      })
-    ];
-
-    postPatch = ''
-      sed -i -e 's/DriverArgs.hasArg(options::OPT_nostdlibinc)/true/' \
-             -e 's/Args.hasArg(options::OPT_nostdlibinc)/true/' \
-             lib/Driver/ToolChains/*.cpp
-    '' + lib.optionalString stdenv.hostPlatform.isMusl ''
-      sed -i -e 's/lgcc_s/lgcc_eh/' lib/Driver/ToolChains/*.cpp
-    '' + lib.optionalString stdenv.hostPlatform.isDarwin ''
-      substituteInPlace tools/extra/clangd/CMakeLists.txt \
-        --replace "NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB" FALSE
-    '';
-
-    outputs = [ "out" "lib" "dev" "python" ];
-
-    postInstall = ''
-      ln -sv $out/bin/clang $out/bin/cpp
-
-      # Move libclang to 'lib' output
-      moveToOutput "lib/libclang.*" "$lib"
-      substituteInPlace $out/lib/cmake/clang/ClangTargets-release.cmake \
-          --replace "\''${_IMPORT_PREFIX}/lib/libclang." "$lib/lib/libclang."
-
-      mkdir -p $python/bin $python/share/{clang,scan-view}
-      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
-      mv $out/share/scan-view/*.py $python/share/scan-view
-      rm $out/bin/c-index-test
-      patchShebangs $python/bin
-
-      mkdir -p $dev/bin
-      cp bin/clang-tblgen $dev/bin
-    '';
-
-    passthru = {
-      inherit libllvm;
-      isClang = true;
-      hardeningUnsupportedFlags = [ "fortify3" ];
-    };
-
-    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";
-
-    buildPhase = ''
-      make 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/nixpkgs/pkgs/development/compilers/llvm/8/clang/gnu-install-dirs.patch b/nixpkgs/pkgs/development/compilers/llvm/8/clang/gnu-install-dirs.patch
deleted file mode 100644
index e4b9c3f8ddd6..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/8/clang/gnu-install-dirs.patch
+++ /dev/null
@@ -1,290 +0,0 @@
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index c2016a45ca6b..9224797da0b5 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -9,6 +9,8 @@ endif()
- if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
-   project(Clang)
- 
-+  include(GNUInstallDirs)
-+
-   # Rely on llvm-config.
-   set(CONFIG_OUTPUT)
-   if(LLVM_CONFIG)
-@@ -382,7 +384,7 @@ include_directories(BEFORE
- 
- if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
-   install(DIRECTORY include/clang include/clang-c
--    DESTINATION include
-+    DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
-     FILES_MATCHING
-     PATTERN "*.def"
-     PATTERN "*.h"
-@@ -391,7 +393,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
-     )
- 
-   install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/clang
--    DESTINATION include
-+    DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
-     FILES_MATCHING
-     PATTERN "CMakeFiles" EXCLUDE
-     PATTERN "*.inc"
-@@ -399,7 +401,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
-     )
- 
-   install(PROGRAMS utils/bash-autocomplete.sh
--    DESTINATION share/clang
-+    DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
-     )
- endif()
- 
-diff --git a/cmake/modules/AddClang.cmake b/cmake/modules/AddClang.cmake
-index 7e22f16f365b..3c0c1d245969 100644
---- a/cmake/modules/AddClang.cmake
-+++ b/cmake/modules/AddClang.cmake
-@@ -99,9 +99,9 @@ macro(add_clang_library name)
-       install(TARGETS ${name}
-         COMPONENT ${name}
-         ${export_to_clangtargets}
--        LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
--        ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
--        RUNTIME DESTINATION bin)
-+        LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
-+        ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
-+        RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
- 
-       if (${ARG_SHARED} AND NOT CMAKE_CONFIGURATION_TYPES)
-         add_llvm_install_targets(install-${name}
-@@ -142,7 +142,7 @@ macro(add_clang_tool name)
- 
-     install(TARGETS ${name}
-       ${export_to_clangtargets}
--      RUNTIME DESTINATION bin
-+      RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
-       COMPONENT ${name})
- 
-     if(NOT CMAKE_CONFIGURATION_TYPES)
-@@ -157,5 +157,5 @@ endmacro()
- macro(add_clang_symlink name dest)
-   add_llvm_tool_symlink(${name} ${dest} ALWAYS_GENERATE)
-   # Always generate install targets
--  llvm_install_symlink(${name} ${dest} ALWAYS_GENERATE)
-+  llvm_install_symlink(${name} ${dest} ${CMAKE_INSTALL_FULL_BINDIR} ALWAYS_GENERATE)
- endmacro()
-diff --git a/lib/Headers/CMakeLists.txt b/lib/Headers/CMakeLists.txt
-index e444c9c8706f..f8e4d06366a4 100644
---- a/lib/Headers/CMakeLists.txt
-+++ b/lib/Headers/CMakeLists.txt
-@@ -164,19 +164,19 @@ install(
-   FILES ${files} ${CMAKE_CURRENT_BINARY_DIR}/arm_neon.h
-   COMPONENT clang-headers
-   PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
--  DESTINATION lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
-+  DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
- 
- install(
-   FILES ${files} ${CMAKE_CURRENT_BINARY_DIR}/arm_fp16.h
-   COMPONENT clang-headers
-   PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
--  DESTINATION lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
-+  DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
- 
- install(
-   FILES ${cuda_wrapper_files}
-   COMPONENT clang-headers
-   PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
--  DESTINATION lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include/cuda_wrappers)
-+  DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include/cuda_wrappers)
- 
- if (NOT CMAKE_CONFIGURATION_TYPES) # don't add this for IDE's.
-   add_llvm_install_targets(install-clang-headers
-diff --git a/tools/c-index-test/CMakeLists.txt b/tools/c-index-test/CMakeLists.txt
-index 53e3421f1b35..79ae5bb4c399 100644
---- a/tools/c-index-test/CMakeLists.txt
-+++ b/tools/c-index-test/CMakeLists.txt
-@@ -54,7 +54,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
-     set_property(TARGET c-index-test APPEND PROPERTY INSTALL_RPATH
-        "@executable_path/../../lib")
-   else()
--    set(INSTALL_DESTINATION bin)
-+    set(INSTALL_DESTINATION ${CMAKE_INSTALL_BINDIR})
-   endif()
- 
-   install(TARGETS c-index-test
-diff --git a/tools/clang-check/CMakeLists.txt b/tools/clang-check/CMakeLists.txt
-index b837b0a0a5d9..9e30bd5780a5 100644
---- a/tools/clang-check/CMakeLists.txt
-+++ b/tools/clang-check/CMakeLists.txt
-@@ -21,4 +21,4 @@ target_link_libraries(clang-check
-   )
- 
- install(TARGETS clang-check
--  RUNTIME DESTINATION bin)
-+  RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
-diff --git a/tools/clang-extdef-mapping/CMakeLists.txt b/tools/clang-extdef-mapping/CMakeLists.txt
-index 6c81689a831a..dacc14737719 100644
---- a/tools/clang-extdef-mapping/CMakeLists.txt
-+++ b/tools/clang-extdef-mapping/CMakeLists.txt
-@@ -18,4 +18,4 @@ target_link_libraries(clang-extdef-mapping
-   )
- 
- install(TARGETS clang-extdef-mapping
--  RUNTIME DESTINATION bin)
-+  RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
-diff --git a/tools/clang-format/CMakeLists.txt b/tools/clang-format/CMakeLists.txt
-index a295e8cd0b2a..1973ff82c7f6 100644
---- a/tools/clang-format/CMakeLists.txt
-+++ b/tools/clang-format/CMakeLists.txt
-@@ -21,20 +21,20 @@ if( LLVM_LIB_FUZZING_ENGINE OR LLVM_USE_SANITIZE_COVERAGE )
- endif()
- 
- install(PROGRAMS clang-format-bbedit.applescript
--  DESTINATION share/clang
-+  DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
-   COMPONENT clang-format)
- install(PROGRAMS clang-format-diff.py
--  DESTINATION share/clang
-+  DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
-   COMPONENT clang-format)
- install(PROGRAMS clang-format-sublime.py
--  DESTINATION share/clang
-+  DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
-   COMPONENT clang-format)
- install(PROGRAMS clang-format.el
--  DESTINATION share/clang
-+  DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
-   COMPONENT clang-format)
- install(PROGRAMS clang-format.py
--  DESTINATION share/clang
-+  DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
-   COMPONENT clang-format)
- install(PROGRAMS git-clang-format
--  DESTINATION bin
-+  DESTINATION ${CMAKE_INSTALL_BINDIR}
-   COMPONENT clang-format)
-diff --git a/tools/clang-offload-bundler/CMakeLists.txt b/tools/clang-offload-bundler/CMakeLists.txt
-index 8718015be76a..7a038f39622e 100644
---- a/tools/clang-offload-bundler/CMakeLists.txt
-+++ b/tools/clang-offload-bundler/CMakeLists.txt
-@@ -22,4 +22,4 @@ target_link_libraries(clang-offload-bundler
-   ${CLANG_OFFLOAD_BUNDLER_LIB_DEPS}
-   )
- 
--install(TARGETS clang-offload-bundler RUNTIME DESTINATION bin)
-+install(TARGETS clang-offload-bundler RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
-diff --git a/tools/clang-rename/CMakeLists.txt b/tools/clang-rename/CMakeLists.txt
-index 45cbd763425c..f534e022024a 100644
---- a/tools/clang-rename/CMakeLists.txt
-+++ b/tools/clang-rename/CMakeLists.txt
-@@ -19,8 +19,8 @@ target_link_libraries(clang-rename
-   )
- 
- install(PROGRAMS clang-rename.py
--  DESTINATION share/clang
-+  DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
-   COMPONENT clang-rename)
- install(PROGRAMS clang-rename.el
--  DESTINATION share/clang
-+  DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
-   COMPONENT clang-rename)
-diff --git a/tools/diagtool/CMakeLists.txt b/tools/diagtool/CMakeLists.txt
-index 96d1c390249c..41c762b37b76 100644
---- a/tools/diagtool/CMakeLists.txt
-+++ b/tools/diagtool/CMakeLists.txt
-@@ -21,7 +21,7 @@ target_link_libraries(diagtool
- if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
-   install(TARGETS diagtool
-     COMPONENT diagtool
--    RUNTIME DESTINATION bin)
-+    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
- 
-   if (NOT CMAKE_CONFIGURATION_TYPES)
-     add_llvm_install_targets(install-diagtool
-diff --git a/tools/libclang/CMakeLists.txt b/tools/libclang/CMakeLists.txt
-index 32333b011ad1..258dfb2d520c 100644
---- a/tools/libclang/CMakeLists.txt
-+++ b/tools/libclang/CMakeLists.txt
-@@ -131,7 +131,7 @@ endif()
- if(INTERNAL_INSTALL_PREFIX)
-   set(LIBCLANG_HEADERS_INSTALL_DESTINATION "${INTERNAL_INSTALL_PREFIX}/include")
- else()
--  set(LIBCLANG_HEADERS_INSTALL_DESTINATION include)
-+  set(LIBCLANG_HEADERS_INSTALL_DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
- endif()
- 
- install(DIRECTORY ../../include/clang-c
-@@ -162,7 +162,7 @@ foreach(PythonVersion ${CLANG_PYTHON_BINDINGS_VERSIONS})
-           COMPONENT
-             libclang-python-bindings
-           DESTINATION
--            "lib${LLVM_LIBDIR_SUFFIX}/python${PythonVersion}/site-packages")
-+            "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/python${PythonVersion}/site-packages")
- endforeach()
- if(NOT CMAKE_CONFIGURATION_TYPES)
-   add_custom_target(libclang-python-bindings)
-diff --git a/tools/scan-build/CMakeLists.txt b/tools/scan-build/CMakeLists.txt
-index 380379300b09..adfd58ed5f7d 100644
---- a/tools/scan-build/CMakeLists.txt
-+++ b/tools/scan-build/CMakeLists.txt
-@@ -41,7 +41,7 @@ if(CLANG_INSTALL_SCANBUILD)
-                          ${CMAKE_BINARY_DIR}/bin/
-                        DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile})
-     list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${BinFile})
--    install(PROGRAMS bin/${BinFile} DESTINATION bin)
-+    install(PROGRAMS bin/${BinFile} DESTINATION ${CMAKE_INSTALL_BINDIR})
-   endforeach()
- 
-   foreach(LibexecFile ${LibexecFiles})
-@@ -53,7 +53,7 @@ if(CLANG_INSTALL_SCANBUILD)
-                          ${CMAKE_BINARY_DIR}/libexec/
-                        DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libexec/${LibexecFile})
-     list(APPEND Depends ${CMAKE_BINARY_DIR}/libexec/${LibexecFile})
--    install(PROGRAMS libexec/${LibexecFile} DESTINATION libexec)
-+    install(PROGRAMS libexec/${LibexecFile} DESTINATION ${CMAKE_INSTALL_LIBEXECDIR})
-   endforeach()
- 
-   foreach(ManPage ${ManPages})
-@@ -77,7 +77,7 @@ if(CLANG_INSTALL_SCANBUILD)
-                          ${CMAKE_BINARY_DIR}/share/scan-build/
-                        DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/share/scan-build/${ShareFile})
-     list(APPEND Depends ${CMAKE_BINARY_DIR}/share/scan-build/${ShareFile})
--    install(FILES share/scan-build/${ShareFile} DESTINATION share/scan-build)
-+    install(FILES share/scan-build/${ShareFile} DESTINATION ${CMAKE_INSTALL_DATADIR}/scan-build)
-   endforeach()
- 
-   add_custom_target(scan-build ALL DEPENDS ${Depends})
-diff --git a/tools/scan-view/CMakeLists.txt b/tools/scan-view/CMakeLists.txt
-index b305ca562a72..554bcb379061 100644
---- a/tools/scan-view/CMakeLists.txt
-+++ b/tools/scan-view/CMakeLists.txt
-@@ -21,7 +21,7 @@ if(CLANG_INSTALL_SCANVIEW)
-                          ${CMAKE_BINARY_DIR}/bin/
-                        DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile})
-     list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${BinFile})
--    install(PROGRAMS bin/${BinFile} DESTINATION bin)
-+    install(PROGRAMS bin/${BinFile} DESTINATION ${CMAKE_INSTALL_BINDIR})
-   endforeach()
- 
-   foreach(ShareFile ${ShareFiles})
-@@ -33,7 +33,7 @@ if(CLANG_INSTALL_SCANVIEW)
-                          ${CMAKE_BINARY_DIR}/share/scan-view/
-                        DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/share/${ShareFile})
-     list(APPEND Depends ${CMAKE_BINARY_DIR}/share/scan-view/${ShareFile})
--    install(FILES share/${ShareFile} DESTINATION share/scan-view)
-+    install(FILES share/${ShareFile} DESTINATION ${CMAKE_INSTALL_DATADIR}/scan-view)
-   endforeach()
- 
-   add_custom_target(scan-view ALL DEPENDS ${Depends})
-diff --git a/utils/hmaptool/CMakeLists.txt b/utils/hmaptool/CMakeLists.txt
-index 5573009d343a..24b3a90f233f 100644
---- a/utils/hmaptool/CMakeLists.txt
-+++ b/utils/hmaptool/CMakeLists.txt
-@@ -9,7 +9,7 @@ add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/${CLANG_HM
-                    DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${CLANG_HMAPTOOL})
- 
- list(APPEND Depends ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/${CLANG_HMAPTOOL})
--install(PROGRAMS ${CLANG_HMAPTOOL} DESTINATION bin)
-+install(PROGRAMS ${CLANG_HMAPTOOL} DESTINATION ${CMAKE_INSTALL_BINDIR})
- 
- add_custom_target(hmaptool ALL DEPENDS ${Depends})
- set_target_properties(hmaptool PROPERTIES FOLDER "Utils")
diff --git a/nixpkgs/pkgs/development/compilers/llvm/8/clang/static-pie.patch b/nixpkgs/pkgs/development/compilers/llvm/8/clang/static-pie.patch
deleted file mode 100644
index d1f86a162327..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/8/clang/static-pie.patch
+++ /dev/null
@@ -1,157 +0,0 @@
-commit 7a9842bc92921e79b84630045276861be90b2d47
-Author: Siva Chandra <sivachandra@google.com>
-Date:   Wed Feb 20 19:07:04 2019 +0000
-
-    [Clang Driver] Add support for "-static-pie" argument to the Clang driver.
-    
-    Summary: This change mimics GCC's support for the "-static-pie" argument.
-    
-    Subscribers: cfe-commits
-    
-    Tags: #clang
-    
-    Differential Revision: https://reviews.llvm.org/D58307
-    
-    git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@354502 91177308-0d34-0410-b5e6-96231b3b80d8
-    (cherry picked from commit 7d6cd7825e6883f8650e32b07f3750824c2cef62)
-
-diff --git a/include/clang/Driver/Options.td b/include/clang/Driver/Options.td
-index d02d9744d7..75a21e66c7 100644
---- a/include/clang/Driver/Options.td
-+++ b/include/clang/Driver/Options.td
-@@ -2502,6 +2502,7 @@ def pthread : Flag<["-"], "pthread">, Flags<[CC1Option]>,
- def no_pthread : Flag<["-"], "no-pthread">, Flags<[CC1Option]>;
- def p : Flag<["-"], "p">;
- def pie : Flag<["-"], "pie">;
-+def static_pie : Flag<["-"], "static-pie">;
- def read__only__relocs : Separate<["-"], "read_only_relocs">;
- def remap : Flag<["-"], "remap">;
- def rewrite_objc : Flag<["-"], "rewrite-objc">, Flags<[DriverOption,CC1Option]>,
-diff --git a/lib/Driver/ToolChains/CommonArgs.cpp b/lib/Driver/ToolChains/CommonArgs.cpp
-index d7e316befa..85ffc1618d 100644
---- a/lib/Driver/ToolChains/CommonArgs.cpp
-+++ b/lib/Driver/ToolChains/CommonArgs.cpp
-@@ -1138,19 +1138,22 @@ static void AddLibgcc(const llvm::Triple &Triple, const Driver &D,
-   bool isCygMing = Triple.isOSCygMing();
-   bool IsIAMCU = Triple.isOSIAMCU();
-   bool StaticLibgcc = Args.hasArg(options::OPT_static_libgcc) ||
--                      Args.hasArg(options::OPT_static);
-+                      Args.hasArg(options::OPT_static) ||
-+                      Args.hasArg(options::OPT_static_pie);
- 
-   bool SharedLibgcc = Args.hasArg(options::OPT_shared_libgcc);
-   bool UnspecifiedLibgcc = !StaticLibgcc && !SharedLibgcc;
- 
-   // Gcc adds libgcc arguments in various ways:
-   //
--  // gcc <none>: -lgcc --as-needed -lgcc_s --no-as-needed
--  // g++ <none>:                   -lgcc_s               -lgcc
--  // gcc shared:                   -lgcc_s               -lgcc
--  // g++ shared:                   -lgcc_s               -lgcc
--  // gcc static: -lgcc             -lgcc_eh
--  // g++ static: -lgcc             -lgcc_eh
-+  // gcc <none>:     -lgcc --as-needed -lgcc_s --no-as-needed
-+  // g++ <none>:                       -lgcc_s               -lgcc
-+  // gcc shared:                       -lgcc_s               -lgcc
-+  // g++ shared:                       -lgcc_s               -lgcc
-+  // gcc static:     -lgcc             -lgcc_eh
-+  // g++ static:     -lgcc             -lgcc_eh
-+  // gcc static-pie: -lgcc             -lgcc_eh
-+  // g++ static-pie: -lgcc             -lgcc_eh
-   //
-   // Also, certain targets need additional adjustments.
- 
-diff --git a/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp
-index 69dba8fec8..0faa0bb473 100644
---- a/lib/Driver/ToolChains/Gnu.cpp
-+++ b/lib/Driver/ToolChains/Gnu.cpp
-@@ -334,6 +334,7 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
-   const bool isAndroid = ToolChain.getTriple().isAndroid();
-   const bool IsIAMCU = ToolChain.getTriple().isOSIAMCU();
-   const bool IsPIE = getPIE(Args, ToolChain);
-+  const bool IsStaticPIE = Args.hasArg(options::OPT_static_pie);
-   const bool HasCRTBeginEndFiles =
-       ToolChain.getTriple().hasEnvironment() ||
-       (ToolChain.getTriple().getVendor() != llvm::Triple::MipsTechnologies);
-@@ -354,6 +355,12 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
-   if (IsPIE)
-     CmdArgs.push_back("-pie");
- 
-+  if (IsStaticPIE) {
-+    CmdArgs.push_back("-static");
-+    CmdArgs.push_back("-pie");
-+    CmdArgs.push_back("--no-dynamic-linker");
-+  }
-+
-   if (Args.hasArg(options::OPT_rdynamic))
-     CmdArgs.push_back("-export-dynamic");
- 
-@@ -415,6 +422,8 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
-           crt1 = "gcrt1.o";
-         else if (IsPIE)
-           crt1 = "Scrt1.o";
-+        else if (IsStaticPIE)
-+          crt1 = "rcrt1.o";
-         else
-           crt1 = "crt1.o";
-       }
-@@ -432,7 +441,7 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
-         crtbegin = isAndroid ? "crtbegin_static.o" : "crtbeginT.o";
-       else if (Args.hasArg(options::OPT_shared))
-         crtbegin = isAndroid ? "crtbegin_so.o" : "crtbeginS.o";
--      else if (IsPIE)
-+      else if (IsPIE || IsStaticPIE)
-         crtbegin = isAndroid ? "crtbegin_dynamic.o" : "crtbeginS.o";
-       else
-         crtbegin = isAndroid ? "crtbegin_dynamic.o" : "crtbegin.o";
-@@ -483,7 +492,7 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
- 
-   if (!Args.hasArg(options::OPT_nostdlib)) {
-     if (!Args.hasArg(options::OPT_nodefaultlibs)) {
--      if (Args.hasArg(options::OPT_static))
-+      if (Args.hasArg(options::OPT_static) || IsStaticPIE)
-         CmdArgs.push_back("--start-group");
- 
-       if (NeedsSanitizerDeps)
-@@ -518,7 +527,7 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
-       if (IsIAMCU)
-         CmdArgs.push_back("-lgloss");
- 
--      if (Args.hasArg(options::OPT_static))
-+      if (Args.hasArg(options::OPT_static) || IsStaticPIE)
-         CmdArgs.push_back("--end-group");
-       else
-         AddRunTimeLibs(ToolChain, D, CmdArgs, Args);
-@@ -535,7 +544,7 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
-       const char *crtend;
-       if (Args.hasArg(options::OPT_shared))
-         crtend = isAndroid ? "crtend_so.o" : "crtendS.o";
--      else if (IsPIE)
-+      else if (IsPIE || IsStaticPIE)
-         crtend = isAndroid ? "crtend_android.o" : "crtendS.o";
-       else
-         crtend = isAndroid ? "crtend_android.o" : "crtend.o";
-diff --git a/test/Driver/linux-ld.c b/test/Driver/linux-ld.c
-index 3ab81be490..800f782523 100644
---- a/test/Driver/linux-ld.c
-+++ b/test/Driver/linux-ld.c
-@@ -176,6 +176,19 @@
- // CHECK-CLANG-NO-LIBGCC-STATIC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
- // CHECK-CLANG-NO-LIBGCC-STATIC: "--start-group" "-lgcc" "-lgcc_eh" "-lc" "--end-group"
- //
-+// RUN: %clang -static-pie -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-+// RUN:     --target=x86_64-unknown-linux -rtlib=platform \
-+// RUN:     --gcc-toolchain="" \
-+// RUN:     --sysroot=%S/Inputs/basic_linux_tree \
-+// RUN:   | FileCheck --check-prefix=CHECK-CLANG-LD-STATIC-PIE %s
-+// CHECK-CLANG-LD-STATIC-PIE: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
-+// CHECK-CLANG-LD-STATIC-PIE: "-static"
-+// CHECK-CLANG-LD-STATIC-PIE: "-pie"
-+// CHECK-CLANG-LD-STATIC-PIE: "--no-dynamic-linker"
-+// CHECK-CLANG-LD-STATIC-PIE: "-m" "elf_x86_64"
-+// CHECK-CLANG-LD-STATIC-PIE: "{{.*}}rcrt1.o"
-+// CHECK-CLANG-LD-STATIC-PIE: "--start-group" "-lgcc" "-lgcc_eh" "-lc" "--end-group"
-+//
- // RUN: %clang -dynamic -no-canonical-prefixes %s -### -o %t.o 2>&1 \
- // RUN:     --target=x86_64-unknown-linux -rtlib=platform \
- // RUN:     --gcc-toolchain="" \
diff --git a/nixpkgs/pkgs/development/compilers/llvm/8/clang/unwindlib.patch b/nixpkgs/pkgs/development/compilers/llvm/8/clang/unwindlib.patch
deleted file mode 100644
index 6958fce60cef..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/8/clang/unwindlib.patch
+++ /dev/null
@@ -1,372 +0,0 @@
-commit cd5603a4767277a29d3e67a9c3f2a5d2129cd973
-Author: Sterling Augustine <saugustine@google.com>
-Date:   Tue Mar 19 20:01:59 2019 +0000
-
-    Add --unwindlib=[libgcc|compiler-rt] to parallel --rtlib= [take 2]
-    
-    "clang++ hello.cc --rtlib=compiler-rt"
-    
-    now can works without specifying additional unwind or exception
-    handling libraries.
-    
-    This reworked version of the feature no longer modifies today's default
-    unwind library for compiler-rt: which is nothing. Rather, a user
-    can specify -DCLANG_DEFAULT_UNWINDLIB=libunwind when configuring
-    the compiler.
-    
-    This should address the issues from the previous version.
-    
-    Update tests for new --unwindlib semantics.
-    
-    Differential Revision: https://reviews.llvm.org/D59109
-    
-    git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@356508 91177308-0d34-0410-b5e6-96231b3b80d8
-    (cherry picked from commit 344aa82a52f2fae527f58284567ae305a314f7a8)
-
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index c2016a45ca..edeb2b66a1 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -261,6 +261,24 @@ if (NOT(CLANG_DEFAULT_RTLIB STREQUAL "" OR
-     "Default runtime library to use (\"libgcc\" or \"compiler-rt\", empty for platform default)" FORCE)
- endif()
- 
-+set(CLANG_DEFAULT_UNWINDLIB "" CACHE STRING
-+  "Default unwind library to use (\"none\" \"libgcc\" or \"libunwind\", empty to match runtime library.)")
-+if (CLANG_DEFAULT_UNWINDLIB STREQUAL "")
-+  if (CLANG_DEFAULT_RTLIB STREQUAL "libgcc")
-+    set (CLANG_DEFAULT_UNWINDLIB "libgcc" CACHE STRING "" FORCE)
-+  elseif (CLANG_DEFAULT_RTLIBS STREQUAL "libunwind")
-+    set (CLANG_DEFAULT_UNWINDLIB "none" CACHE STRING "" FORCE)
-+  endif()
-+endif()
-+
-+if (NOT(CLANG_DEFAULT_UNWINDLIB STREQUAL "none" OR
-+        CLANG_DEFAULT_UNWINDLIB STREQUAL "libgcc" OR
-+        CLANG_DEFAULT_UNWINDLIB STREQUAL "libunwind"))
-+  message(WARNING "Resetting default unwindlib to use platform default")
-+  set(CLANG_DEFAULT_UNWINDLIB "" CACHE STRING
-+    "Default unwind library to use (\"none\" \"libgcc\" or \"libunwind\", empty for none)" FORCE)
-+endif()
-+
- set(CLANG_DEFAULT_OBJCOPY "objcopy" CACHE STRING
-   "Default objcopy executable to use.")
- 
-diff --git a/include/clang/Basic/DiagnosticDriverKinds.td b/include/clang/Basic/DiagnosticDriverKinds.td
-index 5475e28ed7..15971210e4 100644
---- a/include/clang/Basic/DiagnosticDriverKinds.td
-+++ b/include/clang/Basic/DiagnosticDriverKinds.td
-@@ -52,6 +52,10 @@ def err_drv_invalid_rtlib_name : Error<
-   "invalid runtime library name in argument '%0'">;
- def err_drv_unsupported_rtlib_for_platform : Error<
-   "unsupported runtime library '%0' for platform '%1'">;
-+def err_drv_invalid_unwindlib_name : Error<
-+  "invalid unwind library name in argument '%0'">;
-+def err_drv_incompatible_unwindlib : Error<
-+  "--rtlib=libgcc requires --unwindlib=libgcc">;
- def err_drv_invalid_stdlib_name : Error<
-   "invalid library name in argument '%0'">;
- def err_drv_invalid_output_with_multiple_archs : Error<
-diff --git a/include/clang/Config/config.h.cmake b/include/clang/Config/config.h.cmake
-index 1d624450b9..2d4cb747e8 100644
---- a/include/clang/Config/config.h.cmake
-+++ b/include/clang/Config/config.h.cmake
-@@ -23,6 +23,9 @@
- /* Default runtime library to use. */
- #define CLANG_DEFAULT_RTLIB "${CLANG_DEFAULT_RTLIB}"
- 
-+/* Default unwind library to use. */
-+#define CLANG_DEFAULT_UNWINDLIB "${CLANG_DEFAULT_UNWINDLIB}"
-+
- /* Default objcopy to use */
- #define CLANG_DEFAULT_OBJCOPY "${CLANG_DEFAULT_OBJCOPY}"
- 
-diff --git a/include/clang/Driver/Options.td b/include/clang/Driver/Options.td
-index 75a21e66c7..4da0e54965 100644
---- a/include/clang/Driver/Options.td
-+++ b/include/clang/Driver/Options.td
-@@ -2570,6 +2570,8 @@ def std_EQ : Joined<["-", "--"], "std=">, Flags<[CC1Option]>,
-   }]>;
- def stdlib_EQ : Joined<["-", "--"], "stdlib=">, Flags<[CC1Option]>,
-   HelpText<"C++ standard library to use">, Values<"libc++,libstdc++,platform">;
-+def unwindlib_EQ : Joined<["-", "--"], "unwindlib=">, Flags<[CC1Option]>,
-+  HelpText<"Unwind library to use">, Values<"libgcc,unwindlib,platform">;
- def sub__library : JoinedOrSeparate<["-"], "sub_library">;
- def sub__umbrella : JoinedOrSeparate<["-"], "sub_umbrella">;
- def system_header_prefix : Joined<["--"], "system-header-prefix=">,
-diff --git a/include/clang/Driver/ToolChain.h b/include/clang/Driver/ToolChain.h
-index d5f75b8271..4bedf760eb 100644
---- a/include/clang/Driver/ToolChain.h
-+++ b/include/clang/Driver/ToolChain.h
-@@ -100,6 +100,12 @@ public:
-     RLT_Libgcc
-   };
- 
-+  enum UnwindLibType {
-+    UNW_None,
-+    UNW_CompilerRT,
-+    UNW_Libgcc
-+  };
-+
-   enum RTTIMode {
-     RM_Enabled,
-     RM_Disabled,
-@@ -368,6 +374,10 @@ public:
-     return ToolChain::CST_Libstdcxx;
-   }
- 
-+  virtual UnwindLibType GetDefaultUnwindLibType() const {
-+    return ToolChain::UNW_None;
-+  }
-+
-   virtual std::string getCompilerRTPath() const;
- 
-   virtual std::string getCompilerRT(const llvm::opt::ArgList &Args,
-@@ -512,6 +522,10 @@ public:
-   // given compilation arguments.
-   virtual CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const;
- 
-+  // GetUnwindLibType - Determine the unwind library type to use with the
-+  // given compilation arguments.
-+  virtual UnwindLibType GetUnwindLibType(const llvm::opt::ArgList &Args) const;
-+
-   /// AddClangCXXStdlibIncludeArgs - Add the clang -cc1 level arguments to set
-   /// the include paths to use for the given C++ standard library type.
-   virtual void
-diff --git a/lib/Driver/ToolChain.cpp b/lib/Driver/ToolChain.cpp
-index 88a627eab6..d82423f4a8 100644
---- a/lib/Driver/ToolChain.cpp
-+++ b/lib/Driver/ToolChain.cpp
-@@ -680,6 +680,33 @@ ToolChain::RuntimeLibType ToolChain::GetRuntimeLibType(
-   return GetDefaultRuntimeLibType();
- }
- 
-+ToolChain::UnwindLibType ToolChain::GetUnwindLibType(
-+    const ArgList &Args) const {
-+  const Arg *A = Args.getLastArg(options::OPT_unwindlib_EQ);
-+  StringRef LibName = A ? A->getValue() : CLANG_DEFAULT_UNWINDLIB;
-+
-+  if (LibName == "none")
-+    return ToolChain::UNW_None;
-+  else if (LibName == "platform" || LibName == "") {
-+    ToolChain::RuntimeLibType RtLibType = GetRuntimeLibType(Args);
-+    if (RtLibType == ToolChain::RLT_CompilerRT)
-+      return ToolChain::UNW_None;
-+    else if (RtLibType == ToolChain::RLT_Libgcc)
-+      return ToolChain::UNW_Libgcc;
-+  } else if (LibName == "libunwind") {
-+    if (GetRuntimeLibType(Args) == RLT_Libgcc)
-+      getDriver().Diag(diag::err_drv_incompatible_unwindlib);
-+    return ToolChain::UNW_CompilerRT;
-+  } else if (LibName == "libgcc")
-+    return ToolChain::UNW_Libgcc;
-+
-+  if (A)
-+    getDriver().Diag(diag::err_drv_invalid_unwindlib_name)
-+        << A->getAsString(Args);
-+
-+  return GetDefaultUnwindLibType();
-+}
-+
- ToolChain::CXXStdlibType ToolChain::GetCXXStdlibType(const ArgList &Args) const{
-   const Arg *A = Args.getLastArg(options::OPT_stdlib_EQ);
-   StringRef LibName = A ? A->getValue() : CLANG_DEFAULT_CXX_STDLIB;
-diff --git a/lib/Driver/ToolChains/CommonArgs.cpp b/lib/Driver/ToolChains/CommonArgs.cpp
-index 85ffc1618d..9fd29726a4 100644
---- a/lib/Driver/ToolChains/CommonArgs.cpp
-+++ b/lib/Driver/ToolChains/CommonArgs.cpp
-@@ -1132,47 +1132,80 @@ bool tools::isObjCAutoRefCount(const ArgList &Args) {
-   return Args.hasFlag(options::OPT_fobjc_arc, options::OPT_fno_objc_arc, false);
- }
- 
--static void AddLibgcc(const llvm::Triple &Triple, const Driver &D,
--                      ArgStringList &CmdArgs, const ArgList &Args) {
--  bool isAndroid = Triple.isAndroid();
--  bool isCygMing = Triple.isOSCygMing();
--  bool IsIAMCU = Triple.isOSIAMCU();
--  bool StaticLibgcc = Args.hasArg(options::OPT_static_libgcc) ||
--                      Args.hasArg(options::OPT_static) ||
--                      Args.hasArg(options::OPT_static_pie);
--
--  bool SharedLibgcc = Args.hasArg(options::OPT_shared_libgcc);
--  bool UnspecifiedLibgcc = !StaticLibgcc && !SharedLibgcc;
--
--  // Gcc adds libgcc arguments in various ways:
--  //
--  // gcc <none>:     -lgcc --as-needed -lgcc_s --no-as-needed
--  // g++ <none>:                       -lgcc_s               -lgcc
--  // gcc shared:                       -lgcc_s               -lgcc
--  // g++ shared:                       -lgcc_s               -lgcc
--  // gcc static:     -lgcc             -lgcc_eh
--  // g++ static:     -lgcc             -lgcc_eh
--  // gcc static-pie: -lgcc             -lgcc_eh
--  // g++ static-pie: -lgcc             -lgcc_eh
--  //
--  // Also, certain targets need additional adjustments.
-+enum class LibGccType { UnspecifiedLibGcc, StaticLibGcc, SharedLibGcc };
-+
-+static LibGccType getLibGccType(const ArgList &Args) {
-+  bool Static = Args.hasArg(options::OPT_static_libgcc) ||
-+                Args.hasArg(options::OPT_static) ||
-+                Args.hasArg(options::OPT_static_pie);
-+
-+  bool Shared = Args.hasArg(options::OPT_shared_libgcc);
-+  if (Shared)
-+    return LibGccType::SharedLibGcc;
-+  if (Static)
-+    return LibGccType::StaticLibGcc;
-+  return LibGccType::UnspecifiedLibGcc;
-+}
- 
--  bool LibGccFirst = (D.CCCIsCC() && UnspecifiedLibgcc) || StaticLibgcc;
--  if (LibGccFirst)
--    CmdArgs.push_back("-lgcc");
-+// Gcc adds libgcc arguments in various ways:
-+//
-+// gcc <none>:     -lgcc --as-needed -lgcc_s --no-as-needed
-+// g++ <none>:                       -lgcc_s               -lgcc
-+// gcc shared:                       -lgcc_s               -lgcc
-+// g++ shared:                       -lgcc_s               -lgcc
-+// gcc static:     -lgcc             -lgcc_eh
-+// g++ static:     -lgcc             -lgcc_eh
-+// gcc static-pie: -lgcc             -lgcc_eh
-+// g++ static-pie: -lgcc             -lgcc_eh
-+//
-+// Also, certain targets need additional adjustments.
-+
-+static void AddUnwindLibrary(const ToolChain &TC, const Driver &D,
-+                             ArgStringList &CmdArgs, const ArgList &Args) {
-+  ToolChain::UnwindLibType UNW = TC.GetUnwindLibType(Args);
-+  // Targets that don't use unwind libraries.
-+  if (TC.getTriple().isAndroid() || TC.getTriple().isOSIAMCU() ||
-+      TC.getTriple().isOSBinFormatWasm() ||
-+      UNW == ToolChain::UNW_None)
-+    return;
- 
--  bool AsNeeded = D.CCCIsCC() && UnspecifiedLibgcc && !isAndroid && !isCygMing;
-+  LibGccType LGT = getLibGccType(Args);
-+  bool AsNeeded = D.CCCIsCC() && LGT == LibGccType::UnspecifiedLibGcc &&
-+                  !TC.getTriple().isAndroid() && !TC.getTriple().isOSCygMing();
-   if (AsNeeded)
-     CmdArgs.push_back("--as-needed");
- 
--  if ((UnspecifiedLibgcc || SharedLibgcc) && !isAndroid)
--    CmdArgs.push_back("-lgcc_s");
--
--  else if (StaticLibgcc && !isAndroid && !IsIAMCU)
--    CmdArgs.push_back("-lgcc_eh");
-+  switch (UNW) {
-+  case ToolChain::UNW_None:
-+    return;
-+  case ToolChain::UNW_Libgcc: {
-+    LibGccType LGT = getLibGccType(Args);
-+    if (LGT == LibGccType::UnspecifiedLibGcc || LGT == LibGccType::SharedLibGcc)
-+      CmdArgs.push_back("-lgcc_s");
-+    else if (LGT == LibGccType::StaticLibGcc)
-+      CmdArgs.push_back("-lgcc_eh");
-+    break;
-+  }
-+  case ToolChain::UNW_CompilerRT:
-+    CmdArgs.push_back("-lunwind");
-+    break;
-+  }
- 
-   if (AsNeeded)
-     CmdArgs.push_back("--no-as-needed");
-+}
-+
-+static void AddLibgcc(const ToolChain &TC, const Driver &D,
-+                      ArgStringList &CmdArgs, const ArgList &Args) {
-+  bool isAndroid = TC.getTriple().isAndroid();
-+
-+  LibGccType LGT = getLibGccType(Args);
-+  bool LibGccFirst = (D.CCCIsCC() && LGT == LibGccType::UnspecifiedLibGcc) ||
-+                     LGT == LibGccType::StaticLibGcc;
-+  if (LibGccFirst)
-+    CmdArgs.push_back("-lgcc");
-+
-+  AddUnwindLibrary(TC, D, CmdArgs, Args);
- 
-   if (!LibGccFirst)
-     CmdArgs.push_back("-lgcc");
-@@ -1182,7 +1215,7 @@ static void AddLibgcc(const llvm::Triple &Triple, const Driver &D,
-   //
-   // NOTE: This fixes a link error on Android MIPS as well.  The non-static
-   // libgcc for MIPS relies on _Unwind_Find_FDE and dl_iterate_phdr from libdl.
--  if (isAndroid && !StaticLibgcc)
-+  if (isAndroid && getLibGccType(Args) != LibGccType::StaticLibGcc)
-     CmdArgs.push_back("-ldl");
- }
- 
-@@ -1194,6 +1227,7 @@ void tools::AddRunTimeLibs(const ToolChain &TC, const Driver &D,
-   switch (RLT) {
-   case ToolChain::RLT_CompilerRT:
-     CmdArgs.push_back(TC.getCompilerRTArgString(Args, "builtins"));
-+    AddUnwindLibrary(TC, D, CmdArgs, Args);
-     break;
-   case ToolChain::RLT_Libgcc:
-     // Make sure libgcc is not used under MSVC environment by default
-@@ -1205,7 +1239,7 @@ void tools::AddRunTimeLibs(const ToolChain &TC, const Driver &D,
-             << Args.getLastArg(options::OPT_rtlib_EQ)->getValue() << "MSVC";
-       }
-     } else
--      AddLibgcc(TC.getTriple(), D, CmdArgs, Args);
-+      AddLibgcc(TC, D, CmdArgs, Args);
-     break;
-   }
- }
-diff --git a/test/Driver/compiler-rt-unwind.c b/test/Driver/compiler-rt-unwind.c
-new file mode 100644
-index 0000000000..00024dfa7e
---- /dev/null
-+++ b/test/Driver/compiler-rt-unwind.c
-@@ -0,0 +1,49 @@
-+// General tests that the driver handles combinations of --rtlib=XXX and
-+// --unwindlib=XXX properly.
-+//
-+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-+// RUN:     --target=x86_64-unknown-linux \
-+// RUN:     --gcc-toolchain="" \
-+// RUN:   | FileCheck --check-prefix=RTLIB-EMPTY %s
-+// RTLIB-EMPTY: "{{.*}}lgcc"
-+// RTLIB-EMPTY: "{{.*}}-lgcc_s"
-+//
-+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-+// RUN:     --target=x86_64-unknown-linux -rtlib=libgcc \
-+// RUN:     --gcc-toolchain="" \
-+// RUN:   | FileCheck --check-prefix=RTLIB-GCC %s
-+// RTLIB-GCC: "{{.*}}lgcc"
-+// RTLIB-GCC: "{{.*}}lgcc_s"
-+//
-+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-+// RUN:     --target=x86_64-unknown-linux -rtlib=libgcc --unwindlib=libunwind \
-+// RUN:     --gcc-toolchain="" \
-+// RUN:   | FileCheck --check-prefix=RTLIB-GCC-UNWINDLIB-COMPILER-RT %s
-+// RTLIB-GCC-UNWINDLIB-COMPILER-RT: "{{.*}}lgcc"
-+// RTLIB-GCC-UNWINDLIB-COMPILER-RT: "{{.*}}lunwind"
-+//
-+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1   \
-+// RUN:     --target=x86_64-unknown-linux -rtlib=compiler-rt \
-+// RUN:     --gcc-toolchain="" \
-+// RUN:   | FileCheck --check-prefix=RTLIB-COMPILER-RT %s
-+// RTLIB-COMPILER-RT: "{{.*}}libclang_rt.builtins-x86_64.a"
-+//
-+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1   \
-+// RUN:     --target=x86_64-unknown-linux -rtlib=compiler-rt --unwindlib=libgcc \
-+// RUN:     --gcc-toolchain="" \
-+// RUN:   | FileCheck --check-prefix=RTLIB-COMPILER-RT-UNWINDLIB-GCC %s
-+// RTLIB-COMPILER-RT-UNWINDLIB-GCC: "{{.*}}libclang_rt.builtins-x86_64.a"
-+// RTLIB-COMPILER-RT-UNWINDLIB-GCC: "{{.*}}lgcc_s"
-+//
-+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1              \
-+// RUN:     --target=x86_64-unknown-linux -rtlib=compiler-rt --unwindlib=libgcc \
-+// RUN:     -static --gcc-toolchain="" \
-+// RUN:   | FileCheck --check-prefix=RTLIB-COMPILER-RT-UNWINDLIB-GCC-STATIC %s
-+// RTLIB-COMPILER-RT-UNWINDLIB-GCC-STATIC: "{{.*}}libclang_rt.builtins-x86_64.a"
-+// RTLIB-COMPILER-RT-UNWINDLIB-GCC-STATIC: "{{.*}}lgcc_eh"
-+//
-+// RUN: not %clang -no-canonical-prefixes %s -o %t.o 2> %t.err              \
-+// RUN:     --target=x86_64-unknown-linux -rtlib=libgcc --unwindlib=libunwind \
-+// RUN:     --gcc-toolchain="" \
-+// RUN: FileCheck --input-file=%t.err --check-prefix=RTLIB-GCC-UNWINDLIB-COMPILER_RT %s
-+// RTLIB-GCC-UNWINDLIB-COMPILER_RT: "{{[.|\\\n]*}}--rtlib=libgcc requires --unwindlib=libgcc"
diff --git a/nixpkgs/pkgs/development/compilers/llvm/8/clang/xpc.patch b/nixpkgs/pkgs/development/compilers/llvm/8/clang/xpc.patch
deleted file mode 100644
index eb57d3458228..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/8/clang/xpc.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-From 61c9b97d7b81cc2c013b423bf1763a92b14fcae3 Mon Sep 17 00:00:00 2001
-From: Jan Korous <jkorous@apple.com>
-Date: Tue, 26 Mar 2019 03:48:25 +0000
-Subject: [PATCH] [clangd][xpc][cmake] Respect explicit value of
- CLANGD_BUILD_XPC
-
-We shouldn't prevent user from disabling XPC framework build on Darwin.
-However, by keeping it on by default our CI systems also test
-it by default on macOS.
-
-Based on user request:
-http://lists.llvm.org/pipermail/cfe-dev/2019-March/061778.html
-
-Differential Revision: https://reviews.llvm.org/D59808
-
-git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@356974 91177308-0d34-0410-b5e6-96231b3b80d8
----
- CMakeLists.txt | 13 ++++++++++---
- 1 file changed, 10 insertions(+), 3 deletions(-)
-
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 66ebeaeeaa..514b17fb3c 100644
---- a/tools/extra/CMakeLists.txt
-+++ b/tools/extra/CMakeLists.txt
-@@ -1,6 +1,13 @@
--option(CLANGD_BUILD_XPC "Build XPC Support For Clangd." OFF)
--if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
--  set(CLANGD_BUILD_XPC ON CACHE BOOL "" FORCE)
-+if (NOT DEFINED CLANGD_BUILD_XPC)
-+  if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
-+    set(CLANGD_BUILD_XPC_DEFAULT ON)
-+  else ()
-+    set(CLANGD_BUILD_XPC_DEFAULT OFF)
-+  endif ()
-+
-+  set(CLANGD_BUILD_XPC ${CLANGD_BUILD_XPC_DEFAULT} CACHE BOOL "Build XPC Support For Clangd." FORCE)
-+
-+  unset(CLANGD_BUILD_XPC_DEFAULT)
- endif ()
- 
- add_subdirectory(clang-apply-replacements)
\ No newline at end of file
diff --git a/nixpkgs/pkgs/development/compilers/llvm/8/compiler-rt/armv7l.patch b/nixpkgs/pkgs/development/compilers/llvm/8/compiler-rt/armv7l.patch
deleted file mode 100644
index 89d7f1aec918..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/8/compiler-rt/armv7l.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-diff -ur compiler-rt-7.1.0.src/cmake/builtin-config-ix.cmake compiler-rt-7.1.0.src-patched/cmake/builtin-config-ix.cmake
---- compiler-rt-7.1.0.src/cmake/builtin-config-ix.cmake	2018-05-25 06:36:27.000000000 +0900
-+++ compiler-rt-7.1.0.src-patched/cmake/builtin-config-ix.cmake	2020-05-09 20:26:33.030608692 +0900
-@@ -24,7 +24,7 @@
- 
- 
- set(ARM64 aarch64)
--set(ARM32 arm armhf armv6m armv7m armv7em armv7 armv7s armv7k)
-+set(ARM32 arm armhf armv6m armv7m armv7em armv7 armv7s armv7k armv7l)
- set(HEXAGON hexagon)
- set(X86 i386)
- set(X86_64 x86_64)
-diff -ur compiler-rt-7.1.0.src/lib/builtins/CMakeLists.txt compiler-rt-7.1.0.src-patched/lib/builtins/CMakeLists.txt
---- compiler-rt-7.1.0.src/lib/builtins/CMakeLists.txt	2018-07-31 03:18:59.000000000 +0900
-+++ compiler-rt-7.1.0.src-patched/lib/builtins/CMakeLists.txt	2020-05-09 20:27:38.893409318 +0900
-@@ -453,6 +453,7 @@
- set(armv7_SOURCES ${arm_SOURCES})
- set(armv7s_SOURCES ${arm_SOURCES})
- set(armv7k_SOURCES ${arm_SOURCES})
-+set(armv7l_SOURCES ${arm_SOURCES})
- set(arm64_SOURCES ${aarch64_SOURCES})
- 
- # macho_embedded archs
-@@ -563,12 +564,12 @@
-       set(_arch ${arch})
-       if("${arch}" STREQUAL "armv6m")
-         set(_arch "arm|armv6m")
--      elseif("${arch}" MATCHES "^(armhf|armv7|armv7s|armv7k|armv7m|armv7em)$")
-+      elseif("${arch}" MATCHES "^(armhf|armv7|armv7s|armv7k|armv7l|armv7m|armv7em)$")
-         set(_arch "arm")
-       endif()
- 
-       # For ARM archs, exclude any VFP builtins if VFP is not supported
--      if (${arch} MATCHES "^(arm|armhf|armv7|armv7s|armv7k|armv7m|armv7em)$")
-+      if (${arch} MATCHES "^(arm|armhf|armv7|armv7s|armv7k|armv7l|armv7m|armv7em)$")
-         string(REPLACE ";" " " _TARGET_${arch}_CFLAGS "${TARGET_${arch}_CFLAGS}")
-         check_compile_definition(__VFP_FP__ "${CMAKE_C_FLAGS} ${_TARGET_${arch}_CFLAGS}" COMPILER_RT_HAS_${arch}_VFP)
-         if(NOT COMPILER_RT_HAS_${arch}_VFP)
diff --git a/nixpkgs/pkgs/development/compilers/llvm/8/compiler-rt/crtbegin-and-end.patch b/nixpkgs/pkgs/development/compilers/llvm/8/compiler-rt/crtbegin-and-end.patch
deleted file mode 100644
index e63be181f95c..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/8/compiler-rt/crtbegin-and-end.patch
+++ /dev/null
@@ -1,595 +0,0 @@
-Get crtbegin and crtend without compiler GCC! PR is at https://reviews.llvm.org/D28791
-
-Index: compiler-rt/CMakeLists.txt
-===================================================================
---- compiler-rt/CMakeLists.txt
-+++ compiler-rt/CMakeLists.txt
-@@ -29,6 +29,8 @@
- 
- option(COMPILER_RT_BUILD_BUILTINS "Build builtins" ON)
- mark_as_advanced(COMPILER_RT_BUILD_BUILTINS)
-+option(COMPILER_RT_BUILD_CRT "Build crtbegin.o/crtend.o" ON)
-+mark_as_advanced(COMPILER_RT_BUILD_CRT)
- option(COMPILER_RT_BUILD_SANITIZERS "Build sanitizers" ON)
- mark_as_advanced(COMPILER_RT_BUILD_SANITIZERS)
- option(COMPILER_RT_BUILD_XRAY "Build xray" ON)
-Index: compiler-rt/cmake/Modules/AddCompilerRT.cmake
-===================================================================
---- compiler-rt/cmake/Modules/AddCompilerRT.cmake
-+++ compiler-rt/cmake/Modules/AddCompilerRT.cmake
-@@ -132,7 +132,7 @@
- # Adds static or shared runtime for a list of architectures and operating
- # systems and puts it in the proper directory in the build and install trees.
- # add_compiler_rt_runtime(<name>
--#                         {STATIC|SHARED}
-+#                         {OBJECT|STATIC|SHARED}
- #                         ARCHS <architectures>
- #                         OS <os list>
- #                         SOURCES <source files>
-@@ -144,8 +144,8 @@
- #                         PARENT_TARGET <convenience parent target>
- #                         ADDITIONAL_HEADERS <header files>)
- function(add_compiler_rt_runtime name type)
--  if(NOT type MATCHES "^(STATIC|SHARED)$")
--    message(FATAL_ERROR "type argument must be STATIC or SHARED")
-+  if(NOT type MATCHES "^(OBJECT|STATIC|SHARED)$")
-+    message(FATAL_ERROR "type argument must be OBJECT, STATIC or SHARED")
-     return()
-   endif()
-   cmake_parse_arguments(LIB
-@@ -204,7 +204,10 @@
-         message(FATAL_ERROR "Architecture ${arch} can't be targeted")
-         return()
-       endif()
--      if(type STREQUAL "STATIC")
-+      if(type STREQUAL "OBJECT")
-+        set(libname "${name}-${arch}")
-+        set(output_name_${libname} ${libname}${COMPILER_RT_OS_SUFFIX})
-+      elseif(type STREQUAL "STATIC")
-         set(libname "${name}-${arch}")
-         set_output_name(output_name_${libname} ${name} ${arch})
-       else()
-@@ -270,12 +273,34 @@
-       set(COMPONENT_OPTION COMPONENT ${libname})
-     endif()
- 
--    add_library(${libname} ${type} ${sources_${libname}})
--    set_target_compile_flags(${libname} ${extra_cflags_${libname}})
--    set_target_link_flags(${libname} ${extra_link_flags_${libname}})
--    set_property(TARGET ${libname} APPEND PROPERTY
--                COMPILE_DEFINITIONS ${LIB_DEFS})
--    set_target_output_directories(${libname} ${output_dir_${libname}})
-+    if(type STREQUAL "OBJECT")
-+      string(TOUPPER ${CMAKE_BUILD_TYPE} config)
-+      get_property(cflags SOURCE ${sources_${libname}} PROPERTY COMPILE_FLAGS)
-+      separate_arguments(cflags)
-+      add_custom_command(
-+          OUTPUT ${output_dir_${libname}}/${libname}.o
-+          COMMAND ${CMAKE_C_COMPILER} ${sources_${libname}} ${cflags} ${extra_cflags_${libname}} -c -o ${output_dir_${libname}}/${libname}.o
-+          DEPENDS ${sources_${libname}}
-+          COMMENT "Building C object ${libname}.o")
-+      add_custom_target(${libname} DEPENDS ${output_dir_${libname}}/${libname}.o)
-+      install(FILES ${output_dir_${libname}}/${libname}.o
-+        DESTINATION ${install_dir_${libname}}
-+        ${COMPONENT_OPTION})
-+    else()
-+      add_library(${libname} ${type} ${sources_${libname}})
-+      set_target_compile_flags(${libname} ${extra_cflags_${libname}})
-+      set_target_link_flags(${libname} ${extra_link_flags_${libname}})
-+      set_property(TARGET ${libname} APPEND PROPERTY
-+                   COMPILE_DEFINITIONS ${LIB_DEFS})
-+      set_target_output_directories(${libname} ${output_dir_${libname}})
-+      install(TARGETS ${libname}
-+        ARCHIVE DESTINATION ${install_dir_${libname}}
-+                ${COMPONENT_OPTION}
-+        LIBRARY DESTINATION ${install_dir_${libname}}
-+                ${COMPONENT_OPTION}
-+        RUNTIME DESTINATION ${install_dir_${libname}}
-+                ${COMPONENT_OPTION})
-+    endif()
-     set_target_properties(${libname} PROPERTIES
-         OUTPUT_NAME ${output_name_${libname}})
-     set_target_properties(${libname} PROPERTIES FOLDER "Compiler-RT Runtime")
-@@ -299,13 +324,6 @@
-         )
-       endif()
-     endif()
--    install(TARGETS ${libname}
--      ARCHIVE DESTINATION ${install_dir_${libname}}
--              ${COMPONENT_OPTION}
--      LIBRARY DESTINATION ${install_dir_${libname}}
--              ${COMPONENT_OPTION}
--      RUNTIME DESTINATION ${install_dir_${libname}}
--              ${COMPONENT_OPTION})
- 
-     # We only want to generate per-library install targets if you aren't using
-     # an IDE because the extra targets get cluttered in IDEs.
-Index: compiler-rt/cmake/config-ix.cmake
-===================================================================
---- compiler-rt/cmake/config-ix.cmake
-+++ compiler-rt/cmake/config-ix.cmake
-@@ -227,6 +227,7 @@
-     ${ARM32} ${ARM64} ${MIPS32} ${MIPS64} ${S390X})
- set(ALL_ASAN_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64}
-     ${MIPS32} ${MIPS64} ${PPC64} ${S390X})
-+set(ALL_CRT_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64})
- set(ALL_DFSAN_SUPPORTED_ARCH ${X86_64} ${MIPS64} ${ARM64})
- set(ALL_FUZZER_SUPPORTED_ARCH ${X86_64} ${ARM64})
- 
-@@ -474,6 +475,7 @@
-     SANITIZER_COMMON_SUPPORTED_ARCH)
- 
- else()
-+  filter_available_targets(CRT_SUPPORTED_ARCH ${ALL_CRT_SUPPORTED_ARCH})
-   # Architectures supported by compiler-rt libraries.
-   filter_available_targets(SANITIZER_COMMON_SUPPORTED_ARCH
-     ${ALL_SANITIZER_COMMON_SUPPORTED_ARCH})
-@@ -563,6 +565,12 @@
- 
- # TODO: Add builtins support.
- 
-+if (CRT_SUPPORTED_ARCH AND OS_NAME MATCHES "Linux")
-+  set(COMPILER_RT_HAS_CRT TRUE)
-+else()
-+  set(COMPILER_RT_HAS_CRT FALSE)
-+endif()
-+
- if (COMPILER_RT_HAS_SANITIZER_COMMON AND DFSAN_SUPPORTED_ARCH AND
-     OS_NAME MATCHES "Linux")
-   set(COMPILER_RT_HAS_DFSAN TRUE)
-Index: compiler-rt/lib/CMakeLists.txt
-===================================================================
---- compiler-rt/lib/CMakeLists.txt
-+++ compiler-rt/lib/CMakeLists.txt
-@@ -17,6 +17,10 @@
-   add_subdirectory(builtins)
- endif()
- 
-+if(COMPILER_RT_BUILD_CRT)
-+  add_subdirectory(crt)
-+endif()
-+
- function(compiler_rt_build_runtime runtime)
-   string(TOUPPER ${runtime} runtime_uppercase)
-   if(COMPILER_RT_HAS_${runtime_uppercase})
-Index: compiler-rt/lib/crt/CMakeLists.txt
-===================================================================
---- /dev/null
-+++ compiler-rt/lib/crt/CMakeLists.txt
-@@ -0,0 +1,102 @@
-+add_compiler_rt_component(crt)
-+
-+function(check_cxx_section_exists section output)
-+  cmake_parse_arguments(ARG "" "" "SOURCE;FLAGS" ${ARGN})
-+  if(NOT ARG_SOURCE)
-+    set(ARG_SOURCE "int main() { return 0; }\n")
-+  endif()
-+
-+  string(RANDOM TARGET_NAME)
-+  set(TARGET_NAME "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/cmTC_${TARGET_NAME}.dir")
-+  file(MAKE_DIRECTORY ${TARGET_NAME})
-+
-+  file(WRITE "${TARGET_NAME}/CheckSectionExists.c" "${ARG_SOURCE}\n")
-+
-+  string(REGEX MATCHALL "<[A-Za-z0-9_]*>" substitutions
-+         ${CMAKE_C_COMPILE_OBJECT})
-+
-+  set(try_compile_flags "${ARG_FLAGS}")
-+  if(CMAKE_C_COMPILER_ID MATCHES Clang AND CMAKE_C_COMPILER_TARGET)
-+    list(APPEND try_compile_flags "-target ${CMAKE_C_COMPILER_TARGET}")
-+  endif()
-+
-+  string(REPLACE ";" " " extra_flags "${try_compile_flags}")
-+
-+  set(test_compile_command "${CMAKE_C_COMPILE_OBJECT}")
-+  foreach(substitution ${substitutions})
-+    if(substitution STREQUAL "<CMAKE_C_COMPILER>")
-+      string(REPLACE "<CMAKE_C_COMPILER>"
-+             "${CMAKE_C_COMPILER}" test_compile_command ${test_compile_command})
-+    elseif(substitution STREQUAL "<OBJECT>")
-+      string(REPLACE "<OBJECT>" "${TARGET_NAME}/CheckSectionExists.o"
-+             test_compile_command ${test_compile_command})
-+    elseif(substitution STREQUAL "<SOURCE>")
-+      string(REPLACE "<SOURCE>" "${TARGET_NAME}/CheckSectionExists.c"
-+             test_compile_command ${test_compile_command})
-+    elseif(substitution STREQUAL "<FLAGS>")
-+      string(REPLACE "<FLAGS>" "${CMAKE_C_FLAGS} ${extra_flags}"
-+             test_compile_command ${test_compile_command})
-+    else()
-+      string(REPLACE "${substitution}" "" test_compile_command
-+             ${test_compile_command})
-+    endif()
-+  endforeach()
-+
-+  string(REPLACE " " ";" test_compile_command "${test_compile_command}")
-+
-+  execute_process(
-+    COMMAND ${test_compile_command}
-+    RESULT_VARIABLE TEST_RESULT
-+    OUTPUT_VARIABLE TEST_OUTPUT
-+    ERROR_VARIABLE TEST_ERROR
-+  )
-+
-+  execute_process(
-+    COMMAND ${CMAKE_OBJDUMP} -h "${TARGET_NAME}/CheckSectionExists.o"
-+    RESULT_VARIABLE CHECK_RESULT
-+    OUTPUT_VARIABLE CHECK_OUTPUT
-+    ERROR_VARIABLE CHECK_ERROR
-+  )
-+  string(FIND "${CHECK_OUTPUT}" "${section}" SECTION_FOUND)
-+
-+  if(NOT SECTION_FOUND EQUAL -1)
-+    set(${output} TRUE PARENT_SCOPE)
-+  else()
-+    set(${output} FALSE PARENT_SCOPE)
-+  endif()
-+
-+  file(REMOVE_RECURSE ${TARGET_NAME})
-+endfunction()
-+
-+check_cxx_section_exists(".init_array" COMPILER_RT_HAS_INITFINI_ARRAY
-+  SOURCE "__attribute__((constructor)) void f() {}\nint main() { return 0; }\n")
-+
-+append_list_if(COMPILER_RT_HAS_INITFINI_ARRAY -DCRT_HAS_INITFINI_ARRAY CRT_CFLAGS)
-+append_list_if(COMPILER_RT_HAS_FPIC_FLAG -fPIC CRT_CFLAGS)
-+
-+foreach(arch ${CRT_SUPPORTED_ARCH})
-+  add_compiler_rt_runtime(clang_rt.crtbegin
-+    OBJECT
-+    ARCHS ${arch}
-+    SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/crtbegin.c
-+    CFLAGS ${CRT_CFLAGS}
-+    PARENT_TARGET crt)
-+  add_compiler_rt_runtime(clang_rt.crtbegin_shared
-+    OBJECT
-+    ARCHS ${arch}
-+    SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/crtbegin.c
-+    CFLAGS ${CRT_CFLAGS} -DCRT_SHARED
-+    PARENT_TARGET crt)
-+  add_compiler_rt_runtime(clang_rt.crtend
-+    OBJECT
-+    ARCHS ${arch}
-+    SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/crtend.c
-+    CFLAGS ${CRT_CFLAGS}
-+    PARENT_TARGET crt)
-+  add_compiler_rt_runtime(clang_rt.crtend_shared
-+    OBJECT
-+    ARCHS ${arch}
-+    SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/crtend.c
-+    CFLAGS ${CRT_CFLAGS} -DCRT_SHARED
-+    PARENT_TARGET crt)
-+endforeach()
-Index: compiler-rt/lib/crt/crtbegin.c
-===================================================================
---- /dev/null
-+++ compiler-rt/lib/crt/crtbegin.c
-@@ -0,0 +1,108 @@
-+/* ===-- crtbegin.c - Start of constructors and destructors ----------------===
-+ *
-+ *      	       The LLVM Compiler Infrastructure
-+ *
-+ * This file is dual licensed under the MIT and the University of Illinois Open
-+ * Source Licenses. See LICENSE.TXT for details.
-+ *
-+ * ===----------------------------------------------------------------------===
-+ */
-+
-+#include <stddef.h>
-+
-+__attribute__((visibility("hidden")))
-+#ifdef CRT_SHARED
-+void *__dso_handle = &__dso_handle;
-+#else
-+void *__dso_handle = (void *)0;
-+#endif
-+
-+static long __EH_FRAME_LIST__[]
-+    __attribute__((section(".eh_frame"), aligned(sizeof(void *)))) = {};
-+
-+extern void __register_frame_info(const void *, void *) __attribute__((weak));
-+extern void *__deregister_frame_info(const void *) __attribute__((weak));
-+
-+#ifndef CRT_HAS_INITFINI_ARRAY
-+typedef void (*fp)(void);
-+
-+static fp __CTOR_LIST__[]
-+    __attribute__((section(".ctors"), aligned(sizeof(fp)), used)) = {(fp)-1};
-+extern fp __CTOR_LIST_END__[];
-+#endif
-+
-+#ifdef CRT_SHARED
-+extern void __cxa_finalize(void *) __attribute__((weak));
-+#endif
-+
-+static void __attribute__((used)) __do_init() {
-+  static _Bool __initialized;
-+  if (__builtin_expect(__initialized, 0))
-+    return;
-+  __initialized = 1;
-+
-+  static struct { void *p[8]; } __object;
-+  if (__register_frame_info)
-+    __register_frame_info(__EH_FRAME_LIST__, &__object);
-+
-+#ifndef CRT_HAS_INITFINI_ARRAY
-+  const size_t n = __CTOR_LIST_END__ - __CTOR_LIST__ - 1;
-+  for (size_t i = n; i >= 1; i--) __CTOR_LIST__[i]();
-+#endif
-+}
-+
-+#ifdef CRT_HAS_INITFINI_ARRAY
-+__attribute__((section(".init_array"),
-+               used)) static void (*__init)(void) = __do_init;
-+#else  // CRT_HAS_INITFINI_ARRAY
-+#if defined(__i386__) || defined(__x86_64__)
-+asm(".pushsection .init,\"ax\",@progbits\n\t"
-+    "call " __USER_LABEL_PREFIX__ "__do_init\n\t"
-+    ".popsection");
-+#elif defined(__arm__)
-+asm(".pushsection .init,\"ax\",%progbits\n\t"
-+    "bl " __USER_LABEL_PREFIX__ "__do_init\n\t"
-+    ".popsection");
-+#endif  // CRT_HAS_INITFINI_ARRAY
-+#endif
-+
-+#ifndef CRT_HAS_INITFINI_ARRAY
-+static fp __DTOR_LIST__[]
-+    __attribute__((section(".dtors"), aligned(sizeof(fp)), used)) = {(fp)-1};
-+extern fp __DTOR_LIST_END__[];
-+#endif
-+
-+static void __attribute__((used)) __do_fini() {
-+  static _Bool __finalized;
-+  if (__builtin_expect(__finalized, 0))
-+    return;
-+  __finalized = 1;
-+
-+#ifdef CRT_SHARED
-+  if (__cxa_finalize)
-+    __cxa_finalize(__dso_handle);
-+#endif
-+
-+#ifndef CRT_HAS_INITFINI_ARRAY
-+  if (__deregister_frame_info)
-+    __deregister_frame_info(__EH_FRAME_LIST__);
-+
-+  const size_t n = __DTOR_LIST_END__ - __DTOR_LIST__ - 1;
-+  for (size_t i = 1; i < n; i++) __DTOR_LIST__[i]();
-+#endif
-+}
-+
-+#ifdef CRT_HAS_INITFINI_ARRAY
-+__attribute__((section(".fini_array"),
-+               used)) static void (*__fini)(void) = __do_fini;
-+#else  // CRT_HAS_INITFINI_ARRAY
-+#if defined(__i386__) || defined(__x86_64__)
-+asm(".pushsection .fini,\"ax\",@progbits\n\t"
-+    "call " __USER_LABEL_PREFIX__ "__do_fini\n\t"
-+    ".popsection");
-+#elif defined(__arm__)
-+asm(".pushsection .fini,\"ax\",%progbits\n\t"
-+    "bl " __USER_LABEL_PREFIX__ "__do_fini\n\t"
-+    ".popsection");
-+#endif
-+#endif  // CRT_HAS_INIT_FINI_ARRAY
-Index: compiler-rt/lib/crt/crtend.c
-===================================================================
---- /dev/null
-+++ compiler-rt/lib/crt/crtend.c
-@@ -0,0 +1,24 @@
-+/* ===-- crtend.c - End of constructors and destructors --------------------===
-+ *
-+ *      	       The LLVM Compiler Infrastructure
-+ *
-+ * This file is dual licensed under the MIT and the University of Illinois Open
-+ * Source Licenses. See LICENSE.TXT for details.
-+ *
-+ * ===----------------------------------------------------------------------===
-+ */
-+
-+#include <stdint.h>
-+
-+// Put 4-byte zero which is the length field in FDE at the end as a terminator.
-+const int32_t __EH_FRAME_LIST_END__[]
-+    __attribute__((section(".eh_frame"), aligned(sizeof(int32_t)),
-+                   visibility("hidden"), used)) = {0};
-+
-+#ifndef CRT_HAS_INITFINI_ARRAY
-+typedef void (*fp)(void);
-+fp __CTOR_LIST_END__[]
-+    __attribute__((section(".ctors"), visibility("hidden"), used)) = {0};
-+fp __DTOR_LIST_END__[]
-+    __attribute__((section(".dtors"), visibility("hidden"), used)) = {0};
-+#endif
-Index: compiler-rt/test/CMakeLists.txt
-===================================================================
---- compiler-rt/test/CMakeLists.txt
-+++ compiler-rt/test/CMakeLists.txt
-@@ -73,6 +73,9 @@
-   if(COMPILER_RT_BUILD_XRAY)
-     compiler_rt_test_runtime(xray)
-   endif()
-+  if(COMPILER_RT_HAS_CRT)
-+    add_subdirectory(crt)
-+  endif()
-   # ShadowCallStack does not yet provide a runtime with compiler-rt, the tests
-   # include their own minimal runtime
-   add_subdirectory(shadowcallstack)
-Index: compiler-rt/test/crt/CMakeLists.txt
-===================================================================
---- /dev/null
-+++ compiler-rt/test/crt/CMakeLists.txt
-@@ -0,0 +1,31 @@
-+set(CRT_LIT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
-+
-+set(CRT_TESTSUITES)
-+
-+set(CRT_TEST_DEPS "")
-+
-+if(NOT COMPILER_RT_STANDALONE_BUILD AND COMPILER_RT_BUILD_CRT AND
-+   COMPILER_RT_HAS_CRT)
-+  list(APPEND CRT_TEST_DEPS crt)
-+endif()
-+
-+set(CRT_TEST_ARCH ${CRT_SUPPORTED_ARCH})
-+if (COMPILER_RT_BUILD_CRT AND COMPILER_RT_HAS_CRT)
-+  foreach(arch ${CRT_TEST_ARCH})
-+    set(CRT_TEST_TARGET_ARCH ${arch})
-+    string(TOLOWER "-${arch}-${OS_NAME}" CRT_TEST_CONFIG_SUFFIX)
-+    get_test_cc_for_arch(${arch} CRT_TEST_TARGET_CC CRT_TEST_TARGET_CFLAGS)
-+    string(TOUPPER ${arch} ARCH_UPPER_CASE)
-+    set(CONFIG_NAME ${ARCH_UPPER_CASE}${OS_NAME}Config)
-+
-+    configure_lit_site_cfg(
-+      ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
-+      ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg)
-+    list(APPEND CRT_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME})
-+  endforeach()
-+endif()
-+
-+add_lit_testsuite(check-crt "Running the CRT tests"
-+  ${CRT_TESTSUITES}
-+  DEPENDS ${CRT_TEST_DEPS})
-+set_target_properties(check-crt PROPERTIES FOLDER "Compiler-RT Misc")
-Index: compiler-rt/test/crt/dso_handle.cpp
-===================================================================
---- /dev/null
-+++ compiler-rt/test/crt/dso_handle.cpp
-@@ -0,0 +1,33 @@
-+// RUN: %clangxx -g -DCRT_SHARED -c %s -fPIC -o %tshared.o
-+// RUN: %clangxx -g -c %s -fPIC -o %t.o
-+// RUN: %clangxx -g -shared -o %t.so -nostdlib %crti %shared_crtbegin %tshared.o %libstdcxx -lc -lm -lgcc_s %shared_crtend %crtn
-+// RUN: %clangxx -g -o %t -nostdlib %crt1 %crti %crtbegin %t.o %libstdcxx -lc -lm %libgcc %t.so %crtend %crtn
-+// RUN: %run %t 2>&1 | FileCheck %s
-+
-+#include <stdio.h>
-+
-+// CHECK: 1
-+// CHECK-NEXT: ~A()
-+
-+#ifdef CRT_SHARED
-+bool G;
-+void C() {
-+  printf("%d\n", G);
-+}
-+
-+struct A {
-+  A() { G = true; }
-+  ~A() {
-+    printf("~A()\n");
-+  }
-+};
-+
-+A a;
-+#else
-+void C();
-+
-+int main() {
-+  C();
-+  return 0;
-+}
-+#endif
-Index: compiler-rt/test/crt/lit.cfg
-===================================================================
---- /dev/null
-+++ compiler-rt/test/crt/lit.cfg
-@@ -0,0 +1,80 @@
-+# -*- Python -*-
-+
-+import os
-+import subprocess
-+
-+# Setup config name.
-+config.name = 'CRT' + config.name_suffix
-+
-+# Setup source root.
-+config.test_source_root = os.path.dirname(__file__)
-+
-+
-+def get_library_path(file):
-+    cmd = subprocess.Popen([config.clang.strip(),
-+                            config.target_cflags.strip(),
-+                            '-print-file-name=%s' % file],
-+                           stdout=subprocess.PIPE,
-+                           env=config.environment)
-+    if not cmd.stdout:
-+      lit_config.fatal("Couldn't find the library path for '%s'" % file)
-+    dir = cmd.stdout.read().strip()
-+    if sys.platform in ['win32'] and execute_external:
-+        # Don't pass dosish path separator to msys bash.exe.
-+        dir = dir.replace('\\', '/')
-+    # Ensure the result is an ascii string, across Python2.5+ - Python3.
-+    return str(dir.decode('ascii'))
-+
-+
-+def get_libgcc_file_name():
-+    cmd = subprocess.Popen([config.clang.strip(),
-+                            config.target_cflags.strip(),
-+                            '-print-libgcc-file-name'],
-+                           stdout=subprocess.PIPE,
-+                           env=config.environment)
-+    if not cmd.stdout:
-+      lit_config.fatal("Couldn't find the library path for '%s'" % file)
-+    dir = cmd.stdout.read().strip()
-+    if sys.platform in ['win32'] and execute_external:
-+        # Don't pass dosish path separator to msys bash.exe.
-+        dir = dir.replace('\\', '/')
-+    # Ensure the result is an ascii string, across Python2.5+ - Python3.
-+    return str(dir.decode('ascii'))
-+
-+
-+def build_invocation(compile_flags):
-+    return ' ' + ' '.join([config.clang] + compile_flags) + ' '
-+
-+
-+# Setup substitutions.
-+config.substitutions.append(
-+    ('%clang ', build_invocation([config.target_cflags])))
-+config.substitutions.append(
-+    ('%clangxx ',
-+     build_invocation(config.cxx_mode_flags + [config.target_cflags])))
-+
-+base_lib = os.path.join(
-+    config.compiler_rt_libdir, "clang_rt.%%s-%s.o" % config.target_arch)
-+config.substitutions.append(('%crtbegin', base_lib % "crtbegin"))
-+config.substitutions.append(('%shared_crtbegin', base_lib % "crtbegin_shared"))
-+config.substitutions.append(('%crtend', base_lib % "crtend"))
-+config.substitutions.append(('%shared_crtend', base_lib % "crtend_shared"))
-+
-+config.substitutions.append(
-+    ('%crt1', get_library_path('crt1.o')))
-+config.substitutions.append(
-+    ('%crti', get_library_path('crti.o')))
-+config.substitutions.append(
-+    ('%crtn', get_library_path('crtn.o')))
-+
-+config.substitutions.append(
-+    ('%libgcc', get_libgcc_file_name()))
-+
-+config.substitutions.append(
-+    ('%libstdcxx', '-l' + config.sanitizer_cxx_lib.lstrip('lib')))
-+
-+# Default test suffixes.
-+config.suffixes = ['.c', '.cc', '.cpp']
-+
-+if config.host_os not in ['Linux']:
-+    config.unsupported = True
-Index: compiler-rt/test/crt/lit.site.cfg.in
-===================================================================
---- /dev/null
-+++ compiler-rt/test/crt/lit.site.cfg.in
-@@ -0,0 +1,14 @@
-+@LIT_SITE_CFG_IN_HEADER@
-+
-+# Tool-specific config options.
-+config.name_suffix = "@CRT_TEST_CONFIG_SUFFIX@"
-+config.crt_lit_source_dir = "@CRT_LIT_SOURCE_DIR@"
-+config.target_cflags = "@CRT_TEST_TARGET_CFLAGS@"
-+config.target_arch = "@CRT_TEST_TARGET_ARCH@"
-+config.sanitizer_cxx_lib = "@SANITIZER_TEST_CXX_LIBNAME@"
-+
-+# Load common config for all compiler-rt lit tests
-+lit_config.load_config(config, "@COMPILER_RT_BINARY_DIR@/test/lit.common.configured")
-+
-+# Load tool-specific config that would do the real work.
-+lit_config.load_config(config, "@CRT_LIT_SOURCE_DIR@/lit.cfg")
diff --git a/nixpkgs/pkgs/development/compilers/llvm/8/compiler-rt/default.nix b/nixpkgs/pkgs/development/compilers/llvm/8/compiler-rt/default.nix
deleted file mode 100644
index 26cb5aa30617..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/8/compiler-rt/default.nix
+++ /dev/null
@@ -1,117 +0,0 @@
-{ lib, stdenv, llvm_meta, version, fetch, cmake, python3, libllvm, libcxxabi
-, doFakeLibgcc ? stdenv.hostPlatform.isFreeBSD
-}:
-
-let
-
-  useLLVM = stdenv.hostPlatform.useLLVM or false;
-  bareMetal = stdenv.hostPlatform.parsed.kernel.name == "none";
-  haveLibc = stdenv.cc.libc != null;
-  inherit (stdenv.hostPlatform) isMusl;
-
-in
-
-stdenv.mkDerivation {
-  pname = "compiler-rt" + lib.optionalString (haveLibc) "-libc";
-  inherit version;
-  src = fetch "compiler-rt" "0dqqf8f930l8gag4d9qjgn1n0pj0nbv2anviqqhdi1rkhas8z0hi";
-
-  nativeBuildInputs = [ cmake python3 libllvm.dev ];
-  buildInputs = lib.optional stdenv.hostPlatform.isDarwin libcxxabi;
-
-  env.NIX_CFLAGS_COMPILE = toString [
-    "-DSCUDO_DEFAULT_OPTIONS=DeleteSizeMismatch=0:DeallocationTypeMismatch=0"
-  ];
-
-  cmakeFlags = [
-    "-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON"
-    "-DCMAKE_C_COMPILER_TARGET=${stdenv.hostPlatform.config}"
-    "-DCMAKE_ASM_COMPILER_TARGET=${stdenv.hostPlatform.config}"
-  ] ++ lib.optionals (useLLVM || bareMetal || isMusl) [
-    "-DCOMPILER_RT_BUILD_SANITIZERS=OFF"
-    "-DCOMPILER_RT_BUILD_XRAY=OFF"
-    "-DCOMPILER_RT_BUILD_LIBFUZZER=OFF"
-  ] ++ lib.optionals (useLLVM || bareMetal) [
-    "-DCOMPILER_RT_BUILD_PROFILE=OFF"
-  ] ++ lib.optionals ((useLLVM || bareMetal) && !haveLibc) [
-    "-DCMAKE_C_COMPILER_WORKS=ON"
-    "-DCMAKE_CXX_COMPILER_WORKS=ON"
-    "-DCOMPILER_RT_BAREMETAL_BUILD=ON"
-    "-DCMAKE_SIZEOF_VOID_P=${toString (stdenv.hostPlatform.parsed.cpu.bits / 8)}"
-  ] ++ 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) [
-    # The compiler-rt build infrastructure sniffs supported platforms on Darwin
-    # and finds i386;x86_64;x86_64h. We only build for x86_64, so linking fails
-    # when it tries to use libc++ and libc++api for i386.
-    "-DDARWIN_osx_ARCHS=${stdenv.hostPlatform.darwinArch}"
-  ];
-
-  outputs = [ "out" "dev" ];
-
-  patches = [
-    # https://github.com/llvm/llvm-project/commit/947f9692440836dcb8d88b74b69dd379d85974ce
-    ../../common/compiler-rt/glibc.patch
-    ../../common/compiler-rt/7-12-codesign.patch # Revert compiler-rt commit that makes codesign mandatory
-    ./gnu-install-dirs.patch
-    ../../common/compiler-rt/libsanitizer-no-cyclades-9.patch
-  ] ++ lib.optional (useLLVM) ./crtbegin-and-end.patch
-    ++ lib.optional stdenv.hostPlatform.isAarch32 ./armv7l.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) ''
-    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.c \
-      --replace "#include <assert.h>" ""
-  '';
-
-  preConfigure = lib.optionalString (useLLVM && !haveLibc) ''
-    cmakeFlagsArray+=(-DCMAKE_C_FLAGS="-nodefaultlibs -ffreestanding")
-  '';
-
-  # Hack around weird upsream RPATH bug
-  postInstall = lib.optionalString (stdenv.hostPlatform.isDarwin || stdenv.hostPlatform.isWasm) ''
-    ln -s "$out/lib"/*/* "$out/lib"
-  '' + lib.optionalString (useLLVM) ''
-    ln -s $out/lib/*/clang_rt.crtbegin-*.o $out/lib/crtbegin.o
-    ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/crtend.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 ];
-    broken = stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64;
-  };
-}
diff --git a/nixpkgs/pkgs/development/compilers/llvm/8/compiler-rt/gnu-install-dirs.patch b/nixpkgs/pkgs/development/compilers/llvm/8/compiler-rt/gnu-install-dirs.patch
deleted file mode 100644
index a25fa90f9800..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/8/compiler-rt/gnu-install-dirs.patch
+++ /dev/null
@@ -1,117 +0,0 @@
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index aa360a3ef36e..a39676148181 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -8,6 +8,7 @@ cmake_minimum_required(VERSION 3.4.3)
- # Check if compiler-rt is built as a standalone project.
- if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR COMPILER_RT_STANDALONE_BUILD)
-   project(CompilerRT C CXX ASM)
-+  include(GNUInstallDirs)
-   set(COMPILER_RT_STANDALONE_BUILD TRUE)
-   set_property(GLOBAL PROPERTY USE_FOLDERS ON)
- endif()
-diff --git a/cmake/Modules/AddCompilerRT.cmake b/cmake/Modules/AddCompilerRT.cmake
-index 81b110203c27..df7598a11caf 100644
---- a/cmake/Modules/AddCompilerRT.cmake
-+++ b/cmake/Modules/AddCompilerRT.cmake
-@@ -479,7 +479,7 @@ macro(add_compiler_rt_resource_file target_name file_name component)
-   add_custom_target(${target_name} DEPENDS ${dst_file})
-   # Install in Clang resource directory.
-   install(FILES ${file_name}
--    DESTINATION ${COMPILER_RT_INSTALL_PATH}/share
-+    DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_DATADIR}
-     COMPONENT ${component})
-   add_dependencies(${component} ${target_name})
- 
-@@ -496,7 +496,7 @@ macro(add_compiler_rt_script name)
-   add_custom_target(${name} DEPENDS ${dst})
-   install(FILES ${dst}
-     PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
--    DESTINATION ${COMPILER_RT_INSTALL_PATH}/bin)
-+    DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_BINDIR})
- endmacro(add_compiler_rt_script src name)
- 
- # Builds custom version of libc++ and installs it in <prefix>.
-diff --git a/cmake/Modules/CompilerRTDarwinUtils.cmake b/cmake/Modules/CompilerRTDarwinUtils.cmake
-index 04cc955980fa..a99f6dfb2f82 100644
---- a/cmake/Modules/CompilerRTDarwinUtils.cmake
-+++ b/cmake/Modules/CompilerRTDarwinUtils.cmake
-@@ -377,7 +377,7 @@ macro(darwin_add_embedded_builtin_libraries)
-     set(DARWIN_macho_embedded_LIBRARY_OUTPUT_DIR
-       ${COMPILER_RT_OUTPUT_DIR}/lib/macho_embedded)
-     set(DARWIN_macho_embedded_LIBRARY_INSTALL_DIR
--      ${COMPILER_RT_INSTALL_PATH}/lib/macho_embedded)
-+      ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_LIBDIR}/macho_embedded)
-       
-     set(CFLAGS_armv7 "-target thumbv7-apple-darwin-eabi")
-     set(CFLAGS_i386 "-march=pentium")
-diff --git a/cmake/Modules/CompilerRTUtils.cmake b/cmake/Modules/CompilerRTUtils.cmake
-index 5348f2064b67..d7b8fe190789 100644
---- a/cmake/Modules/CompilerRTUtils.cmake
-+++ b/cmake/Modules/CompilerRTUtils.cmake
-@@ -363,7 +363,7 @@ endfunction()
- function(get_compiler_rt_install_dir arch install_dir)
-   if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
-     get_compiler_rt_target(${arch} target)
--    set(${install_dir} ${COMPILER_RT_INSTALL_PATH}/${target}/lib PARENT_SCOPE)
-+    set(${install_dir} ${COMPILER_RT_INSTALL_PATH}/${target}/${CMAKE_INSTALL_FULL_LIBDIR} PARENT_SCOPE)
-   else()
-     set(${install_dir} ${COMPILER_RT_LIBRARY_INSTALL_DIR} PARENT_SCOPE)
-   endif()
-diff --git a/cmake/base-config-ix.cmake b/cmake/base-config-ix.cmake
-index aeabf17653f5..0a927fbfc750 100644
---- a/cmake/base-config-ix.cmake
-+++ b/cmake/base-config-ix.cmake
-@@ -59,11 +59,11 @@ if (LLVM_TREE_AVAILABLE)
- else()
-     # Take output dir and install path from the user.
-   set(COMPILER_RT_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE PATH
--    "Path where built compiler-rt libraries should be stored.")
-+    "Path where built compiler-rt build artifacts should be stored.")
-   set(COMPILER_RT_EXEC_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/bin CACHE PATH
-     "Path where built compiler-rt executables should be stored.")
--  set(COMPILER_RT_INSTALL_PATH ${CMAKE_INSTALL_PREFIX} CACHE PATH
--    "Path where built compiler-rt libraries should be installed.")
-+  set(COMPILER_RT_INSTALL_PATH "" CACHE PATH
-+    "Prefix where built compiler-rt artifacts should be installed, comes before CMAKE_INSTALL_PREFIX.")
-   option(COMPILER_RT_INCLUDE_TESTS "Generate and build compiler-rt unit tests." OFF)
-   option(COMPILER_RT_ENABLE_WERROR "Fail and stop if warning is triggered" OFF)
-   # Use a host compiler to compile/link tests.
-@@ -91,7 +91,7 @@ else(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR)
-   set(COMPILER_RT_LIBRARY_OUTPUT_DIR
-     ${COMPILER_RT_OUTPUT_DIR}/lib/${COMPILER_RT_OS_DIR})
-   set(COMPILER_RT_LIBRARY_INSTALL_DIR
--    ${COMPILER_RT_INSTALL_PATH}/lib/${COMPILER_RT_OS_DIR})
-+    ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_LIBDIR}/${COMPILER_RT_OS_DIR})
- endif()
- 
- if(APPLE)
-diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
-index c4b93b89a30c..3913dc3a1ee6 100644
---- a/include/CMakeLists.txt
-+++ b/include/CMakeLists.txt
-@@ -48,12 +48,12 @@ set_target_properties(compiler-rt-headers PROPERTIES FOLDER "Compiler-RT Misc")
- install(FILES ${SANITIZER_HEADERS}
-   COMPONENT compiler-rt-headers
-   PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
--  DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/sanitizer)
-+  DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_INCLUDEDIR}/sanitizer)
- # Install xray headers.
- install(FILES ${XRAY_HEADERS}
-   COMPONENT compiler-rt-headers
-   PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
--  DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/xray)
-+  DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_INCLUDEDIR}/xray)
- 
- if (NOT CMAKE_CONFIGURATION_TYPES) # don't add this for IDEs.
-   add_custom_target(install-compiler-rt-headers
-diff --git a/lib/dfsan/CMakeLists.txt b/lib/dfsan/CMakeLists.txt
-index b3ae713cf02c..52b364b900f5 100644
---- a/lib/dfsan/CMakeLists.txt
-+++ b/lib/dfsan/CMakeLists.txt
-@@ -54,4 +54,4 @@ add_custom_command(OUTPUT ${dfsan_abilist_filename}
-                    DEPENDS done_abilist.txt libc_ubuntu1404_abilist.txt)
- add_dependencies(dfsan dfsan_abilist)
- install(FILES ${dfsan_abilist_filename}
--        DESTINATION ${COMPILER_RT_INSTALL_PATH}/share)
-+        DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_DATADIR})
diff --git a/nixpkgs/pkgs/development/compilers/llvm/8/default.nix b/nixpkgs/pkgs/development/compilers/llvm/8/default.nix
deleted file mode 100644
index 0483916a620b..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/8/default.nix
+++ /dev/null
@@ -1,272 +0,0 @@
-{ lowPrio, newScope, pkgs, lib, stdenv, cmake
-, preLibcCrossHeaders
-, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith
-, buildLlvmTools # tools, but from the previous stage, for cross
-, targetLlvmLibraries # libraries, but from the next stage, for cross
-, targetLlvm
-# This is the default binutils, but with *this* version of LLD rather
-# than the default LLVM version's, if LLD is the choice. We use these for
-# the `useLLVM` bootstrapping below.
-, bootBintoolsNoLibc ?
-    if stdenv.targetPlatform.linker == "lld"
-    then null
-    else pkgs.bintoolsNoLibc
-, bootBintools ?
-    if stdenv.targetPlatform.linker == "lld"
-    then null
-    else pkgs.bintools
-}:
-
-let
-  release_version = "8.0.1";
-  version = release_version; # differentiating these is important for rc's
-
-  fetch = name: sha256: fetchurl {
-    url = "https://github.com/llvm/llvm-project/releases/download/llvmorg-${release_version}/${name}-${version}.src.tar.xz";
-    inherit sha256;
-  };
-
-  clang-tools-extra_src = fetch "clang-tools-extra" "1qf3097bc5ia8p6cpmbx985rjr3yaah5s8fc0nv7pw742yv7jw8q";
-
-  inherit (import ../common/common-let.nix { inherit lib release_version; }) llvm_meta;
-
-  tools = lib.makeExtensible (tools: let
-    callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch buildLlvmTools; });
-    mkExtraBuildCommands0 = cc: ''
-      rsrc="$out/resource-root"
-      mkdir "$rsrc"
-      ln -s "${cc.lib}/lib/clang/${release_version}/include" "$rsrc"
-      echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
-    '';
-    mkExtraBuildCommands = cc: mkExtraBuildCommands0 cc + ''
-      ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib"
-      ln -s "${targetLlvmLibraries.compiler-rt.out}/share" "$rsrc/share"
-    '';
-
-  bintoolsNoLibc' =
-    if bootBintoolsNoLibc == null
-    then tools.bintoolsNoLibc
-    else bootBintoolsNoLibc;
-  bintools' =
-    if bootBintools == null
-    then tools.bintools
-    else bootBintools;
-
-  in {
-
-    libllvm = callPackage ./llvm {
-      inherit llvm_meta;
-    };
-
-    # `llvm` historically had the binaries.  When choosing an output explicitly,
-    # we need to reintroduce `outputSpecified` to get the expected behavior e.g. of lib.get*
-    llvm = tools.libllvm;
-
-    libllvm-polly = callPackage ./llvm {
-      inherit llvm_meta;
-      enablePolly = true;
-    };
-
-    llvm-polly = tools.libllvm-polly.lib // { outputSpecified = false; };
-
-    libclang = callPackage ./clang {
-      inherit clang-tools-extra_src llvm_meta;
-    };
-
-    clang-unwrapped = tools.libclang;
-
-    clang-polly-unwrapped = callPackage ./clang {
-      inherit llvm_meta;
-      inherit clang-tools-extra_src;
-      libllvm = tools.libllvm-polly;
-      enablePolly = true;
-    };
-
-    # disabled until recommonmark supports sphinx 3
-    #llvm-manpages = lowPrio (tools.libllvm.override {
-    #  enableManpages = true;
-    #  python3 = pkgs.python3;  # don't use python-boot
-    #});
-
-    clang-manpages = lowPrio (tools.libclang.override {
-      enableManpages = true;
-      python3 = pkgs.python3;  # don't use python-boot
-    });
-
-    # pick clang appropriate for package set we are targeting
-    clang =
-      /**/ if stdenv.targetPlatform.libc == null then tools.clangNoLibc
-      else if stdenv.targetPlatform.useLLVM or false then tools.clangUseLLVM
-      else if (pkgs.targetPackages.stdenv or stdenv).cc.isGNU then tools.libstdcxxClang
-      else tools.libcxxClang;
-
-    libstdcxxClang = wrapCCWith rec {
-      cc = tools.clang-unwrapped;
-      # libstdcxx is taken from gcc in an ad-hoc way in cc-wrapper.
-      libcxx = null;
-      extraPackages = [
-        targetLlvmLibraries.compiler-rt
-      ];
-      extraBuildCommands = mkExtraBuildCommands cc;
-    };
-
-    libcxxClang = wrapCCWith rec {
-      cc = tools.clang-unwrapped;
-      libcxx = targetLlvmLibraries.libcxx;
-      extraPackages = [
-        libcxx.cxxabi
-        targetLlvmLibraries.compiler-rt
-      ];
-      extraBuildCommands = mkExtraBuildCommands cc;
-    };
-
-    lld = callPackage ./lld {
-      inherit llvm_meta;
-    };
-
-    lldb = callPackage ./lldb {
-      inherit llvm_meta;
-    };
-
-    # Below, is the LLVM bootstrapping logic. It handles building a
-    # fully LLVM toolchain from scratch. No GCC toolchain should be
-    # pulled in. As a consequence, it is very quick to build different
-    # targets provided by LLVM and we can also build for what GCC
-    # doesn’t support like LLVM. Probably we should move to some other
-    # file.
-
-    bintools-unwrapped = callPackage ../common/bintools.nix { };
-
-    bintoolsNoLibc = wrapBintoolsWith {
-      bintools = tools.bintools-unwrapped;
-      libc = preLibcCrossHeaders;
-    };
-
-    bintools = wrapBintoolsWith {
-      bintools = tools.bintools-unwrapped;
-    };
-
-    clangUseLLVM = wrapCCWith rec {
-      cc = tools.clang-unwrapped;
-      libcxx = targetLlvmLibraries.libcxx;
-      bintools = bintools';
-      extraPackages = [
-        libcxx.cxxabi
-        targetLlvmLibraries.compiler-rt
-      ] ++ lib.optionals (!stdenv.targetPlatform.isWasm) [
-        targetLlvmLibraries.libunwind
-      ];
-      extraBuildCommands = ''
-        echo "-rtlib=compiler-rt -Wno-unused-command-line-argument" >> $out/nix-support/cc-cflags
-        echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
-      '' + lib.optionalString (!stdenv.targetPlatform.isWasm) ''
-        echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags
-      '' + lib.optionalString (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false) ''
-        echo "-lunwind" >> $out/nix-support/cc-ldflags
-      '' + lib.optionalString stdenv.targetPlatform.isWasm ''
-        echo "-fno-exceptions" >> $out/nix-support/cc-cflags
-      '' + mkExtraBuildCommands cc;
-    };
-
-    clangNoLibcxx = wrapCCWith rec {
-      cc = tools.clang-unwrapped;
-      libcxx = null;
-      bintools = bintools';
-      extraPackages = [
-        targetLlvmLibraries.compiler-rt
-      ];
-      extraBuildCommands = ''
-        echo "-rtlib=compiler-rt" >> $out/nix-support/cc-cflags
-        echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
-        echo "-nostdlib++" >> $out/nix-support/cc-cflags
-      '' + mkExtraBuildCommands cc;
-    };
-
-    clangNoLibc = wrapCCWith rec {
-      cc = tools.clang-unwrapped;
-      libcxx = null;
-      bintools = bintoolsNoLibc';
-      extraPackages = [
-        targetLlvmLibraries.compiler-rt
-      ];
-      extraBuildCommands = ''
-        echo "-rtlib=compiler-rt" >> $out/nix-support/cc-cflags
-        echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
-      '' + mkExtraBuildCommands cc;
-    };
-
-    clangNoCompilerRt = wrapCCWith rec {
-      cc = tools.clang-unwrapped;
-      libcxx = null;
-      bintools = bintoolsNoLibc';
-      extraPackages = [ ];
-      extraBuildCommands = ''
-        echo "-nostartfiles" >> $out/nix-support/cc-cflags
-      '' + mkExtraBuildCommands0 cc;
-    };
-
-    clangNoCompilerRtWithLibc = wrapCCWith rec {
-      cc = tools.clang-unwrapped;
-      libcxx = null;
-      bintools = bintools';
-      extraPackages = [ ];
-      extraBuildCommands = mkExtraBuildCommands0 cc;
-    };
-
-  });
-
-  libraries = lib.makeExtensible (libraries: let
-    callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; });
-  in {
-
-    compiler-rt-libc = callPackage ./compiler-rt {
-      inherit llvm_meta;
-      stdenv = if stdenv.hostPlatform.useLLVM or false
-               then overrideCC stdenv buildLlvmTools.clangNoCompilerRtWithLibc
-               else stdenv;
-    };
-
-    compiler-rt-no-libc = callPackage ./compiler-rt {
-      inherit llvm_meta;
-      stdenv = if stdenv.hostPlatform.useLLVM or false
-               then overrideCC stdenv buildLlvmTools.clangNoCompilerRt
-               else stdenv;
-    };
-
-    # N.B. condition is safe because without useLLVM both are the same.
-    compiler-rt = if stdenv.hostPlatform.isAndroid
-      then libraries.compiler-rt-libc
-      else libraries.compiler-rt-no-libc;
-
-    stdenv = overrideCC stdenv buildLlvmTools.clang;
-
-    libcxxStdenv = overrideCC stdenv buildLlvmTools.libcxxClang;
-
-    libcxx = callPackage ./libcxx {
-      inherit llvm_meta;
-      stdenv = if stdenv.hostPlatform.useLLVM or false
-               then overrideCC stdenv buildLlvmTools.clangNoLibcxx
-               else stdenv;
-    };
-
-    libcxxabi = callPackage ./libcxxabi {
-      inherit llvm_meta;
-      stdenv = if stdenv.hostPlatform.useLLVM or false
-               then overrideCC stdenv buildLlvmTools.clangNoLibcxx
-               else stdenv;
-    };
-
-    libunwind = callPackage ./libunwind {
-      inherit llvm_meta;
-      stdenv = if stdenv.hostPlatform.useLLVM or false
-               then overrideCC stdenv buildLlvmTools.clangNoLibcxx
-               else stdenv;
-    };
-
-    openmp = callPackage ./openmp {
-      inherit llvm_meta targetLlvm;
-    };
-  });
-  noExtend = extensible: lib.attrsets.removeAttrs extensible [ "extend" ];
-
-in { inherit tools libraries release_version; } // (noExtend libraries) // (noExtend tools)
diff --git a/nixpkgs/pkgs/development/compilers/llvm/8/libcxx/default.nix b/nixpkgs/pkgs/development/compilers/llvm/8/libcxx/default.nix
deleted file mode 100644
index 967d4b748dbe..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/8/libcxx/default.nix
+++ /dev/null
@@ -1,92 +0,0 @@
-{ lib, stdenv, llvm_meta, fetch, cmake, python3, fixDarwinDylibNames, version
-, cxxabi ? if stdenv.hostPlatform.isFreeBSD then libcxxrt else libcxxabi
-, libcxxabi, libcxxrt
-, enableShared ? !stdenv.hostPlatform.isStatic
-}:
-
-assert stdenv.isDarwin -> cxxabi.pname == "libcxxabi";
-
-stdenv.mkDerivation {
-  pname = "libcxx";
-  inherit version;
-
-  src = fetch "libcxx" "0y4vc9z36c1zlq15cnibdzxnc1xi5glbc6klnm8a41q3db4541kz";
-
-  postUnpack = ''
-    unpackFile ${libcxxabi.src}
-    export LIBCXXABI_INCLUDE_DIR="$PWD/$(ls -d libcxxabi-${version}*)/include"
-  '';
-
-  outputs = [ "out" "dev" ];
-
-  patches = [
-    ./gnu-install-dirs.patch
-  ] ++ lib.optionals stdenv.hostPlatform.isMusl [
-    ../../libcxx-0001-musl-hacks.patch
-  ];
-
-  # Prevent errors like "error: 'foo' is unavailable: introduced in macOS yy.zz"
-  postPatch = ''
-    substituteInPlace include/__config \
-      --replace "#    define _LIBCPP_USE_AVAILABILITY_APPLE" ""
-  '';
-
-  prePatch = ''
-    substituteInPlace lib/CMakeLists.txt --replace "/usr/lib/libc++" "\''${LIBCXX_LIBCXXABI_LIB_PATH}/libc++"
-  '';
-
-  preConfigure = ''
-    # Get headers from the cxxabi source so we can see private headers not installed by the cxxabi package
-    cmakeFlagsArray=($cmakeFlagsArray -DLIBCXX_CXX_ABI_INCLUDE_PATHS="$LIBCXXABI_INCLUDE_DIR")
-  '' + lib.optionalString stdenv.hostPlatform.isMusl ''
-    patchShebangs utils/cat_files.py
-  '';
-  nativeBuildInputs = [ cmake ]
-    ++ lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) python3
-    ++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
-
-  buildInputs = [ cxxabi ];
-
-  cmakeFlags = [
-    "-DLIBCXX_LIBCPPABI_VERSION=2"
-    "-DLIBCXX_CXX_ABI=${cxxabi.pname}"
-  ] ++ lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) "-DLIBCXX_HAS_MUSL_LIBC=1"
-    ++ lib.optional (cxxabi.pname == "libcxxabi") "-DLIBCXX_LIBCXXABI_LIB_PATH=${cxxabi}/lib"
-    ++ lib.optional (stdenv.hostPlatform.useLLVM or false) "-DLIBCXX_USE_COMPILER_RT=ON"
-    ++ lib.optionals stdenv.hostPlatform.isWasm [
-      "-DLIBCXX_ENABLE_THREADS=OFF"
-      "-DLIBCXX_ENABLE_FILESYSTEM=OFF"
-      "-DLIBCXX_ENABLE_EXCEPTIONS=OFF"
-    ] ++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF";
-
-  preInstall = lib.optionalString (stdenv.isDarwin) ''
-    for file in lib/*.dylib; do
-      if [ -L "$file" ]; then continue; fi
-
-      baseName=$(basename $(${stdenv.cc.targetPrefix}otool -D $file | tail -n 1))
-      installName="$out/lib/$baseName"
-      abiName=$(echo "$baseName" | sed -e 's/libc++/libc++abi/')
-
-      for other in $(${stdenv.cc.targetPrefix}otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
-        ${stdenv.cc.targetPrefix}install_name_tool -change $other ${cxxabi}/lib/$abiName $file
-      done
-    done
-  '';
-
-  passthru = {
-    isLLVM = true;
-    inherit cxxabi;
-  };
-
-  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/nixpkgs/pkgs/development/compilers/llvm/8/libcxx/gnu-install-dirs.patch b/nixpkgs/pkgs/development/compilers/llvm/8/libcxx/gnu-install-dirs.patch
deleted file mode 100644
index 6af403ac86b4..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/8/libcxx/gnu-install-dirs.patch
+++ /dev/null
@@ -1,72 +0,0 @@
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 6b83bce1ae72..63cda3e4e80c 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -26,6 +26,8 @@ set(CMAKE_MODULE_PATH
- if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
-   project(libcxx CXX C)
- 
-+  include(GNUInstallDirs)
-+
-   set(PACKAGE_NAME libcxx)
-   set(PACKAGE_VERSION 8.0.1)
-   set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
-diff --git a/cmake/Modules/HandleLibCXXABI.cmake b/cmake/Modules/HandleLibCXXABI.cmake
-index 1c19d7e01af7..9c8aee8e8bb7 100644
---- a/cmake/Modules/HandleLibCXXABI.cmake
-+++ b/cmake/Modules/HandleLibCXXABI.cmake
-@@ -59,7 +59,7 @@ macro(setup_abi_lib abidefines abilib abifiles abidirs)
- 
-         if (LIBCXX_INSTALL_HEADERS)
-           install(FILES "${LIBCXX_BINARY_INCLUDE_DIR}/${fpath}"
--            DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1/${dstdir}
-+            DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}${CMAKE_INSTALL_INCLUDEDIR}/c++/v1/${dstdir}
-             COMPONENT cxx-headers
-             PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
-             )
-diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
-index 73f7cfc4d8e3..92cf0864ac7e 100644
---- a/include/CMakeLists.txt
-+++ b/include/CMakeLists.txt
-@@ -243,7 +243,7 @@ if (LIBCXX_INSTALL_HEADERS)
-   foreach(file ${files})
-     get_filename_component(dir ${file} DIRECTORY)
-     install(FILES ${file}
--      DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1/${dir}
-+      DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}${CMAKE_INSTALL_INCLUDEDIR}/c++/v1/${dir}
-       COMPONENT cxx-headers
-       PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
-     )
-@@ -252,7 +252,7 @@ if (LIBCXX_INSTALL_HEADERS)
-   if (LIBCXX_NEEDS_SITE_CONFIG)
-     # Install the generated header as __config.
-     install(FILES ${LIBCXX_BINARY_DIR}/__generated_config
--      DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1
-+      DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}${CMAKE_INSTALL_INCLUDEDIR}/c++/v1
-       PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
-       RENAME __config
-       COMPONENT cxx-headers)
-diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
-index 24489e8fb5e8..7327e5ee4b85 100644
---- a/lib/CMakeLists.txt
-+++ b/lib/CMakeLists.txt
-@@ -414,8 +414,8 @@ if (LIBCXX_INSTALL_LIBRARY)
-     set(experimental_lib cxx_experimental)
-   endif()
-   install(TARGETS ${LIBCXX_INSTALL_TARGETS} ${filesystem_lib} ${experimental_lib}
--    LIBRARY DESTINATION ${LIBCXX_INSTALL_PREFIX}lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx
--    ARCHIVE DESTINATION ${LIBCXX_INSTALL_PREFIX}lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx
-+    LIBRARY DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_LIBDIR}${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx
-+    ARCHIVE DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_LIBDIR}${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx
-     )
-   # NOTE: This install command must go after the cxx install command otherwise
-   # it will not be executed after the library symlinks are installed.
-@@ -423,7 +423,7 @@ if (LIBCXX_INSTALL_LIBRARY)
-     # Replace the libc++ filename with $<TARGET_LINKER_FILE:cxx>
-     # after we required CMake 3.0.
-     install(FILES "${LIBCXX_LIBRARY_DIR}/libc++${CMAKE_SHARED_LIBRARY_SUFFIX}"
--      DESTINATION ${LIBCXX_INSTALL_PREFIX}lib${LIBCXX_LIBDIR_SUFFIX}
-+      DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_LIBDIR}${LIBCXX_LIBDIR_SUFFIX}
-       COMPONENT libcxx)
-   endif()
- endif()
diff --git a/nixpkgs/pkgs/development/compilers/llvm/8/libcxxabi/default.nix b/nixpkgs/pkgs/development/compilers/llvm/8/libcxxabi/default.nix
deleted file mode 100644
index 885d85b8c3e7..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/8/libcxxabi/default.nix
+++ /dev/null
@@ -1,85 +0,0 @@
-{ lib, stdenv, llvm_meta, cmake, fetch, libcxx, libunwind, llvm, version
-, enableShared ? !stdenv.hostPlatform.isStatic
-}:
-
-stdenv.mkDerivation {
-  pname = "libcxxabi";
-  inherit version;
-
-  src = fetch "libcxxabi" "1vznz8n1z1h8af0ga451m98lc2hjnv4fyzl71napsvjhvk4g6nxp";
-
-  outputs = [ "out" "dev" ];
-
-  postUnpack = ''
-    unpackFile ${libcxx.src}
-    unpackFile ${llvm.src}
-    cmakeFlags+=" -DLLVM_PATH=$PWD/$(ls -d llvm-*) -DLIBCXXABI_LIBCXX_PATH=$PWD/$(ls -d libcxx-*)"
-  '' + lib.optionalString stdenv.isDarwin ''
-    export TRIPLE=x86_64-apple-darwin
-  '' + lib.optionalString stdenv.hostPlatform.isMusl ''
-    patch -p1 -d $(ls -d libcxx-*) -i ${../../libcxx-0001-musl-hacks.patch}
-  '' + lib.optionalString stdenv.hostPlatform.isWasm ''
-    patch -p1 -d $(ls -d llvm-*) -i ${./wasm.patch}
-  '';
-
-  patches = [
-    ../../common/libcxxabi/no-threads.patch
-    ./gnu-install-dirs.patch
-  ];
-
-  nativeBuildInputs = [ cmake ];
-  buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.hostPlatform.isWasm) libunwind;
-
-  cmakeFlags = lib.optionals (stdenv.hostPlatform.useLLVM or false) [
-    "-DLLVM_ENABLE_LIBCXX=ON"
-    "-DLIBCXXABI_USE_LLVM_UNWINDER=ON"
-  ] ++ lib.optionals stdenv.hostPlatform.isWasm [
-    "-DLIBCXXABI_ENABLE_THREADS=OFF"
-    "-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF"
-  ] ++ lib.optionals (!enableShared) [
-    "-DLIBCXXABI_ENABLE_SHARED=OFF"
-  ];
-
-  preInstall = lib.optionalString stdenv.isDarwin ''
-    for file in lib/*.dylib; do
-      if [ -L "$file" ]; then continue; fi
-
-      # Fix up the install name. Preserve the basename, just replace the path.
-      installName="$out/lib/$(basename $(${stdenv.cc.targetPrefix}otool -D $file | tail -n 1))"
-
-      # this should be done in CMake, but having trouble figuring out
-      # the magic combination of necessary CMake variables
-      # if you fancy a try, take a look at
-      # https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling
-      ${stdenv.cc.targetPrefix}install_name_tool -id $installName $file
-
-      # cc-wrapper passes '-lc++abi' to all c++ link steps, but that causes
-      # libcxxabi to sometimes link against a different version of itself.
-      # Here we simply make that second reference point to ourselves.
-      for other in $(${stdenv.cc.targetPrefix}otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
-        ${stdenv.cc.targetPrefix}install_name_tool -change $other $installName $file
-      done
-    done
-  '';
-
-  postInstall = ''
-    mkdir -p "$dev/include"
-    install -m 644 ../include/${if stdenv.isDarwin then "*" else "cxxabi.h"} "$dev/include"
-  '';
-
-  passthru = {
-    libName = "c++abi";
-  };
-
-  meta = llvm_meta // {
-    homepage = "https://libcxxabi.llvm.org/";
-    description = "Provides C++ standard library support";
-    longDescription = ''
-      libc++abi is a new implementation of low level support for a standard C++ library.
-    '';
-    # "All of the code in libc++abi is dual licensed under the MIT license and
-    # the UIUC License (a BSD-like license)":
-    license = with lib.licenses; [ mit ncsa ];
-    maintainers = llvm_meta.maintainers ++ [ lib.maintainers.vlstill ];
-  };
-}
diff --git a/nixpkgs/pkgs/development/compilers/llvm/8/libcxxabi/gnu-install-dirs.patch b/nixpkgs/pkgs/development/compilers/llvm/8/libcxxabi/gnu-install-dirs.patch
deleted file mode 100644
index 3f924b0efbea..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/8/libcxxabi/gnu-install-dirs.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 92c7dc5dc557..556b3e05a042 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -20,6 +20,8 @@ set(CMAKE_MODULE_PATH
- if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
-   project(libcxxabi CXX C)
- 
-+  include(GNUInstallDirs)
-+
-   set(PACKAGE_NAME libcxxabi)
-   set(PACKAGE_VERSION 8.0.0)
-   set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
-diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
-index 7e21fb2d7926..30711099a19c 100644
---- a/src/CMakeLists.txt
-+++ b/src/CMakeLists.txt
-@@ -220,8 +220,8 @@ add_custom_target(cxxabi DEPENDS ${LIBCXXABI_BUILD_TARGETS})
- 
- if (LIBCXXABI_INSTALL_LIBRARY)
-   install(TARGETS ${LIBCXXABI_INSTALL_TARGETS}
--    LIBRARY DESTINATION ${LIBCXXABI_INSTALL_PREFIX}lib${LIBCXXABI_LIBDIR_SUFFIX} COMPONENT cxxabi
--    ARCHIVE DESTINATION ${LIBCXXABI_INSTALL_PREFIX}lib${LIBCXXABI_LIBDIR_SUFFIX} COMPONENT cxxabi
-+    LIBRARY DESTINATION ${LIBCXXABI_INSTALL_PREFIX}${CMAKE_INSTALL_LIBDIR}${LIBCXXABI_LIBDIR_SUFFIX} COMPONENT cxxabi
-+    ARCHIVE DESTINATION ${LIBCXXABI_INSTALL_PREFIX}${CMAKE_INSTALL_LIBDIR}${LIBCXXABI_LIBDIR_SUFFIX} COMPONENT cxxabi
-     )
- endif()
- 
diff --git a/nixpkgs/pkgs/development/compilers/llvm/8/libunwind/default.nix b/nixpkgs/pkgs/development/compilers/llvm/8/libunwind/default.nix
deleted file mode 100644
index 244b5775bdc8..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/8/libunwind/default.nix
+++ /dev/null
@@ -1,40 +0,0 @@
-{ lib, stdenv, llvm_meta, version, fetch, cmake, fetchpatch
-, enableShared ? !stdenv.hostPlatform.isStatic
-}:
-
-stdenv.mkDerivation rec {
-  pname = "libunwind";
-  inherit version;
-
-  src = fetch pname "0vhgcgzsb33l83qaikrkj87ypqb48mi607rccczccwiiv8ficw0q";
-
-  patches = [
-    (fetchpatch {
-      url = "https://github.com/llvm-mirror/libunwind/commit/34a45c630d4c79af403661d267db42fbe7de1178.patch";
-      sha256 = "0n0pv6jvcky8pn3srhrf9x5kbnd0d2kia9xlx2g590f5q0bgwfhv";
-    })
-    (fetchpatch {
-      url = "https://github.com/llvm-mirror/libunwind/commit/e050272d2eb57eb4e56a37b429a61df2ebb8aa3e.patch";
-      sha256 = "1sxyx5xnax8k713jjcxgq3jq3cpnxygs2rcdf5vfja0f2k9jzldl";
-    })
-    ./gnu-install-dirs.patch
-  ];
-
-  outputs = [ "out" "dev" ];
-
-  nativeBuildInputs = [ cmake ];
-
-  cmakeFlags = 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/nixpkgs/pkgs/development/compilers/llvm/8/libunwind/gnu-install-dirs.patch b/nixpkgs/pkgs/development/compilers/llvm/8/libunwind/gnu-install-dirs.patch
deleted file mode 100644
index ffabba8137d6..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/8/libunwind/gnu-install-dirs.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 3d06073cfe74..55c7d1635fcd 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -18,6 +18,8 @@ set(CMAKE_MODULE_PATH
- if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
-   project(libunwind)
- 
-+  include(GNUInstallDirs)
-+
-   # Rely on llvm-config.
-   set(CONFIG_OUTPUT)
-   if(NOT LLVM_CONFIG_PATH)
-diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
-index f7523f88b6ac..4060dad214de 100644
---- a/src/CMakeLists.txt
-+++ b/src/CMakeLists.txt
-@@ -151,8 +151,8 @@ add_custom_target(unwind DEPENDS ${LIBUNWIND_BUILD_TARGETS})
- 
- if (LIBUNWIND_INSTALL_LIBRARY)
-   install(TARGETS ${LIBUNWIND_INSTALL_TARGETS}
--    LIBRARY DESTINATION ${LIBUNWIND_INSTALL_PREFIX}lib${LIBUNWIND_LIBDIR_SUFFIX} COMPONENT unwind
--    ARCHIVE DESTINATION ${LIBUNWIND_INSTALL_PREFIX}lib${LIBUNWIND_LIBDIR_SUFFIX} COMPONENT unwind)
-+    LIBRARY DESTINATION ${LIBUNWIND_INSTALL_PREFIX}${CMAKE_INSTALL_LIBDIR}${LIBUNWIND_LIBDIR_SUFFIX} COMPONENT unwind
-+    ARCHIVE DESTINATION ${LIBUNWIND_INSTALL_PREFIX}${CMAKE_INSTALL_LIBDIR}${LIBUNWIND_LIBDIR_SUFFIX} COMPONENT unwind)
- endif()
- 
- if (NOT CMAKE_CONFIGURATION_TYPES AND LIBUNWIND_INSTALL_LIBRARY)
diff --git a/nixpkgs/pkgs/development/compilers/llvm/8/lld/default.nix b/nixpkgs/pkgs/development/compilers/llvm/8/lld/default.nix
deleted file mode 100644
index 9a3a49db7855..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/8/lld/default.nix
+++ /dev/null
@@ -1,46 +0,0 @@
-{ lib, stdenv, llvm_meta
-, buildLlvmTools
-, fetch
-, cmake
-, libxml2
-, libllvm
-, version
-}:
-
-stdenv.mkDerivation rec {
-  pname = "lld";
-  inherit version;
-
-  src = fetch pname "121xhxrlvwy3k5nf6p1wv31whxlb635ssfkci8z93mwv4ja1xflz";
-
-  patches = [
-    ./gnu-install-dirs.patch
-  ];
-
-  nativeBuildInputs = [ cmake ];
-  buildInputs = [ libllvm libxml2 ];
-
-  cmakeFlags = [
-    "-DLLVM_CONFIG_PATH=${libllvm.dev}/bin/llvm-config${lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "-native"}"
-  ] ++ 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/nixpkgs/pkgs/development/compilers/llvm/8/lld/gnu-install-dirs.patch b/nixpkgs/pkgs/development/compilers/llvm/8/lld/gnu-install-dirs.patch
deleted file mode 100644
index acc2d3d47760..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/8/lld/gnu-install-dirs.patch
+++ /dev/null
@@ -1,68 +0,0 @@
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index e2fbdbfbbb47..d601b231ebb8 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -6,6 +6,8 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
-   set(CMAKE_INCLUDE_CURRENT_DIR ON)
-   set(LLD_BUILT_STANDALONE TRUE)
- 
-+  include(GNUInstallDirs)
-+
-   find_program(LLVM_CONFIG_PATH "llvm-config" DOC "Path to llvm-config binary")
-   if(NOT LLVM_CONFIG_PATH)
-     message(FATAL_ERROR "llvm-config not found: specify LLVM_CONFIG_PATH")
-@@ -203,7 +205,7 @@ include_directories(BEFORE
- 
- if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
-   install(DIRECTORY include/
--    DESTINATION include
-+    DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
-     FILES_MATCHING
-     PATTERN "*.h"
-     PATTERN ".svn" EXCLUDE
-diff --git a/cmake/modules/AddLLD.cmake b/cmake/modules/AddLLD.cmake
-index fa48b428d26b..e7967aad3ceb 100644
---- a/cmake/modules/AddLLD.cmake
-+++ b/cmake/modules/AddLLD.cmake
-@@ -20,9 +20,9 @@ macro(add_lld_library name)
-     install(TARGETS ${name}
-       COMPONENT ${name}
-       ${export_to_lldtargets}
--      LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
--      ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
--      RUNTIME DESTINATION bin)
-+      LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
-+      ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
-+      RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
- 
-     if (${ARG_SHARED} AND NOT CMAKE_CONFIGURATION_TYPES)
-       add_llvm_install_targets(install-${name}
-@@ -54,7 +54,7 @@ macro(add_lld_tool name)
- 
-     install(TARGETS ${name}
-       ${export_to_lldtargets}
--      RUNTIME DESTINATION bin
-+      RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
-       COMPONENT ${name})
- 
-     if(NOT CMAKE_CONFIGURATION_TYPES)
-@@ -69,5 +69,5 @@ endmacro()
- macro(add_lld_symlink name dest)
-   add_llvm_tool_symlink(${name} ${dest} ALWAYS_GENERATE)
-   # Always generate install targets
--  llvm_install_symlink(${name} ${dest} ALWAYS_GENERATE)
-+  llvm_install_symlink(${name} ${dest} ${CMAKE_INSTALL_FULL_BINDIR} ALWAYS_GENERATE)
- endmacro()
-diff --git a/tools/lld/CMakeLists.txt b/tools/lld/CMakeLists.txt
-index d8829493fc22..df748a0e749b 100644
---- a/tools/lld/CMakeLists.txt
-+++ b/tools/lld/CMakeLists.txt
-@@ -16,7 +16,7 @@ target_link_libraries(lld
-   )
- 
- install(TARGETS lld
--  RUNTIME DESTINATION bin)
-+  RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
- 
- if(NOT LLD_SYMLINKS_TO_CREATE)
-   set(LLD_SYMLINKS_TO_CREATE lld-link ld.lld ld64.lld wasm-ld)
diff --git a/nixpkgs/pkgs/development/compilers/llvm/8/lldb/default.nix b/nixpkgs/pkgs/development/compilers/llvm/8/lldb/default.nix
deleted file mode 100644
index 4e8cdcdf8ac2..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/8/lldb/default.nix
+++ /dev/null
@@ -1,109 +0,0 @@
-{ lib, stdenv, llvm_meta
-, fetch
-, cmake
-, zlib
-, ncurses
-, swig
-, which
-, libedit
-, libxml2
-, libllvm
-, libclang
-, python3
-, version
-, darwin
-, makeWrapper
-}:
-
-stdenv.mkDerivation rec {
-  pname = "lldb";
-  inherit version;
-
-  src = fetch "lldb" "1mriw4adrwm6kzabrjr7yqmdiylxd6glf6samd80dp8idnm9p9z8";
-
-  patches = [
-    ./gnu-install-dirs.patch
-
-    # Fix darwin build
-    ./lldb-gdb-remote-no-libcompress.patch
-  ];
-
-  postPatch = ''
-    # Fix up various paths that assume llvm and clang are installed in the same place
-    sed -i 's,".*ClangConfig.cmake","${libclang.dev}/lib/cmake/clang/ClangConfig.cmake",' \
-      cmake/modules/LLDBStandalone.cmake
-    sed -i 's,".*tools/clang/include","${libclang.dev}/include",' \
-      cmake/modules/LLDBStandalone.cmake
-    sed -i 's,"$.LLVM_LIBRARY_DIR.",${libllvm.lib}/lib ${libclang.lib}/lib,' \
-      cmake/modules/LLDBStandalone.cmake
-
-    substituteInPlace tools/CMakeLists.txt \
-      --replace "add_subdirectory(debugserver)" ""
-  '';
-
-  outputs = [ "out" "lib" "dev" ];
-
-  nativeBuildInputs = [
-    cmake python3 which swig makeWrapper
-  ];
-
-  buildInputs = [
-    ncurses zlib libedit libxml2 libllvm
-  ] ++ lib.optionals stdenv.isDarwin [
-    darwin.libobjc
-    darwin.apple_sdk.libs.xpc
-    darwin.apple_sdk.frameworks.Foundation
-    darwin.bootstrap_cmds
-    darwin.apple_sdk.frameworks.Carbon
-    darwin.apple_sdk.frameworks.Cocoa
-    darwin.apple_sdk.frameworks.DebugSymbols
-  ];
-
-  CXXFLAGS = "-fno-rtti";
-  hardeningDisable = [ "format" ];
-
-  cmakeFlags = [
-    "-DLLDB_INCLUDE_TESTS=${if doCheck then "YES" else "NO"}"
-    "-DLLDB_CODESIGN_IDENTITY=" # codesigning makes nondeterministic
-  ] ++ lib.optionals stdenv.isDarwin [
-    # Building debugserver requires the proprietary libcompression
-    "-DLLDB_NO_DEBUGSERVER=ON"
-  ] ++ lib.optionals doCheck [
-    "-DLLDB_TEST_C_COMPILER=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc"
-    "-DLLDB_TEST_CXX_COMPILER=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c++"
-  ];
-
-  doCheck = false;
-
-  doInstallCheck = true;
-
-  installCheckPhase = ''
-    if [ ! -e "$lib/${python3.sitePackages}/lldb/_lldb.so" ] ; then
-        echo "ERROR: python files not installed where expected!";
-        return 1;
-    fi
-  '';
-
-  postInstall = ''
-    wrapProgram $out/bin/lldb --prefix PYTHONPATH : $lib/${python3.sitePackages}/
-
-    mkdir -p $out/share/man/man1
-    cp ../docs/lldb.1 $out/share/man/man1/
-
-    install -D ../tools/lldb-vscode/package.json $out/share/vscode/extensions/llvm-org.lldb-vscode-0.1.0/package.json
-    mkdir -p $out/share/vscode/extensions/llvm-org.lldb-vscode-0.1.0/bin
-    ln -s $out/bin/llvm-vscode $out/share/vscode/extensions/llvm-org.lldb-vscode-0.1.0/bin
-  '';
-
-  meta = llvm_meta // {
-    broken = stdenv.isDarwin && stdenv.isAarch64;
-    homepage = "https://lldb.llvm.org/";
-    description = "A next-generation high-performance debugger";
-    longDescription = ''
-      LLDB is a next generation, high-performance debugger. It is built as a set
-      of reusable components which highly leverage existing libraries in the
-      larger LLVM Project, such as the Clang expression parser and LLVM
-      disassembler.
-    '';
-  };
-}
diff --git a/nixpkgs/pkgs/development/compilers/llvm/8/lldb/gnu-install-dirs.patch b/nixpkgs/pkgs/development/compilers/llvm/8/lldb/gnu-install-dirs.patch
deleted file mode 100644
index 08b6fae654e5..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/8/lldb/gnu-install-dirs.patch
+++ /dev/null
@@ -1,120 +0,0 @@
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index cdf22c4b0fc8..8def776f2b4a 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -7,6 +7,8 @@ set(CMAKE_MODULE_PATH
-   "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
-   )
- 
-+include(GNUInstallDirs)
-+
- include(LLDBStandalone)
- include(LLDBConfig)
- include(AddLLDB)
-diff --git a/cmake/modules/AddLLDB.cmake b/cmake/modules/AddLLDB.cmake
-index f82c11d3d317..776e6d6ef9de 100644
---- a/cmake/modules/AddLLDB.cmake
-+++ b/cmake/modules/AddLLDB.cmake
-@@ -63,18 +63,18 @@ function(add_lldb_library name)
-             set(install_dir ".")
-           endif()
-         else()
--          set(install_dir lib${LLVM_LIBDIR_SUFFIX})
-+          set(install_dir ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
-         endif()
-         install(TARGETS ${name}
-           COMPONENT ${name}
--          RUNTIME DESTINATION bin
-+          RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
-           LIBRARY DESTINATION ${install_dir}
-           ARCHIVE DESTINATION ${install_dir})
-       else()
-         install(TARGETS ${name}
-           COMPONENT ${name}
--          LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
--          ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
-+          LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
-+          ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
-       endif()
-       if (NOT CMAKE_CONFIGURATION_TYPES)
-         add_llvm_install_targets(install-${name}
-@@ -122,7 +122,7 @@ function(add_lldb_executable name)
-   if(ARG_GENERATE_INSTALL)
-     install(TARGETS ${name}
-             COMPONENT ${name}
--            RUNTIME DESTINATION bin)
-+            RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
-     if (NOT CMAKE_CONFIGURATION_TYPES)
-       add_llvm_install_targets(install-${name}
-                                DEPENDS ${name}
-diff --git a/cmake/modules/LLDBConfig.cmake b/cmake/modules/LLDBConfig.cmake
-index 109c5132d3be..8b9092faa29d 100644
---- a/cmake/modules/LLDBConfig.cmake
-+++ b/cmake/modules/LLDBConfig.cmake
-@@ -319,7 +319,7 @@ include_directories(BEFORE
- if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
-   install(DIRECTORY include/
-     COMPONENT lldb-headers
--    DESTINATION include
-+    DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
-     FILES_MATCHING
-     PATTERN "*.h"
-     PATTERN ".svn" EXCLUDE
-@@ -329,7 +329,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
- 
-   install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/
-     COMPONENT lldb-headers
--    DESTINATION include
-+    DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
-     FILES_MATCHING
-     PATTERN "*.h"
-     PATTERN ".svn" EXCLUDE
-diff --git a/tools/intel-features/CMakeLists.txt b/tools/intel-features/CMakeLists.txt
-index b5316540fdf3..3c3c882d503f 100644
---- a/tools/intel-features/CMakeLists.txt
-+++ b/tools/intel-features/CMakeLists.txt
-@@ -64,4 +64,4 @@ if (NOT LLDB_DISABLE_PYTHON AND LLDB_BUILD_INTEL_PT)
- endif()
- 
- install(TARGETS lldbIntelFeatures
--  LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX})
-+  LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index cdf22c4..d56fc6a 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -146,7 +146,7 @@ if (NOT LLDB_DISABLE_PYTHON)
-                --cfgBldDir=${lldb_scripts_dir}
-                --prefix=${CMAKE_BINARY_DIR}
-                --cmakeBuildConfiguration=${CMAKE_CFG_INTDIR}
--               --lldbLibDir=lib${LLVM_LIBDIR_SUFFIX}
-+               --lldbLibDir=${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
-                ${use_python_wrapper_from_src_dir}
-                ${use_six_py_from_system}
-         VERBATIM
-diff --git a/cmake/modules/LLDBStandalone.cmake b/cmake/modules/LLDBStandalone.cmake
-index a9059dd..d76a47d 100644
---- a/cmake/modules/LLDBStandalone.cmake
-+++ b/cmake/modules/LLDBStandalone.cmake
-@@ -124,7 +124,7 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
-   link_directories("${LLVM_LIBRARY_DIR}")
-
-   set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
--  set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX})
-+  set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_INSTALL_LIBDIR}/lib${LLVM_LIBDIR_SUFFIX})
-   set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX})
-
-   set(LLDB_BUILT_STANDALONE 1)
-diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt
-index 3598247..bd60451 100644
---- a/scripts/CMakeLists.txt
-+++ b/scripts/CMakeLists.txt
-@@ -47,7 +47,7 @@ if(NOT LLDB_BUILD_FRAMEWORK)
-   endif()
-
-   set(SWIG_PYTHON_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${swig_python_subdir})
--  set(SWIG_INSTALL_DIR lib${LLVM_LIBDIR_SUFFIX})
-+  set(SWIG_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
-
-   # Install the LLDB python module
-   install(DIRECTORY ${SWIG_PYTHON_DIR} DESTINATION ${SWIG_INSTALL_DIR})
diff --git a/nixpkgs/pkgs/development/compilers/llvm/8/lldb/lldb-gdb-remote-no-libcompress.patch b/nixpkgs/pkgs/development/compilers/llvm/8/lldb/lldb-gdb-remote-no-libcompress.patch
deleted file mode 100644
index e04d4ffb1060..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/8/lldb/lldb-gdb-remote-no-libcompress.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-diff -ru a/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
---- a/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp	2019-01-09 19:46:09.000000000 -0500
-+++ b/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp	2021-11-27 00:23:08.000000000 -0500
-@@ -42,11 +42,6 @@
- #define DEBUGSERVER_BASENAME "lldb-server"
- #endif
- 
--#if defined(__APPLE__)
--#define HAVE_LIBCOMPRESSION
--#include <compression.h>
--#endif
--
- #if defined(HAVE_LIBZ)
- #include <zlib.h>
- #endif
-diff -ru a/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
---- a/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp	2018-12-18 18:02:50.000000000 -0500
-+++ b/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp	2021-11-27 00:09:07.000000000 -0500
-@@ -37,11 +37,6 @@
- 
- #include "llvm/ADT/StringSwitch.h"
- 
--#if defined(__APPLE__)
--#define HAVE_LIBCOMPRESSION
--#include <compression.h>
--#endif
--
- using namespace lldb;
- using namespace lldb_private;
- using namespace lldb_private::process_gdb_remote;
diff --git a/nixpkgs/pkgs/development/compilers/llvm/8/llvm/default.nix b/nixpkgs/pkgs/development/compilers/llvm/8/llvm/default.nix
deleted file mode 100644
index 7cef04347429..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/8/llvm/default.nix
+++ /dev/null
@@ -1,329 +0,0 @@
-{ lib, stdenv, llvm_meta
-, pkgsBuildBuild
-, fetch
-, fetchpatch
-, cmake
-, python3
-, libffi
-, enableGoldPlugin ? libbfd.hasPluginAPI
-, libbfd
-, libpfm
-, libxml2
-, ncurses
-, version
-, release_version
-, zlib
-, buildLlvmTools
-, debugVersion ? false
-, doCheck ? stdenv.isLinux && (!stdenv.isx86_32)
-  && (stdenv.hostPlatform == stdenv.buildPlatform)
-, enableManpages ? false
-, enableSharedLibraries ? !stdenv.hostPlatform.isStatic
-# broken for Ampere eMAG 8180 (c2.large.arm on Packet) #56245
-# broken for the armv7l builder
-, enablePFM ? stdenv.isLinux && !stdenv.hostPlatform.isAarch
-, enablePolly ? false
-}:
-
-let
-  inherit (lib) optional optionals optionalString;
-
-  # Used when creating a version-suffixed symlink of libLLVM.dylib
-  shortVersion = with lib;
-    concatStringsSep "." (take 1 (splitVersion release_version));
-
-  # Ordinarily we would just the `doCheck` and `checkDeps` functionality
-  # `mkDerivation` gives us to manage our test dependencies (instead of breaking
-  # out `doCheck` as a package level attribute).
-  #
-  # Unfortunately `lit` does not forward `$PYTHONPATH` to children processes, in
-  # particular the children it uses to do feature detection.
-  #
-  # This means that python deps we add to `checkDeps` (which the python
-  # interpreter is made aware of via `$PYTHONPATH` – populated by the python
-  # setup hook) are not picked up by `lit` which causes it to skip tests.
-  #
-  # Adding `python3.withPackages (ps: [ ... ])` to `checkDeps` also doesn't work
-  # because this package is shadowed in `$PATH` by the regular `python3`
-  # package.
-  #
-  # So, we "manually" assemble one python derivation for the package to depend
-  # on, taking into account whether checks are enabled or not:
-  python = if doCheck then
-    let
-      checkDeps = ps: with ps; [ psutil ];
-    in python3.withPackages checkDeps
-  else python3;
-
-in stdenv.mkDerivation (rec {
-  pname = "llvm";
-  inherit version;
-
-  src = fetch "llvm" "1rvm5gqp5v8hfn17kqws3zhk94w4kxndal12bqa0y57p09nply24";
-  polly_src = fetch "polly" "1lfjdz3ilj5xmjxvicd8f5ykybks67ry2pdb777352r3mzlgg8g8";
-
-  unpackPhase = ''
-    unpackFile $src
-    mv llvm-${version}* llvm
-    sourceRoot=$PWD/llvm
-  '' + optionalString enablePolly ''
-    unpackFile $polly_src
-    mv polly-* $sourceRoot/tools/polly
-  '';
-
-  outputs = [ "out" "lib" "dev" "python" ];
-
-  nativeBuildInputs = [ cmake python ]
-    ++ optionals enableManpages [ python3.pkgs.sphinx python3.pkgs.recommonmark ];
-
-  buildInputs = [ libxml2 libffi ]
-    ++ optional enablePFM libpfm; # exegesis
-
-  propagatedBuildInputs = [ ncurses zlib ];
-
-  patches = [
-    # When cross-compiling we configure llvm-config-native with an approximation
-    # of the flags used for the normal LLVM build. To avoid the need for building
-    # a native libLLVM.so (which would fail) we force llvm-config to be linked
-    # statically against the necessary LLVM components always.
-    ../../llvm-config-link-static.patch
-
-    # Fix missing includes for GCC 10
-    (fetchpatch {
-      url = "https://bugs.gentoo.org/attachment.cgi?id=612792";
-      sha256 = "0rwx6jpqq4xnf4mvfm8v2d4r34y1yi05am0mx5k2d5bha9j64lqg";
-    })
-    ./gnu-install-dirs.patch
-
-    # Fix missing includes for GCC 11
-    (fetchpatch {
-      name = "headers-gcc-11.patch";
-      url = "https://github.com/llvm/llvm-project/commit/b498303066a63a203d24f739b2d2e0e56dca70d1.patch";
-      sha256 = "0nh123kld0dgz2h941lng331dkj3wbm5lfxm375k1f569gv83hlk";
-      stripLen = 1;
-    })
-
-    # Fix invalid std::string(nullptr) for GCC 12
-    (fetchpatch {
-      name = "nvptx-gcc-12.patch";
-      url = "https://github.com/llvm/llvm-project/commit/99e64623ec9b31def9375753491cc6093c831809.patch";
-      sha256 = "0zjfjgavqzi2ypqwqnlvy6flyvdz8hi1anwv0ybwnm2zqixg7za3";
-      stripLen = 1;
-    })
-
-    # Fix musl build.
-    (fetchpatch {
-      url = "https://github.com/llvm/llvm-project/commit/5cd554303ead0f8891eee3cd6d25cb07f5a7bf67.patch";
-      relative = "llvm";
-      hash = "sha256-XPbvNJ45SzjMGlNUgt/IgEvM2dHQpDOe6woUJY+nUYA=";
-    })
-  ] ++ lib.optionals enablePolly [
-    ./gnu-install-dirs-polly.patch
-    # Add missing isl header includess required to build LLVM 8 + Polly with clang 16.
-    (fetchpatch {
-      name = "polly-ppcg-isl-headers.patch";
-      url = "https://repo.or.cz/ppcg.git/patch/098ba285306114dc71497f7b51c357f69c9b4472";
-      hash = "sha256-c9L30rDROYAMbUSuaK9U/ixyFMlH/Sa1n+VgLODzSCQ=";
-      extraPrefix = "tools/polly/lib/External/ppcg/";
-      stripLen = 1;
-    })
-  ];
-
-  postPatch = optionalString stdenv.isDarwin ''
-    substituteInPlace cmake/modules/AddLLVM.cmake \
-      --replace 'set(_install_name_dir INSTALL_NAME_DIR "@rpath")' "set(_install_name_dir)" \
-      --replace 'set(_install_rpath "@loader_path/../''${CMAKE_INSTALL_LIBDIR}" ''${extra_libdir})' ""
-  '' + ''
-    # FileSystem permissions tests fail with various special bits
-    substituteInPlace unittests/Support/CMakeLists.txt \
-      --replace "Path.cpp" ""
-    rm unittests/Support/Path.cpp
-  '' + optionalString stdenv.hostPlatform.isMusl ''
-    patch -p1 -i ${../../TLI-musl.patch}
-    substituteInPlace unittests/Support/CMakeLists.txt \
-      --replace "add_subdirectory(DynamicLibrary)" ""
-    rm unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp
-    # valgrind unhappy with musl or glibc, but fails w/musl only
-    rm test/CodeGen/AArch64/wineh4.mir
-  '' + ''
-    patchShebangs test/BugPoint/compile-custom.ll.py
-  '' + ''
-    # Tweak tests to ignore namespace part of type to support
-    # gcc-12: https://gcc.gnu.org/PR103598.
-    # The change below mangles strings like:
-    #    CHECK-NEXT: Starting llvm::Function pass manager run.
-    # to:
-    #    CHECK-NEXT: Starting {{.*}}Function pass manager run.
-    for f in \
-      test/Other/new-pass-manager.ll \
-      test/Other/new-pm-defaults.ll \
-      test/Other/new-pm-lto-defaults.ll \
-      test/Other/new-pm-thinlto-defaults.ll \
-      test/Other/pass-pipeline-parsing.ll \
-      test/Transforms/Inline/cgscc-incremental-invalidate.ll \
-      test/Transforms/Inline/clear-analyses.ll \
-      test/Transforms/LoopUnroll/unroll-loop-invalidation.ll \
-      test/Transforms/SCCP/ipsccp-preserve-analysis.ll \
-      test/Transforms/SCCP/preserve-analysis.ll \
-      test/Transforms/SROA/dead-inst.ll \
-      test/tools/gold/X86/new-pm.ll \
-      ; do
-      echo "PATCH: $f"
-      substituteInPlace $f \
-        --replace 'Starting llvm::' 'Starting {{.*}}' \
-        --replace 'Finished llvm::' 'Finished {{.*}}'
-    done
-  '';
-
-  preConfigure = ''
-    # Workaround for configure flags that need to have spaces
-    cmakeFlagsArray+=(
-      -DLLVM_LIT_ARGS='-svj''${NIX_BUILD_CORES} --no-progress-bar'
-    )
-  '';
-
-  # hacky fix: created binaries need to be run before installation
-  preBuild = ''
-    mkdir -p $out/
-    ln -sv $PWD/lib $out
-  '';
-
-  cmakeBuildType = if debugVersion then "Debug" else "Release";
-
-  cmakeFlags = with stdenv; let
-    # These flags influence llvm-config's BuildVariables.inc in addition to the
-    # general build. We need to make sure these are also passed via
-    # CROSS_TOOLCHAIN_FLAGS_NATIVE when cross-compiling or llvm-config-native
-    # will return different results from the cross llvm-config.
-    #
-    # Some flags don't need to be repassed because LLVM already does so (like
-    # CMAKE_BUILD_TYPE), others are irrelevant to the result.
-    flagsForLlvmConfig = [
-      "-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
-      "-DLLVM_ENABLE_RTTI=ON"
-    ] ++ optionals enableSharedLibraries [
-      "-DLLVM_LINK_LLVM_DYLIB=ON"
-    ];
-  in flagsForLlvmConfig ++ [
-    "-DLLVM_INSTALL_UTILS=ON"  # Needed by rustc
-    "-DLLVM_BUILD_TESTS=${if doCheck then "ON" else "OFF"}"
-    "-DLLVM_ENABLE_FFI=ON"
-    "-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}"
-    "-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}"
-    "-DLLVM_ENABLE_DUMP=ON"
-  ] ++ optionals enableManpages [
-    "-DLLVM_BUILD_DOCS=ON"
-    "-DLLVM_ENABLE_SPHINX=ON"
-    "-DSPHINX_OUTPUT_MAN=ON"
-    "-DSPHINX_OUTPUT_HTML=OFF"
-    "-DSPHINX_WARNINGS_AS_ERRORS=OFF"
-  ] ++ optionals (enableGoldPlugin) [
-    "-DLLVM_BINUTILS_INCDIR=${libbfd.dev}/include"
-  ] ++ optionals (isDarwin) [
-    "-DLLVM_ENABLE_LIBCXX=ON"
-    "-DCAN_TARGET_i386=false"
-  ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
-    "-DCMAKE_CROSSCOMPILING=True"
-    "-DLLVM_TABLEGEN=${buildLlvmTools.llvm}/bin/llvm-tblgen"
-    (
-      let
-        nativeCC = pkgsBuildBuild.targetPackages.stdenv.cc;
-        nativeBintools = nativeCC.bintools.bintools;
-        nativeToolchainFlags = [
-          "-DCMAKE_C_COMPILER=${nativeCC}/bin/${nativeCC.targetPrefix}cc"
-          "-DCMAKE_CXX_COMPILER=${nativeCC}/bin/${nativeCC.targetPrefix}c++"
-          "-DCMAKE_AR=${nativeBintools}/bin/${nativeBintools.targetPrefix}ar"
-          "-DCMAKE_STRIP=${nativeBintools}/bin/${nativeBintools.targetPrefix}strip"
-          "-DCMAKE_RANLIB=${nativeBintools}/bin/${nativeBintools.targetPrefix}ranlib"
-        ];
-        # We need to repass the custom GNUInstallDirs values, otherwise CMake
-        # will choose them for us, leading to wrong results in llvm-config-native
-        nativeInstallFlags = [
-          "-DCMAKE_INSTALL_PREFIX=${placeholder "out"}"
-          "-DCMAKE_INSTALL_BINDIR=${placeholder "out"}/bin"
-          "-DCMAKE_INSTALL_INCLUDEDIR=${placeholder "dev"}/include"
-          "-DCMAKE_INSTALL_LIBDIR=${placeholder "lib"}/lib"
-          "-DCMAKE_INSTALL_LIBEXECDIR=${placeholder "lib"}/libexec"
-        ];
-      in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list="
-      + lib.concatStringsSep ";" (lib.concatLists [
-        flagsForLlvmConfig
-        nativeToolchainFlags
-        nativeInstallFlags
-      ])
-    )
-  ];
-
-  postBuild = ''
-    rm -fR $out
-  '';
-
-  preCheck = ''
-    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}$PWD/lib
-  '';
-
-  postInstall = ''
-    mkdir -p $python/share
-    mv $out/share/opt-viewer $python/share/opt-viewer
-    moveToOutput "bin/llvm-config*" "$dev"
-    substituteInPlace "$dev/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
-      --replace "\''${_IMPORT_PREFIX}/lib/lib" "$lib/lib/lib" \
-      --replace "$out/bin/llvm-config" "$dev/bin/llvm-config"
-    substituteInPlace "$dev/lib/cmake/llvm/LLVMConfig.cmake" \
-      --replace 'set(LLVM_BINARY_DIR "''${LLVM_INSTALL_PREFIX}")' 'set(LLVM_BINARY_DIR "''${LLVM_INSTALL_PREFIX}'"$lib"'")'
-  ''
-  + optionalString (stdenv.isDarwin && enableSharedLibraries) ''
-    ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${shortVersion}.dylib
-    ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${release_version}.dylib
-  ''
-  + optionalString (stdenv.buildPlatform != stdenv.hostPlatform) ''
-    cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native
-  '';
-
-  inherit doCheck;
-
-  checkTarget = "check-all";
-
-  requiredSystemFeatures = [ "big-parallel" ];
-  meta = llvm_meta // {
-    homepage = "https://llvm.org/";
-    description = "A collection of modular and reusable compiler and toolchain technologies";
-    longDescription = ''
-      The LLVM Project is a collection of modular and reusable compiler and
-      toolchain technologies. Despite its name, LLVM has little to do with
-      traditional virtual machines. The name "LLVM" itself is not an acronym; it
-      is the full name of the project.
-      LLVM began as a research project at the University of Illinois, with the
-      goal of providing a modern, SSA-based compilation strategy capable of
-      supporting both static and dynamic compilation of arbitrary programming
-      languages. Since then, LLVM has grown to be an umbrella project consisting
-      of a number of subprojects, many of which are being used in production by
-      a wide variety of commercial and open source projects as well as being
-      widely used in academic research. Code in the LLVM project is licensed
-      under the "Apache 2.0 License with LLVM exceptions".
-    '';
-  };
-} // lib.optionalAttrs enableManpages {
-  pname = "llvm-manpages";
-
-  buildPhase = ''
-    make docs-llvm-man
-  '';
-
-  propagatedBuildInputs = [];
-
-  installPhase = ''
-    make -C docs install
-  '';
-
-  postPatch = null;
-  postInstall = null;
-
-  outputs = [ "out" ];
-
-  doCheck = false;
-
-  meta = llvm_meta // {
-    description = "man pages for LLVM ${version}";
-  };
-})
diff --git a/nixpkgs/pkgs/development/compilers/llvm/8/llvm/gnu-install-dirs-polly.patch b/nixpkgs/pkgs/development/compilers/llvm/8/llvm/gnu-install-dirs-polly.patch
deleted file mode 100644
index 7c477c7df58a..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/8/llvm/gnu-install-dirs-polly.patch
+++ /dev/null
@@ -1,106 +0,0 @@
-diff --git a/tools/polly/CMakeLists.txt b/tools/polly/CMakeLists.txt
-index 9939097f743e..8cc538da912a 100644
---- a/tools/polly/CMakeLists.txt
-+++ b/tools/polly/CMakeLists.txt
-@@ -2,7 +2,11 @@
- if (NOT DEFINED LLVM_MAIN_SRC_DIR)
-   project(Polly)
-   cmake_minimum_required(VERSION 3.4.3)
-+endif()
-+
-+include(GNUInstallDirs)
- 
-+if (NOT DEFINED LLVM_MAIN_SRC_DIR)
-   # Where is LLVM installed?
-   find_package(LLVM CONFIG REQUIRED)
-   set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${LLVM_CMAKE_DIR})
-@@ -145,14 +149,14 @@ include_directories(
- 
- if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
-   install(DIRECTORY include/
--    DESTINATION include
-+    DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
-     FILES_MATCHING
-     PATTERN "*.h"
-     PATTERN ".svn" EXCLUDE
-     )
- 
-   install(DIRECTORY ${POLLY_BINARY_DIR}/include/
--    DESTINATION include
-+    DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
-     FILES_MATCHING
-     PATTERN "*.h"
-     PATTERN "CMakeFiles" EXCLUDE
-diff --git a/tools/polly/cmake/CMakeLists.txt b/tools/polly/cmake/CMakeLists.txt
-index 211f95512717..f9e04a4844b6 100644
---- a/tools/polly/cmake/CMakeLists.txt
-+++ b/tools/polly/cmake/CMakeLists.txt
-@@ -79,18 +79,18 @@ file(GENERATE
- 
- # Generate PollyConfig.cmake for the install tree.
- unset(POLLY_EXPORTS)
--set(POLLY_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
-+set(POLLY_INSTALL_PREFIX "")
- set(POLLY_CONFIG_LLVM_CMAKE_DIR "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}")
--set(POLLY_CONFIG_CMAKE_DIR "${POLLY_INSTALL_PREFIX}/${POLLY_INSTALL_PACKAGE_DIR}")
--set(POLLY_CONFIG_LIBRARY_DIRS "${POLLY_INSTALL_PREFIX}/lib${LLVM_LIBDIR_SUFFIX}")
-+set(POLLY_CONFIG_CMAKE_DIR "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_PREFIX}/${POLLY_INSTALL_PACKAGE_DIR}")
-+set(POLLY_CONFIG_LIBRARY_DIRS "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_LIBDIR}${LLVM_LIBDIR_SUFFIX}")
- if (POLLY_BUNDLED_ISL)
-   set(POLLY_CONFIG_INCLUDE_DIRS
--    "${POLLY_INSTALL_PREFIX}/include"
--    "${POLLY_INSTALL_PREFIX}/include/polly"
-+    "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_LIBDIR}"
-+    "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_LIBDIR}/polly"
-     )
- else()
-   set(POLLY_CONFIG_INCLUDE_DIRS
--    "${POLLY_INSTALL_PREFIX}/include"
-+    "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_INCLUDEDIR}"
-     ${ISL_INCLUDE_DIRS}
-     )
- endif()
-@@ -100,12 +100,12 @@ endif()
- foreach(tgt IN LISTS POLLY_CONFIG_EXPORTED_TARGETS)
-   get_target_property(tgt_type ${tgt} TYPE)
-   if (tgt_type STREQUAL "EXECUTABLE")
--    set(tgt_prefix "bin/")
-+    set(tgt_prefix "${CMAKE_INSTALL_BINDIR}/")
-   else()
--    set(tgt_prefix "lib/")
-+    set(tgt_prefix "${CMAKE_INSTALL_LIBDIR}/")
-   endif()
- 
--  set(tgt_path "${CMAKE_INSTALL_PREFIX}/${tgt_prefix}$<TARGET_FILE_NAME:${tgt}>")
-+  set(tgt_path "${tgt_prefix}$<TARGET_FILE_NAME:${tgt}>")
-   file(RELATIVE_PATH tgt_path ${POLLY_CONFIG_CMAKE_DIR} ${tgt_path})
- 
-   if (NOT tgt_type STREQUAL "INTERFACE_LIBRARY")
-diff --git a/tools/polly/cmake/polly_macros.cmake b/tools/polly/cmake/polly_macros.cmake
-index e48203871884..5bc8a2a52541 100644
---- a/tools/polly/cmake/polly_macros.cmake
-+++ b/tools/polly/cmake/polly_macros.cmake
-@@ -44,8 +44,8 @@ macro(add_polly_library name)
-   if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "LLVMPolly")
-     install(TARGETS ${name}
-       EXPORT LLVMExports
--      LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
--      ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
-+	  LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
-+      ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
-   endif()
-   set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
- endmacro(add_polly_library)
-diff --git a/tools/polly/lib/External/CMakeLists.txt b/tools/polly/lib/External/CMakeLists.txt
-index 8ffd984e542b..261cc19f3238 100644
---- a/tools/polly/lib/External/CMakeLists.txt
-+++ b/tools/polly/lib/External/CMakeLists.txt
-@@ -274,7 +274,7 @@ if (POLLY_BUNDLED_ISL)
-     install(DIRECTORY
-       ${ISL_SOURCE_DIR}/include/
-       ${ISL_BINARY_DIR}/include/
--      DESTINATION include/polly
-+      DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/polly
-       FILES_MATCHING
-       PATTERN "*.h"
-       PATTERN "CMakeFiles" EXCLUDE
diff --git a/nixpkgs/pkgs/development/compilers/llvm/8/llvm/gnu-install-dirs.patch b/nixpkgs/pkgs/development/compilers/llvm/8/llvm/gnu-install-dirs.patch
deleted file mode 100644
index 027e43f7caca..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/8/llvm/gnu-install-dirs.patch
+++ /dev/null
@@ -1,394 +0,0 @@
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 81c2bab39ec9..075e68be6125 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -251,15 +251,21 @@ if (CMAKE_BUILD_TYPE AND
-   message(FATAL_ERROR "Invalid value for CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
- endif()
- 
-+include(GNUInstallDirs)
-+
- set(LLVM_LIBDIR_SUFFIX "" CACHE STRING "Define suffix of library directory name (32/64)" )
- 
--set(LLVM_TOOLS_INSTALL_DIR "bin" CACHE STRING "Path for binary subdirectory (defaults to 'bin')")
-+set(LLVM_TOOLS_INSTALL_DIR "${CMAKE_INSTALL_BINDIR}" CACHE STRING
-+    "Path for binary subdirectory (defaults to 'bin')")
- mark_as_advanced(LLVM_TOOLS_INSTALL_DIR)
- 
- set(LLVM_UTILS_INSTALL_DIR "${LLVM_TOOLS_INSTALL_DIR}" CACHE STRING
-     "Path to install LLVM utilities (enabled by LLVM_INSTALL_UTILS=ON) (defaults to LLVM_TOOLS_INSTALL_DIR)")
- mark_as_advanced(LLVM_UTILS_INSTALL_DIR)
- 
-+set(LLVM_INSTALL_CMAKE_DIR "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/cmake/llvm" CACHE STRING
-+	"Path for CMake subdirectory (defaults to lib/cmake/llvm)" )
-+
- # They are used as destination of target generators.
- set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
- set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
-@@ -517,9 +523,9 @@ option (LLVM_ENABLE_SPHINX "Use Sphinx to generate llvm documentation." OFF)
- option (LLVM_ENABLE_OCAMLDOC "Build OCaml bindings documentation." ON)
- option (LLVM_ENABLE_BINDINGS "Build bindings." ON)
- 
--set(LLVM_INSTALL_DOXYGEN_HTML_DIR "share/doc/llvm/doxygen-html"
-+set(LLVM_INSTALL_DOXYGEN_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/${project}/doxygen-html"
-     CACHE STRING "Doxygen-generated HTML documentation install directory")
--set(LLVM_INSTALL_OCAMLDOC_HTML_DIR "share/doc/llvm/ocaml-html"
-+set(LLVM_INSTALL_OCAMLDOC_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/${project}/ocaml-html"
-     CACHE STRING "OCamldoc-generated HTML documentation install directory")
- 
- option (LLVM_BUILD_EXTERNAL_COMPILER_RT
-@@ -956,7 +962,7 @@ endif()
- 
- if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
-   install(DIRECTORY include/llvm include/llvm-c
--    DESTINATION include
-+    DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
-     COMPONENT llvm-headers
-     FILES_MATCHING
-     PATTERN "*.def"
-@@ -968,7 +974,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
-     )
- 
-   install(DIRECTORY ${LLVM_INCLUDE_DIR}/llvm ${LLVM_INCLUDE_DIR}/llvm-c
--    DESTINATION include
-+    DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
-     COMPONENT llvm-headers
-     FILES_MATCHING
-     PATTERN "*.def"
-@@ -983,13 +989,13 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
- 
-   if (LLVM_INSTALL_MODULEMAPS)
-     install(DIRECTORY include/llvm include/llvm-c
--            DESTINATION include
-+            DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
-             COMPONENT llvm-headers
-             FILES_MATCHING
-             PATTERN "module.modulemap"
-             )
-     install(FILES include/llvm/module.install.modulemap
--            DESTINATION include/llvm
-+            DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/llvm
-             COMPONENT llvm-headers
-             RENAME "module.extern.modulemap"
-             )
-diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake
-index 1a417447278b..0c2aef338078 100644
---- a/cmake/modules/AddLLVM.cmake
-+++ b/cmake/modules/AddLLVM.cmake
-@@ -646,11 +646,11 @@ macro(add_llvm_library name)
-     if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "LTO" OR
-         ${name} STREQUAL "OptRemarks" OR
-         (LLVM_LINK_LLVM_DYLIB AND ${name} STREQUAL "LLVM"))
--      set(install_dir lib${LLVM_LIBDIR_SUFFIX})
-+      set(install_dir ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
-       if(ARG_MODULE OR ARG_SHARED OR BUILD_SHARED_LIBS)
-         if(WIN32 OR CYGWIN OR MINGW)
-           set(install_type RUNTIME)
--          set(install_dir bin)
-+          set(install_dir ${CMAKE_INSTALL_BINDIR})
-         else()
-           set(install_type LIBRARY)
-         endif()
-@@ -898,7 +898,7 @@ macro(add_llvm_example name)
-   endif()
-   add_llvm_executable(${name} ${ARGN})
-   if( LLVM_BUILD_EXAMPLES )
--    install(TARGETS ${name} RUNTIME DESTINATION examples)
-+    install(TARGETS ${name} RUNTIME DESTINATION ${CMAKE_INSTALL_DOCDIR}/examples)
-   endif()
-   set_target_properties(${name} PROPERTIES FOLDER "Examples")
- endmacro(add_llvm_example name)
-@@ -1442,7 +1442,7 @@ function(llvm_install_library_symlink name dest type)
-   set(full_name ${CMAKE_${type}_LIBRARY_PREFIX}${name}${CMAKE_${type}_LIBRARY_SUFFIX})
-   set(full_dest ${CMAKE_${type}_LIBRARY_PREFIX}${dest}${CMAKE_${type}_LIBRARY_SUFFIX})
- 
--  set(output_dir lib${LLVM_LIBDIR_SUFFIX})
-+  set(output_dir ${CMAKE_INSTALL_FULL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
-   if(WIN32 AND "${type}" STREQUAL "SHARED")
-     set(output_dir bin)
-   endif()
-@@ -1458,7 +1458,7 @@ function(llvm_install_library_symlink name dest type)
-   endif()
- endfunction()
- 
--function(llvm_install_symlink name dest)
-+function(llvm_install_symlink name dest output_dir)
-   cmake_parse_arguments(ARG "ALWAYS_GENERATE" "COMPONENT" "" ${ARGN})
-   foreach(path ${CMAKE_MODULE_PATH})
-     if(EXISTS ${path}/LLVMInstallSymlink.cmake)
-@@ -1481,7 +1481,7 @@ function(llvm_install_symlink name dest)
-   set(full_dest ${dest}${CMAKE_EXECUTABLE_SUFFIX})
- 
-   install(SCRIPT ${INSTALL_SYMLINK}
--          CODE "install_symlink(${full_name} ${full_dest} ${LLVM_TOOLS_INSTALL_DIR})"
-+          CODE "install_symlink(${full_name} ${full_dest} ${output_dir})"
-           COMPONENT ${component})
- 
-   if (NOT LLVM_ENABLE_IDE AND NOT ARG_ALWAYS_GENERATE)
-@@ -1563,7 +1563,8 @@ function(add_llvm_tool_symlink link_name target)
-     endif()
- 
-     if ((TOOL_IS_TOOLCHAIN OR NOT LLVM_INSTALL_TOOLCHAIN_ONLY) AND LLVM_BUILD_TOOLS)
--      llvm_install_symlink(${link_name} ${target})
-+      GNUInstallDirs_get_absolute_install_dir(output_dir LLVM_TOOLS_INSTALL_DIR)
-+      llvm_install_symlink(${link_name} ${target} ${output_dir})
-     endif()
-   endif()
- endfunction()
-@@ -1670,9 +1671,9 @@ function(llvm_setup_rpath name)
- 
-   if (APPLE)
-     set(_install_name_dir INSTALL_NAME_DIR "@rpath")
--    set(_install_rpath "@loader_path/../lib" ${extra_libdir})
-+    set(_install_rpath "@loader_path/../${CMAKE_INSTALL_LIBDIR}" ${extra_libdir})
-   elseif(UNIX)
--    set(_install_rpath "\$ORIGIN/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
-+    set(_install_rpath "\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
-     if(${CMAKE_SYSTEM_NAME} MATCHES "(FreeBSD|DragonFly)")
-       set_property(TARGET ${name} APPEND_STRING PROPERTY
-                    LINK_FLAGS " -Wl,-z,origin ")
-diff --git a/cmake/modules/AddOCaml.cmake b/cmake/modules/AddOCaml.cmake
-index 02bab6846376..eff26adb2efc 100644
---- a/cmake/modules/AddOCaml.cmake
-+++ b/cmake/modules/AddOCaml.cmake
-@@ -140,9 +140,9 @@ function(add_ocaml_library name)
-   endforeach()
- 
-   if( APPLE )
--    set(ocaml_rpath "@executable_path/../../../lib${LLVM_LIBDIR_SUFFIX}")
-+    set(ocaml_rpath "@executable_path/../../../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}")
-   elseif( UNIX )
--    set(ocaml_rpath "\\$ORIGIN/../../../lib${LLVM_LIBDIR_SUFFIX}")
-+    set(ocaml_rpath "\\$ORIGIN/../../../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}")
-   endif()
-   list(APPEND ocaml_flags "-ldopt" "-Wl,-rpath,${ocaml_rpath}")
- 
-diff --git a/cmake/modules/AddSphinxTarget.cmake b/cmake/modules/AddSphinxTarget.cmake
-index 22e3dcb776aa..ba77b9c195e2 100644
---- a/cmake/modules/AddSphinxTarget.cmake
-+++ b/cmake/modules/AddSphinxTarget.cmake
-@@ -73,7 +73,7 @@ function (add_sphinx_target builder project)
- 
-       elseif (builder STREQUAL html)
-         string(TOUPPER "${project}" project_upper)
--        set(${project_upper}_INSTALL_SPHINX_HTML_DIR "share/doc/${project}/html"
-+        set(${project_upper}_INSTALL_SPHINX_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/${project}/html"
-             CACHE STRING "HTML documentation install directory for ${project}")
- 
-         # '/.' indicates: copy the contents of the directory directly into
-diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt
-index f5cc0006fa06..77698aeaf000 100644
---- a/cmake/modules/CMakeLists.txt
-+++ b/cmake/modules/CMakeLists.txt
-@@ -1,4 +1,4 @@
--set(LLVM_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm)
-+set(LLVM_INSTALL_PACKAGE_DIR ${LLVM_INSTALL_CMAKE_DIR} CACHE STRING "Path for CMake subdirectory (defaults to 'cmake/llvm')")
- set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}")
- 
- # First for users who use an installed LLVM, create the LLVMExports.cmake file.
-@@ -90,11 +90,11 @@ foreach(p ${_count})
-   set(LLVM_CONFIG_CODE "${LLVM_CONFIG_CODE}
- get_filename_component(LLVM_INSTALL_PREFIX \"\${LLVM_INSTALL_PREFIX}\" PATH)")
- endforeach(p)
--set(LLVM_CONFIG_INCLUDE_DIRS "\${LLVM_INSTALL_PREFIX}/include")
--set(LLVM_CONFIG_LIBRARY_DIRS "\${LLVM_INSTALL_PREFIX}/lib\${LLVM_LIBDIR_SUFFIX}")
-+set(LLVM_CONFIG_INCLUDE_DIRS "\${LLVM_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}")
-+set(LLVM_CONFIG_LIBRARY_DIRS "\${LLVM_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}\${LLVM_LIBDIR_SUFFIX}")
- set(LLVM_CONFIG_CMAKE_DIR "\${LLVM_INSTALL_PREFIX}/${LLVM_INSTALL_PACKAGE_DIR}")
- set(LLVM_CONFIG_BINARY_DIR "\${LLVM_INSTALL_PREFIX}")
--set(LLVM_CONFIG_TOOLS_BINARY_DIR "\${LLVM_INSTALL_PREFIX}/bin")
-+set(LLVM_CONFIG_TOOLS_BINARY_DIR "\${LLVM_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}")
- set(LLVM_CONFIG_EXPORTS_FILE "\${LLVM_CMAKE_DIR}/LLVMExports.cmake")
- set(LLVM_CONFIG_EXPORTS "${LLVM_EXPORTS}")
- configure_file(
-diff --git a/cmake/modules/LLVMInstallSymlink.cmake b/cmake/modules/LLVMInstallSymlink.cmake
-index 1a04de931ff7..1c5ea4200635 100644
---- a/cmake/modules/LLVMInstallSymlink.cmake
-+++ b/cmake/modules/LLVMInstallSymlink.cmake
-@@ -10,7 +10,7 @@ function(install_symlink name target outdir)
-     set(LINK_OR_COPY copy)
-   endif()
- 
--  set(bindir "${DESTDIR}${CMAKE_INSTALL_PREFIX}/${outdir}/")
-+  set(bindir "${DESTDIR}${outdir}/")
- 
-   message("Creating ${name}")
- 
-diff --git a/docs/CMake.rst b/docs/CMake.rst
-index eb219c58560b..6f32532f8ebf 100644
---- a/docs/CMake.rst
-+++ b/docs/CMake.rst
-@@ -196,7 +196,7 @@ CMake manual, or execute ``cmake --help-variable VARIABLE_NAME``.
- **LLVM_LIBDIR_SUFFIX**:STRING
-   Extra suffix to append to the directory where libraries are to be
-   installed. On a 64-bit architecture, one could use ``-DLLVM_LIBDIR_SUFFIX=64``
--  to install libraries to ``/usr/lib64``.
-+  to install libraries to ``/usr/lib64``. See also ``CMAKE_INSTALL_LIBDIR``.
- 
- **CMAKE_C_FLAGS**:STRING
-   Extra flags to use when compiling C source files.
-@@ -479,8 +479,8 @@ LLVM-specific variables
- 
- **LLVM_INSTALL_DOXYGEN_HTML_DIR**:STRING
-   The path to install Doxygen-generated HTML documentation to. This path can
--  either be absolute or relative to the CMAKE_INSTALL_PREFIX. Defaults to
--  `share/doc/llvm/doxygen-html`.
-+  either be absolute or relative to the ``CMAKE_INSTALL_PREFIX``. Defaults to
-+  `${CMAKE_INSTALL_DOCDIR}/${project}/doxygen-html`.
- 
- **LLVM_ENABLE_SPHINX**:BOOL
-   If specified, CMake will search for the ``sphinx-build`` executable and will make
-@@ -511,13 +511,33 @@ LLVM-specific variables
- 
- **LLVM_INSTALL_SPHINX_HTML_DIR**:STRING
-   The path to install Sphinx-generated HTML documentation to. This path can
--  either be absolute or relative to the CMAKE_INSTALL_PREFIX. Defaults to
--  `share/doc/llvm/html`.
-+  either be absolute or relative to the ``CMAKE_INSTALL_PREFIX``. Defaults to
-+  `${CMAKE_INSTALL_DOCDIR}/${project}/html`.
- 
- **LLVM_INSTALL_OCAMLDOC_HTML_DIR**:STRING
-   The path to install OCamldoc-generated HTML documentation to. This path can
--  either be absolute or relative to the CMAKE_INSTALL_PREFIX. Defaults to
--  `share/doc/llvm/ocaml-html`.
-+  either be absolute or relative to the ``CMAKE_INSTALL_PREFIX``. Defaults to
-+  `${CMAKE_INSTALL_DOCDIR}/${project}/ocaml-html`.
-+
-+**CMAKE_INSTALL_BINDIR**:STRING
-+  The path to install binary tools, relative to the ``CMAKE_INSTALL_PREFIX``.
-+  Defaults to `bin`.
-+
-+**CMAKE_INSTALL_LIBDIR**:STRING
-+  The path to install libraries, relative to the ``CMAKE_INSTALL_PREFIX``.
-+  Defaults to `lib`.
-+
-+**CMAKE_INSTALL_INCLUDEDIR**:STRING
-+  The path to install header files, relative to the ``CMAKE_INSTALL_PREFIX``.
-+  Defaults to `include`.
-+
-+**CMAKE_INSTALL_DOCDIR**:STRING
-+  The path to install documentation, relative to the ``CMAKE_INSTALL_PREFIX``.
-+  Defaults to `share/doc`.
-+
-+**CMAKE_INSTALL_MANDIR**:STRING
-+  The path to install manpage files, relative to the ``CMAKE_INSTALL_PREFIX``.
-+  Defaults to `share/man`.
- 
- **LLVM_CREATE_XCODE_TOOLCHAIN**:BOOL
-   OS X Only: If enabled CMake will generate a target named
-@@ -691,9 +711,11 @@ the ``cmake`` command or by setting it directly in ``ccmake`` or ``cmake-gui``).
- 
- This file is available in two different locations.
- 
--* ``<INSTALL_PREFIX>/lib/cmake/llvm/LLVMConfig.cmake`` where
--  ``<INSTALL_PREFIX>`` is the install prefix of an installed version of LLVM.
--  On Linux typically this is ``/usr/lib/cmake/llvm/LLVMConfig.cmake``.
-+* ``<LLVM_INSTALL_PACKAGE_DIR>LLVMConfig.cmake`` where
-+  ``<LLVM_INSTALL_PACKAGE_DIR>`` is the location where LLVM CMake modules are
-+  installed as part of an installed version of LLVM. This is typically
-+  ``cmake/llvm/`` within the lib directory. On Linux, this is typically
-+  ``/usr/lib/cmake/llvm/LLVMConfig.cmake``.
- 
- * ``<LLVM_BUILD_ROOT>/lib/cmake/llvm/LLVMConfig.cmake`` where
-   ``<LLVM_BUILD_ROOT>`` is the root of the LLVM build tree. **Note: this is only
-diff --git a/include/llvm/CMakeLists.txt b/include/llvm/CMakeLists.txt
-index 1d5ca3ba92b0..026f5453c1da 100644
---- a/include/llvm/CMakeLists.txt
-+++ b/include/llvm/CMakeLists.txt
-@@ -4,5 +4,5 @@ add_subdirectory(Support)
- # If we're doing an out-of-tree build, copy a module map for generated
- # header files into the build area.
- if (NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
--  configure_file(module.modulemap.build module.modulemap COPYONLY)
-+  configure_file(module.modulemap.build ${LLVM_INCLUDE_DIR}/module.modulemap COPYONLY)
- endif (NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
-diff --git a/tools/llvm-config/BuildVariables.inc.in b/tools/llvm-config/BuildVariables.inc.in
-index f201e1f7bff0..4582ed556a02 100644
---- a/tools/llvm-config/BuildVariables.inc.in
-+++ b/tools/llvm-config/BuildVariables.inc.in
-@@ -24,6 +24,10 @@
- #define LLVM_CXXFLAGS "@LLVM_CXXFLAGS@"
- #define LLVM_BUILDMODE "@LLVM_BUILDMODE@"
- #define LLVM_LIBDIR_SUFFIX "@LLVM_LIBDIR_SUFFIX@"
-+#define LLVM_INSTALL_BINDIR "@CMAKE_INSTALL_BINDIR@"
-+#define LLVM_INSTALL_LIBDIR "@CMAKE_INSTALL_LIBDIR@"
-+#define LLVM_INSTALL_INCLUDEDIR "@CMAKE_INSTALL_INCLUDEDIR@"
-+#define LLVM_INSTALL_CMAKEDIR "@LLVM_INSTALL_CMAKE_DIR@"
- #define LLVM_TARGETS_BUILT "@LLVM_TARGETS_BUILT@"
- #define LLVM_SYSTEM_LIBS "@LLVM_SYSTEM_LIBS@"
- #define LLVM_BUILD_SYSTEM "@LLVM_BUILD_SYSTEM@"
-diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
-index bec89fef98ca..31d78f925d45 100644
---- a/tools/llvm-config/llvm-config.cpp
-+++ b/tools/llvm-config/llvm-config.cpp
-@@ -333,12 +333,26 @@ int main(int argc, char **argv) {
-         ("-I" + ActiveIncludeDir + " " + "-I" + ActiveObjRoot + "/include");
-   } else {
-     ActivePrefix = CurrentExecPrefix;
--    ActiveIncludeDir = ActivePrefix + "/include";
--    SmallString<256> path(StringRef(LLVM_TOOLS_INSTALL_DIR));
--    sys::fs::make_absolute(ActivePrefix, path);
--    ActiveBinDir = path.str();
--    ActiveLibDir = ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX;
--    ActiveCMakeDir = ActiveLibDir + "/cmake/llvm";
-+    {
-+      SmallString<256> path(StringRef(LLVM_INSTALL_INCLUDEDIR));
-+      sys::fs::make_absolute(ActivePrefix, path);
-+      ActiveIncludeDir = std::string(path.str());
-+    }
-+    {
-+      SmallString<256> path(StringRef(LLVM_INSTALL_BINDIR));
-+      sys::fs::make_absolute(ActivePrefix, path);
-+      ActiveBinDir = std::string(path.str());
-+    }
-+    {
-+      SmallString<256> path(StringRef(LLVM_INSTALL_LIBDIR LLVM_LIBDIR_SUFFIX));
-+      sys::fs::make_absolute(ActivePrefix, path);
-+      ActiveLibDir = std::string(path.str());
-+    }
-+    {
-+      SmallString<256> path(StringRef(LLVM_INSTALL_CMAKEDIR));
-+      sys::fs::make_absolute(ActivePrefix, path);
-+      ActiveCMakeDir = std::string(path.str());
-+    }
-     ActiveIncludeOption = "-I" + ActiveIncludeDir;
-   }
- 
-diff --git a/tools/lto/CMakeLists.txt b/tools/lto/CMakeLists.txt
-index 6e913519a809..85641eef721f 100644
---- a/tools/lto/CMakeLists.txt
-+++ b/tools/lto/CMakeLists.txt
-@@ -19,7 +19,7 @@ set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/lto.exports)
- add_llvm_library(LTO SHARED ${SOURCES} DEPENDS intrinsics_gen)
- 
- install(FILES ${LLVM_MAIN_INCLUDE_DIR}/llvm-c/lto.h
--  DESTINATION include/llvm-c
-+  DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/llvm-c
-   COMPONENT LTO)
- 
- if (APPLE)
-diff --git a/tools/opt-remarks/CMakeLists.txt b/tools/opt-remarks/CMakeLists.txt
-index a87beae1e893..149ea3d10168 100644
---- a/tools/opt-remarks/CMakeLists.txt
-+++ b/tools/opt-remarks/CMakeLists.txt
-@@ -11,7 +11,7 @@ set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/OptRemarks.exports)
- add_llvm_library(OptRemarks SHARED ${SOURCES})
- 
- install(FILES ${LLVM_MAIN_INCLUDE_DIR}/llvm-c/OptRemarks.h
--  DESTINATION include/llvm-c
-+  DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/llvm-c
-   COMPONENT OptRemarks)
- 
- if (APPLE)
-diff --git a/tools/opt-viewer/CMakeLists.txt b/tools/opt-viewer/CMakeLists.txt
-index 19b606933082..27b9f71b3d79 100644
---- a/tools/opt-viewer/CMakeLists.txt
-+++ b/tools/opt-viewer/CMakeLists.txt
-@@ -8,6 +8,6 @@ set (files
- 
- foreach (file ${files})
-   install(PROGRAMS ${file}
--    DESTINATION share/opt-viewer
-+    DESTINATION ${CMAKE_INSTALL_DATADIR}/opt-viewer
-     COMPONENT opt-viewer)
- endforeach (file)
diff --git a/nixpkgs/pkgs/development/compilers/llvm/8/openmp/default.nix b/nixpkgs/pkgs/development/compilers/llvm/8/openmp/default.nix
deleted file mode 100644
index 32b564ff0ecf..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/8/openmp/default.nix
+++ /dev/null
@@ -1,37 +0,0 @@
-{ lib
-, stdenv
-, llvm_meta
-, fetch
-, cmake
-, llvm
-, targetLlvm
-, perl
-, version
-}:
-
-stdenv.mkDerivation {
-  pname = "openmp";
-  inherit version;
-
-  src = fetch "openmp" "0b3jlxhqbpyd1nqkpxjfggm5d9va5qpyf7d4i5y7n4a1mlydv19y";
-
-  nativeBuildInputs = [ cmake perl ];
-  buildInputs = [
-    (if stdenv.buildPlatform == stdenv.hostPlatform then llvm else targetLlvm)
-  ];
-
-  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 ];
-  };
-}
diff --git a/nixpkgs/pkgs/development/compilers/llvm/9/clang/default.nix b/nixpkgs/pkgs/development/compilers/llvm/9/clang/default.nix
index 75814fc11c48..e8a2a4bd0db1 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/9/clang/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/9/clang/default.nix
@@ -97,7 +97,7 @@ let
     passthru = {
       inherit libllvm;
       isClang = true;
-      hardeningUnsupportedFlags = [ "fortify3" ];
+      hardeningUnsupportedFlags = [ "fortify3" "zerocallusedregs" ];
     };
 
     meta = llvm_meta // {
diff --git a/nixpkgs/pkgs/development/compilers/llvm/9/compiler-rt/default.nix b/nixpkgs/pkgs/development/compilers/llvm/9/compiler-rt/default.nix
index d03fcbc7f708..4dddbc67d7cb 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/9/compiler-rt/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/9/compiler-rt/default.nix
@@ -115,6 +115,9 @@ stdenv.mkDerivation {
     # "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 ];
-    broken = stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64;
+    broken = stdenv.hostPlatform.system == "aarch64-darwin"
+      # compiler-rt requires a Clang stdenv on 32-bit RISC-V:
+      # https://reviews.llvm.org/D43106#1019077
+      || (stdenv.hostPlatform.isRiscV32 && !stdenv.cc.isClang);
   };
 }
diff --git a/nixpkgs/pkgs/development/compilers/llvm/9/default.nix b/nixpkgs/pkgs/development/compilers/llvm/9/default.nix
index fbd2e57805be..a6274c8b2b9c 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/9/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/9/default.nix
@@ -161,6 +161,7 @@ let
         echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
       '' + lib.optionalString (!stdenv.targetPlatform.isWasm) ''
         echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags
+        echo "-L${targetLlvmLibraries.libunwind}/lib" >> $out/nix-support/cc-ldflags
       '' + lib.optionalString (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false) ''
         echo "-lunwind" >> $out/nix-support/cc-ldflags
       '' + lib.optionalString stdenv.targetPlatform.isWasm ''
diff --git a/nixpkgs/pkgs/development/compilers/llvm/9/llvm/default.nix b/nixpkgs/pkgs/development/compilers/llvm/9/llvm/default.nix
index 75c786855973..c0ef7801c348 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/9/llvm/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/9/llvm/default.nix
@@ -237,7 +237,7 @@ in stdenv.mkDerivation (rec {
   ] ++ optionals (isDarwin) [
     "-DLLVM_ENABLE_LIBCXX=ON"
     "-DCAN_TARGET_i386=false"
-  ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+  ] ++ optionals ((stdenv.hostPlatform != stdenv.buildPlatform) && !(stdenv.buildPlatform.canExecute stdenv.hostPlatform)) [
     "-DCMAKE_CROSSCOMPILING=True"
     "-DLLVM_TABLEGEN=${buildLlvmTools.llvm}/bin/llvm-tblgen"
     (
diff --git a/nixpkgs/pkgs/development/compilers/llvm/aarch64.patch b/nixpkgs/pkgs/development/compilers/llvm/aarch64.patch
deleted file mode 100644
index 205074e48e4e..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/aarch64.patch
+++ /dev/null
@@ -1,51 +0,0 @@
---- lib/Support/Unix/Memory.inc
-+++ lib/Support/Unix/Memory.inc
-@@ -126,8 +126,12 @@
-   Result.Address = Addr;
-   Result.Size = NumPages*PageSize;
- 
--  if (PFlags & MF_EXEC)
--    Memory::InvalidateInstructionCache(Result.Address, Result.Size);
-+  // Rely on protectMappedMemory to invalidate instruction cache.
-+  if (PFlags & MF_EXEC) {
-+    EC = Memory::protectMappedMemory (Result, PFlags);
-+    if (EC != std::error_code())
-+      return MemoryBlock();
-+  }
- 
-   return Result;
- }
-@@ -156,15 +160,31 @@
-     return std::error_code(EINVAL, std::generic_category());
- 
-   int Protect = getPosixProtectionFlags(Flags);
--
-   uintptr_t Start = alignAddr((uint8_t *)M.Address - PageSize + 1, PageSize);
-   uintptr_t End = alignAddr((uint8_t *)M.Address + M.Size, PageSize);
-+
-+  bool InvalidateCache = (Flags & MF_EXEC);
-+
-+#if defined(__arm__) || defined(__aarch64__)
-+  // Certain ARM implementations treat icache clear instruction as a memory read,
-+  // and CPU segfaults on trying to clear cache on !PROT_READ page.  Therefore we need
-+  // to temporarily add PROT_READ for the sake of flushing the instruction caches.
-+  if (InvalidateCache && !(Protect & PROT_READ)) {
-+    int Result = ::mprotect((void *)Start, End - Start, Protect | PROT_READ);
-+    if (Result != 0)
-+      return std::error_code(errno, std::generic_category());
-+
-+    Memory::InvalidateInstructionCache(M.Address, M.Size);
-+    InvalidateCache = false;
-+  }
-+#endif
-+
-   int Result = ::mprotect((void *)Start, End - Start, Protect);
- 
-   if (Result != 0)
-     return std::error_code(errno, std::generic_category());
- 
--  if (Flags & MF_EXEC)
-+  if (InvalidateCache)
-     Memory::InvalidateInstructionCache(M.Address, M.Size);
- 
-   return std::error_code();
diff --git a/nixpkgs/pkgs/development/compilers/llvm/common/clang/5-8-purity.patch b/nixpkgs/pkgs/development/compilers/llvm/common/clang/5-8-purity.patch
deleted file mode 100644
index b30d0d0b5d5b..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/common/clang/5-8-purity.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From 4add81bba40dcec62c4ea4481be8e35ac53e89d8 Mon Sep 17 00:00:00 2001
-From: Will Dietz <w@wdtz.org>
-Date: Thu, 18 May 2017 11:56:12 -0500
-Subject: [PATCH] "purity" patch for 5.0
-
----
- lib/Driver/ToolChains/Gnu.cpp | 7 -------
- 1 file changed, 7 deletions(-)
-
-diff --git a/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp
-index fe3c0191bb..c6a482bece 100644
---- a/lib/Driver/ToolChains/Gnu.cpp
-+++ b/lib/Driver/ToolChains/Gnu.cpp
-@@ -494,13 +494,6 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
-   if (!Args.hasArg(options::OPT_static)) {
-     if (Args.hasArg(options::OPT_rdynamic))
-       CmdArgs.push_back("-export-dynamic");
--
--    if (!Args.hasArg(options::OPT_shared)) {
--      const std::string Loader =
--          D.DyldPrefix + ToolChain.getDynamicLinker(Args);
--      CmdArgs.push_back("-dynamic-linker");
--      CmdArgs.push_back(Args.MakeArgString(Loader));
--    }
-   }
- 
-   CmdArgs.push_back("-o");
--- 
-2.11.0
-
diff --git a/nixpkgs/pkgs/development/compilers/llvm/common/lldb.nix b/nixpkgs/pkgs/development/compilers/llvm/common/lldb.nix
index 4cb73a4d97a6..59e427e846c4 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/common/lldb.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/common/lldb.nix
@@ -5,7 +5,8 @@
 , cmake
 , zlib
 , ncurses
-, swig
+, swig3
+, swig4
 , which
 , libedit
 , libxml2
@@ -34,6 +35,11 @@ let
         cp -r ${monorepoSrc}/cmake "$out"
         cp -r ${monorepoSrc}/lldb "$out"
       '' else src;
+  vscodeExt = {
+    name = if lib.versionAtLeast release_version "18" then "lldb-dap" else "lldb-vscode";
+    version = if lib.versionAtLeast release_version "18" then "0.2.0" else "0.1.0";
+  };
+  swig = if lib.versionAtLeast release_version "18" then swig4 else swig3;
 in
 
 stdenv.mkDerivation (rec {
@@ -58,7 +64,10 @@ stdenv.mkDerivation (rec {
     lua5_3
   ] ++ lib.optionals enableManpages [
     python3.pkgs.sphinx
+  ] ++ lib.optionals (lib.versionOlder release_version "18" && enableManpages) [
     python3.pkgs.recommonmark
+  ] ++ lib.optionals (lib.versionAtLeast release_version "18" && enableManpages) [
+    python3.pkgs.myst-parser
   ] ++ lib.optionals (lib.versionAtLeast release_version "14") [
     ninja
   ];
@@ -154,14 +163,14 @@ stdenv.mkDerivation (rec {
 
     # Editor support
     # vscode:
-    install -D ../tools/lldb-vscode/package.json $out/share/vscode/extensions/llvm-org.lldb-vscode-0.1.0/package.json
-    mkdir -p $out/share/vscode/extensions/llvm-org.lldb-vscode-0.1.0/bin
-    ln -s $out/bin/*-vscode $out/share/vscode/extensions/llvm-org.lldb-vscode-0.1.0/bin
+    install -D ../tools/${vscodeExt.name}/package.json $out/share/vscode/extensions/llvm-org.${vscodeExt.name}-${vscodeExt.version}/package.json
+    mkdir -p $out/share/vscode/extensions/llvm-org.${vscodeExt.name}-${vscodeExt.version}/bin
+    ln -s $out/bin/*${if lib.versionAtLeast release_version "18" then vscodeExt.name else "-vscode"} $out/share/vscode/extensions/llvm-org.${vscodeExt.name}-${vscodeExt.version}/bin
   '';
 
-  passthru.vscodeExtName = "lldb-vscode";
+  passthru.vscodeExtName = vscodeExt.name;
   passthru.vscodeExtPublisher = "llvm";
-  passthru.vscodeExtUniqueId = "llvm-org.lldb-vscode-0.1.0";
+  passthru.vscodeExtUniqueId = "llvm-org.${vscodeExt.name}-${vscodeExt.version}";
 
   meta = llvm_meta // {
     homepage = "https://lldb.llvm.org/";
diff --git a/nixpkgs/pkgs/development/compilers/llvm/git/clang/default.nix b/nixpkgs/pkgs/development/compilers/llvm/git/clang/default.nix
index d8fe08569f3f..eea346ef22ef 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/git/clang/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/git/clang/default.nix
@@ -7,7 +7,7 @@
 }:
 
 let
-  self = stdenv.mkDerivation (rec {
+  self = stdenv.mkDerivation (finalAttrs: rec {
     pname = "clang";
     inherit version;
 
@@ -21,6 +21,7 @@ let
     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;
 
@@ -70,7 +71,7 @@ let
       ln -sv $out/bin/clang $out/bin/cpp
 
       mkdir -p $lib/lib/clang
-      mv $lib/lib/18 $lib/lib/clang/18
+      mv $lib/lib/${lib.versions.major version} $lib/lib/clang/${lib.versions.major version}
 
       # Move libclang to 'lib' output
       moveToOutput "lib/libclang.*" "$lib"
@@ -95,7 +96,12 @@ let
     passthru = {
       inherit libllvm;
       isClang = true;
-      hardeningUnsupportedFlags = [ "fortify3" ];
+      hardeningUnsupportedFlags = [
+        "fortify3"
+      ];
+      hardeningUnsupportedFlagsByTargetPlatform = targetPlatform:
+        lib.optional (!(targetPlatform.isx86_64 || targetPlatform.isAarch64)) "zerocallusedregs"
+        ++ (finalAttrs.passthru.hardeningUnsupportedFlags or []);
     };
 
     meta = llvm_meta // {
diff --git a/nixpkgs/pkgs/development/compilers/llvm/git/clang/purity.patch b/nixpkgs/pkgs/development/compilers/llvm/git/clang/purity.patch
index 1c94f293eb93..5ce14a3479a0 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/git/clang/purity.patch
+++ b/nixpkgs/pkgs/development/compilers/llvm/git/clang/purity.patch
@@ -4,26 +4,22 @@ Date: Thu, 18 May 2017 11:56:12 -0500
 Subject: [PATCH] "purity" patch for 5.0
 
 ---
- lib/Driver/ToolChains/Gnu.cpp | 7 -------
- 1 file changed, 7 deletions(-)
+ lib/Driver/ToolChains/Gnu.cpp | 3 ---
+ 1 file changed, 3 deletions(-)
 
 diff --git a/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp
 index fe3c0191bb..c6a482bece 100644
 --- a/lib/Driver/ToolChains/Gnu.cpp
 +++ b/lib/Driver/ToolChains/Gnu.cpp
-@@ -487,13 +487,7 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
-   } else {
-     if (Args.hasArg(options::OPT_rdynamic))
-       CmdArgs.push_back("-export-dynamic");
-
--    if (!Args.hasArg(options::OPT_shared) && !IsStaticPIE &&
--        !Args.hasArg(options::OPT_r)) {
+@@ -446,9 +446,6 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
+                            ToolChain.isPIEDefault(Args));
+       if (IsPIE)
+         CmdArgs.push_back("-pie");
 -      CmdArgs.push_back("-dynamic-linker");
 -      CmdArgs.push_back(Args.MakeArgString(Twine(D.DyldPrefix) +
 -                                           ToolChain.getDynamicLinker(Args)));
--    }
+     }
    }
  
-   CmdArgs.push_back("-o");
 -- 
 2.11.0
diff --git a/nixpkgs/pkgs/development/compilers/llvm/git/compiler-rt/default.nix b/nixpkgs/pkgs/development/compilers/llvm/git/compiler-rt/default.nix
index 808df140e772..0f15a9e12cde 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/git/compiler-rt/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/git/compiler-rt/default.nix
@@ -152,5 +152,8 @@ stdenv.mkDerivation {
     # "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/nixpkgs/pkgs/development/compilers/llvm/git/default.nix b/nixpkgs/pkgs/development/compilers/llvm/git/default.nix
index 41ce6076da5f..7dfec234104d 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/git/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/git/default.nix
@@ -19,9 +19,9 @@
 # LLVM release information; specify one of these but not both:
 , gitRelease ? {
   version = "18.0.0";
-  rev = "6f44f87011cd52367626cac111ddbb2d25784b90";
-  rev-version = "18.0.0-unstable-2023-10-04";
-  sha256 = "sha256-CqsCDlzg8I2c9BybKP7B5nfHiQWktqgVavrfiYkjkx4=";
+  rev = "2fd7657b6609454af7adb75765d164ec7d1bb80b";
+  rev-version = "18.0.0-unstable-2023-12-13";
+  sha256 = "sha256-/sMQzzFid0tAnreOIV9SUm2H6QbEGhpNcizl3LDPM5s=";
 }
   # i.e.:
   # {
@@ -216,6 +216,7 @@ in let
           (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false)
           "-lunwind"
         ++ lib.optional stdenv.targetPlatform.isWasm "-fno-exceptions";
+      nixSupport.cc-ldflags = lib.optionals (!stdenv.targetPlatform.isWasm) [ "-L${targetLlvmLibraries.libunwind}/lib" ];
     };
 
     clangNoLibcxx = wrapCCWith rec {
diff --git a/nixpkgs/pkgs/development/compilers/llvm/git/libcxx/default.nix b/nixpkgs/pkgs/development/compilers/llvm/git/libcxx/default.nix
index 7b9996641663..8a5272ea07af 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/git/libcxx/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/git/libcxx/default.nix
@@ -1,5 +1,5 @@
 { lib, stdenv, llvm_meta
-, monorepoSrc, runCommand
+, monorepoSrc, runCommand, fetchpatch
 , cmake, ninja, python3, fixDarwinDylibNames, version
 , cxxabi ? if stdenv.hostPlatform.isFreeBSD then libcxxrt else libcxxabi
 , libcxxabi, libcxxrt, libunwind
@@ -45,6 +45,17 @@ stdenv.mkDerivation rec {
     chmod -R u+w .
   '';
 
+  patches = [
+    # fix for https://github.com/NixOS/nixpkgs/issues/269548
+    # https://github.com/llvm/llvm-project/pull/77218
+    (fetchpatch {
+      name = "darwin-system-libcxxabi-link-flags.patch";
+      url = "https://github.com/llvm/llvm-project/commit/c5b89b29ee6e3c444a355fd1cf733ce7ab2e316a.patch";
+      hash = "sha256-LNoPg1KCoP8RWxU/AzHR52f4Dww24I9BGQJedMhFxyQ=";
+      relative = "libcxx";
+    })
+  ];
+
   postPatch = ''
     cd ../runtimes
   '';
diff --git a/nixpkgs/pkgs/development/compilers/llvm/git/llvm/default.nix b/nixpkgs/pkgs/development/compilers/llvm/git/llvm/default.nix
index 36edfee8a091..3c52b7a9bb0b 100644
--- a/nixpkgs/pkgs/development/compilers/llvm/git/llvm/default.nix
+++ b/nixpkgs/pkgs/development/compilers/llvm/git/llvm/default.nix
@@ -86,10 +86,14 @@ stdenv.mkDerivation (rec {
 
   nativeBuildInputs = [ cmake ninja python ]
     ++ optionals enableManpages [
-      # Note: we intentionally use `python3Packages` instead of `python3.pkgs`;
-      # splicing does *not* work with the latter. (TODO: fix)
-      python3Packages.sphinx python3Packages.recommonmark
-    ];
+    # Note: we intentionally use `python3Packages` instead of `python3.pkgs`;
+    # splicing does *not* work with the latter. (TODO: fix)
+    python3Packages.sphinx
+  ] ++ optionals (lib.versionOlder version "18" && enableManpages) [
+    python3Packages.recommonmark
+  ] ++ optionals (lib.versionAtLeast version "18" && enableManpages) [
+    python3Packages.myst-parser
+  ];
 
   buildInputs = [ libxml2 libffi ]
     ++ optional enablePFM libpfm; # exegesis
@@ -329,7 +333,7 @@ stdenv.mkDerivation (rec {
   ] ++ optionals isDarwin [
     "-DLLVM_ENABLE_LIBCXX=ON"
     "-DCAN_TARGET_i386=false"
-  ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+  ] ++ optionals ((stdenv.hostPlatform != stdenv.buildPlatform) && !(stdenv.buildPlatform.canExecute stdenv.hostPlatform)) [
     "-DCMAKE_CROSSCOMPILING=True"
     "-DLLVM_TABLEGEN=${buildLlvmTools.llvm}/bin/llvm-tblgen"
     (
diff --git a/nixpkgs/pkgs/development/compilers/llvm/llvm-7-musl.patch b/nixpkgs/pkgs/development/compilers/llvm/llvm-7-musl.patch
deleted file mode 100644
index 0dac12cc20d6..000000000000
--- a/nixpkgs/pkgs/development/compilers/llvm/llvm-7-musl.patch
+++ /dev/null
@@ -1,92 +0,0 @@
-From 8c747d3157df2830eed9205e7caf1203b345de17 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Sat, 4 Feb 2023 13:54:41 -0800
-Subject: [PATCH] cmake: Enable 64bit off_t on 32bit glibc systems
-
-Pass -D_FILE_OFFSET_BITS=64 to compiler flags on 32bit glibc based
-systems. This will make sure that 64bit versions of LFS functions are
-used e.g. seek will behave same as lseek64. Also revert [1] partially
-because this added a cmake test to detect lseek64 but then forgot to
-pass the needed macro to actual compile, this test was incomplete too
-since libc implementations like musl has 64bit off_t by default on 32bit
-systems and does not bundle[2] -D_LARGEFILE64_SOURCE under -D_GNU_SOURCE
-like glibc, which means the compile now fails on musl because the cmake
-check passes but we do not have _LARGEFILE64_SOURCE defined. Using the
-*64 function was transitional anyways so use -D_FILE_OFFSET_BITS=64
-instead
-
-[1] https://github.com/llvm/llvm-project/commit/8db7e5e4eed4c4e697dc3164f2c9351d8c3e942b
-[2] https://git.musl-libc.org/cgit/musl/commit/?id=25e6fee27f4a293728dd15b659170e7b9c7db9bc
-
-Reviewed By: MaskRay
-
-Differential Revision: https://reviews.llvm.org/D139752
-
-(cherry picked from commit 5cd554303ead0f8891eee3cd6d25cb07f5a7bf67)
----
- cmake/config-ix.cmake              | 13 ++++++++++---
- include/llvm/Config/config.h.cmake |  3 ---
- lib/Support/raw_ostream.cpp        |  2 --
- 3 files changed, 10 insertions(+), 8 deletions(-)
-
-diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake
-index 18977d9950ff..b558aa83fa62 100644
---- a/cmake/config-ix.cmake
-+++ b/cmake/config-ix.cmake
-@@ -197,9 +197,6 @@ check_symbol_exists(posix_fallocate fcntl.h HAVE_POSIX_FALLOCATE)
- if( HAVE_SIGNAL_H AND NOT LLVM_USE_SANITIZER MATCHES ".*Address.*" AND NOT APPLE )
-   check_symbol_exists(sigaltstack signal.h HAVE_SIGALTSTACK)
- endif()
--set(CMAKE_REQUIRED_DEFINITIONS "-D_LARGEFILE64_SOURCE")
--check_symbol_exists(lseek64 "sys/types.h;unistd.h" HAVE_LSEEK64)
--set(CMAKE_REQUIRED_DEFINITIONS "")
- check_symbol_exists(mallctl malloc_np.h HAVE_MALLCTL)
- check_symbol_exists(mallinfo malloc.h HAVE_MALLINFO)
- check_symbol_exists(malloc_zone_statistics malloc/malloc.h
-@@ -237,6 +234,16 @@ if( PURE_WINDOWS )
-   check_function_exists(__main HAVE___MAIN)
-   check_function_exists(__cmpdi2 HAVE___CMPDI2)
- endif()
-+
-+check_symbol_exists(__GLIBC__ stdio.h LLVM_USING_GLIBC)
-+if( LLVM_USING_GLIBC )
-+# enable 64bit off_t on 32bit systems using glibc
-+  if (CMAKE_SIZEOF_VOID_P EQUAL 4)
-+    add_compile_definitions(_FILE_OFFSET_BITS=64)
-+    list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_FILE_OFFSET_BITS=64")
-+  endif()
-+endif()
-+
- if( HAVE_DLFCN_H )
-   if( HAVE_LIBDL )
-     list(APPEND CMAKE_REQUIRED_LIBRARIES dl)
-diff --git a/include/llvm/Config/config.h.cmake b/include/llvm/Config/config.h.cmake
-index e934617d7ec7..3c39c373b3c1 100644
---- a/include/llvm/Config/config.h.cmake
-+++ b/include/llvm/Config/config.h.cmake
-@@ -112,9 +112,6 @@
- /* Define to 1 if you have the <link.h> header file. */
- #cmakedefine HAVE_LINK_H ${HAVE_LINK_H}
- 
--/* Define to 1 if you have the `lseek64' function. */
--#cmakedefine HAVE_LSEEK64 ${HAVE_LSEEK64}
--
- /* Define to 1 if you have the <mach/mach.h> header file. */
- #cmakedefine HAVE_MACH_MACH_H ${HAVE_MACH_MACH_H}
- 
-diff --git a/lib/Support/raw_ostream.cpp b/lib/Support/raw_ostream.cpp
-index 038ad00bd608..921ab8409008 100644
---- a/lib/Support/raw_ostream.cpp
-+++ b/lib/Support/raw_ostream.cpp
-@@ -677,8 +677,6 @@ uint64_t raw_fd_ostream::seek(uint64_t off) {
-   flush();
- #ifdef _WIN32
-   pos = ::_lseeki64(FD, off, SEEK_SET);
--#elif defined(HAVE_LSEEK64)
--  pos = ::lseek64(FD, off, SEEK_SET);
- #else
-   pos = ::lseek(FD, off, SEEK_SET);
- #endif
--- 
-2.37.1
-