diff options
Diffstat (limited to 'pkgs/development/compilers/llvm/common')
33 files changed, 0 insertions, 2726 deletions
diff --git a/pkgs/development/compilers/llvm/common/bintools.nix b/pkgs/development/compilers/llvm/common/bintools.nix deleted file mode 100644 index 85b570d976ae..000000000000 --- a/pkgs/development/compilers/llvm/common/bintools.nix +++ /dev/null @@ -1,49 +0,0 @@ -{ lib, runCommand, stdenv, llvm, lld, version, release_version }: - -let - targetPrefix = lib.optionalString (stdenv.hostPlatform != stdenv.targetPlatform) "${stdenv.targetPlatform.config}-"; -in -runCommand "llvm-binutils-${version}" -{ - preferLocalBuild = true; - passthru = { - isLLVM = true; - inherit targetPrefix; - }; -} - ('' - mkdir -p $out/bin - for prog in ${lld}/bin/*; do - ln -s $prog $out/bin/${targetPrefix}$(basename $prog) - done - for prog in ${llvm}/bin/*; do - ln -sf $prog $out/bin/${targetPrefix}$(basename $prog) - done - - llvmBin="${llvm}/bin" - - ln -s $llvmBin/llvm-ar $out/bin/${targetPrefix}ar - ln -s $llvmBin/llvm-ar $out/bin/${targetPrefix}dlltool - ln -s $llvmBin/llvm-ar $out/bin/${targetPrefix}ranlib - ln -s $llvmBin/llvm-cxxfilt $out/bin/${targetPrefix}c++filt - ln -s $llvmBin/llvm-dwp $out/bin/${targetPrefix}dwp - ln -s $llvmBin/llvm-nm $out/bin/${targetPrefix}nm - ln -s $llvmBin/llvm-objcopy $out/bin/${targetPrefix}objcopy - ln -s $llvmBin/llvm-objcopy $out/bin/${targetPrefix}strip - ln -s $llvmBin/llvm-objdump $out/bin/${targetPrefix}objdump - ln -s $llvmBin/llvm-readobj $out/bin/${targetPrefix}readelf - ln -s $llvmBin/llvm-size $out/bin/${targetPrefix}size - ln -s $llvmBin/llvm-strings $out/bin/${targetPrefix}strings - ln -s $llvmBin/llvm-symbolizer $out/bin/${targetPrefix}addr2line - - if [ -e "$llvmBin/llvm-debuginfod" ]; then - ln -s $llvmBin/llvm-debuginfod $out/bin/${targetPrefix}debuginfod - ln -s $llvmBin/llvm-debuginfod-find $out/bin/${targetPrefix}debuginfod-find - fi - - ln -s ${lld}/bin/lld $out/bin/${targetPrefix}ld - - # Only >=13 show GNU windres compatible in help - '' + lib.optionalString (lib.versionAtLeast release_version "13") '' - ln -s $llvmBin/llvm-rc $out/bin/${targetPrefix}windres - '') diff --git a/pkgs/development/compilers/llvm/common/clang/add-nostdlibinc-flag.patch b/pkgs/development/compilers/llvm/common/clang/add-nostdlibinc-flag.patch deleted file mode 100644 index 80c2eb362383..000000000000 --- a/pkgs/development/compilers/llvm/common/clang/add-nostdlibinc-flag.patch +++ /dev/null @@ -1,18 +0,0 @@ -diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp -index 3f29afd35971..223d2769cdfc 100644 ---- a/lib/Driver/Driver.cpp -+++ b/lib/Driver/Driver.cpp -@@ -491,6 +491,13 @@ DerivedArgList *Driver::TranslateInputArgs(const InputArgList &Args) const { - } - #endif - -+ { -+ Arg *A = DAL->MakeFlagArg(/*BaseArg=*/nullptr, -+ Opts.getOption(options::OPT_nostdlibinc)); -+ A->claim(); -+ DAL->append(A); -+ } -+ - return DAL; - } - diff --git a/pkgs/development/compilers/llvm/common/clang/clang-11-15-LLVMgold-path.patch b/pkgs/development/compilers/llvm/common/clang/clang-11-15-LLVMgold-path.patch deleted file mode 100644 index 8f8991976f33..000000000000 --- a/pkgs/development/compilers/llvm/common/clang/clang-11-15-LLVMgold-path.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/lib/Driver/ToolChains/CommonArgs.cpp b/lib/Driver/ToolChains/CommonArgs.cpp -index 6b6e276b8ce7..7896542a1202 100644 ---- a/lib/Driver/ToolChains/CommonArgs.cpp -+++ b/lib/Driver/ToolChains/CommonArgs.cpp -@@ -409,7 +409,7 @@ void tools::addLTOOptions(const ToolChain &ToolChain, const ArgList &Args, - - SmallString<1024> Plugin; - llvm::sys::path::native( -- Twine(D.Dir) + "/../lib" CLANG_LIBDIR_SUFFIX "/LLVMgold" + Suffix, -+ Twine("@libllvmLibdir@" "/LLVMgold") + Suffix, - Plugin); - CmdArgs.push_back(Args.MakeArgString(Plugin)); - } diff --git a/pkgs/development/compilers/llvm/common/clang/clang-at-least-16-LLVMgold-path.patch b/pkgs/development/compilers/llvm/common/clang/clang-at-least-16-LLVMgold-path.patch deleted file mode 100644 index 74cdbacc8a71..000000000000 --- a/pkgs/development/compilers/llvm/common/clang/clang-at-least-16-LLVMgold-path.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff --git a/lib/Driver/ToolChains/CommonArgs.cpp b/lib/Driver/ToolChains/CommonArgs.cpp -index 34640b3c450d..93c4a4f4ec5c 100644 ---- a/lib/Driver/ToolChains/CommonArgs.cpp -+++ b/lib/Driver/ToolChains/CommonArgs.cpp -@@ -589,8 +589,7 @@ void tools::addLTOOptions(const ToolChain &ToolChain, const ArgList &Args, - #endif - - SmallString<1024> Plugin; -- llvm::sys::path::native(Twine(D.Dir) + -- "/../" CLANG_INSTALL_LIBDIR_BASENAME + -+ llvm::sys::path::native(Twine("@libllvmLibdir@") + - PluginName + Suffix, - Plugin); - CmdArgs.push_back(Args.MakeArgString(Twine(PluginPrefix) + Plugin)); diff --git a/pkgs/development/compilers/llvm/common/clang/default.nix b/pkgs/development/compilers/llvm/common/clang/default.nix deleted file mode 100644 index e597ec4d604b..000000000000 --- a/pkgs/development/compilers/llvm/common/clang/default.nix +++ /dev/null @@ -1,207 +0,0 @@ -{ lib -, stdenv -, llvm_meta -, patches ? [] -, src ? null -, monorepoSrc ? null -, runCommand -, substituteAll -, cmake -, ninja -, libxml2 -, libllvm -, release_version -, version -, python3 -, buildLlvmTools -, fixDarwinDylibNames -, enableManpages ? false -, clang-tools-extra_src ? null -}: - -let - pname = "clang"; - - src' = if monorepoSrc != null then - runCommand "${pname}-src-${version}" {} '' - mkdir -p "$out" - cp -r ${monorepoSrc}/cmake "$out" - cp -r ${monorepoSrc}/${pname} "$out" - cp -r ${monorepoSrc}/clang-tools-extra "$out" - '' else src; - - self = stdenv.mkDerivation (finalAttrs: rec { - inherit pname version patches; - - src = src'; - - sourceRoot = if lib.versionOlder release_version "13" then null - else "${src.name}/${pname}"; - - nativeBuildInputs = [ cmake ] - ++ (lib.optional (lib.versionAtLeast release_version "15") ninja) - ++ [ python3 ] - ++ lib.optional (lib.versionAtLeast version "18" && enableManpages) python3.pkgs.myst-parser - ++ lib.optional enableManpages python3.pkgs.sphinx - ++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames; - - buildInputs = [ libxml2 libllvm ]; - - cmakeFlags = (lib.optionals (lib.versionAtLeast release_version "15") [ - "-DCLANG_INSTALL_PACKAGE_DIR=${placeholder "dev"}/lib/cmake/clang" - ]) ++ [ - "-DCLANGD_BUILD_XPC=OFF" - "-DLLVM_ENABLE_RTTI=ON" - ] ++ lib.optionals (lib.versionAtLeast release_version "17") [ - "-DLLVM_INCLUDE_TESTS=OFF" - ] ++ lib.optionals enableManpages [ - "-DCLANG_INCLUDE_DOCS=ON" - "-DLLVM_ENABLE_SPHINX=ON" - "-DSPHINX_OUTPUT_MAN=ON" - "-DSPHINX_OUTPUT_HTML=OFF" - "-DSPHINX_WARNINGS_AS_ERRORS=OFF" - ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) ([ - "-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen" - "-DCLANG_TABLEGEN=${buildLlvmTools.libclang.dev}/bin/clang-tblgen" - ] ++ lib.optionals (lib.versionAtLeast release_version "15") [ - # Added in LLVM15: - # `clang-tidy-confusable-chars-gen`: https://github.com/llvm/llvm-project/commit/c3574ef739fbfcc59d405985a3a4fa6f4619ecdb - # `clang-pseudo-gen`: https://github.com/llvm/llvm-project/commit/cd2292ef824591cc34cc299910a3098545c840c7 - "-DCLANG_TIDY_CONFUSABLE_CHARS_GEN=${buildLlvmTools.libclang.dev}/bin/clang-tidy-confusable-chars-gen" - "-DCLANG_PSEUDO_GEN=${buildLlvmTools.libclang.dev}/bin/clang-pseudo-gen" - ]); - - postPatch = '' - # Make sure clang passes the correct location of libLTO to ld64 - substituteInPlace lib/Driver/ToolChains/Darwin.cpp \ - --replace-fail 'StringRef P = llvm::sys::path::parent_path(D.Dir);' 'StringRef P = "${lib.getLib libllvm}";' - '' + (if lib.versionOlder release_version "13" then '' - sed -i -e 's/DriverArgs.hasArg(options::OPT_nostdlibinc)/true/' \ - -e 's/Args.hasArg(options::OPT_nostdlibinc)/true/' \ - lib/Driver/ToolChains/*.cpp - '' else '' - (cd tools && ln -s ../../clang-tools-extra extra) - '') + lib.optionalString stdenv.hostPlatform.isMusl '' - sed -i -e 's/lgcc_s/lgcc_eh/' lib/Driver/ToolChains/*.cpp - ''; - - outputs = [ "out" "lib" "dev" "python" ]; - - postInstall = '' - ln -sv $out/bin/clang $out/bin/cpp - '' + (lib.optionalString (lib.versions.major release_version == "17") '' - - mkdir -p $lib/lib/clang - mv $lib/lib/17 $lib/lib/clang/17 - '') + (lib.optionalString (lib.versionAtLeast release_version "19") '' - mv $out/lib/clang $lib/lib/clang - '') + '' - - # Move libclang to 'lib' output - moveToOutput "lib/libclang.*" "$lib" - moveToOutput "lib/libclang-cpp.*" "$lib" - '' + (if lib.versionOlder release_version "15" then '' - 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." - '' else '' - substituteInPlace $dev/lib/cmake/clang/ClangTargets-release.cmake \ - --replace "\''${_IMPORT_PREFIX}/lib/libclang." "$lib/lib/libclang." \ - --replace "\''${_IMPORT_PREFIX}/lib/libclang-cpp." "$lib/lib/libclang-cpp." - '') + '' - - '' + (if lib.versionOlder release_version "15" then '' - mkdir -p $python/bin $python/share/{clang,scan-view} - '' else '' - mkdir -p $python/bin $python/share/clang/ - '') + '' - mv $out/bin/{git-clang-format,scan-view} $python/bin - if [ -e $out/bin/set-xcode-analyzer ]; then - mv $out/bin/set-xcode-analyzer $python/bin - fi - mv $out/share/clang/*.py $python/share/clang - '' + (lib.optionalString (lib.versionOlder release_version "15") '' - mv $out/share/scan-view/*.py $python/share/scan-view - '') + '' - rm $out/bin/c-index-test - patchShebangs $python/bin - - mkdir -p $dev/bin - '' + (if lib.versionOlder release_version "15" then '' - cp bin/clang-tblgen $dev/bin - '' else '' - cp bin/{clang-tblgen,clang-tidy-confusable-chars-gen,clang-pseudo-gen} $dev/bin - ''); - - passthru = { - inherit libllvm; - isClang = true; - } // (lib.optionalAttrs (lib.versionAtLeast release_version "15") { - hardeningUnsupportedFlags = [ - "fortify3" - ]; - hardeningUnsupportedFlagsByTargetPlatform = targetPlatform: - lib.optional (!(targetPlatform.isx86_64 || targetPlatform.isAarch64)) "zerocallusedregs" - ++ (finalAttrs.passthru.hardeningUnsupportedFlags or []); - }) // (lib.optionalAttrs (lib.versionOlder release_version "15") { - hardeningUnsupportedFlags = [ "fortify3" "zerocallusedregs" ]; - }); - - meta = llvm_meta // { - homepage = "https://clang.llvm.org/"; - description = "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"; - - 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}"; - }; - } // (if lib.versionOlder release_version "15" then { - buildPhase = '' - make docs-clang-man - ''; - } else { - ninjaFlags = [ "docs-clang-man" ]; - })) // (lib.optionalAttrs (clang-tools-extra_src != null) { inherit clang-tools-extra_src; }) - // (lib.optionalAttrs (lib.versionOlder release_version "13") { - unpackPhase = '' - unpackFile $src - mv clang-* clang - sourceRoot=$PWD/clang - unpackFile ${clang-tools-extra_src} - mv clang-tools-extra-* $sourceRoot/tools/extra - substituteInPlace $sourceRoot/tools/extra/clangd/quality/CompletionModel.cmake \ - --replace ' ''${CMAKE_SOURCE_DIR}/../clang-tools-extra' ' ''${CMAKE_SOURCE_DIR}/tools/extra' - ''; - }) - // (lib.optionalAttrs (lib.versionAtLeast release_version "15") { - env = lib.optionalAttrs (stdenv.buildPlatform != stdenv.hostPlatform) { - # The following warning is triggered with (at least) gcc >= - # 12, but appears to occur only for cross compiles. - NIX_CFLAGS_COMPILE = "-Wno-maybe-uninitialized"; - }; - })); -in self diff --git a/pkgs/development/compilers/llvm/common/common-let.nix b/pkgs/development/compilers/llvm/common/common-let.nix deleted file mode 100644 index 31360f5b98b9..000000000000 --- a/pkgs/development/compilers/llvm/common/common-let.nix +++ /dev/null @@ -1,60 +0,0 @@ -{ lib -, fetchFromGitHub ? null -, release_version ? null -, gitRelease ? null -, officialRelease ? null -, monorepoSrc' ? null -}: - -rec { - llvm_meta = { - license = lib.licenses.ncsa; - maintainers = lib.teams.llvm.members; - - # See llvm/cmake/config-ix.cmake. - platforms = - lib.platforms.aarch64 ++ - lib.platforms.arm ++ - lib.platforms.mips ++ - lib.platforms.power ++ - lib.platforms.s390x ++ - lib.platforms.wasi ++ - lib.platforms.x86 ++ - lib.optionals (lib.versionAtLeast release_version "7") lib.platforms.riscv ++ - lib.optionals (lib.versionAtLeast release_version "14") lib.platforms.m68k; - }; - - releaseInfo = - if gitRelease != null then rec { - original = gitRelease; - release_version = original.version; - version = gitRelease.rev-version; - } else rec { - original = officialRelease; - release_version = original.version; - version = - if original ? candidate then - "${release_version}-${original.candidate}" - else - release_version; - }; - - monorepoSrc = - if monorepoSrc' != null then - monorepoSrc' - else - let - sha256 = releaseInfo.original.sha256; - rev = - if gitRelease != null then - gitRelease.rev - else - "llvmorg-${releaseInfo.version}"; - in - fetchFromGitHub { - owner = "llvm"; - repo = "llvm-project"; - inherit rev sha256; - }; - -} diff --git a/pkgs/development/compilers/llvm/common/compiler-rt/7-12-codesign.patch b/pkgs/development/compilers/llvm/common/compiler-rt/7-12-codesign.patch deleted file mode 100644 index 3cc12b94b200..000000000000 --- a/pkgs/development/compilers/llvm/common/compiler-rt/7-12-codesign.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 3dec5f3475a26aeb4678627795c4b67c6b7b4785 Mon Sep 17 00:00:00 2001 -From: Will Dietz <w@wdtz.org> -Date: Tue, 19 Sep 2017 13:13:06 -0500 -Subject: [PATCH] remove codesign use on Apple, disable ios sim testing that - needs it - ---- - cmake/Modules/AddCompilerRT.cmake | 8 ------ - test/asan/CMakeLists.txt | 52 --------------------------------------- - test/tsan/CMakeLists.txt | 47 ----------------------------------- - 3 files changed, 107 deletions(-) - -diff --git a/cmake/Modules/AddCompilerRT.cmake b/cmake/Modules/AddCompilerRT.cmake -index bc5fb9ff7..b64eb4246 100644 ---- a/cmake/Modules/AddCompilerRT.cmake -+++ b/cmake/Modules/AddCompilerRT.cmake -@@ -210,14 +210,6 @@ function(add_compiler_rt_runtime name type) - set_target_properties(${libname} PROPERTIES IMPORT_PREFIX "") - set_target_properties(${libname} PROPERTIES IMPORT_SUFFIX ".lib") - endif() -- if(APPLE) -- # Ad-hoc sign the dylibs -- add_custom_command(TARGET ${libname} -- POST_BUILD -- COMMAND codesign --sign - $<TARGET_FILE:${libname}> -- WORKING_DIRECTORY ${COMPILER_RT_LIBRARY_OUTPUT_DIR} -- ) -- endif() - endif() - install(TARGETS ${libname} - ARCHIVE DESTINATION ${COMPILER_RT_LIBRARY_INSTALL_DIR} -2.14.1 - diff --git a/pkgs/development/compilers/llvm/common/compiler-rt/armv6-mcr-dmb.patch b/pkgs/development/compilers/llvm/common/compiler-rt/armv6-mcr-dmb.patch deleted file mode 100644 index acdcc9e983b8..000000000000 --- a/pkgs/development/compilers/llvm/common/compiler-rt/armv6-mcr-dmb.patch +++ /dev/null @@ -1,75 +0,0 @@ -From a11d1cc41c725ec6dee58f75e4a852a658dd7543 Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.khem@gmail.com> -Date: Thu, 10 Mar 2022 19:30:00 -0800 -Subject: [PATCH] [builtins] Use mcr for dmb instruction on armv6 - -At present compiler-rt cross compiles for armv6 ( -march=armv6 ) but includes -dmb instructions which are only available in armv7+ this causes SIGILL on -clang+compiler-rt compiled components on rpi0w platforms. - -Reviewed By: MaskRay - -Differential Revision: https://reviews.llvm.org/D99282 ---- - compiler-rt/lib/builtins/arm/sync-ops.h | 8 ++++---- - compiler-rt/lib/builtins/assembly.h | 8 ++++++++ - 2 files changed, 12 insertions(+), 4 deletions(-) - -diff --git a/lib/builtins/arm/sync-ops.h b/lib/builtins/arm/sync-ops.h -index c9623249e5d20..7a26170741ad2 100644 ---- a/lib/builtins/arm/sync-ops.h -+++ b/lib/builtins/arm/sync-ops.h -@@ -19,14 +19,14 @@ - .thumb; \ - .syntax unified; \ - DEFINE_COMPILERRT_THUMB_FUNCTION(__sync_fetch_and_##op) \ -- dmb; \ -+ DMB; \ - mov r12, r0; \ - LOCAL_LABEL(tryatomic_##op) : ldrex r0, [r12]; \ - op(r2, r0, r1); \ - strex r3, r2, [r12]; \ - cmp r3, #0; \ - bne LOCAL_LABEL(tryatomic_##op); \ -- dmb; \ -+ DMB; \ - bx lr - - #define SYNC_OP_8(op) \ -@@ -35,14 +35,14 @@ - .syntax unified; \ - DEFINE_COMPILERRT_THUMB_FUNCTION(__sync_fetch_and_##op) \ - push {r4, r5, r6, lr}; \ -- dmb; \ -+ DMB; \ - mov r12, r0; \ - LOCAL_LABEL(tryatomic_##op) : ldrexd r0, r1, [r12]; \ - op(r4, r5, r0, r1, r2, r3); \ - strexd r6, r4, r5, [r12]; \ - cmp r6, #0; \ - bne LOCAL_LABEL(tryatomic_##op); \ -- dmb; \ -+ DMB; \ - pop { r4, r5, r6, pc } - - #define MINMAX_4(rD, rN, rM, cmp_kind) \ -diff --git a/lib/builtins/assembly.h b/lib/builtins/assembly.h -index 69a3d8620f924..06aa18162e3b4 100644 ---- a/lib/builtins/assembly.h -+++ b/lib/builtins/assembly.h -@@ -189,6 +189,14 @@ - JMP(ip) - #endif - -+#if __ARM_ARCH >= 7 -+#define DMB dmb -+#elif __ARM_ARCH >= 6 -+#define DMB mcr p15, #0, r0, c7, c10, #5 -+#else -+#error only supported on ARMv6+ -+#endif -+ - #if defined(USE_THUMB_2) - #define WIDE(op) op.w - #else - diff --git a/pkgs/development/compilers/llvm/common/compiler-rt/armv6-no-ldrexd-strexd.patch b/pkgs/development/compilers/llvm/common/compiler-rt/armv6-no-ldrexd-strexd.patch deleted file mode 100644 index 2537ae1fae12..000000000000 --- a/pkgs/development/compilers/llvm/common/compiler-rt/armv6-no-ldrexd-strexd.patch +++ /dev/null @@ -1,162 +0,0 @@ -From 4fe3f21bf8b20c766877d2251d61118d0ff36688 Mon Sep 17 00:00:00 2001 -From: Ben Wolsieffer <benwolsieffer@gmail.com> -Date: Wed, 7 Dec 2022 14:56:51 -0500 -Subject: [PATCH] [compiler-rt][builtins] Do not use ldrexd or strexd on ARMv6 - -The ldrexd and strexd instructions are not available on base ARMv6, and were -only added in ARMv6K (see [1]). This patch solves this problem once and for all -using the __ARM_FEATURE_LDREX macro (see [2]) defined in the ARM C Language -Extensions (ACLE). Although this macro is technically deprecated in the ACLE, -it allows compiler-rt to reliably detect whether ldrexd and strexd are supported -without complicated conditionals to detect different ARM architecture variants. - -[1] https://developer.arm.com/documentation/dht0008/a/ch01s02s01 -[2] https://arm-software.github.io/acle/main/acle.html#ldrexstrex - -Differential Revision: https://reviews.llvm.org/D139585 ---- - compiler-rt/lib/builtins/arm/sync_fetch_and_add_8.S | 2 +- - compiler-rt/lib/builtins/arm/sync_fetch_and_and_8.S | 2 +- - compiler-rt/lib/builtins/arm/sync_fetch_and_max_8.S | 2 +- - compiler-rt/lib/builtins/arm/sync_fetch_and_min_8.S | 2 +- - compiler-rt/lib/builtins/arm/sync_fetch_and_nand_8.S | 2 +- - compiler-rt/lib/builtins/arm/sync_fetch_and_or_8.S | 2 +- - compiler-rt/lib/builtins/arm/sync_fetch_and_sub_8.S | 2 +- - compiler-rt/lib/builtins/arm/sync_fetch_and_umax_8.S | 2 +- - compiler-rt/lib/builtins/arm/sync_fetch_and_umin_8.S | 2 +- - compiler-rt/lib/builtins/arm/sync_fetch_and_xor_8.S | 2 +- - 10 files changed, 10 insertions(+), 10 deletions(-) - -diff --git a/lib/builtins/arm/sync_fetch_and_add_8.S b/lib/builtins/arm/sync_fetch_and_add_8.S -index 18bdd875b8b7..bee6f7ba0f34 100644 ---- a/lib/builtins/arm/sync_fetch_and_add_8.S -+++ b/lib/builtins/arm/sync_fetch_and_add_8.S -@@ -13,7 +13,7 @@ - - #include "sync-ops.h" - --#if __ARM_ARCH_PROFILE != 'M' -+#if __ARM_FEATURE_LDREX & 8 - #define add_8(rD_LO, rD_HI, rN_LO, rN_HI, rM_LO, rM_HI) \ - adds rD_LO, rN_LO, rM_LO ; \ - adc rD_HI, rN_HI, rM_HI -diff --git a/lib/builtins/arm/sync_fetch_and_and_8.S b/lib/builtins/arm/sync_fetch_and_and_8.S -index 3716eff809d5..b4e77a54edf6 100644 ---- a/lib/builtins/arm/sync_fetch_and_and_8.S -+++ b/lib/builtins/arm/sync_fetch_and_and_8.S -@@ -13,7 +13,7 @@ - - #include "sync-ops.h" - --#if __ARM_ARCH_PROFILE != 'M' -+#if __ARM_FEATURE_LDREX & 8 - #define and_8(rD_LO, rD_HI, rN_LO, rN_HI, rM_LO, rM_HI) \ - and rD_LO, rN_LO, rM_LO ; \ - and rD_HI, rN_HI, rM_HI -diff --git a/lib/builtins/arm/sync_fetch_and_max_8.S b/lib/builtins/arm/sync_fetch_and_max_8.S -index 06115ab55246..1813274cc649 100644 ---- a/lib/builtins/arm/sync_fetch_and_max_8.S -+++ b/lib/builtins/arm/sync_fetch_and_max_8.S -@@ -13,7 +13,7 @@ - - #include "sync-ops.h" - --#if __ARM_ARCH_PROFILE != 'M' -+#if __ARM_FEATURE_LDREX & 8 - #define max_8(rD_LO, rD_HI, rN_LO, rN_HI, rM_LO, rM_HI) MINMAX_8(rD_LO, rD_HI, rN_LO, rN_HI, rM_LO, rM_HI, gt) - - SYNC_OP_8(max_8) -diff --git a/lib/builtins/arm/sync_fetch_and_min_8.S b/lib/builtins/arm/sync_fetch_and_min_8.S -index 4f3e299d95cc..fa8f3477757b 100644 ---- a/lib/builtins/arm/sync_fetch_and_min_8.S -+++ b/lib/builtins/arm/sync_fetch_and_min_8.S -@@ -13,7 +13,7 @@ - - #include "sync-ops.h" - --#if __ARM_ARCH_PROFILE != 'M' -+#if __ARM_FEATURE_LDREX & 8 - #define min_8(rD_LO, rD_HI, rN_LO, rN_HI, rM_LO, rM_HI) MINMAX_8(rD_LO, rD_HI, rN_LO, rN_HI, rM_LO, rM_HI, lt) - - SYNC_OP_8(min_8) -diff --git a/lib/builtins/arm/sync_fetch_and_nand_8.S b/lib/builtins/arm/sync_fetch_and_nand_8.S -index 425c94474af7..fb27219ee200 100644 ---- a/lib/builtins/arm/sync_fetch_and_nand_8.S -+++ b/lib/builtins/arm/sync_fetch_and_nand_8.S -@@ -13,7 +13,7 @@ - - #include "sync-ops.h" - --#if __ARM_ARCH_PROFILE != 'M' -+#if __ARM_FEATURE_LDREX & 8 - #define nand_8(rD_LO, rD_HI, rN_LO, rN_HI, rM_LO, rM_HI) \ - bic rD_LO, rN_LO, rM_LO ; \ - bic rD_HI, rN_HI, rM_HI -diff --git a/lib/builtins/arm/sync_fetch_and_or_8.S b/lib/builtins/arm/sync_fetch_and_or_8.S -index 4f18dcf84df9..3b077c8737b1 100644 ---- a/lib/builtins/arm/sync_fetch_and_or_8.S -+++ b/lib/builtins/arm/sync_fetch_and_or_8.S -@@ -13,7 +13,7 @@ - - #include "sync-ops.h" - --#if __ARM_ARCH_PROFILE != 'M' -+#if __ARM_FEATURE_LDREX & 8 - #define or_8(rD_LO, rD_HI, rN_LO, rN_HI, rM_LO, rM_HI) \ - orr rD_LO, rN_LO, rM_LO ; \ - orr rD_HI, rN_HI, rM_HI -diff --git a/lib/builtins/arm/sync_fetch_and_sub_8.S b/lib/builtins/arm/sync_fetch_and_sub_8.S -index 25a4a1076555..c171607eabd8 100644 ---- a/lib/builtins/arm/sync_fetch_and_sub_8.S -+++ b/lib/builtins/arm/sync_fetch_and_sub_8.S -@@ -13,7 +13,7 @@ - - #include "sync-ops.h" - --#if __ARM_ARCH_PROFILE != 'M' -+#if __ARM_FEATURE_LDREX & 8 - #define sub_8(rD_LO, rD_HI, rN_LO, rN_HI, rM_LO, rM_HI) \ - subs rD_LO, rN_LO, rM_LO ; \ - sbc rD_HI, rN_HI, rM_HI -diff --git a/lib/builtins/arm/sync_fetch_and_umax_8.S b/lib/builtins/arm/sync_fetch_and_umax_8.S -index aa5213ff1def..d1224f758049 100644 ---- a/lib/builtins/arm/sync_fetch_and_umax_8.S -+++ b/lib/builtins/arm/sync_fetch_and_umax_8.S -@@ -13,7 +13,7 @@ - - #include "sync-ops.h" - --#if __ARM_ARCH_PROFILE != 'M' -+#if __ARM_FEATURE_LDREX & 8 - #define umax_8(rD_LO, rD_HI, rN_LO, rN_HI, rM_LO, rM_HI) MINMAX_8(rD_LO, rD_HI, rN_LO, rN_HI, rM_LO, rM_HI, hi) - - SYNC_OP_8(umax_8) -diff --git a/lib/builtins/arm/sync_fetch_and_umin_8.S b/lib/builtins/arm/sync_fetch_and_umin_8.S -index 8b40541ab47d..595444e6d053 100644 ---- a/lib/builtins/arm/sync_fetch_and_umin_8.S -+++ b/lib/builtins/arm/sync_fetch_and_umin_8.S -@@ -13,7 +13,7 @@ - - #include "sync-ops.h" - --#if __ARM_ARCH_PROFILE != 'M' -+#if __ARM_FEATURE_LDREX & 8 - #define umin_8(rD_LO, rD_HI, rN_LO, rN_HI, rM_LO, rM_HI) MINMAX_8(rD_LO, rD_HI, rN_LO, rN_HI, rM_LO, rM_HI, lo) - - SYNC_OP_8(umin_8) -diff --git a/lib/builtins/arm/sync_fetch_and_xor_8.S b/lib/builtins/arm/sync_fetch_and_xor_8.S -index 7436eb1d4cae..9fc3d85cef75 100644 ---- a/lib/builtins/arm/sync_fetch_and_xor_8.S -+++ b/lib/builtins/arm/sync_fetch_and_xor_8.S -@@ -13,7 +13,7 @@ - - #include "sync-ops.h" - --#if __ARM_ARCH_PROFILE != 'M' -+#if __ARM_FEATURE_LDREX & 8 - #define xor_8(rD_LO, rD_HI, rN_LO, rN_HI, rM_LO, rM_HI) \ - eor rD_LO, rN_LO, rM_LO ; \ - eor rD_HI, rN_HI, rM_HI --- -2.38.1 - diff --git a/pkgs/development/compilers/llvm/common/compiler-rt/armv6-scudo-libatomic.patch b/pkgs/development/compilers/llvm/common/compiler-rt/armv6-scudo-libatomic.patch deleted file mode 100644 index 13b67eb2a41c..000000000000 --- a/pkgs/development/compilers/llvm/common/compiler-rt/armv6-scudo-libatomic.patch +++ /dev/null @@ -1,65 +0,0 @@ -From a56bb19a9dc303a50ef12d83cd24c2395bf81076 Mon Sep 17 00:00:00 2001 -From: Ben Wolsieffer <benwolsieffer@gmail.com> -Date: Wed, 7 Dec 2022 21:25:46 -0500 -Subject: [PATCH] [scudo][standalone] Use CheckAtomic to decide to link to - libatomic - -Standalone scudo uses the atomic operation builtin functions, which require -linking to libatomic on some platforms. Currently, this is done in an ad-hoc -manner. MIPS platforms always link to libatomic, and the tests are always linked -to it as well. libatomic is required on base ARMv6 (but not ARMv6K), but it is -currently not linked, causing the build to fail. - -This patch replaces this ad-hoc logic with the CheckAtomic CMake module already -used in other parts of LLVM. The CheckAtomic module checks whether std::atomic -requires libatomic, which is not strictly the same as checking the atomic -builtins, but should have the same results as far as I know. If this is -problematic, a custom version of CheckAtomic could be used to specifically test -the builtins. ---- - compiler-rt/lib/scudo/standalone/CMakeLists.txt | 7 +++++++ - compiler-rt/lib/scudo/standalone/tests/CMakeLists.txt | 4 +--- - 2 files changed, 8 insertions(+), 3 deletions(-) - -diff --git a/lib/scudo/standalone/CMakeLists.txt b/lib/scudo/standalone/CMakeLists.txt -index ae5c354768c8..eb27374ca520 100644 ---- a/lib/scudo/standalone/CMakeLists.txt -+++ b/lib/scudo/standalone/CMakeLists.txt -@@ -1,5 +1,8 @@ - add_compiler_rt_component(scudo_standalone) - -+include(DetermineGCCCompatible) -+include(CheckAtomic) -+ - include_directories(../.. include) - - set(SCUDO_CFLAGS) -@@ -34,6 +37,10 @@ list(APPEND SCUDO_LINK_FLAGS -Wl,-z,defs,-z,now,-z,relro) - - list(APPEND SCUDO_LINK_FLAGS -ffunction-sections -fdata-sections -Wl,--gc-sections) - -+if(HAVE_CXX_ATOMICS_WITH_LIB OR HAVE_CXX_ATOMICS64_WITH_LIB) -+ list(APPEND SCUDO_LINK_FLAGS -latomic) -+endif() -+ - # We don't use the C++ standard library, so avoid including it by mistake. - append_list_if(COMPILER_RT_HAS_NOSTDLIBXX_FLAG -nostdlib++ SCUDO_LINK_FLAGS) - -diff --git a/lib/scudo/standalone/tests/CMakeLists.txt b/lib/scudo/standalone/tests/CMakeLists.txt -index 6d0936cbb5c1..70a5a7e959c1 100644 ---- a/lib/scudo/standalone/tests/CMakeLists.txt -+++ b/lib/scudo/standalone/tests/CMakeLists.txt -@@ -38,9 +38,7 @@ set(LINK_FLAGS - ${SANITIZER_TEST_CXX_LIBRARIES} - ) - list(APPEND LINK_FLAGS -pthread) --# Linking against libatomic is required with some compilers --check_library_exists(atomic __atomic_load_8 "" COMPILER_RT_HAS_LIBATOMIC) --if (COMPILER_RT_HAS_LIBATOMIC) -+if(HAVE_CXX_ATOMICS_WITH_LIB OR HAVE_CXX_ATOMICS64_WITH_LIB) - list(APPEND LINK_FLAGS -latomic) - endif() - --- -2.38.1 - diff --git a/pkgs/development/compilers/llvm/common/compiler-rt/armv6-scudo-no-yield.patch b/pkgs/development/compilers/llvm/common/compiler-rt/armv6-scudo-no-yield.patch deleted file mode 100644 index 2fd48eda6518..000000000000 --- a/pkgs/development/compilers/llvm/common/compiler-rt/armv6-scudo-no-yield.patch +++ /dev/null @@ -1,34 +0,0 @@ -From ff0b373b959165477f45d9f5f9a8da471ae111ab Mon Sep 17 00:00:00 2001 -From: Ben Wolsieffer <benwolsieffer@gmail.com> -Date: Wed, 7 Dec 2022 18:03:56 -0500 -Subject: [PATCH] [scudo][standalone] Only use yield on ARMv6K and newer - -The yield instruction is only available in ARMv6K and newer. It behaves as a -nop on single threaded platforms anyway, so use nop instead on unsupported -architectures. - -Differential Revision: https://reviews.llvm.org/D139600 ---- - compiler-rt/lib/scudo/standalone/common.h | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/lib/scudo/standalone/common.h b/lib/scudo/standalone/common.h -index bc3dfec6dbba..862cda1d4bc4 100644 ---- a/lib/scudo/standalone/common.h -+++ b/lib/scudo/standalone/common.h -@@ -109,7 +109,12 @@ inline void yieldProcessor(u8 Count) { - #elif defined(__aarch64__) || defined(__arm__) - __asm__ __volatile__("" ::: "memory"); - for (u8 I = 0; I < Count; I++) -+#if __ARM_ARCH >= 6 && !defined(__ARM_ARCH_6__) -+ // yield is supported on ARMv6K and newer - __asm__ __volatile__("yield"); -+#else -+ __asm__ __volatile__("nop"); -+#endif - #endif - __asm__ __volatile__("" ::: "memory"); - } --- -2.38.1 - diff --git a/pkgs/development/compilers/llvm/common/compiler-rt/armv6-sync-ops-no-thumb.patch b/pkgs/development/compilers/llvm/common/compiler-rt/armv6-sync-ops-no-thumb.patch deleted file mode 100644 index 098a155d448c..000000000000 --- a/pkgs/development/compilers/llvm/common/compiler-rt/armv6-sync-ops-no-thumb.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 5017de8ba4b1fe985169cf54590e858a9019a91f Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.khem@gmail.com> -Date: Fri, 11 Mar 2022 16:25:49 -0800 -Subject: [PATCH] [builtins] Do not force thumb mode directive in - arm/sync-ops.h - -.thumb_func was not switching mode until [1] -so it did not show up but now that .thumb_func (without argument) is -switching mode, its causing build failures on armv6 ( rpi0 ) even when -build is explicitly asking for this file to be built with -marm (ARM -mode), therefore use DEFINE_COMPILERRT_FUNCTION macro to add function -header which considers arch and mode from compiler cmdline to decide if -the function is built using thumb mode or arm mode. - -[1] https://reviews.llvm.org/D101975 - -Note that it also needs https://reviews.llvm.org/D99282 - -Reviewed By: peter.smith, MaskRay - -Differential Revision: https://reviews.llvm.org/D104183 ---- - compiler-rt/lib/builtins/arm/sync-ops.h | 6 ++---- - 1 file changed, 2 insertions(+), 4 deletions(-) - -diff --git a/lib/builtins/arm/sync-ops.h b/lib/builtins/arm/sync-ops.h -index 7a26170741ad2..d914f9d3a1093 100644 ---- a/lib/builtins/arm/sync-ops.h -+++ b/lib/builtins/arm/sync-ops.h -@@ -16,9 +16,8 @@ - - #define SYNC_OP_4(op) \ - .p2align 2; \ -- .thumb; \ - .syntax unified; \ -- DEFINE_COMPILERRT_THUMB_FUNCTION(__sync_fetch_and_##op) \ -+ DEFINE_COMPILERRT_FUNCTION(__sync_fetch_and_##op) \ - DMB; \ - mov r12, r0; \ - LOCAL_LABEL(tryatomic_##op) : ldrex r0, [r12]; \ -@@ -31,9 +30,8 @@ - - #define SYNC_OP_8(op) \ - .p2align 2; \ -- .thumb; \ - .syntax unified; \ -- DEFINE_COMPILERRT_THUMB_FUNCTION(__sync_fetch_and_##op) \ -+ DEFINE_COMPILERRT_FUNCTION(__sync_fetch_and_##op) \ - push {r4, r5, r6, lr}; \ - DMB; \ - mov r12, r0; \ - diff --git a/pkgs/development/compilers/llvm/common/compiler-rt/armv7l-15.patch b/pkgs/development/compilers/llvm/common/compiler-rt/armv7l-15.patch deleted file mode 100644 index ca1c2332abd9..000000000000 --- a/pkgs/development/compilers/llvm/common/compiler-rt/armv7l-15.patch +++ /dev/null @@ -1,32 +0,0 @@ -diff -ur a/cmake/builtin-config-ix.cmake b/cmake/builtin-config-ix.cmake ---- a/cmake/builtin-config-ix.cmake @llvm 15.0.6 -+++ b/cmake/builtin-config-ix.cmake -@@ -46,7 +46,7 @@ - - set(ARM64 aarch64) --set(ARM32 arm armhf armv6m armv7m armv7em armv7 armv7s armv7k armv8m.main armv8.1m.main) -+set(ARM32 arm armhf armv6m armv7m armv7em armv7 armv7s armv7k armv7l armv8m.main armv8.1m.main) - set(AVR avr) - set(HEXAGON hexagon) - set(X86 i386) - set(X86_64 x86_64) -diff -ur a/lib/builtins/CMakeLists.txt b/lib/builtins/CMakeLists.txt ---- a/lib/builtins/CMakeLists.txt @llvm 15.0.6 -+++ b/lib/builtins/CMakeLists.txt -@@ -565,6 +565,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 -@@ -734,7 +735,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|armv8m.main|armv8.1m.main)$") -+ if (${arch} MATCHES "^(arm|armhf|armv7|armv7s|armv7k|armv7l|armv7m|armv7em|armv8m.main|armv8.1m.main)$") - 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/pkgs/development/compilers/llvm/common/compiler-rt/darwin-plistbuddy-workaround.patch b/pkgs/development/compilers/llvm/common/compiler-rt/darwin-plistbuddy-workaround.patch deleted file mode 100644 index dae8b3a690ac..000000000000 --- a/pkgs/development/compilers/llvm/common/compiler-rt/darwin-plistbuddy-workaround.patch +++ /dev/null @@ -1,25 +0,0 @@ -CMake tries to read a list field from SDKSettings.plist, but the output of -xcbuild PlistBuddy is incompatible with Apple's. (Plus we don't want it in our -dependencies.) - -Simply assume ARM64 is supported by the SDK. We already limit the actual archs -we build for by setting DARWIN_osx_BUILTIN_ARCHS explicitely. - ---- a/cmake/builtin-config-ix.cmake -+++ b/cmake/builtin-config-ix.cmake -@@ -97,14 +97,7 @@ if(APPLE) - set(DARWIN_osx_BUILTIN_MIN_VER 10.5) - set(DARWIN_osx_BUILTIN_MIN_VER_FLAG - -mmacosx-version-min=${DARWIN_osx_BUILTIN_MIN_VER}) -- set(DARWIN_osx_BUILTIN_ALL_POSSIBLE_ARCHS ${X86} ${X86_64}) -- # Add support for arm64 macOS if available in SDK. -- foreach(arch ${ARM64}) -- sdk_has_arch_support(${DARWIN_osx_SYSROOT} macosx ${arch} MACOS_ARM_SUPPORT) -- if (MACOS_ARM_SUPPORT) -- list(APPEND DARWIN_osx_BUILTIN_ALL_POSSIBLE_ARCHS ${arch}) -- endif() -- endforeach(arch) -+ set(DARWIN_osx_BUILTIN_ALL_POSSIBLE_ARCHS ${X86} ${X86_64} ${ARM64}) - - if(COMPILER_RT_ENABLE_IOS) - list(APPEND DARWIN_EMBEDDED_PLATFORMS ios) diff --git a/pkgs/development/compilers/llvm/common/compiler-rt/default.nix b/pkgs/development/compilers/llvm/common/compiler-rt/default.nix deleted file mode 100644 index 23a966ce238f..000000000000 --- a/pkgs/development/compilers/llvm/common/compiler-rt/default.nix +++ /dev/null @@ -1,192 +0,0 @@ -{ lib -, stdenv -, llvm_meta -, release_version -, version -, patches ? [] -, src ? null -, monorepoSrc ? null -, runCommand -, cmake -, ninja -, python3 -, xcbuild -, libllvm -, linuxHeaders -, libxcrypt - -# Some platforms have switched to using compiler-rt, but still want a -# libgcc.a for ABI compat purposes. The use case would be old code that -# expects to link `-lgcc` but doesn't care exactly what its contents -# are, so long as it provides some builtins. -, doFakeLibgcc ? stdenv.hostPlatform.isFreeBSD - -# In recent releases, the compiler-rt build seems to produce -# many `libclang_rt*` libraries, but not a single unified -# `libcompiler_rt` library, at least under certain configurations. Some -# platforms stil expect this, however, so we symlink one into place. -, forceLinkCompilerRt ? stdenv.hostPlatform.isOpenBSD -}: - -let - - useLLVM = stdenv.hostPlatform.useLLVM or false; - bareMetal = stdenv.hostPlatform.parsed.kernel.name == "none"; - haveLibc = stdenv.cc.libc != null; - isDarwinStatic = stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isStatic && lib.versionAtLeast release_version "16"; - inherit (stdenv.hostPlatform) isMusl isAarch64; - - baseName = "compiler-rt"; - pname = baseName + lib.optionalString (haveLibc) "-libc"; - - src' = if monorepoSrc != null then - runCommand "${baseName}-src-${version}" {} '' - mkdir -p "$out" - cp -r ${monorepoSrc}/cmake "$out" - cp -r ${monorepoSrc}/${baseName} "$out" - '' else src; - - preConfigure = lib.optionalString (useLLVM && !haveLibc) '' - cmakeFlagsArray+=(-DCMAKE_C_FLAGS="-nodefaultlibs -ffreestanding") - ''; -in - -stdenv.mkDerivation ({ - inherit pname version patches; - - src = src'; - sourceRoot = if lib.versionOlder release_version "13" then null - else "${src'.name}/${baseName}"; - - nativeBuildInputs = [ cmake ] - ++ (lib.optional (lib.versionAtLeast release_version "15") ninja) - ++ [ python3 libllvm.dev ] - ++ lib.optional stdenv.isDarwin xcbuild.xcrun; - buildInputs = - lib.optional (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isRiscV) linuxHeaders; - - env.NIX_CFLAGS_COMPILE = toString ([ - "-DSCUDO_DEFAULT_OPTIONS=DeleteSizeMismatch=0:DeallocationTypeMismatch=0" - ] ++ lib.optionals (!haveLibc) [ - # The compiler got stricter about this, and there is a usellvm patch below - # which patches out the assert include causing an implicit definition of - # assert. It would be nicer to understand why compiler-rt thinks it should - # be able to #include <assert.h> in the first place; perhaps it's in the - # wrong, or perhaps there is a way to provide an assert.h. - "-Wno-error=implicit-function-declaration" - ]); - - cmakeFlags = [ - "-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON" - "-DCMAKE_C_COMPILER_TARGET=${stdenv.hostPlatform.config}" - "-DCMAKE_ASM_COMPILER_TARGET=${stdenv.hostPlatform.config}" - ] ++ lib.optionals (haveLibc && stdenv.hostPlatform.libc == "glibc") [ - "-DSANITIZER_COMMON_CFLAGS=-I${libxcrypt}/include" - ] ++ lib.optionals ((useLLVM || bareMetal || isMusl || isAarch64) && (lib.versions.major release_version == "13")) [ - "-DCOMPILER_RT_BUILD_LIBFUZZER=OFF" - ] ++ lib.optionals (useLLVM || bareMetal || isMusl || isDarwinStatic) [ - "-DCOMPILER_RT_BUILD_SANITIZERS=OFF" - "-DCOMPILER_RT_BUILD_XRAY=OFF" - "-DCOMPILER_RT_BUILD_LIBFUZZER=OFF" - "-DCOMPILER_RT_BUILD_MEMPROF=OFF" - "-DCOMPILER_RT_BUILD_ORC=OFF" # may be possible to build with musl if necessary - ] ++ lib.optionals (useLLVM || bareMetal) [ - "-DCOMPILER_RT_BUILD_PROFILE=OFF" - ] ++ lib.optionals ((useLLVM && !haveLibc) || bareMetal || isDarwinStatic) [ - "-DCMAKE_CXX_COMPILER_WORKS=ON" - ] ++ lib.optionals ((useLLVM && !haveLibc) || bareMetal) [ - "-DCMAKE_C_COMPILER_WORKS=ON" - "-DCOMPILER_RT_BAREMETAL_BUILD=ON" - "-DCMAKE_SIZEOF_VOID_P=${toString (stdenv.hostPlatform.parsed.cpu.bits / 8)}" - ] ++ lib.optionals (useLLVM && !haveLibc) [ - "-DCMAKE_C_FLAGS=-nodefaultlibs" - ] ++ lib.optionals (useLLVM) [ - "-DCOMPILER_RT_BUILD_BUILTINS=ON" - #https://stackoverflow.com/questions/53633705/cmake-the-c-compiler-is-not-able-to-compile-a-simple-test-program - "-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY" - ] ++ lib.optionals (bareMetal) [ - "-DCOMPILER_RT_OS_DIR=baremetal" - ] ++ lib.optionals (stdenv.hostPlatform.isDarwin) (lib.optionals (lib.versionAtLeast release_version "16") [ - "-DCMAKE_LIPO=${lib.getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}lipo" - ] ++ [ - "-DDARWIN_macosx_OVERRIDE_SDK_VERSION=ON" - "-DDARWIN_osx_ARCHS=${stdenv.hostPlatform.darwinArch}" - "-DDARWIN_osx_BUILTIN_ARCHS=${stdenv.hostPlatform.darwinArch}" - ] ++ lib.optionals (lib.versionAtLeast release_version "15") [ - # `COMPILER_RT_DEFAULT_TARGET_ONLY` does not apply to Darwin: - # https://github.com/llvm/llvm-project/blob/27ef42bec80b6c010b7b3729ed0528619521a690/compiler-rt/cmake/base-config-ix.cmake#L153 - "-DCOMPILER_RT_ENABLE_IOS=OFF" - ]) ++ lib.optionals (lib.versionAtLeast version "19" && stdenv.isDarwin && lib.versionOlder stdenv.hostPlatform.darwinMinVersion "10.13") [ - "-DSANITIZER_MIN_OSX_VERSION=10.10" - ]; - - outputs = [ "out" "dev" ]; - - # TSAN requires XPC on Darwin, which we have no public/free source files for. We can depend on the Apple frameworks - # to get it, but they're unfree. Since LLVM is rather central to the stdenv, we patch out TSAN support so that Hydra - # can build this. If we didn't do it, basically the entire nixpkgs on Darwin would have an unfree dependency and we'd - # get no binary cache for the entire platform. If you really find yourself wanting the TSAN, make this controllable by - # a flag and turn the flag off during the stdenv build. - postPatch = lib.optionalString (!stdenv.isDarwin) '' - substituteInPlace cmake/builtin-config-ix.cmake \ - --replace 'set(X86 i386)' 'set(X86 i386 i486 i586 i686)' - '' + lib.optionalString stdenv.isDarwin '' - substituteInPlace cmake/config-ix.cmake \ - --replace 'set(COMPILER_RT_HAS_TSAN TRUE)' 'set(COMPILER_RT_HAS_TSAN FALSE)' - '' + lib.optionalString (useLLVM && !haveLibc) ((lib.optionalString (lib.versionAtLeast release_version "18") '' - substituteInPlace lib/builtins/aarch64/sme-libc-routines.c \ - --replace "<stdlib.h>" "<stddef.h>" - '') + '' - substituteInPlace lib/builtins/int_util.c \ - --replace "#include <stdlib.h>" "" - '' + (if stdenv.hostPlatform.isFreeBSD then - # As per above, but in FreeBSD assert is a macro and simply allowing it to be implicitly declared causes Issues!!!!! - '' - substituteInPlace lib/builtins/clear_cache.c lib/builtins/cpu_model.c \ - --replace "#include <assert.h>" "#define assert(e) ((e)?(void)0:__assert(__FUNCTION__,__FILE__,__LINE__,#e))" - '' else '' - substituteInPlace lib/builtins/clear_cache.c \ - --replace "#include <assert.h>" "" - substituteInPlace lib/builtins/cpu_model${lib.optionalString (lib.versionAtLeast version "18") "/x86"}.c \ - --replace "#include <assert.h>" "" - '')); - - # Hack around weird upsream RPATH bug - postInstall = lib.optionalString (stdenv.hostPlatform.isDarwin) '' - ln -s "$out/lib"/*/* "$out/lib" - '' + lib.optionalString (useLLVM && stdenv.hostPlatform.isLinux) '' - ln -s $out/lib/*/clang_rt.crtbegin-*.o $out/lib/crtbegin.o - ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/crtend.o - # Note the history of crt{begin,end}S in previous versions of llvm in nixpkg: - # The presence of crtbegin_shared has been added and removed; it's possible - # people have added/removed it to get it working on their platforms. - # Try each in turn for now. - ln -s $out/lib/*/clang_rt.crtbegin-*.o $out/lib/crtbeginS.o - ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/crtendS.o - ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/crtbeginS.o - ln -s $out/lib/*/clang_rt.crtend_shared-*.o $out/lib/crtendS.o - '' + lib.optionalString doFakeLibgcc '' - ln -s $out/lib/*/libclang_rt.builtins-*.a $out/lib/libgcc.a - '' + lib.optionalString forceLinkCompilerRt '' - ln -s $out/lib/*/libclang_rt.builtins-*.a $out/lib/libcompiler_rt.a - ''; - - meta = llvm_meta // { - homepage = "https://compiler-rt.llvm.org/"; - description = "Compiler runtime libraries"; - longDescription = '' - The compiler-rt project provides highly tuned implementations of the - low-level code generator support routines like "__fixunsdfdi" and other - calls generated when a target doesn't have a short sequence of native - instructions to implement a core IR operation. It also provides - implementations of run-time libraries for dynamic testing tools such as - AddressSanitizer, ThreadSanitizer, MemorySanitizer, and DataFlowSanitizer. - ''; - # "All of the code in the compiler-rt project is dual licensed under the MIT - # license and the UIUC License (a BSD-like license)": - license = with lib.licenses; [ mit ncsa ]; - # compiler-rt requires a Clang stdenv on 32-bit RISC-V: - # https://reviews.llvm.org/D43106#1019077 - broken = stdenv.hostPlatform.isRiscV32 && !stdenv.cc.isClang; - }; -} // (if lib.versionOlder release_version "16" then { inherit preConfigure; } else {})) diff --git a/pkgs/development/compilers/llvm/common/compiler-rt/glibc.patch b/pkgs/development/compilers/llvm/common/compiler-rt/glibc.patch deleted file mode 100644 index 2d211795fc80..000000000000 --- a/pkgs/development/compilers/llvm/common/compiler-rt/glibc.patch +++ /dev/null @@ -1,48 +0,0 @@ -diff --git a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc -index 54da635..c5dc1cd 100644 ---- a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc -+++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc -@@ -1158,8 +1158,9 @@ CHECK_SIZE_AND_OFFSET(ipc_perm, uid); - CHECK_SIZE_AND_OFFSET(ipc_perm, gid); - CHECK_SIZE_AND_OFFSET(ipc_perm, cuid); - CHECK_SIZE_AND_OFFSET(ipc_perm, cgid); --#if !defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21) --/* On aarch64 glibc 2.20 and earlier provided incorrect mode field. */ -+#if !SANITIZER_LINUX || __GLIBC_PREREQ (2, 31) -+/* glibc 2.30 and earlier provided 16-bit mode field instead of 32-bit -+ on many architectures. */ - CHECK_SIZE_AND_OFFSET(ipc_perm, mode); - #endif - -diff --git a/lib/sanitizer_common/sanitizer_platform_limits_posix.h b/lib/sanitizer_common/sanitizer_platform_limits_posix.h -index f89a113..f6f986f 100644 ---- a/lib/sanitizer_common/sanitizer_platform_limits_posix.h -+++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.h -@@ -213,26 +213,13 @@ namespace __sanitizer { - u64 __unused1; - u64 __unused2; - #elif defined(__sparc__) --#if defined(__arch64__) - unsigned mode; -- unsigned short __pad1; --#else -- unsigned short __pad1; -- unsigned short mode; - unsigned short __pad2; --#endif - unsigned short __seq; - unsigned long long __unused1; - unsigned long long __unused2; --#elif defined(__mips__) || defined(__aarch64__) || defined(__s390x__) -- unsigned int mode; -- unsigned short __seq; -- unsigned short __pad1; -- unsigned long __unused1; -- unsigned long __unused2; - #else -- unsigned short mode; -- unsigned short __pad1; -+ unsigned int mode; - unsigned short __seq; - unsigned short __pad2; - #if defined(__x86_64__) && !defined(_LP64) diff --git a/pkgs/development/compilers/llvm/common/compiler-rt/libsanitizer-no-cyclades-9.patch b/pkgs/development/compilers/llvm/common/compiler-rt/libsanitizer-no-cyclades-9.patch deleted file mode 100644 index 7ef02a169269..000000000000 --- a/pkgs/development/compilers/llvm/common/compiler-rt/libsanitizer-no-cyclades-9.patch +++ /dev/null @@ -1,80 +0,0 @@ -https://github.com/llvm/llvm-project/commit/68d5235cb58f988c71b403334cd9482d663841ab.patch -https://reviews.llvm.org/D102059 ---- a/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc -+++ b/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc -@@ -370,15 +370,6 @@ static void ioctl_table_fill() { - - #if SANITIZER_GLIBC - // _(SIOCDEVPLIP, WRITE, struct_ifreq_sz); // the same as EQL_ENSLAVE -- _(CYGETDEFTHRESH, WRITE, sizeof(int)); -- _(CYGETDEFTIMEOUT, WRITE, sizeof(int)); -- _(CYGETMON, WRITE, struct_cyclades_monitor_sz); -- _(CYGETTHRESH, WRITE, sizeof(int)); -- _(CYGETTIMEOUT, WRITE, sizeof(int)); -- _(CYSETDEFTHRESH, NONE, 0); -- _(CYSETDEFTIMEOUT, NONE, 0); -- _(CYSETTHRESH, NONE, 0); -- _(CYSETTIMEOUT, NONE, 0); - _(EQL_EMANCIPATE, WRITE, struct_ifreq_sz); - _(EQL_ENSLAVE, WRITE, struct_ifreq_sz); - _(EQL_GETMASTRCFG, WRITE, struct_ifreq_sz); ---- a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc -+++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc -@@ -143,7 +143,6 @@ typedef struct user_fpregs elf_fpregset_t; - # include <sys/procfs.h> - #endif - #include <sys/user.h> --#include <linux/cyclades.h> - #include <linux/if_eql.h> - #include <linux/if_plip.h> - #include <linux/lp.h> -@@ -460,7 +459,6 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr); - - #if SANITIZER_GLIBC - unsigned struct_ax25_parms_struct_sz = sizeof(struct ax25_parms_struct); -- unsigned struct_cyclades_monitor_sz = sizeof(struct cyclades_monitor); - #if EV_VERSION > (0x010000) - unsigned struct_input_keymap_entry_sz = sizeof(struct input_keymap_entry); - #else -@@ -824,15 +822,6 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr); - #endif // SANITIZER_LINUX - - #if SANITIZER_LINUX && !SANITIZER_ANDROID -- unsigned IOCTL_CYGETDEFTHRESH = CYGETDEFTHRESH; -- unsigned IOCTL_CYGETDEFTIMEOUT = CYGETDEFTIMEOUT; -- unsigned IOCTL_CYGETMON = CYGETMON; -- unsigned IOCTL_CYGETTHRESH = CYGETTHRESH; -- unsigned IOCTL_CYGETTIMEOUT = CYGETTIMEOUT; -- unsigned IOCTL_CYSETDEFTHRESH = CYSETDEFTHRESH; -- unsigned IOCTL_CYSETDEFTIMEOUT = CYSETDEFTIMEOUT; -- unsigned IOCTL_CYSETTHRESH = CYSETTHRESH; -- unsigned IOCTL_CYSETTIMEOUT = CYSETTIMEOUT; - unsigned IOCTL_EQL_EMANCIPATE = EQL_EMANCIPATE; - unsigned IOCTL_EQL_ENSLAVE = EQL_ENSLAVE; - unsigned IOCTL_EQL_GETMASTRCFG = EQL_GETMASTRCFG; ---- a/lib/sanitizer_common/sanitizer_platform_limits_posix.h -+++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.h -@@ -983,7 +983,6 @@ extern unsigned struct_vt_mode_sz; - - #if SANITIZER_LINUX && !SANITIZER_ANDROID - extern unsigned struct_ax25_parms_struct_sz; -- extern unsigned struct_cyclades_monitor_sz; - extern unsigned struct_input_keymap_entry_sz; - extern unsigned struct_ipx_config_data_sz; - extern unsigned struct_kbdiacrs_sz; -@@ -1328,15 +1327,6 @@ extern unsigned IOCTL_VT_WAITACTIVE; - #endif // SANITIZER_LINUX - - #if SANITIZER_LINUX && !SANITIZER_ANDROID -- extern unsigned IOCTL_CYGETDEFTHRESH; -- extern unsigned IOCTL_CYGETDEFTIMEOUT; -- extern unsigned IOCTL_CYGETMON; -- extern unsigned IOCTL_CYGETTHRESH; -- extern unsigned IOCTL_CYGETTIMEOUT; -- extern unsigned IOCTL_CYSETDEFTHRESH; -- extern unsigned IOCTL_CYSETDEFTIMEOUT; -- extern unsigned IOCTL_CYSETTHRESH; -- extern unsigned IOCTL_CYSETTIMEOUT; - extern unsigned IOCTL_EQL_EMANCIPATE; - extern unsigned IOCTL_EQL_ENSLAVE; - extern unsigned IOCTL_EQL_GETMASTRCFG; diff --git a/pkgs/development/compilers/llvm/common/libclc.nix b/pkgs/development/compilers/llvm/common/libclc.nix deleted file mode 100644 index 4c2081e693c1..000000000000 --- a/pkgs/development/compilers/llvm/common/libclc.nix +++ /dev/null @@ -1,54 +0,0 @@ -{ lib, stdenv, version, runCommand, monorepoSrc, llvm, buildPackages, buildLlvmTools, ninja, cmake, python3 }: - -stdenv.mkDerivation rec { - pname = "libclc"; - inherit version; - - src = runCommand "${pname}-src-${version}" {} '' - mkdir -p "$out" - cp -r ${monorepoSrc}/cmake "$out" - cp -r ${monorepoSrc}/${pname} "$out" - ''; - - sourceRoot = "${src.name}/${pname}"; - - outputs = [ "out" "dev" ]; - - patches = [ - ./libclc/libclc-gnu-install-dirs.patch - ]; - - # cmake expects all required binaries to be in the same place, so it will not be able to find clang without the patch - postPatch = '' - substituteInPlace CMakeLists.txt \ - --replace 'find_program( LLVM_CLANG clang PATHS ''${LLVM_TOOLS_BINARY_DIR} NO_DEFAULT_PATH )' \ - 'find_program( LLVM_CLANG clang PATHS "${buildLlvmTools.clang.cc}/bin" NO_DEFAULT_PATH )' \ - --replace 'find_program( LLVM_AS llvm-as PATHS ''${LLVM_TOOLS_BINARY_DIR} NO_DEFAULT_PATH )' \ - 'find_program( LLVM_AS llvm-as PATHS "${buildLlvmTools.llvm}/bin" NO_DEFAULT_PATH )' \ - --replace 'find_program( LLVM_LINK llvm-link PATHS ''${LLVM_TOOLS_BINARY_DIR} NO_DEFAULT_PATH )' \ - 'find_program( LLVM_LINK llvm-link PATHS "${buildLlvmTools.llvm}/bin" NO_DEFAULT_PATH )' \ - --replace 'find_program( LLVM_OPT opt PATHS ''${LLVM_TOOLS_BINARY_DIR} NO_DEFAULT_PATH )' \ - 'find_program( LLVM_OPT opt PATHS "${buildLlvmTools.llvm}/bin" NO_DEFAULT_PATH )' \ - --replace 'find_program( LLVM_SPIRV llvm-spirv PATHS ''${LLVM_TOOLS_BINARY_DIR} NO_DEFAULT_PATH )' \ - 'find_program( LLVM_SPIRV llvm-spirv PATHS "${buildPackages.spirv-llvm-translator.override { inherit (buildLlvmTools) llvm; }}/bin" NO_DEFAULT_PATH )' - '' + lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) '' - substituteInPlace CMakeLists.txt \ - --replace 'COMMAND prepare_builtins' 'COMMAND ${buildLlvmTools.libclc.dev}/bin/prepare_builtins' - ''; - - nativeBuildInputs = [ cmake ninja python3 ]; - buildInputs = [ llvm ]; - strictDeps = true; - - postInstall = '' - install -Dt $dev/bin prepare_builtins - ''; - - meta = with lib; { - homepage = "http://libclc.llvm.org/"; - description = "Implementation of the library requirements of the OpenCL C programming language"; - mainProgram = "prepare_builtins"; - license = licenses.mit; - platforms = platforms.all; - }; -} diff --git a/pkgs/development/compilers/llvm/common/libclc/libclc-gnu-install-dirs.patch b/pkgs/development/compilers/llvm/common/libclc/libclc-gnu-install-dirs.patch deleted file mode 100644 index 1e5108a27c38..000000000000 --- a/pkgs/development/compilers/llvm/common/libclc/libclc-gnu-install-dirs.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/libclc.pc.in -+++ b/libclc.pc.in -@@ -1,5 +1,5 @@ --includedir=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@ --libexecdir=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_DATADIR@/clc -+includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ -+libexecdir=@CMAKE_INSTALL_FULL_DATADIR@/clc - - Name: libclc - Description: Library requirements of the OpenCL C programming language diff --git a/pkgs/development/compilers/llvm/common/libcxx/default.nix b/pkgs/development/compilers/llvm/common/libcxx/default.nix deleted file mode 100644 index b2c23f35f0a1..000000000000 --- a/pkgs/development/compilers/llvm/common/libcxx/default.nix +++ /dev/null @@ -1,186 +0,0 @@ -{ lib -, stdenv -, llvm_meta -, release_version -, monorepoSrc ? null -, src ? null -, patches ? [] -, runCommand -, substitute -, cmake -, lndir -, ninja -, python3 -, fixDarwinDylibNames -, version -, cxxabi ? null -, libcxxrt -, libunwind -, enableShared ? !stdenv.hostPlatform.isStatic -}: - -# note: our setup using libcxxabi instead of libcxxrt on FreeBSD diverges from -# normal FreeBSD. This may cause issues with binary patching down the line. -# If this becomes an issue, try adding as symlink libcxxrt.so -> libc++abi.so - -# external cxxabi is not supported on Darwin as the build will not link libcxx -# properly and not re-export the cxxabi symbols into libcxx -# https://github.com/NixOS/nixpkgs/issues/166205 -# https://github.com/NixOS/nixpkgs/issues/269548 -assert cxxabi == null || !stdenv.hostPlatform.isDarwin; -let - basename = "libcxx"; - pname = basename; - cxxabiName = "lib${if cxxabi == null then "cxxabi" else cxxabi.libName}"; - runtimes = [ "libcxx" ] ++ lib.optional (cxxabi == null) "libcxxabi"; - - # Note: useLLVM is likely false for Darwin but true under pkgsLLVM - useLLVM = stdenv.hostPlatform.useLLVM or false; - - src' = if monorepoSrc != null then - runCommand "${pname}-src-${version}" {} ('' - mkdir -p "$out/llvm" - '' + (lib.optionalString (lib.versionAtLeast release_version "14") '' - cp -r ${monorepoSrc}/cmake "$out" - '') + '' - cp -r ${monorepoSrc}/libcxx "$out" - cp -r ${monorepoSrc}/llvm/cmake "$out/llvm" - cp -r ${monorepoSrc}/llvm/utils "$out/llvm" - '' + (lib.optionalString (lib.versionAtLeast release_version "14") '' - cp -r ${monorepoSrc}/third-party "$out" - '') + '' - cp -r ${monorepoSrc}/runtimes "$out" - '' + (lib.optionalString (cxxabi == null) '' - cp -r ${monorepoSrc}/libcxxabi "$out" - '')) else src; - - cxxabiCMakeFlags = lib.optionals (lib.versionAtLeast release_version "18") [ - "-DLIBCXXABI_USE_LLVM_UNWINDER=OFF" - ] ++ lib.optionals (useLLVM && !stdenv.hostPlatform.isWasm) (if lib.versionAtLeast release_version "18" then [ - "-DLIBCXXABI_ADDITIONAL_LIBRARIES=unwind" - "-DLIBCXXABI_USE_COMPILER_RT=ON" - ] else [ - "-DLIBCXXABI_USE_COMPILER_RT=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" - ]; - - cxxCMakeFlags = [ - "-DLIBCXX_CXX_ABI=${cxxabiName}" - ] ++ lib.optionals (cxxabi == null && lib.versionAtLeast release_version "16") [ - # Note: llvm < 16 doesn't support this flag (or it's broken); handled in postInstall instead. - # Include libc++abi symbols within libc++.a for static linking libc++; - # dynamic linking includes them through libc++.so being a linker script - # which includes both shared objects. - "-DLIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY=ON" - ] ++ lib.optionals (cxxabi != null) [ - "-DLIBCXX_CXX_ABI_INCLUDE_PATHS=${lib.getDev cxxabi}/include" - ] ++ lib.optionals (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) [ - "-DLIBCXX_HAS_MUSL_LIBC=1" - ] ++ lib.optionals (lib.versionAtLeast release_version "18" && !useLLVM && stdenv.hostPlatform.libc == "glibc" && !stdenv.hostPlatform.isStatic) [ - "-DLIBCXX_ADDITIONAL_LIBRARIES=gcc_s" - ] ++ lib.optionals useLLVM [ - "-DLIBCXX_USE_COMPILER_RT=ON" - ] ++ lib.optionals (useLLVM && lib.versionAtLeast release_version "16") [ - "-DLIBCXX_ADDITIONAL_LIBRARIES=unwind" - ] ++ lib.optionals stdenv.hostPlatform.isWasm [ - "-DLIBCXX_ENABLE_THREADS=OFF" - "-DLIBCXX_ENABLE_FILESYSTEM=OFF" - "-DLIBCXX_ENABLE_EXCEPTIONS=OFF" - ] ++ lib.optionals (!enableShared) [ - "-DLIBCXX_ENABLE_SHARED=OFF" - ]; - - cmakeFlags = [ - "-DLLVM_ENABLE_RUNTIMES=${lib.concatStringsSep ";" runtimes}" - ] ++ lib.optionals stdenv.hostPlatform.isWasm [ - "-DCMAKE_C_COMPILER_WORKS=ON" - "-DCMAKE_CXX_COMPILER_WORKS=ON" - "-DUNIX=ON" # Required otherwise libc++ fails to detect the correct linker - ] ++ cxxCMakeFlags - ++ lib.optionals (cxxabi == null) cxxabiCMakeFlags; - -in - -stdenv.mkDerivation (rec { - inherit pname version cmakeFlags patches; - - src = src'; - - outputs = [ "out" "dev" ]; - - preConfigure = lib.optionalString stdenv.hostPlatform.isMusl '' - patchShebangs utils/cat_files.py - ''; - - nativeBuildInputs = [ cmake ninja python3 ] - ++ lib.optional stdenv.isDarwin fixDarwinDylibNames - ++ lib.optional (cxxabi != null) lndir; - - buildInputs = [ cxxabi ] - ++ lib.optionals (useLLVM && !stdenv.hostPlatform.isWasm) [ libunwind ]; - - # libc++.so is a linker script which expands to multiple libraries, - # libc++.so.1 and libc++abi.so or the external cxxabi. ld-wrapper doesn't - # support linker scripts so the external cxxabi needs to be symlinked in - postInstall = lib.optionalString (cxxabi != null) '' - lndir ${lib.getDev cxxabi}/include $dev/include/c++/v1 - lndir ${lib.getLib cxxabi}/lib $out/lib - libcxxabi=$out/lib/lib${cxxabi.libName}.a - '' - # LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY=ON doesn't work for LLVM < 16 or - # external cxxabi libraries so merge libc++abi.a into libc++.a ourselves. - - # GNU binutils emits objects in LIFO order in MRI scripts so after the merge - # the objects are in reversed order so a second MRI script is required so the - # objects in the archive are listed in proper order (libc++.a, libc++abi.a) - + lib.optionalString (cxxabi != null || lib.versionOlder release_version "16") '' - libcxxabi=''${libcxxabi-$out/lib/libc++abi.a} - if [[ -f $out/lib/libc++.a && -e $libcxxabi ]]; then - $AR -M <<MRI - create $out/lib/libc++.a - addlib $out/lib/libc++.a - addlib $libcxxabi - save - end - MRI - $AR -M <<MRI - create $out/lib/libc++.a - addlib $out/lib/libc++.a - save - end - MRI - fi - ''; - - passthru = { - isLLVM = true; - }; - - meta = llvm_meta // { - homepage = "https://libcxx.llvm.org/"; - description = "C++ standard library"; - longDescription = '' - libc++ is an implementation of the C++ standard library, targeting C++11, - C++14 and above. - ''; - # "All of the code in libc++ is dual licensed under the MIT license and the - # UIUC License (a BSD-like license)": - license = with lib.licenses; [ mit ncsa ]; - }; -} // (if (lib.versionOlder release_version "16" || lib.versionAtLeast release_version "17") then { - postPatch = (lib.optionalString (lib.versionAtLeast release_version "14" && lib.versionOlder release_version "15") '' - # fix CMake error when static and LIBCXXABI_USE_LLVM_UNWINDER=ON. aren't - # building unwind so don't need to depend on it - substituteInPlace libcxx/src/CMakeLists.txt \ - --replace-fail "add_dependencies(cxx_static unwind)" "# add_dependencies(cxx_static unwind)" - '') + '' - cd runtimes - ''; -} else { - sourceRoot = "${src'.name}/runtimes"; -})) diff --git a/pkgs/development/compilers/llvm/common/libcxx/libcxx-0001-musl-hacks.patch b/pkgs/development/compilers/llvm/common/libcxx/libcxx-0001-musl-hacks.patch deleted file mode 100644 index bcb5ad8cfb87..000000000000 --- a/pkgs/development/compilers/llvm/common/libcxx/libcxx-0001-musl-hacks.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 1c936d7fda3275265e37f93697232a1ed652390f Mon Sep 17 00:00:00 2001 -From: Will Dietz <w@wdtz.org> -Date: Sat, 9 Jul 2016 19:22:54 -0500 -Subject: [PATCH] musl fixes/hacks - -Conflicts: - - include/__config - include/locale - src/locale.cpp ---- - include/locale | 4 ++-- - 1 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/include/locale b/include/locale -index 3d804e8..9b01f5b 100644 ---- a/include/locale -+++ b/include/locale -@@ -695,7 +695,7 @@ __num_get_signed_integral(const char* __a, const char* __a_end, - typename remove_reference<decltype(errno)>::type __save_errno = errno; - errno = 0; - char *__p2; -- long long __ll = strtoll_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE); -+ long long __ll = strtoll(__a, &__p2, __base); - typename remove_reference<decltype(errno)>::type __current_errno = errno; - if (__current_errno == 0) - errno = __save_errno; -@@ -735,7 +735,7 @@ __num_get_unsigned_integral(const char* __a, const char* __a_end, - typename remove_reference<decltype(errno)>::type __save_errno = errno; - errno = 0; - char *__p2; -- unsigned long long __ll = strtoull_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE); -+ unsigned long long __ll = strtoull(__a, &__p2, __base); - typename remove_reference<decltype(errno)>::type __current_errno = errno; - if (__current_errno == 0) - errno = __save_errno; --- -1.7.1 - diff --git a/pkgs/development/compilers/llvm/common/libcxxabi/wasm.patch b/pkgs/development/compilers/llvm/common/libcxxabi/wasm.patch deleted file mode 100644 index 4ebfe46aa813..000000000000 --- a/pkgs/development/compilers/llvm/common/libcxxabi/wasm.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff --git a/cmake/modules/HandleLLVMOptions.cmake b/cmake/modules/HandleLLVMOptions.cmake -index 15497d405e0..33f7f18193a 100644 ---- a/cmake/modules/HandleLLVMOptions.cmake -+++ b/cmake/modules/HandleLLVMOptions.cmake -@@ -127,7 +127,10 @@ else(WIN32) - set(LLVM_HAVE_LINK_VERSION_SCRIPT 1) - endif() - else(FUCHSIA OR UNIX) -- MESSAGE(SEND_ERROR "Unable to determine platform") -+ if(${CMAKE_SYSTEM_NAME} MATCHES "Wasi") -+ else() -+ MESSAGE(SEND_ERROR "Unable to determine platform") -+ endif() - endif(FUCHSIA OR UNIX) - endif(WIN32) - diff --git a/pkgs/development/compilers/llvm/common/libunwind/default.nix b/pkgs/development/compilers/llvm/common/libunwind/default.nix deleted file mode 100644 index 515914e6acb6..000000000000 --- a/pkgs/development/compilers/llvm/common/libunwind/default.nix +++ /dev/null @@ -1,87 +0,0 @@ -{ lib -, stdenv -, release_version -, patches ? [] -, src ? null -, llvm_meta -, version -, monorepoSrc ? null -, runCommand -, cmake -, ninja -, python3 -, libcxx -, enableShared ? !stdenv.hostPlatform.isStatic -}: -let - pname = "libunwind"; - src' = if monorepoSrc != null then - runCommand "${pname}-src-${version}" {} ('' - mkdir -p "$out" - cp -r ${monorepoSrc}/cmake "$out" - cp -r ${monorepoSrc}/${pname} "$out" - mkdir -p "$out/libcxx" - cp -r ${monorepoSrc}/libcxx/cmake "$out/libcxx" - cp -r ${monorepoSrc}/libcxx/utils "$out/libcxx" - mkdir -p "$out/llvm" - cp -r ${monorepoSrc}/llvm/cmake "$out/llvm" - '' + lib.optionalString (lib.versionAtLeast release_version "15") '' - cp -r ${monorepoSrc}/llvm/utils "$out/llvm" - cp -r ${monorepoSrc}/runtimes "$out" - '') else src; - - hasPatches = builtins.length patches > 0; - - postUnpack = lib.optionalString (lib.versions.major release_version == "12") '' - ln -s ${libcxx.src}/libcxx . - ln -s ${libcxx.src}/llvm . - ''; - - prePatch = lib.optionalString (lib.versionAtLeast release_version "15" && (hasPatches || lib.versionOlder release_version "18")) '' - cd ../${pname} - chmod -R u+w . - ''; - - postPatch = lib.optionalString (lib.versionAtLeast release_version "15" && (hasPatches || lib.versionOlder release_version "18")) '' - cd ../runtimes - ''; - - postInstall = lib.optionalString (enableShared && !stdenv.hostPlatform.isDarwin) '' - # libcxxabi wants to link to libunwind_shared.so (?). - ln -s $out/lib/libunwind.so $out/lib/libunwind_shared.so - ''; -in -stdenv.mkDerivation (rec { - inherit pname version patches; - - src = src'; - - sourceRoot = - if lib.versionOlder release_version "13" then null - else if lib.versionAtLeast release_version "15" then "${src.name}/runtimes" - else "${src.name}/${pname}"; - - outputs = [ "out" "dev" ]; - - nativeBuildInputs = [ cmake ] ++ lib.optionals (lib.versionAtLeast release_version "15") [ - ninja python3 - ]; - - cmakeFlags = lib.optional (lib.versionAtLeast release_version "15") "-DLLVM_ENABLE_RUNTIMES=libunwind" - ++ lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF"; - - meta = llvm_meta // { - # Details: https://github.com/llvm/llvm-project/blob/main/libunwind/docs/index.rst - homepage = "https://clang.llvm.org/docs/Toolchain.html#unwind-library"; - description = "LLVM's unwinder library"; - longDescription = '' - The unwind library provides a family of _Unwind_* functions implementing - the language-neutral stack unwinding portion of the Itanium C++ ABI (Level - I). It is a dependency of the C++ ABI library, and sometimes is a - dependency of other runtimes. - ''; - }; -} // (if postUnpack != "" then { inherit postUnpack; } else {}) - // (if (lib.versionAtLeast release_version "15") then { inherit postInstall; } else {}) - // (if prePatch != "" then { inherit prePatch; } else {}) - // (if postPatch != "" then { inherit postPatch; } else {})) diff --git a/pkgs/development/compilers/llvm/common/lld/default.nix b/pkgs/development/compilers/llvm/common/lld/default.nix deleted file mode 100644 index 99bb150a817d..000000000000 --- a/pkgs/development/compilers/llvm/common/lld/default.nix +++ /dev/null @@ -1,77 +0,0 @@ -{ lib -, stdenv -, llvm_meta -, release_version -, patches ? [] -, buildLlvmTools -, monorepoSrc ? null -, src ? null -, libunwind ? null -, runCommand -, cmake -, ninja -, libxml2 -, libllvm -, version -}: -let - pname = "lld"; - src' = - if monorepoSrc != null then - runCommand "lld-src-${version}" {} '' - mkdir -p "$out" - cp -r ${monorepoSrc}/cmake "$out" - cp -r ${monorepoSrc}/${pname} "$out" - mkdir -p "$out/libunwind" - cp -r ${monorepoSrc}/libunwind/include "$out/libunwind" - mkdir -p "$out/llvm" - '' else src; - - postPatch = lib.optionalString (lib.versions.major release_version == "12") '' - substituteInPlace MachO/CMakeLists.txt --replace \ - '(''${LLVM_MAIN_SRC_DIR}/' '(' - mkdir -p libunwind/include - tar -xf "${libunwind.src}" --wildcards -C libunwind/include --strip-components=2 "libunwind-*/include/" - '' + lib.optionalString (lib.versions.major release_version == "13" && stdenv.isDarwin) '' - substituteInPlace MachO/CMakeLists.txt --replace \ - '(''${LLVM_MAIN_SRC_DIR}/' '(../' - ''; -in -stdenv.mkDerivation (rec { - inherit pname version patches; - - src = src'; - - sourceRoot = - if lib.versionOlder release_version "13" then null - else "${src.name}/${pname}"; - - nativeBuildInputs = [ cmake ] ++ lib.optional (lib.versionAtLeast release_version "15") ninja; - buildInputs = [ libllvm libxml2 ]; - - cmakeFlags = lib.optionals (lib.versionOlder release_version "14") [ - "-DLLVM_CONFIG_PATH=${libllvm.dev}/bin/llvm-config${lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "-native"}" - ] ++ lib.optionals (lib.versionAtLeast release_version "15") [ - "-DLLD_INSTALL_PACKAGE_DIR=${placeholder "dev"}/lib/cmake/lld" - ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ - "-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen" - ]; - - # Musl's default stack size is too small for lld to be able to link Firefox. - LDFLAGS = lib.optionalString stdenv.hostPlatform.isMusl "-Wl,-z,stack-size=2097152"; - - outputs = [ "out" "lib" "dev" ]; - - meta = llvm_meta // { - homepage = "https://lld.llvm.org/"; - description = "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. - ''; - }; -} // (if (postPatch == "" && lib.versions.major release_version != "13") then {} else { inherit postPatch; })) diff --git a/pkgs/development/compilers/llvm/common/lldb-plugins/llef.nix b/pkgs/development/compilers/llvm/common/lldb-plugins/llef.nix deleted file mode 100644 index f671132aa61e..000000000000 --- a/pkgs/development/compilers/llvm/common/lldb-plugins/llef.nix +++ /dev/null @@ -1,43 +0,0 @@ -{ lib -, stdenv -, fetchFromGitHub -, makeWrapper -, lldb -}: - -stdenv.mkDerivation { - pname = "llef"; - version = "unstable-2023-10-18"; - - src = fetchFromGitHub { - owner = "foundryzero"; - repo = "llef"; - rev = "629bd75f44c356f7a3576a6436d3919ce111240d"; - hash = "sha256-JtCHG89s436Di/6+V7Le4CZnkIPh/RYIllfXEO/B7+8"; - }; - - dontBuild = true; - - nativeBuildInputs = [ makeWrapper ]; - - installPhase = '' - runHook preInstall - - mkdir -p $out/share/llef - cp -r llef.py arch commands common handlers $out/share/llef - makeWrapper ${lib.getExe lldb} $out/bin/llef \ - --add-flags "-o 'settings set stop-disassembly-display never'" \ - --add-flags "-o \"command script import $out/share/llef/llef.py\"" - - runHook postInstall - ''; - - meta = with lib; { - description = "LLEF is a plugin for LLDB to make it more useful for RE and VR"; - homepage = "https://github.com/foundryzero/llef"; - license = licenses.mit; - platforms = platforms.all; - maintainers = with maintainers; [ nrabulinski ]; - mainProgram = "llef"; - }; -} diff --git a/pkgs/development/compilers/llvm/common/lldb.nix b/pkgs/development/compilers/llvm/common/lldb.nix deleted file mode 100644 index 71afcb159a44..000000000000 --- a/pkgs/development/compilers/llvm/common/lldb.nix +++ /dev/null @@ -1,218 +0,0 @@ -{ lib -, stdenv -, llvm_meta -, release_version -, cmake -, zlib -, ncurses -, swig3 -, swig4 -, which -, libedit -, libxml2 -, libllvm -, libclang -, python3 -, version -, darwin -, lit -, makeWrapper -, lua5_3 -, ninja -, runCommand -, src ? null -, monorepoSrc ? null -, patches ? [ ] -, enableManpages ? false -, ... -}: - -let - src' = - if monorepoSrc != null then - runCommand "lldb-src-${version}" { } '' - mkdir -p "$out" - 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 { - passthru.monorepoSrc = monorepoSrc; - pname = "lldb"; - inherit version; - - src = src'; - inherit patches; - - outputs = [ "out" "lib" "dev" ]; - - sourceRoot = lib.optional (lib.versionAtLeast release_version "13") "${src.name}/${pname}"; - - nativeBuildInputs = [ - cmake - python3 - which - swig - lit - makeWrapper - 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 - ]; - - buildInputs = [ - ncurses - zlib - libedit - libxml2 - libllvm - ] ++ lib.optionals (lib.versionAtLeast release_version "16") [ - # Starting with LLVM 16, the resource dir patch is no longer enough to get - # libclang into the rpath of the lldb executables. By putting it into - # buildInputs cc-wrapper will set up rpath correctly for us. - (lib.getLib libclang) - ] ++ 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 - ] - # The older libSystem used on x86_64 macOS is missing the - # `<bsm/audit_session.h>` header which `lldb` uses. - # - # We copy this header over from macOS 10.12 SDK. - # - # See here for context: - # https://github.com/NixOS/nixpkgs/pull/194634#issuecomment-1272129132 - ++ lib.optional - ( - stdenv.targetPlatform.isDarwin - && !stdenv.targetPlatform.isAarch64 - && (lib.versionAtLeast release_version "15") - ) - ( - runCommand "bsm-audit-session-header" { } '' - install -Dm444 \ - "${lib.getDev darwin.apple_sdk.sdk}/include/bsm/audit_session.h" \ - "$out/include/bsm/audit_session.h" - '' - ); - - hardeningDisable = [ "format" ]; - - cmakeFlags = [ - "-DLLDB_INCLUDE_TESTS=${if doCheck then "YES" else "NO"}" - "-DLLVM_ENABLE_RTTI=OFF" - "-DClang_DIR=${lib.getDev libclang}/lib/cmake" - "-DLLVM_EXTERNAL_LIT=${lit}/bin/lit" - ] ++ lib.optionals stdenv.isDarwin [ - "-DLLDB_USE_SYSTEM_DEBUGSERVER=ON" - ] ++ lib.optionals (!stdenv.isDarwin) [ - "-DLLDB_CODESIGN_IDENTITY=" # codesigning makes nondeterministic - ] ++ lib.optionals (lib.versionAtLeast release_version "17") [ - "-DCLANG_RESOURCE_DIR=../../../../${libclang.lib}" - ] ++ lib.optionals enableManpages ([ - "-DLLVM_ENABLE_SPHINX=ON" - "-DSPHINX_OUTPUT_MAN=ON" - "-DSPHINX_OUTPUT_HTML=OFF" - ] ++ lib.optionals (lib.versionAtLeast release_version "15") [ - # docs reference `automodapi` but it's not added to the extensions list when - # only building the manpages: - # https://github.com/llvm/llvm-project/blob/af6ec9200b09039573d85e349496c4f5b17c3d7f/lldb/docs/conf.py#L54 - # - # so, we just ignore the resulting errors - "-DSPHINX_WARNINGS_AS_ERRORS=OFF" - ]) ++ 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 = lib.versionOlder release_version "15"; - - # TODO: cleanup with mass-rebuild - installCheckPhase = '' - if [ ! -e $lib/${python3.sitePackages}/lldb/_lldb*.so ] ; then - echo "ERROR: python files not installed where expected!"; - return 1; - fi - '' # Something lua is built on older versions but this file doesn't exist. - + lib.optionalString (lib.versionAtLeast release_version "14") '' - if [ ! -e "$lib/lib/lua/${lua5_3.luaversion}/lldb.so" ] ; then - echo "ERROR: lua files not installed where expected!"; - return 1; - fi - ''; - - postInstall = '' - wrapProgram $out/bin/lldb --prefix PYTHONPATH : $lib/${python3.sitePackages}/ - - # Editor support - # vscode: - 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 = vscodeExt.name; - passthru.vscodeExtPublisher = "llvm"; - passthru.vscodeExtUniqueId = "llvm-org.${vscodeExt.name}-${vscodeExt.version}"; - - meta = llvm_meta // { - homepage = "https://lldb.llvm.org/"; - description = "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. - ''; - # llvm <10 never built on aarch64-darwin since first introduction in nixpkgs - broken = - (lib.versionOlder release_version "11" && stdenv.isDarwin && stdenv.isAarch64) - || (((lib.versions.major release_version) == "13") && stdenv.isDarwin); - mainProgram = "lldb"; - }; -} // lib.optionalAttrs enableManpages { - pname = "lldb-manpages"; - - buildPhase = lib.optionalString (lib.versionOlder release_version "15") '' - make ${if (lib.versionOlder release_version "12") then "docs-man" else "docs-lldb-man"} - ''; - - - ninjaFlags = lib.optionals (lib.versionAtLeast release_version "15") [ "docs-lldb-man" ]; - - propagatedBuildInputs = [ ]; - - # manually install lldb man page - installPhase = '' - mkdir -p $out/share/man/man1 - install docs/man/lldb.1 -t $out/share/man/man1/ - ''; - - postPatch = null; - postInstall = null; - - outputs = [ "out" ]; - - doCheck = false; - - meta = llvm_meta // { - description = "man pages for LLDB ${version}"; - }; -}) diff --git a/pkgs/development/compilers/llvm/common/lldb/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/common/lldb/gnu-install-dirs.patch deleted file mode 100644 index ec550764be81..000000000000 --- a/pkgs/development/compilers/llvm/common/lldb/gnu-install-dirs.patch +++ /dev/null @@ -1,68 +0,0 @@ -diff --git a/bindings/lua/CMakeLists.txt b/bindings/lua/CMakeLists.txt -index 1a739a980..59f8fc3a0 100644 ---- a/bindings/lua/CMakeLists.txt -+++ b/bindings/lua/CMakeLists.txt -@@ -56,7 +56,7 @@ function(finish_swig_lua swig_target lldb_lua_bindings_dir lldb_lua_target_dir) - if(LLDB_BUILD_FRAMEWORK) - set(LLDB_LUA_INSTALL_PATH ${LLDB_FRAMEWORK_INSTALL_DIR}/LLDB.framework/Resources/Python) - else() -- set(LLDB_LUA_INSTALL_PATH ${LLDB_LUA_RELATIVE_PATH}) -+ set(LLDB_LUA_INSTALL_PATH ${CMAKE_INSTALL_LIBDIR}/../${LLDB_LUA_RELATIVE_PATH}) - endif() - install(DIRECTORY ${lldb_lua_target_dir}/ - DESTINATION ${LLDB_LUA_INSTALL_PATH} -diff --git a/bindings/python/CMakeLists.txt b/bindings/python/CMakeLists.txt -index c631faf52ac3..1d92d069960b 100644 ---- a/bindings/python/CMakeLists.txt -+++ b/bindings/python/CMakeLists.txt -@@ -160,7 +160,7 @@ function(finish_swig_python swig_target lldb_python_bindings_dir lldb_python_tar - if(LLDB_BUILD_FRAMEWORK) - set(LLDB_PYTHON_INSTALL_PATH ${LLDB_FRAMEWORK_INSTALL_DIR}/LLDB.framework/Versions/${LLDB_FRAMEWORK_VERSION}/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/cmake/modules/AddLLDB.cmake b/cmake/modules/AddLLDB.cmake -index 3291a7c808e1..b27d27ce6a87 100644 ---- a/cmake/modules/AddLLDB.cmake -+++ b/cmake/modules/AddLLDB.cmake -@@ -109,7 +109,7 @@ 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() -diff --git a/tools/intel-features/CMakeLists.txt b/tools/intel-features/CMakeLists.txt -index 7d48491ec89a..c04543585588 100644 ---- a/tools/intel-features/CMakeLists.txt -+++ b/tools/intel-features/CMakeLists.txt -@@ -30,4 +30,4 @@ add_lldb_library(lldbIntelFeatures SHARED - ) - - install(TARGETS lldbIntelFeatures -- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}) -+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}) -diff --git a/source/API/CMakeLists.txt b/source/API/CMakeLists.txt -index 7d48491ec89a..c04543585588 100644 ---- a/source/API/CMakeLists.txt 2024-05-30 18:59:13.449269853 -0700 -+++ b/source/API/CMakeLists.txt 2024-05-30 19:00:33.721858164 -0700 -@@ -115,14 +115,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/common/llvm/TLI-musl.patch b/pkgs/development/compilers/llvm/common/llvm/TLI-musl.patch deleted file mode 100644 index 1a6908086637..000000000000 --- a/pkgs/development/compilers/llvm/common/llvm/TLI-musl.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 5c571082fdaf61f6df19d9b7137dc26d71334058 Mon Sep 17 00:00:00 2001 -From: Natanael Copa <ncopa@alpinelinux.org> -Date: Thu, 18 Feb 2016 10:33:04 +0100 -Subject: [PATCH 2/3] Fix build with musl libc - -On musl libc the fopen64 and fopen are the same thing, but for -compatibility they have a `#define fopen64 fopen`. Same applies for -fseek64, fstat64, fstatvfs64, ftello64, lstat64, stat64 and tmpfile64. ---- - include/llvm/Analysis/TargetLibraryInfo.h | 9 +++++++++ - 1 file changed, 9 insertions(+) - -diff --git a/include/llvm/Analysis/TargetLibraryInfo.h b/include/llvm/Analysis/TargetLibraryInfo.h -index 7becdf0..7f14427 100644 ---- a/include/llvm/Analysis/TargetLibraryInfo.h -+++ b/include/llvm/Analysis/TargetLibraryInfo.h -@@ -18,6 +18,15 @@ - #include "llvm/IR/Module.h" - #include "llvm/Pass.h" - -+#undef fopen64 -+#undef fseeko64 -+#undef fstat64 -+#undef fstatvfs64 -+#undef ftello64 -+#undef lstat64 -+#undef stat64 -+#undef tmpfile64 -+ - namespace llvm { - /// VecDesc - Describes a possible vectorization of a function. - /// Function 'VectorFnName' is equivalent to 'ScalarFnName' vectorized --- -2.7.3 - diff --git a/pkgs/development/compilers/llvm/common/llvm/default.nix b/pkgs/development/compilers/llvm/common/llvm/default.nix deleted file mode 100644 index 89ea8f6e7a56..000000000000 --- a/pkgs/development/compilers/llvm/common/llvm/default.nix +++ /dev/null @@ -1,540 +0,0 @@ -{ lib -, stdenv -, llvm_meta -, pkgsBuildBuild -, pollyPatches ? [] -, patches ? [] -, polly_src ? null -, src ? null -, monorepoSrc ? null -, runCommand -, cmake -, darwin -, ninja -, python3 -, python3Packages -, libffi - # TODO: Can this memory corruption bug still occur? - # <https://github.com/llvm/llvm-project/issues/61350> -, enableGoldPlugin ? libbfd.hasPluginAPI -, libbfd -, libpfm -, libxml2 -, ncurses -, version -, release_version -, zlib -, which -, sysctl -, buildLlvmTools -, debugVersion ? false -, doCheck ? !stdenv.isAarch32 && (if lib.versionOlder release_version "15" then stdenv.isLinux else true) - && (!stdenv.isx86_32 /* TODO: why */) && (!stdenv.hostPlatform.isMusl) - && !(stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isBigEndian) - && (stdenv.hostPlatform == stdenv.buildPlatform) -, enableManpages ? false -, enableSharedLibraries ? !stdenv.hostPlatform.isStatic -, enablePFM ? stdenv.isLinux /* PFM only supports Linux */ - # broken for Ampere eMAG 8180 (c2.large.arm on Packet) #56245 - # broken for the armv7l builder - && !stdenv.hostPlatform.isAarch -, enablePolly ? lib.versionAtLeast release_version "14" -, enableTerminfo ? 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 - # Note that we _explicitly_ ask for a python interpreter for our host - # platform here; the splicing that would ordinarily take care of this for - # us does not seem to work once we use `withPackages`. - let - checkDeps = ps: with ps; [ psutil ]; - in pkgsBuildBuild.targetPackages.python3.withPackages checkDeps - else python3; - - pname = "llvm"; - - src' = if monorepoSrc != null then - runCommand "${pname}-src-${version}" {} ('' - mkdir -p "$out" - cp -r ${monorepoSrc}/cmake "$out" - cp -r ${monorepoSrc}/${pname} "$out" - cp -r ${monorepoSrc}/third-party "$out" - '' + lib.optionalString enablePolly '' - chmod u+w "$out/${pname}/tools" - cp -r ${monorepoSrc}/polly "$out/${pname}/tools" - '') else src; - - patches' = patches ++ lib.optionals enablePolly pollyPatches; -in - -stdenv.mkDerivation (rec { - inherit pname version; - - src = src'; - patches = patches'; - - sourceRoot = if lib.versionOlder release_version "13" then null - else "${src.name}/${pname}"; - - outputs = [ "out" "lib" "dev" "python" ]; - - nativeBuildInputs = [ cmake ] - ++ (lib.optional (lib.versionAtLeast release_version "15") ninja) - ++ [ python ] - ++ optionals enableManpages [ - # 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 - - propagatedBuildInputs = (lib.optional (lib.versionAtLeast release_version "14" || stdenv.buildPlatform == stdenv.hostPlatform) ncurses) - ++ [ zlib ]; - - 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})' "" - '' + - # As of LLVM 15, marked as XFAIL on arm64 macOS but lit doesn't seem to pick - # this up: https://github.com/llvm/llvm-project/blob/c344d97a125b18f8fed0a64aace73c49a870e079/llvm/test/MC/ELF/cfi-version.ll#L7 - (optionalString (lib.versionAtLeast release_version "15") ('' - rm test/MC/ELF/cfi-version.ll - - '' + - # This test tries to call `sw_vers` by absolute path (`/usr/bin/sw_vers`) - # and thus fails under the sandbox: - (if lib.versionAtLeast release_version "16" then '' - substituteInPlace unittests/TargetParser/Host.cpp \ - --replace '/usr/bin/sw_vers' "${(builtins.toString darwin.DarwinTools) + "/bin/sw_vers" }" - '' else '' - substituteInPlace unittests/Support/Host.cpp \ - --replace '/usr/bin/sw_vers' "${(builtins.toString darwin.DarwinTools) + "/bin/sw_vers" }" - '') + - # This test tries to call the intrinsics `@llvm.roundeven.f32` and - # `@llvm.roundeven.f64` which seem to (incorrectly?) lower to `roundevenf` - # and `roundeven` on macOS and FreeBSD. - # - # However these functions are glibc specific so the test fails: - # - https://www.gnu.org/software/gnulib/manual/html_node/roundevenf.html - # - https://www.gnu.org/software/gnulib/manual/html_node/roundeven.html - # - # TODO(@rrbutani): this seems to run fine on `aarch64-darwin`, why does it - # pass there? - optionalString (lib.versionAtLeast release_version "16") '' - substituteInPlace test/ExecutionEngine/Interpreter/intrinsics.ll \ - --replace "%roundeven32 = call float @llvm.roundeven.f32(float 0.000000e+00)" "" \ - --replace "%roundeven64 = call double @llvm.roundeven.f64(double 0.000000e+00)" "" - '' + - # fails when run in sandbox - optionalString (!stdenv.hostPlatform.isx86 && lib.versionAtLeast release_version "18") '' - substituteInPlace unittests/Support/VirtualFileSystemTest.cpp \ - --replace "PhysicalFileSystemWorkingDirFailure" "DISABLED_PhysicalFileSystemWorkingDirFailure" - ''))) + - # dup of above patch with different conditions - optionalString (stdenv.isDarwin && stdenv.hostPlatform.isx86 && lib.versionAtLeast release_version "15") (optionalString (lib.versionOlder release_version "16") '' - substituteInPlace test/ExecutionEngine/Interpreter/intrinsics.ll \ - --replace "%roundeven32 = call float @llvm.roundeven.f32(float 0.000000e+00)" "" \ - --replace "%roundeven64 = call double @llvm.roundeven.f64(double 0.000000e+00)" "" - - '' + - # fails when run in sandbox - ((optionalString (lib.versionAtLeast release_version "18") '' - substituteInPlace unittests/Support/VirtualFileSystemTest.cpp \ - --replace "PhysicalFileSystemWorkingDirFailure" "DISABLED_PhysicalFileSystemWorkingDirFailure" - '') + - # This test fails on darwin x86_64 because `sw_vers` reports a different - # macOS version than what LLVM finds by reading - # `/System/Library/CoreServices/SystemVersion.plist` (which is passed into - # the sandbox on macOS). - # - # The `sw_vers` provided by nixpkgs reports the macOS version associated - # with the `CoreFoundation` framework with which it was built. Because - # nixpkgs pins the SDK for `aarch64-darwin` and `x86_64-darwin` what - # `sw_vers` reports is not guaranteed to match the macOS version of the host - # that's building this derivation. - # - # Astute readers will note that we only _patch_ this test on aarch64-darwin - # (to use the nixpkgs provided `sw_vers`) instead of disabling it outright. - # So why does this test pass on aarch64? - # - # Well, it seems that `sw_vers` on aarch64 actually links against the _host_ - # CoreFoundation framework instead of the nixpkgs provided one. - # - # Not entirely sure what the right fix is here. I'm assuming aarch64 - # `sw_vers` doesn't intentionally link against the host `CoreFoundation` - # (still digging into how this ends up happening, will follow up) but that - # aside I think the more pertinent question is: should we be patching LLVM's - # macOS version detection logic to use `sw_vers` instead of reading host - # paths? This *is* a way in which details about builder machines can creep - # into the artifacts that are produced, affecting reproducibility, but it's - # not clear to me when/where/for what this even gets used in LLVM. - # - # TODO(@rrbutani): fix/follow-up - (if lib.versionAtLeast release_version "16" then '' - substituteInPlace unittests/TargetParser/Host.cpp \ - --replace "getMacOSHostVersion" "DISABLED_getMacOSHostVersion" - '' else '' - substituteInPlace unittests/Support/Host.cpp \ - --replace "getMacOSHostVersion" "DISABLED_getMacOSHostVersion" - '') + - # This test fails with a `dysmutil` crash; have not yet dug into what's - # going on here (TODO(@rrbutani)). - lib.optionalString (lib.versionOlder release_version "19") '' - rm test/tools/dsymutil/ARM/obfuscated.test - '')) + - # 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 - '' + lib.optionalString (lib.versionAtLeast release_version "13") '' - rm test/tools/llvm-objcopy/ELF/mirror-permissions-unix.test - '' + lib.optionalString (lib.versionOlder release_version "13") '' - # TODO: Fix failing tests: - rm test/DebugInfo/X86/vla-multi.ll - '' + - # Fails in the presence of anti-virus software or other intrusion-detection software that - # modifies the atime when run. See #284056. - lib.optionalString (lib.versionAtLeast release_version "16") ('' - rm test/tools/llvm-objcopy/ELF/strip-preserve-atime.test - '' + lib.optionalString (lib.versionOlder release_version "17") '' - - '') + - # timing-based tests are trouble - lib.optionalString (lib.versionAtLeast release_version "15" && lib.versionOlder release_version "17") '' - rm utils/lit/tests/googletest-timeout.py - '' + - # valgrind unhappy with musl or glibc, but fails w/musl only - 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 - 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 - rm test/tools/llvm-objcopy/MachO/universal-object.test - '' + - # Seems to require certain floating point hardware (NEON?) - optionalString (stdenv.hostPlatform.system == "armv6l-linux") '' - rm test/ExecutionEngine/frem.ll - '' + - # 1. TODO: Why does this test fail on FreeBSD? - # It seems to reference /usr/local/lib/libfile.a, which is clearly a problem. - # 2. This test fails for the same reason it fails on MacOS, but the fix is - # not trivial to apply. - optionalString stdenv.isFreeBSD '' - rm test/tools/llvm-libtool-darwin/L-and-l.test - rm test/ExecutionEngine/Interpreter/intrinsics.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. - (lib.optionalString (lib.versionOlder release_version "13") ('' - for f in \ - test/Other/new-pass-manager.ll \ - test/Other/new-pm-O0-defaults.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 - '' + - # gcc-13 fix - '' - sed -i '/#include <string>/i#include <cstdint>' \ - include/llvm/DebugInfo/Symbolize/DIPrinter.h - '')); - - # Workaround for configure flags that need to have spaces - preConfigure = if lib.versionAtLeast release_version "15" then '' - cmakeFlagsArray+=( - -DLLVM_LIT_ARGS="-svj''${NIX_BUILD_CORES} --no-progress-bar" - ) - '' else '' - cmakeFlagsArray+=( - -DLLVM_LIT_ARGS='-svj''${NIX_BUILD_CORES} --no-progress-bar' - ) - ''; - - # E.g. mesa.drivers use the build-id as a cache key (see #93946): - LDFLAGS = optionalString (enableSharedLibraries && !stdenv.isDarwin) "-Wl,--build-id=sha1"; - - 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 = (if lib.versionOlder release_version "15" then [ - "-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/" - ] else [ - "-DLLVM_INSTALL_PACKAGE_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" - (lib.cmakeBool "LLVM_ENABLE_TERMINFO" enableTerminfo) - ] ++ optionals (!doCheck) [ - "-DLLVM_INCLUDE_TESTS=OFF" - ] ++ optionals stdenv.hostPlatform.isStatic [ - # Disables building of shared libs, -fPIC is still injected by cc-wrapper - "-DLLVM_ENABLE_PIC=OFF" - "-DCMAKE_SKIP_INSTALL_RPATH=ON" - "-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 - ]) - ) - ]; - - 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" - '' + (if lib.versionOlder release_version "15" then '' - substituteInPlace "$dev/lib/cmake/llvm/LLVMConfig.cmake" \ - --replace 'set(LLVM_BINARY_DIR "''${LLVM_INSTALL_PREFIX}")' 'set(LLVM_BINARY_DIR "''${LLVM_INSTALL_PREFIX}'"$lib"'")' - '' else '' - substituteInPlace "$dev/lib/cmake/llvm/LLVMConfig.cmake" \ - --replace 'set(LLVM_BINARY_DIR "''${LLVM_INSTALL_PREFIX}")' 'set(LLVM_BINARY_DIR "'"$lib"'")' - '') - + optionalString (stdenv.isDarwin && enableSharedLibraries && lib.versionOlder release_version "18") '' - ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${shortVersion}.dylib - '' - + optionalString (stdenv.isDarwin && enableSharedLibraries) '' - 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"; - - # For the update script: - passthru.monorepoSrc = monorepoSrc; - - requiredSystemFeatures = [ "big-parallel" ]; - meta = llvm_meta // { - homepage = "https://llvm.org/"; - description = "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"; - - propagatedBuildInputs = []; - - postPatch = null; - postInstall = null; - - outputs = [ "out" ]; - - doCheck = false; - - meta = llvm_meta // { - description = "man pages for LLVM ${version}"; - }; -} // (if lib.versionOlder release_version "15" then { - buildPhase = '' - make docs-llvm-man - ''; - - installPhase = '' - make -C docs install - ''; -} else { - ninjaFlags = [ "docs-llvm-man" ]; - installTargets = [ "install-docs-llvm-man" ]; - - postPatch = null; - postInstall = null; -})) // lib.optionalAttrs (lib.versionOlder release_version "13") { - inherit polly_src; - - unpackPhase = '' - unpackFile $src - mv llvm-${release_version}* llvm - sourceRoot=$PWD/llvm - '' + optionalString enablePolly '' - unpackFile $polly_src - mv polly-* $sourceRoot/tools/polly - ''; -} // lib.optionalAttrs (lib.versionAtLeast release_version "13") { - nativeCheckInputs = [ which ] ++ lib.optional (stdenv.isDarwin && lib.versionAtLeast release_version "15") sysctl; -} // lib.optionalAttrs (lib.versionOlder release_version "15") { - # hacky fix: created binaries need to be run before installation - preBuild = '' - mkdir -p $out/ - ln -sv $PWD/lib $out - ''; - - postBuild = '' - rm -fR $out - ''; - - preCheck = '' - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}$PWD/lib - ''; -} // lib.optionalAttrs (lib.versionAtLeast release_version "15") { - # Defensive check: some paths (that we make symlinks to) depend on the release - # version, for example: - # - https://github.com/llvm/llvm-project/blob/406bde9a15136254f2b10d9ef3a42033b3cb1b16/clang/lib/Headers/CMakeLists.txt#L185 - # - # So we want to sure that the version in the source matches the release - # version we were given. - # - # We do this check here, in the LLVM build, because it happens early. - postConfigure = let - v = lib.versions; - major = v.major release_version; - minor = v.minor release_version; - patch = v.patch release_version; - in '' - # $1: part, $2: expected - check_version() { - part="''${1^^}" - part="$(cat include/llvm/Config/llvm-config.h | grep "#define LLVM_VERSION_''${part} " | cut -d' ' -f3)" - - if [[ "$part" != "$2" ]]; then - echo >&2 \ - "mismatch in the $1 version! we have version ${release_version}" \ - "and expected the $1 version to be '$2'; the source has '$part' instead" - exit 3 - fi - } - - check_version major ${major} - check_version minor ${minor} - check_version patch ${patch} - ''; -} // lib.optionalAttrs (lib.versionOlder release_version "17" || lib.versionAtLeast release_version "18") { - hardeningDisable = [ "trivialautovarinit" ]; -}) diff --git a/pkgs/development/compilers/llvm/common/llvm/llvm-config-link-static.patch b/pkgs/development/compilers/llvm/common/llvm/llvm-config-link-static.patch deleted file mode 100644 index 3881cc5206e2..000000000000 --- a/pkgs/development/compilers/llvm/common/llvm/llvm-config-link-static.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git llvm/tools/llvm-config/CMakeLists.txt llvm/tools/llvm-config/CMakeLists.txt -index 16ba54c0cf2f..20b017195e84 100644 ---- llvm/tools/llvm-config/CMakeLists.txt -+++ llvm/tools/llvm-config/CMakeLists.txt -@@ -6,6 +6,7 @@ set(BUILDVARIABLES_OBJPATH ${CMAKE_CURRENT_BINARY_DIR}/BuildVariables.inc) - # Add the llvm-config tool. - add_llvm_tool(llvm-config - llvm-config.cpp -+ DISABLE_LLVM_LINK_LLVM_DYLIB - ) - - # Compute the substitution values for various items. diff --git a/pkgs/development/compilers/llvm/common/mlir/default.nix b/pkgs/development/compilers/llvm/common/mlir/default.nix deleted file mode 100644 index 891e66b1d57c..000000000000 --- a/pkgs/development/compilers/llvm/common/mlir/default.nix +++ /dev/null @@ -1,81 +0,0 @@ -{ lib -, stdenv -, llvm_meta -, buildLlvmTools -, monorepoSrc -, runCommand -, cmake -, ninja -, libxml2 -, libllvm -, version -, doCheck ? (!stdenv.isx86_32 /* TODO: why */) && (!stdenv.hostPlatform.isMusl) -}: - -stdenv.mkDerivation rec { - pname = "mlir"; - inherit version doCheck; - - # Blank llvm dir just so relative path works - src = runCommand "${pname}-src-${version}" { } '' - mkdir -p "$out" - cp -r ${monorepoSrc}/cmake "$out" - cp -r ${monorepoSrc}/mlir "$out" - cp -r ${monorepoSrc}/third-party "$out/third-party" - - mkdir -p "$out/llvm" - ''; - - sourceRoot = "${src.name}/mlir"; - - patches = [ - ./gnu-install-dirs.patch - ]; - - nativeBuildInputs = [ - cmake - ninja - ]; - - buildInputs = [ - libllvm - libxml2 - ]; - - cmakeFlags = [ - "-DLLVM_BUILD_TOOLS=ON" - # Install headers as well - "-DLLVM_INSTALL_TOOLCHAIN_ONLY=OFF" - "-DMLIR_TOOLS_INSTALL_DIR=${placeholder "out"}/bin/" - "-DLLVM_ENABLE_IDE=OFF" - "-DMLIR_INSTALL_PACKAGE_DIR=${placeholder "dev"}/lib/cmake/mlir" - "-DMLIR_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/mlir" - "-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" - ] ++ lib.optionals stdenv.hostPlatform.isStatic [ - # Disables building of shared libs, -fPIC is still injected by cc-wrapper - "-DLLVM_ENABLE_PIC=OFF" - "-DLLVM_BUILD_STATIC=ON" - "-DLLVM_LINK_LLVM_DYLIB=OFF" - ] ++ lib.optionals ((stdenv.hostPlatform != stdenv.buildPlatform) && !(stdenv.buildPlatform.canExecute stdenv.hostPlatform)) [ - "-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen" - "-DMLIR_TABLEGEN_EXE=${buildLlvmTools.mlir}/bin/mlir-tblgen" - ]; - - outputs = [ "out" "dev" ]; - - meta = llvm_meta // { - homepage = "https://mlir.llvm.org/"; - description = "Multi-Level IR Compiler Framework"; - longDescription = '' - The MLIR project is a novel approach to building reusable and extensible - compiler infrastructure. MLIR aims to address software fragmentation, - improve compilation for heterogeneous hardware, significantly reduce - the cost of building domain specific compilers, and aid in connecting - existing compilers together. - ''; - }; -} diff --git a/pkgs/development/compilers/llvm/common/mlir/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/common/mlir/gnu-install-dirs.patch deleted file mode 100644 index 95191022d1a3..000000000000 --- a/pkgs/development/compilers/llvm/common/mlir/gnu-install-dirs.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index c91e9cd93dc8..23b6032a46b7 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -32,8 +32,8 @@ if(MLIR_STANDALONE_BUILD) - endif() - - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY -- "${CMAKE_CURRENT_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}") -- set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin") -+ "${CMAKE_INSTALL_LIBDIR}/${LLVM_LIBDIR_SUFFIX}") -+ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_INSTALL_BINDIR}") - - set(LLVM_LIT_ARGS "-sv" CACHE STRING "Default options for lit") - endif() diff --git a/pkgs/development/compilers/llvm/common/openmp/default.nix b/pkgs/development/compilers/llvm/common/openmp/default.nix deleted file mode 100644 index 7d9d813f024c..000000000000 --- a/pkgs/development/compilers/llvm/common/openmp/default.nix +++ /dev/null @@ -1,86 +0,0 @@ -{ lib -, stdenv -, llvm_meta -, release_version -, patches ? [] -, monorepoSrc ? null -, src ? null -, runCommand -, cmake -, ninja -, llvm -, targetLlvm -, lit -, clang-unwrapped -, perl -, pkg-config -, xcbuild -, version -}: -let - pname = "openmp"; - src' = - if monorepoSrc != null then - runCommand "${pname}-src-${version}" {} '' - mkdir -p "$out" - cp -r ${monorepoSrc}/cmake "$out" - cp -r ${monorepoSrc}/${pname} "$out" - '' else src; -in -stdenv.mkDerivation (rec { - inherit pname version patches; - - src = src'; - - sourceRoot = - if lib.versionOlder release_version "13" then null - else "${src.name}/${pname}"; - - outputs = [ "out" ] - ++ lib.optionals (lib.versionAtLeast release_version "14") [ "dev" ]; - - patchFlags = - if lib.versionOlder release_version "14" then [ "-p2" ] - else null; - - nativeBuildInputs = [ - cmake - ] ++ lib.optionals (lib.versionAtLeast release_version "15") [ - ninja - ] ++ [ perl ] ++ lib.optionals (lib.versionAtLeast release_version "14") [ - pkg-config lit - ]; - - buildInputs = [ - (if stdenv.buildPlatform == stdenv.hostPlatform then llvm else targetLlvm) - ]; - - cmakeFlags = lib.optionals (lib.versions.major release_version == "13") [ - "-DLIBOMPTARGET_BUILD_AMDGCN_BCLIB=OFF" # Building the AMDGCN device RTL fails - ] ++ lib.optionals (lib.versionAtLeast release_version "14") [ - "-DCLANG_TOOL=${clang-unwrapped}/bin/clang" - "-DOPT_TOOL=${llvm}/bin/opt" - "-DLINK_TOOL=${llvm}/bin/llvm-link" - ]; - - meta = llvm_meta // { - homepage = "https://openmp.llvm.org/"; - description = "Support for the OpenMP language"; - longDescription = '' - The OpenMP subproject of LLVM contains the components required to build an - executable OpenMP program that are outside the compiler itself. - Contains the code for the runtime library against which code compiled by - "clang -fopenmp" must be linked before it can run and the library that - supports offload to target devices. - ''; - # "All of the code is dual licensed under the MIT license and the UIUC - # License (a BSD-like license)": - license = with lib.licenses; [ mit ncsa ]; - }; -} // (lib.optionalAttrs (lib.versionAtLeast release_version "14") { - doCheck = false; - checkTarget = "check-openmp"; - preCheck = '' - patchShebangs ../tools/archer/tests/deflake.bash - ''; -})) |