about summary refs log tree commit diff
path: root/pkgs/development/compilers/llvm/13
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/compilers/llvm/13')
-rw-r--r--pkgs/development/compilers/llvm/13/clang/gnu-install-dirs.patch235
-rw-r--r--pkgs/development/compilers/llvm/13/clang/purity.patch28
-rw-r--r--pkgs/development/compilers/llvm/13/compiler-rt/X86-support-extension.patch21
-rw-r--r--pkgs/development/compilers/llvm/13/compiler-rt/normalize-var.patch16
-rw-r--r--pkgs/development/compilers/llvm/13/default.nix388
-rw-r--r--pkgs/development/compilers/llvm/13/lld/gnu-install-dirs.patch68
-rw-r--r--pkgs/development/compilers/llvm/13/lldb/gnu-install-dirs.patch19
-rw-r--r--pkgs/development/compilers/llvm/13/lldb/procfs.patch31
-rw-r--r--pkgs/development/compilers/llvm/13/lldb/resource-dir.patch13
-rw-r--r--pkgs/development/compilers/llvm/13/llvm/default.nix315
-rw-r--r--pkgs/development/compilers/llvm/13/llvm/gnu-install-dirs-polly.patch105
11 files changed, 19 insertions, 1220 deletions
diff --git a/pkgs/development/compilers/llvm/13/clang/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/13/clang/gnu-install-dirs.patch
deleted file mode 100644
index b834d386b4ebc..0000000000000
--- a/pkgs/development/compilers/llvm/13/clang/gnu-install-dirs.patch
+++ /dev/null
@@ -1,235 +0,0 @@
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 9e74014134a0..976e6a1757fd 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -5,6 +5,8 @@ cmake_minimum_required(VERSION 3.13.4)
- if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
-   project(Clang)
- 
-+  include(GNUInstallDirs)
-+
-   set(CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard to conform to")
-   set(CMAKE_CXX_STANDARD_REQUIRED YES)
-   set(CMAKE_CXX_EXTENSIONS NO)
-@@ -416,7 +418,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"
-@@ -425,7 +427,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
-@@ -445,7 +447,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 704278a0e93b..d25c8d325c71 100644
---- a/cmake/modules/AddClang.cmake
-+++ b/cmake/modules/AddClang.cmake
-@@ -123,9 +123,9 @@ macro(add_clang_library name)
-         install(TARGETS ${lib}
-           COMPONENT ${lib}
-           ${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-${lib}
-@@ -170,7 +170,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)
-@@ -185,7 +185,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 b2c0ce8dd4a0..19e5443d8c25 100644
---- a/lib/Headers/CMakeLists.txt
-+++ b/lib/Headers/CMakeLists.txt
-@@ -215,7 +215,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/libclang/CMakeLists.txt b/tools/libclang/CMakeLists.txt
-index 51ff2e7e1565..1ed5f8a079a1 100644
---- a/tools/libclang/CMakeLists.txt
-+++ b/tools/libclang/CMakeLists.txt
-@@ -166,7 +166,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
-@@ -196,7 +196,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 ec0702d76f18..d25d982f51da 100644
---- a/tools/scan-build/CMakeLists.txt
-+++ b/tools/scan-build/CMakeLists.txt
-@@ -47,7 +47,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()
- 
-@@ -61,7 +61,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()
- 
-@@ -89,7 +89,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 dd3d33439299..fea19c12ce70 100644
---- a/tools/scan-view/CMakeLists.txt
-+++ b/tools/scan-view/CMakeLists.txt
-@@ -19,7 +19,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()
- 
-@@ -33,7 +33,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/pkgs/development/compilers/llvm/13/clang/purity.patch b/pkgs/development/compilers/llvm/13/clang/purity.patch
deleted file mode 100644
index deb230a36c5b5..0000000000000
--- a/pkgs/development/compilers/llvm/13/clang/purity.patch
+++ /dev/null
@@ -1,28 +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
-@@ -487,12 +487,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) {
--      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/pkgs/development/compilers/llvm/13/compiler-rt/X86-support-extension.patch b/pkgs/development/compilers/llvm/13/compiler-rt/X86-support-extension.patch
deleted file mode 100644
index 66742e5b1498f..0000000000000
--- a/pkgs/development/compilers/llvm/13/compiler-rt/X86-support-extension.patch
+++ /dev/null
@@ -1,21 +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
-@@ -345,4 +345,8 @@ if (NOT MSVC)
- 
-+  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/pkgs/development/compilers/llvm/13/compiler-rt/normalize-var.patch b/pkgs/development/compilers/llvm/13/compiler-rt/normalize-var.patch
deleted file mode 100644
index 135cf625ef78f..0000000000000
--- a/pkgs/development/compilers/llvm/13/compiler-rt/normalize-var.patch
+++ /dev/null
@@ -1,16 +0,0 @@
-diff --git a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake
-index f1f46fb9599c..6f19e69507ba 100644
---- a/cmake/Modules/CompilerRTUtils.cmake
-+++ b/cmake/Modules/CompilerRTUtils.cmake
-@@ -302,8 +302,9 @@ macro(load_llvm_config)
-     # Get some LLVM variables from LLVMConfig.
-     include("${LLVM_CMAKE_PATH}/LLVMConfig.cmake")
- 
--    set(LLVM_LIBRARY_OUTPUT_INTDIR
--      ${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
-+    get_filename_component(LLVM_LIBRARY_OUTPUT_INTDIR
-+      ${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX}
-+      REALPATH)
-   endif()
- endmacro()
- 
diff --git a/pkgs/development/compilers/llvm/13/default.nix b/pkgs/development/compilers/llvm/13/default.nix
deleted file mode 100644
index 018fb0c638505..0000000000000
--- a/pkgs/development/compilers/llvm/13/default.nix
+++ /dev/null
@@ -1,388 +0,0 @@
-{ lowPrio, newScope, pkgs, lib, stdenv, cmake
-, preLibcCrossHeaders
-, fetchpatch
-, libxml2, python3, isl, fetchFromGitHub, substitute, substituteAll, 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
-, darwin
-# LLVM release information; specify one of these but not both:
-, gitRelease ? null
-  # i.e.:
-  # {
-  #   version = /* i.e. "15.0.0" */;
-  #   rev = /* commit SHA */;
-  #   rev-version = /* human readable version; i.e. "unstable-2022-26-07" */;
-  #   sha256 = /* checksum for this release, can omit if specifying your own `monorepoSrc` */;
-  # }
-, officialRelease ? { version = "13.0.1"; sha256 = "06dv6h5dmvzdxbif2s8njki6h32796v368dyb5945x8gjj72xh7k"; }
-  # i.e.:
-  # {
-  #   version = /* i.e. "15.0.0" */;
-  #   candidate = /* optional; if specified, should be: "rcN" */
-  #   sha256 = /* checksum for this release, can omit if specifying your own `monorepoSrc` */;
-  # }
-# By default, we'll try to fetch a release from `github:llvm/llvm-project`
-# corresponding to the `gitRelease` or `officialRelease` specified.
-#
-# You can provide your own LLVM source by specifying this arg but then it's up
-# to you to make sure that the LLVM repo given matches the release configuration
-# specified.
-, monorepoSrc ? null
-
-}:
-
-assert
-  lib.assertMsg
-    (lib.xor
-      (gitRelease != null)
-      (officialRelease != null))
-    ("must specify `gitRelease` or `officialRelease`" +
-      (lib.optionalString (gitRelease != null) " — not both"));
-let
-  monorepoSrc' = monorepoSrc;
-in let
-  # Import releaseInfo separately to avoid infinite recursion
-  inherit (import ../common/common-let.nix { inherit lib gitRelease officialRelease; }) releaseInfo;
-  inherit (releaseInfo) release_version version;
-  inherit (import ../common/common-let.nix { inherit lib fetchFromGitHub release_version gitRelease officialRelease monorepoSrc'; }) llvm_meta monorepoSrc;
-
-  src = monorepoSrc;
-
-  tools = lib.makeExtensible (tools: let
-    callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version src 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 ../common/clang {
-      patches = [
-        ./clang/purity.patch
-        # https://reviews.llvm.org/D51899
-        ./clang/gnu-install-dirs.patch
-        # Revert of https://reviews.llvm.org/D100879
-        # The malloc alignment assumption is incorrect for jemalloc and causes
-        # mis-compilation in firefox.
-        # See: https://bugzilla.mozilla.org/show_bug.cgi?id=1741454
-        ./clang/revert-malloc-alignment-assumption.patch
-        ../common/clang/add-nostdlibinc-flag.patch
-        (substituteAll {
-          src = ../common/clang/clang-11-15-LLVMgold-path.patch;
-          libllvmLibdir = "${tools.libllvm.lib}/lib";
-        })
-      ];
-      inherit llvm_meta;
-    };
-
-    clang-unwrapped = tools.libclang;
-
-    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
-    });
-
-    # TODO: lldb/docs/index.rst:155:toctree contains reference to nonexisting document 'design/structureddataplugins'
-    # 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 = [
-        targetLlvmLibraries.compiler-rt
-      ];
-      extraBuildCommands = mkExtraBuildCommands cc;
-    };
-
-    lld = callPackage ../common/lld {
-      patches = [
-        ./lld/gnu-install-dirs.patch
-      ];
-      inherit llvm_meta;
-    };
-
-    lldb = callPackage ../common/lldb.nix {
-      patches =
-        let
-          resourceDirPatch = callPackage
-            ({ substituteAll, libclang }: substituteAll
-              {
-                src = ./lldb/resource-dir.patch;
-                clangLibDir = "${libclang.lib}/lib";
-              })
-            { };
-        in
-        [
-          ./lldb/procfs.patch
-          resourceDirPatch
-          ./lldb/gnu-install-dirs.patch
-        ]
-        # This is a stopgap solution if/until the macOS SDK used for x86_64 is
-        # updated.
-        #
-        # The older 10.12 SDK used on x86_64 as of this writing has a `mach/machine.h`
-        # header that does not define `CPU_SUBTYPE_ARM64E` so we replace the one use
-        # of this preprocessor symbol in `lldb` with its expansion.
-        #
-        # See here for some context:
-        # https://github.com/NixOS/nixpkgs/pull/194634#issuecomment-1272129132
-        ++ lib.optional (
-          stdenv.targetPlatform.isDarwin
-            && !stdenv.targetPlatform.isAarch64
-            && (lib.versionOlder darwin.apple_sdk.sdk.version "11.0")
-        ) ./lldb/cpu_subtype_arm64e_replacement.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 = [
-        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
-        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 ''
-        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 src; });
-  in {
-
-    compiler-rt-libc = callPackage ../common/compiler-rt {
-      patches = [
-        ./compiler-rt/codesign.patch # Revert compiler-rt commit that makes codesign mandatory
-        ./compiler-rt/X86-support-extension.patch # Add support for i486 i586 i686 by reusing i386 config
-        # ld-wrapper dislikes `-rpath-link //nix/store`, so we normalize away the
-        # extra `/`.
-        ./compiler-rt/normalize-var.patch
-        # Prevent a compilation error on darwin
-        ./compiler-rt/darwin-targetconditionals.patch
-        ../common/compiler-rt/darwin-plistbuddy-workaround.patch
-        ./compiler-rt/armv7l.patch
-        # 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
-        ../common/compiler-rt/armv6-scudo-no-yield.patch
-        ../common/compiler-rt/armv6-scudo-libatomic.patch
-      ];
-      inherit llvm_meta;
-      stdenv = if stdenv.hostPlatform.useLLVM or false
-               then overrideCC stdenv buildLlvmTools.clangNoCompilerRtWithLibc
-               else stdenv;
-    };
-
-    compiler-rt-no-libc = callPackage ../common/compiler-rt {
-      patches = [
-        ./compiler-rt/codesign.patch # Revert compiler-rt commit that makes codesign mandatory
-        ./compiler-rt/X86-support-extension.patch # Add support for i486 i586 i686 by reusing i386 config
-        # ld-wrapper dislikes `-rpath-link //nix/store`, so we normalize away the
-        # extra `/`.
-        ./compiler-rt/normalize-var.patch
-        # Prevent a compilation error on darwin
-        ./compiler-rt/darwin-targetconditionals.patch
-        ../common/compiler-rt/darwin-plistbuddy-workaround.patch
-        ./compiler-rt/armv7l.patch
-        # 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
-        ../common/compiler-rt/armv6-scudo-no-yield.patch
-        ../common/compiler-rt/armv6-scudo-libatomic.patch
-      ];
-      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 ../common/libcxx {
-      patches = [
-        (substitute {
-          src = ../common/libcxxabi/wasm.patch;
-          replacements = [
-            "--replace-fail" "/cmake/" "/llvm/cmake/"
-          ];
-        })
-      ] ++ lib.optionals stdenv.hostPlatform.isMusl [
-        (substitute {
-          src = ../common/libcxx/libcxx-0001-musl-hacks.patch;
-          replacements = [
-            "--replace-fail" "/include/" "/libcxx/include/"
-          ];
-        })
-      ];
-      inherit llvm_meta;
-      stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx;
-      monorepoSrc = src;
-    };
-
-    libunwind = callPackage ../common/libunwind {
-      patches = [
-        ./libunwind/gnu-install-dirs.patch
-      ];
-      inherit llvm_meta;
-      stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx;
-    };
-
-    openmp = callPackage ../common/openmp {
-      patches = [
-        # Fix cross.
-        (fetchpatch {
-          url = "https://github.com/llvm/llvm-project/commit/5e2358c781b85a18d1463fd924d2741d4ae5e42e.patch";
-          hash = "sha256-UxIlAifXnexF/MaraPW0Ut6q+sf3e7y1fMdEv1q103A=";
-        })
-      ];
-      inherit llvm_meta targetLlvm;
-    };
-  });
-  noExtend = extensible: lib.attrsets.removeAttrs extensible [ "extend" ];
-
-in { inherit tools libraries release_version; } // (noExtend libraries) // (noExtend tools)
diff --git a/pkgs/development/compilers/llvm/13/lld/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/13/lld/gnu-install-dirs.patch
deleted file mode 100644
index 61e2f0e486536..0000000000000
--- a/pkgs/development/compilers/llvm/13/lld/gnu-install-dirs.patch
+++ /dev/null
@@ -1,68 +0,0 @@
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index d4e561b50d8f..cfa5bdd79c2a 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")
-@@ -179,7 +181,7 @@ include_directories(BEFORE
- 
- if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
-   install(DIRECTORY include/
--    DESTINATION include
-+    DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
-     FILES_MATCHING
-     PATTERN "*.h"
-     )
-diff --git a/cmake/modules/AddLLD.cmake b/cmake/modules/AddLLD.cmake
-index 23df41312403..d62372c88de7 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 5cff736ff57f..64e775c771b9 100644
---- a/tools/lld/CMakeLists.txt
-+++ b/tools/lld/CMakeLists.txt
-@@ -21,7 +21,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
diff --git a/pkgs/development/compilers/llvm/13/lldb/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/13/lldb/gnu-install-dirs.patch
index afc945ce26147..eba6fbabac626 100644
--- a/pkgs/development/compilers/llvm/13/lldb/gnu-install-dirs.patch
+++ b/pkgs/development/compilers/llvm/13/lldb/gnu-install-dirs.patch
@@ -89,3 +89,22 @@ index b5633e2..86e4738 100644
    endif()
    get_target_property(lldb_python_bindings_dir swig_wrapper_python BINARY_DIR)
    finish_swig_python("lldb-python" "${lldb_python_bindings_dir}" "${lldb_python_target_dir}")
+diff --git a/source/API/CMakeLists.txt b/source/API/CMakeLists.txt
+index b5633e2..86e4738 100644
+--- a/source/API/CMakeLists.txt	2024-05-30 21:38:39.829955586 -0700
++++ b/source/API/CMakeLists.txt	2024-05-30 21:38:48.015673758 -0700
+@@ -112,14 +112,6 @@
+   ${option_install_prefix}
+ )
+ 
+-# lib/pythonX.Y/dist-packages/lldb/_lldb.so is a symlink to lib/liblldb.so,
+-# which depends on lib/libLLVM*.so (BUILD_SHARED_LIBS) or lib/libLLVM-10git.so
+-# (LLVM_LINK_LLVM_DYLIB). Add an additional rpath $ORIGIN/../../../../lib so
+-# that _lldb.so can be loaded from Python.
+-if(LLDB_ENABLE_PYTHON AND (BUILD_SHARED_LIBS OR LLVM_LINK_LLVM_DYLIB) AND UNIX AND NOT APPLE)
+-  set_property(TARGET liblldb APPEND PROPERTY INSTALL_RPATH "\$ORIGIN/../../../../lib${LLVM_LIBDIR_SUFFIX}")
+-endif()
+-
+ if(Python3_RPATH)
+   set_property(TARGET liblldb APPEND PROPERTY INSTALL_RPATH "${Python3_RPATH}")
+   set_property(TARGET liblldb APPEND PROPERTY BUILD_RPATH   "${Python3_RPATH}")
diff --git a/pkgs/development/compilers/llvm/13/lldb/procfs.patch b/pkgs/development/compilers/llvm/13/lldb/procfs.patch
deleted file mode 100644
index b075dbaeee0ad..0000000000000
--- a/pkgs/development/compilers/llvm/13/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/pkgs/development/compilers/llvm/13/lldb/resource-dir.patch b/pkgs/development/compilers/llvm/13/lldb/resource-dir.patch
deleted file mode 100644
index e0db80afeb9f7..0000000000000
--- a/pkgs/development/compilers/llvm/13/lldb/resource-dir.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake
-index 37364341ff8b..7f74c1a3e257 100644
---- a/cmake/modules/LLDBConfig.cmake
-+++ b/cmake/modules/LLDBConfig.cmake
-@@ -257,7 +257,7 @@ if (NOT TARGET clang-resource-headers)
-   # Iterate over the possible places where the external resource directory
-   # could be and pick the first that exists.
-   foreach(CANDIDATE "${Clang_DIR}/../.." "${LLVM_DIR}" "${LLVM_LIBRARY_DIRS}"
--                    "${LLVM_BUILD_LIBRARY_DIR}"
-+                    "${LLVM_BUILD_LIBRARY_DIR}" "@clangLibDir@"
-                     "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}")
-     # Build the resource directory path by appending 'clang/<version number>'.
-     set(CANDIDATE_RESOURCE_DIR "${CANDIDATE}/clang/${LLDB_CLANG_RESOURCE_DIR_NAME}")
diff --git a/pkgs/development/compilers/llvm/13/llvm/default.nix b/pkgs/development/compilers/llvm/13/llvm/default.nix
deleted file mode 100644
index 58e742b9b41ea..0000000000000
--- a/pkgs/development/compilers/llvm/13/llvm/default.nix
+++ /dev/null
@@ -1,315 +0,0 @@
-{ lib, stdenv, llvm_meta
-, pkgsBuildBuild
-, src
-, fetchpatch
-, cmake
-, python3
-, libffi
-, enableGoldPlugin ? libbfd.hasPluginAPI
-, libbfd
-, libpfm
-, libxml2
-, ncurses
-, version
-, release_version
-, zlib
-, which
-, buildLlvmTools
-, debugVersion ? false
-, doCheck ? stdenv.isLinux && (!stdenv.isx86_32) && (!stdenv.hostPlatform.isMusl)
-  && (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 (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;
-
-  inherit src;
-  sourceRoot = "${src.name}/${pname}";
-
-  outputs = [ "out" "lib" "dev" "python" ];
-
-  nativeBuildInputs = [ cmake python ]
-    ++ optionals enableManpages [ python3.pkgs.sphinx python3.pkgs.recommonmark ];
-
-  buildInputs = [ libxml2 libffi ]
-    ++ optional enablePFM libpfm; # exegesis
-
-  propagatedBuildInputs = optionals (stdenv.hostPlatform == stdenv.buildPlatform) [ ncurses ]
-    ++ [ zlib ];
-
-  nativeCheckInputs = [ which ];
-
-  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.
-    ../../common/llvm/llvm-config-link-static.patch
-
-    ./gnu-install-dirs.patch
-
-    # Fix random compiler crashes: https://bugs.llvm.org/show_bug.cgi?id=50611
-    (fetchpatch {
-      url = "https://raw.githubusercontent.com/archlinux/svntogit-packages/4764a4f8c920912a2bfd8b0eea57273acfe0d8a8/trunk/no-strict-aliasing-DwarfCompileUnit.patch";
-      sha256 = "18l6mrvm2vmwm77ckcnbjvh6ybvn72rhrb799d4qzwac4x2ifl7g";
-      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;
-    })
-    (fetchpatch {
-      name = "base64-gcc-13.patch";
-      url = "https://github.com/llvm/llvm-project/commit/5e9be93566f39ee6cecd579401e453eccfbe81e5.patch";
-      hash = "sha256-PAwrVrvffPd7tphpwCkYiz+67szPRzRB2TXBvKfzQ7U=";
-      stripLen = 1;
-    })
-  ] ++ lib.optional enablePolly ./gnu-install-dirs-polly.patch;
-
-  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
-    substituteInPlace unittests/IR/CMakeLists.txt \
-      --replace "PassBuilderCallbacksTest.cpp" ""
-    rm unittests/IR/PassBuilderCallbacksTest.cpp
-    rm test/tools/llvm-objcopy/ELF/mirror-permissions-unix.test
-  '' + optionalString stdenv.hostPlatform.isMusl ''
-    patch -p1 -i ${../../common/llvm/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/tools/dsymutil/X86/op-convert.test
-    rm test/tools/gold/X86/split-dwarf.ll
-  '' + 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
-  '';
-
-  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
-  '';
-
-  # E.g. mesa.drivers use the build-id as a cache key (see #93946):
-  LDFLAGS = optionalString (enableSharedLibraries && !stdenv.isDarwin) "-Wl,--build-id=sha1";
-
-  hardeningDisable = [ "trivialautovarinit" ];
-
-  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 stdenv.hostPlatform.isStatic [
-    # Disables building of shared libs, -fPIC is still injected by cc-wrapper
-    "-DLLVM_ENABLE_PIC=OFF"
-    "-DLLVM_BUILD_STATIC=ON"
-    # libxml2 needs to be disabled because the LLVM build system ignores its .la
-    # file and doesn't link zlib as well.
-    # https://github.com/ClangBuiltLinux/tc-build/issues/150#issuecomment-845418812
-    "-DLLVM_ENABLE_LIBXML2=OFF"
-  ] ++ 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) && !(stdenv.buildPlatform.canExecute stdenv.hostPlatform)) [
-    "-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/pkgs/development/compilers/llvm/13/llvm/gnu-install-dirs-polly.patch b/pkgs/development/compilers/llvm/13/llvm/gnu-install-dirs-polly.patch
deleted file mode 100644
index 68f3c45396f67..0000000000000
--- a/pkgs/development/compilers/llvm/13/llvm/gnu-install-dirs-polly.patch
+++ /dev/null
@@ -1,105 +0,0 @@
-diff --git a/tools/polly/CMakeLists.txt b/tools/polly/CMakeLists.txt
-index ca7c04c565bb..6ed5db5dd4f8 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.13.4)
-+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})
-@@ -122,13 +126,13 @@ include_directories(
- 
- if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
-   install(DIRECTORY include/
--    DESTINATION include
-+    DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
-     FILES_MATCHING
-     PATTERN "*.h"
-     )
- 
-   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 7cc129ba2e90..137be25e4b80 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 518a09b45a42..bd9d6f5542ad 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 8991094d92c7..178d8ad606bb 100644
---- a/tools/polly/lib/External/CMakeLists.txt
-+++ b/tools/polly/lib/External/CMakeLists.txt
-@@ -275,7 +275,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