From bd1607202d4befa0c17ba323d1ed985291bb157e Mon Sep 17 00:00:00 2001 From: Weijia Wang <9713184+wegank@users.noreply.github.com> Date: Fri, 23 Feb 2024 05:14:36 +0100 Subject: llvmPackages: move patches to proper folders (#287092) * llvmPackages: move clang-*-LLVMgold-path.patch to common/clang * llvmPackages: move exegesis-force-bdver2.patch to 9/llvm * llvmPackages: move llvm-config-link-static.patch to common/llvm * llvmPackages: move TLI-musl.patch to common/llvm * llvmPackages: move libcxx-0001-musl-hacks.patch to common/llvm --- .../compilers/llvm/11/clang/default.nix | 2 +- .../compilers/llvm/11/libcxx/default.nix | 2 +- .../compilers/llvm/11/libcxxabi/default.nix | 2 +- .../development/compilers/llvm/11/llvm/default.nix | 4 +-- .../compilers/llvm/12/clang/default.nix | 2 +- .../compilers/llvm/12/libcxx/default.nix | 2 +- .../compilers/llvm/12/libcxxabi/default.nix | 2 +- .../development/compilers/llvm/12/llvm/default.nix | 4 +-- .../compilers/llvm/13/clang/default.nix | 2 +- .../compilers/llvm/13/libcxx/default.nix | 2 +- .../development/compilers/llvm/13/llvm/default.nix | 4 +-- .../compilers/llvm/14/clang/default.nix | 2 +- .../compilers/llvm/14/libcxx/default.nix | 2 +- .../development/compilers/llvm/14/llvm/default.nix | 2 +- .../compilers/llvm/15/clang/default.nix | 2 +- .../compilers/llvm/15/libcxx/default.nix | 2 +- .../development/compilers/llvm/15/llvm/default.nix | 2 +- .../compilers/llvm/16/clang/default.nix | 2 +- .../development/compilers/llvm/16/llvm/default.nix | 2 +- .../compilers/llvm/17/clang/default.nix | 2 +- .../development/compilers/llvm/17/llvm/default.nix | 2 +- .../development/compilers/llvm/9/clang/default.nix | 2 +- .../compilers/llvm/9/libcxx/default.nix | 2 +- .../compilers/llvm/9/libcxxabi/default.nix | 2 +- pkgs/development/compilers/llvm/9/llvm/default.nix | 6 ++-- .../llvm/9/llvm/exegesis-force-bdver2.patch | 11 ++++++ pkgs/development/compilers/llvm/TLI-musl.patch | 35 ------------------- .../compilers/llvm/clang-11-15-LLVMgold-path.patch | 13 -------- .../compilers/llvm/clang-6-10-LLVMgold-path.patch | 15 --------- .../llvm/clang-at-least-16-LLVMgold-path.patch | 14 -------- .../common/clang/clang-11-15-LLVMgold-path.patch | 13 ++++++++ .../common/clang/clang-6-10-LLVMgold-path.patch | 15 +++++++++ .../clang/clang-at-least-16-LLVMgold-path.patch | 14 ++++++++ .../common/libcxx/libcxx-0001-musl-hacks.patch | 39 ++++++++++++++++++++++ .../compilers/llvm/common/llvm/TLI-musl.patch | 35 +++++++++++++++++++ .../llvm/common/llvm/llvm-config-link-static.patch | 12 +++++++ .../compilers/llvm/exegesis-force-bdver2.patch | 11 ------ .../compilers/llvm/git/clang/default.nix | 2 +- .../compilers/llvm/git/llvm/default.nix | 2 +- .../compilers/llvm/libcxx-0001-musl-hacks.patch | 39 ---------------------- .../compilers/llvm/llvm-config-link-static.patch | 12 ------- 41 files changed, 171 insertions(+), 171 deletions(-) create mode 100644 pkgs/development/compilers/llvm/9/llvm/exegesis-force-bdver2.patch delete mode 100644 pkgs/development/compilers/llvm/TLI-musl.patch delete mode 100644 pkgs/development/compilers/llvm/clang-11-15-LLVMgold-path.patch delete mode 100644 pkgs/development/compilers/llvm/clang-6-10-LLVMgold-path.patch delete mode 100644 pkgs/development/compilers/llvm/clang-at-least-16-LLVMgold-path.patch create mode 100644 pkgs/development/compilers/llvm/common/clang/clang-11-15-LLVMgold-path.patch create mode 100644 pkgs/development/compilers/llvm/common/clang/clang-6-10-LLVMgold-path.patch create mode 100644 pkgs/development/compilers/llvm/common/clang/clang-at-least-16-LLVMgold-path.patch create mode 100644 pkgs/development/compilers/llvm/common/libcxx/libcxx-0001-musl-hacks.patch create mode 100644 pkgs/development/compilers/llvm/common/llvm/TLI-musl.patch create mode 100644 pkgs/development/compilers/llvm/common/llvm/llvm-config-link-static.patch delete mode 100644 pkgs/development/compilers/llvm/exegesis-force-bdver2.patch delete mode 100644 pkgs/development/compilers/llvm/libcxx-0001-musl-hacks.patch delete mode 100644 pkgs/development/compilers/llvm/llvm-config-link-static.patch (limited to 'pkgs') diff --git a/pkgs/development/compilers/llvm/11/clang/default.nix b/pkgs/development/compilers/llvm/11/clang/default.nix index 5ddecd1f47e9..a31d0422f52b 100644 --- a/pkgs/development/compilers/llvm/11/clang/default.nix +++ b/pkgs/development/compilers/llvm/11/clang/default.nix @@ -50,7 +50,7 @@ let # https://reviews.llvm.org/D51899 ./gnu-install-dirs.patch (substituteAll { - src = ../../clang-11-15-LLVMgold-path.patch; + src = ../../common/clang/clang-11-15-LLVMgold-path.patch; libllvmLibdir = "${libllvm.lib}/lib"; }) ]; diff --git a/pkgs/development/compilers/llvm/11/libcxx/default.nix b/pkgs/development/compilers/llvm/11/libcxx/default.nix index 3e77e03b124b..10b8c00dd16a 100644 --- a/pkgs/development/compilers/llvm/11/libcxx/default.nix +++ b/pkgs/development/compilers/llvm/11/libcxx/default.nix @@ -30,7 +30,7 @@ stdenv.mkDerivation { }) ./gnu-install-dirs.patch ] ++ lib.optionals stdenv.hostPlatform.isMusl [ - ../../libcxx-0001-musl-hacks.patch + ../../common/libcxx/libcxx-0001-musl-hacks.patch ]; # Prevent errors like "error: 'foo' is unavailable: introduced in macOS yy.zz" diff --git a/pkgs/development/compilers/llvm/11/libcxxabi/default.nix b/pkgs/development/compilers/llvm/11/libcxxabi/default.nix index 8a0a18f67822..6c8487a2eb99 100644 --- a/pkgs/development/compilers/llvm/11/libcxxabi/default.nix +++ b/pkgs/development/compilers/llvm/11/libcxxabi/default.nix @@ -20,7 +20,7 @@ stdenv.mkDerivation { '' + lib.optionalString stdenv.isDarwin '' export TRIPLE=x86_64-apple-darwin '' + lib.optionalString stdenv.hostPlatform.isMusl '' - patch -p1 -d libcxx -i ${../../libcxx-0001-musl-hacks.patch} + patch -p1 -d libcxx -i ${../../common/libcxx/libcxx-0001-musl-hacks.patch} '' + lib.optionalString stdenv.hostPlatform.isWasm '' patch -p1 -d llvm -i ${../../common/libcxxabi/wasm.patch} ''; diff --git a/pkgs/development/compilers/llvm/11/llvm/default.nix b/pkgs/development/compilers/llvm/11/llvm/default.nix index 423b08396666..e71d63859a06 100644 --- a/pkgs/development/compilers/llvm/11/llvm/default.nix +++ b/pkgs/development/compilers/llvm/11/llvm/default.nix @@ -86,7 +86,7 @@ in stdenv.mkDerivation (rec { # of the flags used for the normal LLVM build. To avoid the need for building # a native libLLVM.so (which would fail) we force llvm-config to be linked # statically against the necessary LLVM components always. - ../../llvm-config-link-static.patch + ../../common/llvm/llvm-config-link-static.patch ./gnu-install-dirs.patch # On older CPUs (e.g. Hydra/wendy) we'd be getting an error in this test. @@ -149,7 +149,7 @@ in stdenv.mkDerivation (rec { --replace "Path.cpp" "" rm unittests/Support/Path.cpp '' + optionalString stdenv.hostPlatform.isMusl '' - patch -p1 -i ${../../TLI-musl.patch} + patch -p1 -i ${../../common/llvm/TLI-musl.patch} substituteInPlace unittests/Support/CMakeLists.txt \ --replace "add_subdirectory(DynamicLibrary)" "" rm unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp diff --git a/pkgs/development/compilers/llvm/12/clang/default.nix b/pkgs/development/compilers/llvm/12/clang/default.nix index 28f976a26bdb..c482a8ee6875 100644 --- a/pkgs/development/compilers/llvm/12/clang/default.nix +++ b/pkgs/development/compilers/llvm/12/clang/default.nix @@ -47,7 +47,7 @@ let # https://reviews.llvm.org/D51899 ./gnu-install-dirs.patch (substituteAll { - src = ../../clang-11-15-LLVMgold-path.patch; + src = ../../common/clang/clang-11-15-LLVMgold-path.patch; libllvmLibdir = "${libllvm.lib}/lib"; }) ]; diff --git a/pkgs/development/compilers/llvm/12/libcxx/default.nix b/pkgs/development/compilers/llvm/12/libcxx/default.nix index 40bff3c1168b..67e2aed35cb6 100644 --- a/pkgs/development/compilers/llvm/12/libcxx/default.nix +++ b/pkgs/development/compilers/llvm/12/libcxx/default.nix @@ -24,7 +24,7 @@ stdenv.mkDerivation { patches = [ ./gnu-install-dirs.patch ] ++ lib.optionals stdenv.hostPlatform.isMusl [ - ../../libcxx-0001-musl-hacks.patch + ../../common/libcxx/libcxx-0001-musl-hacks.patch ]; preConfigure = lib.optionalString stdenv.hostPlatform.isMusl '' diff --git a/pkgs/development/compilers/llvm/12/libcxxabi/default.nix b/pkgs/development/compilers/llvm/12/libcxxabi/default.nix index 78a4a68d6a16..5ebb77ad3880 100644 --- a/pkgs/development/compilers/llvm/12/libcxxabi/default.nix +++ b/pkgs/development/compilers/llvm/12/libcxxabi/default.nix @@ -20,7 +20,7 @@ stdenv.mkDerivation { '' + lib.optionalString stdenv.isDarwin '' export TRIPLE=x86_64-apple-darwin '' + lib.optionalString stdenv.hostPlatform.isMusl '' - patch -p1 -d libcxx -i ${../../libcxx-0001-musl-hacks.patch} + patch -p1 -d libcxx -i ${../../common/libcxx/libcxx-0001-musl-hacks.patch} '' + lib.optionalString stdenv.hostPlatform.isWasm '' patch -p1 -d llvm -i ${../../common/libcxxabi/wasm.patch} ''; diff --git a/pkgs/development/compilers/llvm/12/llvm/default.nix b/pkgs/development/compilers/llvm/12/llvm/default.nix index 3263c4ddaf35..3ac3ee24aec4 100644 --- a/pkgs/development/compilers/llvm/12/llvm/default.nix +++ b/pkgs/development/compilers/llvm/12/llvm/default.nix @@ -87,7 +87,7 @@ in stdenv.mkDerivation (rec { # of the flags used for the normal LLVM build. To avoid the need for building # a native libLLVM.so (which would fail) we force llvm-config to be linked # statically against the necessary LLVM components always. - ../../llvm-config-link-static.patch + ../../common/llvm/llvm-config-link-static.patch # Fix llvm being miscompiled by some gccs. See llvm/llvm-project#49955 # Fix llvm being miscompiled by some gccs. See https://github.com/llvm/llvm-project/issues/49955 ./fix-llvm-issue-49955.patch @@ -138,7 +138,7 @@ in stdenv.mkDerivation (rec { # TODO: Fix failing tests: rm test/DebugInfo/X86/vla-multi.ll '' + optionalString stdenv.hostPlatform.isMusl '' - patch -p1 -i ${../../TLI-musl.patch} + patch -p1 -i ${../../common/llvm/TLI-musl.patch} substituteInPlace unittests/Support/CMakeLists.txt \ --replace "add_subdirectory(DynamicLibrary)" "" rm unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp diff --git a/pkgs/development/compilers/llvm/13/clang/default.nix b/pkgs/development/compilers/llvm/13/clang/default.nix index 7673c903e71c..2d02ffb60b36 100644 --- a/pkgs/development/compilers/llvm/13/clang/default.nix +++ b/pkgs/development/compilers/llvm/13/clang/default.nix @@ -43,7 +43,7 @@ let ./revert-malloc-alignment-assumption.patch ../../common/clang/add-nostdlibinc-flag.patch (substituteAll { - src = ../../clang-11-15-LLVMgold-path.patch; + src = ../../common/clang/clang-11-15-LLVMgold-path.patch; libllvmLibdir = "${libllvm.lib}/lib"; }) ]; diff --git a/pkgs/development/compilers/llvm/13/libcxx/default.nix b/pkgs/development/compilers/llvm/13/libcxx/default.nix index 994ec7dd5a56..2974fc80e191 100644 --- a/pkgs/development/compilers/llvm/13/libcxx/default.nix +++ b/pkgs/development/compilers/llvm/13/libcxx/default.nix @@ -25,7 +25,7 @@ stdenv.mkDerivation rec { patches = [ ./gnu-install-dirs.patch ] ++ lib.optionals stdenv.hostPlatform.isMusl [ - ../../libcxx-0001-musl-hacks.patch + ../../common/libcxx/libcxx-0001-musl-hacks.patch ]; preConfigure = lib.optionalString stdenv.hostPlatform.isMusl '' diff --git a/pkgs/development/compilers/llvm/13/llvm/default.nix b/pkgs/development/compilers/llvm/13/llvm/default.nix index 1e71cdd89c6c..faebfb6e2bfd 100644 --- a/pkgs/development/compilers/llvm/13/llvm/default.nix +++ b/pkgs/development/compilers/llvm/13/llvm/default.nix @@ -81,7 +81,7 @@ in stdenv.mkDerivation (rec { # of the flags used for the normal LLVM build. To avoid the need for building # a native libLLVM.so (which would fail) we force llvm-config to be linked # statically against the necessary LLVM components always. - ../../llvm-config-link-static.patch + ../../common/llvm/llvm-config-link-static.patch ./gnu-install-dirs.patch @@ -128,7 +128,7 @@ in stdenv.mkDerivation (rec { rm unittests/IR/PassBuilderCallbacksTest.cpp rm test/tools/llvm-objcopy/ELF/mirror-permissions-unix.test '' + optionalString stdenv.hostPlatform.isMusl '' - patch -p1 -i ${../../TLI-musl.patch} + patch -p1 -i ${../../common/llvm/TLI-musl.patch} substituteInPlace unittests/Support/CMakeLists.txt \ --replace "add_subdirectory(DynamicLibrary)" "" rm unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp diff --git a/pkgs/development/compilers/llvm/14/clang/default.nix b/pkgs/development/compilers/llvm/14/clang/default.nix index f63f55cfa546..829edb15d600 100644 --- a/pkgs/development/compilers/llvm/14/clang/default.nix +++ b/pkgs/development/compilers/llvm/14/clang/default.nix @@ -46,7 +46,7 @@ let ./gnu-install-dirs.patch ../../common/clang/add-nostdlibinc-flag.patch (substituteAll { - src = ../../clang-11-15-LLVMgold-path.patch; + src = ../../common/clang/clang-11-15-LLVMgold-path.patch; libllvmLibdir = "${libllvm.lib}/lib"; }) ]; diff --git a/pkgs/development/compilers/llvm/14/libcxx/default.nix b/pkgs/development/compilers/llvm/14/libcxx/default.nix index 3e42a8b1e43c..ad9e82291cde 100644 --- a/pkgs/development/compilers/llvm/14/libcxx/default.nix +++ b/pkgs/development/compilers/llvm/14/libcxx/default.nix @@ -41,7 +41,7 @@ stdenv.mkDerivation rec { patches = [ ./gnu-install-dirs.patch ] ++ lib.optionals stdenv.hostPlatform.isMusl [ - ../../libcxx-0001-musl-hacks.patch + ../../common/libcxx/libcxx-0001-musl-hacks.patch ]; preConfigure = lib.optionalString stdenv.hostPlatform.isMusl '' diff --git a/pkgs/development/compilers/llvm/14/llvm/default.nix b/pkgs/development/compilers/llvm/14/llvm/default.nix index eab49d326ad4..caef58615fce 100644 --- a/pkgs/development/compilers/llvm/14/llvm/default.nix +++ b/pkgs/development/compilers/llvm/14/llvm/default.nix @@ -110,7 +110,7 @@ in stdenv.mkDerivation (rec { rm unittests/IR/PassBuilderCallbacksTest.cpp rm test/tools/llvm-objcopy/ELF/mirror-permissions-unix.test '' + optionalString stdenv.hostPlatform.isMusl '' - patch -p1 -i ${../../TLI-musl.patch} + patch -p1 -i ${../../common/llvm/TLI-musl.patch} substituteInPlace unittests/Support/CMakeLists.txt \ --replace "add_subdirectory(DynamicLibrary)" "" rm unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp diff --git a/pkgs/development/compilers/llvm/15/clang/default.nix b/pkgs/development/compilers/llvm/15/clang/default.nix index 9ec15a393004..de789edaa9ff 100644 --- a/pkgs/development/compilers/llvm/15/clang/default.nix +++ b/pkgs/development/compilers/llvm/15/clang/default.nix @@ -52,7 +52,7 @@ let ./gnu-install-dirs.patch ../../common/clang/add-nostdlibinc-flag.patch (substituteAll { - src = ../../clang-11-15-LLVMgold-path.patch; + src = ../../common/clang/clang-11-15-LLVMgold-path.patch; libllvmLibdir = "${libllvm.lib}/lib"; }) ]; diff --git a/pkgs/development/compilers/llvm/15/libcxx/default.nix b/pkgs/development/compilers/llvm/15/libcxx/default.nix index be56770039d8..6a055581fffd 100644 --- a/pkgs/development/compilers/llvm/15/libcxx/default.nix +++ b/pkgs/development/compilers/llvm/15/libcxx/default.nix @@ -65,7 +65,7 @@ stdenv.mkDerivation rec { relative = "libcxx"; }) ] ++ lib.optionals stdenv.hostPlatform.isMusl [ - ../../libcxx-0001-musl-hacks.patch + ../../common/libcxx/libcxx-0001-musl-hacks.patch ]; postPatch = '' diff --git a/pkgs/development/compilers/llvm/15/llvm/default.nix b/pkgs/development/compilers/llvm/15/llvm/default.nix index 4f17678ba14f..7f1232d57a18 100644 --- a/pkgs/development/compilers/llvm/15/llvm/default.nix +++ b/pkgs/development/compilers/llvm/15/llvm/default.nix @@ -230,7 +230,7 @@ in stdenv.mkDerivation (rec { # timing-based tests are trouble rm utils/lit/tests/googletest-timeout.py '' + optionalString stdenv.hostPlatform.isMusl '' - patch -p1 -i ${../../TLI-musl.patch} + patch -p1 -i ${../../common/llvm/TLI-musl.patch} substituteInPlace unittests/Support/CMakeLists.txt \ --replace "add_subdirectory(DynamicLibrary)" "" rm unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp diff --git a/pkgs/development/compilers/llvm/16/clang/default.nix b/pkgs/development/compilers/llvm/16/clang/default.nix index 43c497b92761..c5d9af356d9e 100644 --- a/pkgs/development/compilers/llvm/16/clang/default.nix +++ b/pkgs/development/compilers/llvm/16/clang/default.nix @@ -52,7 +52,7 @@ let ./gnu-install-dirs.patch ../../common/clang/add-nostdlibinc-flag.patch (substituteAll { - src = ../../clang-at-least-16-LLVMgold-path.patch; + src = ../../common/clang/clang-at-least-16-LLVMgold-path.patch; libllvmLibdir = "${libllvm.lib}/lib"; }) ]; diff --git a/pkgs/development/compilers/llvm/16/llvm/default.nix b/pkgs/development/compilers/llvm/16/llvm/default.nix index 73fb6a785413..661866c1890b 100644 --- a/pkgs/development/compilers/llvm/16/llvm/default.nix +++ b/pkgs/development/compilers/llvm/16/llvm/default.nix @@ -223,7 +223,7 @@ in # timing-based tests are trouble rm utils/lit/tests/googletest-timeout.py '' + optionalString stdenv.hostPlatform.isMusl '' - patch -p1 -i ${../../TLI-musl.patch} + patch -p1 -i ${../../common/llvm/TLI-musl.patch} substituteInPlace unittests/Support/CMakeLists.txt \ --replace "add_subdirectory(DynamicLibrary)" "" rm unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp diff --git a/pkgs/development/compilers/llvm/17/clang/default.nix b/pkgs/development/compilers/llvm/17/clang/default.nix index f2f114233c28..f7922f3d9951 100644 --- a/pkgs/development/compilers/llvm/17/clang/default.nix +++ b/pkgs/development/compilers/llvm/17/clang/default.nix @@ -53,7 +53,7 @@ let ./gnu-install-dirs.patch ../../common/clang/add-nostdlibinc-flag.patch (substituteAll { - src = ../../clang-at-least-16-LLVMgold-path.patch; + src = ../../common/clang/clang-at-least-16-LLVMgold-path.patch; libllvmLibdir = "${libllvm.lib}/lib"; }) ]; diff --git a/pkgs/development/compilers/llvm/17/llvm/default.nix b/pkgs/development/compilers/llvm/17/llvm/default.nix index 627679ce812f..2c5d6aeb5cec 100644 --- a/pkgs/development/compilers/llvm/17/llvm/default.nix +++ b/pkgs/development/compilers/llvm/17/llvm/default.nix @@ -220,7 +220,7 @@ stdenv.mkDerivation (rec { rm unittests/IR/PassBuilderCallbacksTest.cpp rm test/tools/llvm-objcopy/ELF/mirror-permissions-unix.test '' + optionalString stdenv.hostPlatform.isMusl '' - patch -p1 -i ${../../TLI-musl.patch} + patch -p1 -i ${../../common/llvm/TLI-musl.patch} substituteInPlace unittests/Support/CMakeLists.txt \ --replace "add_subdirectory(DynamicLibrary)" "" rm unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp diff --git a/pkgs/development/compilers/llvm/9/clang/default.nix b/pkgs/development/compilers/llvm/9/clang/default.nix index e8a2a4bd0db1..37138b13bd4c 100644 --- a/pkgs/development/compilers/llvm/9/clang/default.nix +++ b/pkgs/development/compilers/llvm/9/clang/default.nix @@ -52,7 +52,7 @@ let ./HIP-use-PATH-9.patch ./gnu-install-dirs.patch (substituteAll { - src = ../../clang-6-10-LLVMgold-path.patch; + src = ../../common/clang/clang-6-10-LLVMgold-path.patch; libllvmLibdir = "${libllvm.lib}/lib"; }) ]; diff --git a/pkgs/development/compilers/llvm/9/libcxx/default.nix b/pkgs/development/compilers/llvm/9/libcxx/default.nix index ec09998ed37d..65f0e19225a5 100644 --- a/pkgs/development/compilers/llvm/9/libcxx/default.nix +++ b/pkgs/development/compilers/llvm/9/libcxx/default.nix @@ -22,7 +22,7 @@ stdenv.mkDerivation { patches = [ ./gnu-install-dirs.patch ] ++ lib.optionals stdenv.hostPlatform.isMusl [ - ../../libcxx-0001-musl-hacks.patch + ../../common/libcxx/libcxx-0001-musl-hacks.patch ]; # Prevent errors like "error: 'foo' is unavailable: introduced in macOS yy.zz" diff --git a/pkgs/development/compilers/llvm/9/libcxxabi/default.nix b/pkgs/development/compilers/llvm/9/libcxxabi/default.nix index 24d89b1a2da5..7d4a83db390b 100644 --- a/pkgs/development/compilers/llvm/9/libcxxabi/default.nix +++ b/pkgs/development/compilers/llvm/9/libcxxabi/default.nix @@ -17,7 +17,7 @@ stdenv.mkDerivation { '' + lib.optionalString stdenv.isDarwin '' export TRIPLE=x86_64-apple-darwin '' + lib.optionalString stdenv.hostPlatform.isMusl '' - patch -p1 -d $(ls -d libcxx-*) -i ${../../libcxx-0001-musl-hacks.patch} + patch -p1 -d $(ls -d libcxx-*) -i ${../../common/libcxx/libcxx-0001-musl-hacks.patch} '' + lib.optionalString stdenv.hostPlatform.isWasm '' patch -p1 -d $(ls -d llvm-*) -i ${../../common/libcxxabi/wasm.patch} ''; diff --git a/pkgs/development/compilers/llvm/9/llvm/default.nix b/pkgs/development/compilers/llvm/9/llvm/default.nix index c0ef7801c348..7d5e8389eba9 100644 --- a/pkgs/development/compilers/llvm/9/llvm/default.nix +++ b/pkgs/development/compilers/llvm/9/llvm/default.nix @@ -86,12 +86,12 @@ in stdenv.mkDerivation (rec { # of the flags used for the normal LLVM build. To avoid the need for building # a native libLLVM.so (which would fail) we force llvm-config to be linked # statically against the necessary LLVM components always. - ../../llvm-config-link-static.patch + ../../common/llvm/llvm-config-link-static.patch ./gnu-install-dirs.patch # Force a test to evaluate the saved benchmark for a CPU for which LLVM has # an execution model. See NixOS/nixpkgs#119673. - ../../exegesis-force-bdver2.patch + ./exegesis-force-bdver2.patch # Fix missing includes for GCC 11 (fetchpatch { @@ -137,7 +137,7 @@ in stdenv.mkDerivation (rec { --replace "Path.cpp" "" rm unittests/Support/Path.cpp '' + optionalString stdenv.hostPlatform.isMusl '' - patch -p1 -i ${../../TLI-musl.patch} + patch -p1 -i ${../../common/llvm/TLI-musl.patch} substituteInPlace unittests/Support/CMakeLists.txt \ --replace "add_subdirectory(DynamicLibrary)" "" rm unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp diff --git a/pkgs/development/compilers/llvm/9/llvm/exegesis-force-bdver2.patch b/pkgs/development/compilers/llvm/9/llvm/exegesis-force-bdver2.patch new file mode 100644 index 000000000000..c2654153ed5a --- /dev/null +++ b/pkgs/development/compilers/llvm/9/llvm/exegesis-force-bdver2.patch @@ -0,0 +1,11 @@ +diff --git a/test/tools/llvm-exegesis/X86/uops-CMOV16rm-noreg.s b/test/tools/llvm-exegesis/X86/uops-CMOV16rm-noreg.s +index 3fc1f31d54dc..a4c9bdd92131 100644 +--- a/test/tools/llvm-exegesis/X86/uops-CMOV16rm-noreg.s ++++ b/test/tools/llvm-exegesis/X86/uops-CMOV16rm-noreg.s +@@ -1,5 +1,6 @@ + # RUN: llvm-exegesis -mode=uops -opcode-name=CMOV16rm -benchmarks-file=%t.CMOV16rm-uops.yaml + # RUN: FileCheck -check-prefixes=CHECK-YAML -input-file=%t.CMOV16rm-uops.yaml %s ++# RUN: sed -i 's,cpu_name:.*,cpu_name: bdver2,g' %t.CMOV16rm-uops.yaml + # RUN: llvm-exegesis -mcpu=bdver2 -mode=analysis -benchmarks-file=%t.CMOV16rm-uops.yaml -analysis-clusters-output-file=- -analysis-clustering-epsilon=0.1 -analysis-inconsistency-epsilon=0.1 -analysis-numpoints=1 -analysis-clustering=naive | FileCheck -check-prefixes=CHECK-CLUSTERS %s + + # https://bugs.llvm.org/show_bug.cgi?id=41448 diff --git a/pkgs/development/compilers/llvm/TLI-musl.patch b/pkgs/development/compilers/llvm/TLI-musl.patch deleted file mode 100644 index 1a6908086637..000000000000 --- a/pkgs/development/compilers/llvm/TLI-musl.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 5c571082fdaf61f6df19d9b7137dc26d71334058 Mon Sep 17 00:00:00 2001 -From: Natanael Copa -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/clang-11-15-LLVMgold-path.patch b/pkgs/development/compilers/llvm/clang-11-15-LLVMgold-path.patch deleted file mode 100644 index 8f8991976f33..000000000000 --- a/pkgs/development/compilers/llvm/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/clang-6-10-LLVMgold-path.patch b/pkgs/development/compilers/llvm/clang-6-10-LLVMgold-path.patch deleted file mode 100644 index 93504316edf3..000000000000 --- a/pkgs/development/compilers/llvm/clang-6-10-LLVMgold-path.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff --git a/lib/Driver/ToolChains/CommonArgs.cpp b/lib/Driver/ToolChains/CommonArgs.cpp -index 37ec73468570..b73e75aa6e59 100644 ---- a/lib/Driver/ToolChains/CommonArgs.cpp -+++ b/lib/Driver/ToolChains/CommonArgs.cpp -@@ -370,8 +370,8 @@ void tools::AddGoldPlugin(const ToolChain &ToolChain, const ArgList &Args, - #endif - - SmallString<1024> Plugin; -- llvm::sys::path::native(Twine(ToolChain.getDriver().Dir) + -- "/../lib" CLANG_LIBDIR_SUFFIX "/LLVMgold" + -+ llvm::sys::path::native(Twine("@libllvmLibdir@" -+ "/LLVMgold") + - Suffix, - Plugin); - CmdArgs.push_back(Args.MakeArgString(Plugin)); diff --git a/pkgs/development/compilers/llvm/clang-at-least-16-LLVMgold-path.patch b/pkgs/development/compilers/llvm/clang-at-least-16-LLVMgold-path.patch deleted file mode 100644 index 74cdbacc8a71..000000000000 --- a/pkgs/development/compilers/llvm/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/clang-11-15-LLVMgold-path.patch b/pkgs/development/compilers/llvm/common/clang/clang-11-15-LLVMgold-path.patch new file mode 100644 index 000000000000..8f8991976f33 --- /dev/null +++ b/pkgs/development/compilers/llvm/common/clang/clang-11-15-LLVMgold-path.patch @@ -0,0 +1,13 @@ +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-6-10-LLVMgold-path.patch b/pkgs/development/compilers/llvm/common/clang/clang-6-10-LLVMgold-path.patch new file mode 100644 index 000000000000..93504316edf3 --- /dev/null +++ b/pkgs/development/compilers/llvm/common/clang/clang-6-10-LLVMgold-path.patch @@ -0,0 +1,15 @@ +diff --git a/lib/Driver/ToolChains/CommonArgs.cpp b/lib/Driver/ToolChains/CommonArgs.cpp +index 37ec73468570..b73e75aa6e59 100644 +--- a/lib/Driver/ToolChains/CommonArgs.cpp ++++ b/lib/Driver/ToolChains/CommonArgs.cpp +@@ -370,8 +370,8 @@ void tools::AddGoldPlugin(const ToolChain &ToolChain, const ArgList &Args, + #endif + + SmallString<1024> Plugin; +- llvm::sys::path::native(Twine(ToolChain.getDriver().Dir) + +- "/../lib" CLANG_LIBDIR_SUFFIX "/LLVMgold" + ++ llvm::sys::path::native(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 new file mode 100644 index 000000000000..74cdbacc8a71 --- /dev/null +++ b/pkgs/development/compilers/llvm/common/clang/clang-at-least-16-LLVMgold-path.patch @@ -0,0 +1,14 @@ +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/libcxx/libcxx-0001-musl-hacks.patch b/pkgs/development/compilers/llvm/common/libcxx/libcxx-0001-musl-hacks.patch new file mode 100644 index 000000000000..bcb5ad8cfb87 --- /dev/null +++ b/pkgs/development/compilers/llvm/common/libcxx/libcxx-0001-musl-hacks.patch @@ -0,0 +1,39 @@ +From 1c936d7fda3275265e37f93697232a1ed652390f Mon Sep 17 00:00:00 2001 +From: Will Dietz +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::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::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::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::type __current_errno = errno; + if (__current_errno == 0) + errno = __save_errno; +-- +1.7.1 + diff --git a/pkgs/development/compilers/llvm/common/llvm/TLI-musl.patch b/pkgs/development/compilers/llvm/common/llvm/TLI-musl.patch new file mode 100644 index 000000000000..1a6908086637 --- /dev/null +++ b/pkgs/development/compilers/llvm/common/llvm/TLI-musl.patch @@ -0,0 +1,35 @@ +From 5c571082fdaf61f6df19d9b7137dc26d71334058 Mon Sep 17 00:00:00 2001 +From: Natanael Copa +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/llvm-config-link-static.patch b/pkgs/development/compilers/llvm/common/llvm/llvm-config-link-static.patch new file mode 100644 index 000000000000..3881cc5206e2 --- /dev/null +++ b/pkgs/development/compilers/llvm/common/llvm/llvm-config-link-static.patch @@ -0,0 +1,12 @@ +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/exegesis-force-bdver2.patch b/pkgs/development/compilers/llvm/exegesis-force-bdver2.patch deleted file mode 100644 index c2654153ed5a..000000000000 --- a/pkgs/development/compilers/llvm/exegesis-force-bdver2.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff --git a/test/tools/llvm-exegesis/X86/uops-CMOV16rm-noreg.s b/test/tools/llvm-exegesis/X86/uops-CMOV16rm-noreg.s -index 3fc1f31d54dc..a4c9bdd92131 100644 ---- a/test/tools/llvm-exegesis/X86/uops-CMOV16rm-noreg.s -+++ b/test/tools/llvm-exegesis/X86/uops-CMOV16rm-noreg.s -@@ -1,5 +1,6 @@ - # RUN: llvm-exegesis -mode=uops -opcode-name=CMOV16rm -benchmarks-file=%t.CMOV16rm-uops.yaml - # RUN: FileCheck -check-prefixes=CHECK-YAML -input-file=%t.CMOV16rm-uops.yaml %s -+# RUN: sed -i 's,cpu_name:.*,cpu_name: bdver2,g' %t.CMOV16rm-uops.yaml - # RUN: llvm-exegesis -mcpu=bdver2 -mode=analysis -benchmarks-file=%t.CMOV16rm-uops.yaml -analysis-clusters-output-file=- -analysis-clustering-epsilon=0.1 -analysis-inconsistency-epsilon=0.1 -analysis-numpoints=1 -analysis-clustering=naive | FileCheck -check-prefixes=CHECK-CLUSTERS %s - - # https://bugs.llvm.org/show_bug.cgi?id=41448 diff --git a/pkgs/development/compilers/llvm/git/clang/default.nix b/pkgs/development/compilers/llvm/git/clang/default.nix index eea346ef22ef..01b33c540ca2 100644 --- a/pkgs/development/compilers/llvm/git/clang/default.nix +++ b/pkgs/development/compilers/llvm/git/clang/default.nix @@ -54,7 +54,7 @@ let ./gnu-install-dirs.patch ../../common/clang/add-nostdlibinc-flag.patch (substituteAll { - src = ../../clang-at-least-16-LLVMgold-path.patch; + src = ../../common/clang/clang-at-least-16-LLVMgold-path.patch; libllvmLibdir = "${libllvm.lib}/lib"; }) ]; diff --git a/pkgs/development/compilers/llvm/git/llvm/default.nix b/pkgs/development/compilers/llvm/git/llvm/default.nix index 3c52b7a9bb0b..b8cef2287806 100644 --- a/pkgs/development/compilers/llvm/git/llvm/default.nix +++ b/pkgs/development/compilers/llvm/git/llvm/default.nix @@ -224,7 +224,7 @@ stdenv.mkDerivation (rec { rm unittests/IR/PassBuilderCallbacksTest.cpp rm test/tools/llvm-objcopy/ELF/mirror-permissions-unix.test '' + optionalString stdenv.hostPlatform.isMusl '' - patch -p1 -i ${../../TLI-musl.patch} + patch -p1 -i ${../../common/llvm/TLI-musl.patch} substituteInPlace unittests/Support/CMakeLists.txt \ --replace "add_subdirectory(DynamicLibrary)" "" rm unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp diff --git a/pkgs/development/compilers/llvm/libcxx-0001-musl-hacks.patch b/pkgs/development/compilers/llvm/libcxx-0001-musl-hacks.patch deleted file mode 100644 index bcb5ad8cfb87..000000000000 --- a/pkgs/development/compilers/llvm/libcxx-0001-musl-hacks.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 1c936d7fda3275265e37f93697232a1ed652390f Mon Sep 17 00:00:00 2001 -From: Will Dietz -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::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::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::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::type __current_errno = errno; - if (__current_errno == 0) - errno = __save_errno; --- -1.7.1 - diff --git a/pkgs/development/compilers/llvm/llvm-config-link-static.patch b/pkgs/development/compilers/llvm/llvm-config-link-static.patch deleted file mode 100644 index 3881cc5206e2..000000000000 --- a/pkgs/development/compilers/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. -- cgit 1.4.1