diff options
author | sternenseemann <sternenseemann@systemli.org> | 2023-12-12 17:34:08 +0100 |
---|---|---|
committer | sternenseemann <sternenseemann@systemli.org> | 2023-12-12 17:36:20 +0100 |
commit | 3e8355df84c7352c908bfbe3ac0231c9d6ea24a2 (patch) | |
tree | 6f1213443022a45d2bd70320d5dc97378bfb705a /pkgs/development/compilers/llvm | |
parent | 6db6c6df7b29062f980150435cf357efee22d13b (diff) | |
download | nixlib-3e8355df84c7352c908bfbe3ac0231c9d6ea24a2.tar nixlib-3e8355df84c7352c908bfbe3ac0231c9d6ea24a2.tar.gz nixlib-3e8355df84c7352c908bfbe3ac0231c9d6ea24a2.tar.bz2 nixlib-3e8355df84c7352c908bfbe3ac0231c9d6ea24a2.tar.lz nixlib-3e8355df84c7352c908bfbe3ac0231c9d6ea24a2.tar.xz nixlib-3e8355df84c7352c908bfbe3ac0231c9d6ea24a2.tar.zst nixlib-3e8355df84c7352c908bfbe3ac0231c9d6ea24a2.zip |
llvmPackages_{16,17,git}: reenable LLVMgold plugin
See https://github.com/nixos/nixpkgs/issues/123361 for context regarding the clang patch. Seems like the https://github.com/llvm/llvm-project/issues/61350 crash no longer occurs in the test suite and we can reenable the gold plugin by default.
Diffstat (limited to 'pkgs/development/compilers/llvm')
7 files changed, 40 insertions, 29 deletions
diff --git a/pkgs/development/compilers/llvm/16/clang/default.nix b/pkgs/development/compilers/llvm/16/clang/default.nix index b801bdda5292..5f28e810f603 100644 --- a/pkgs/development/compilers/llvm/16/clang/default.nix +++ b/pkgs/development/compilers/llvm/16/clang/default.nix @@ -1,6 +1,6 @@ { lib, stdenv, llvm_meta , monorepoSrc, runCommand -, cmake, ninja, libxml2, libllvm, version, python3 +, substituteAll, cmake, ninja, libxml2, libllvm, version, python3 , buildLlvmTools , fixDarwinDylibNames , enableManpages ? false @@ -51,11 +51,10 @@ let # https://reviews.llvm.org/D51899 ./gnu-install-dirs.patch ../../common/clang/add-nostdlibinc-flag.patch - # FIMXE: do we need this patch? - # (substituteAll { - # src = ../../clang-11-12-LLVMgold-path.patch; - # libllvmLibdir = "${libllvm.lib}/lib"; - # }) + (substituteAll { + src = ../../clang-at-least-16-LLVMgold-path.patch; + libllvmLibdir = "${libllvm.lib}/lib"; + }) ]; postPatch = '' diff --git a/pkgs/development/compilers/llvm/16/llvm/default.nix b/pkgs/development/compilers/llvm/16/llvm/default.nix index 9994076bbdab..a6faf9fd635d 100644 --- a/pkgs/development/compilers/llvm/16/llvm/default.nix +++ b/pkgs/development/compilers/llvm/16/llvm/default.nix @@ -325,7 +325,8 @@ in "-DSPHINX_OUTPUT_MAN=ON" "-DSPHINX_OUTPUT_HTML=OFF" "-DSPHINX_WARNINGS_AS_ERRORS=OFF" - ] ++ optionals (false) [ + ] ++ optionals enableGoldPlugin [ + # For LLVMgold plugin "-DLLVM_BINUTILS_INCDIR=${libbfd.dev}/include" ] ++ optionals isDarwin [ "-DLLVM_ENABLE_LIBCXX=ON" diff --git a/pkgs/development/compilers/llvm/17/clang/default.nix b/pkgs/development/compilers/llvm/17/clang/default.nix index a576c07d3661..3184437830a2 100644 --- a/pkgs/development/compilers/llvm/17/clang/default.nix +++ b/pkgs/development/compilers/llvm/17/clang/default.nix @@ -1,6 +1,6 @@ { lib, stdenv, llvm_meta , monorepoSrc, runCommand -, cmake, ninja, libxml2, libllvm, version, python3 +, substituteAll, cmake, ninja, libxml2, libllvm, version, python3 , buildLlvmTools , fixDarwinDylibNames , enableManpages ? false @@ -52,11 +52,10 @@ let # https://reviews.llvm.org/D51899 ./gnu-install-dirs.patch ../../common/clang/add-nostdlibinc-flag.patch - # FIMXE: do we need this patch? - # (substituteAll { - # src = ../../clang-11-12-LLVMgold-path.patch; - # libllvmLibdir = "${libllvm.lib}/lib"; - # }) + (substituteAll { + src = ../../clang-at-least-16-LLVMgold-path.patch; + libllvmLibdir = "${libllvm.lib}/lib"; + }) ]; postPatch = '' diff --git a/pkgs/development/compilers/llvm/17/llvm/default.nix b/pkgs/development/compilers/llvm/17/llvm/default.nix index 3d05837d45da..b38fef333135 100644 --- a/pkgs/development/compilers/llvm/17/llvm/default.nix +++ b/pkgs/development/compilers/llvm/17/llvm/default.nix @@ -8,8 +8,7 @@ , python3 , python3Packages , libffi -# TODO: Gold plugin on LLVM16 has a severe memory corruption bug: https://github.com/llvm/llvm-project/issues/61350. -, enableGoldPlugin ? false +, enableGoldPlugin ? true , libbfd , libpfm , libxml2 @@ -66,8 +65,8 @@ let else python3; in - assert (lib.assertMsg (!enableGoldPlugin) "Gold plugin cannot be enabled on LLVM16 due to a upstream issue: https://github.com/llvm/llvm-project/issues/61350"); - stdenv.mkDerivation (rec { + +stdenv.mkDerivation (rec { pname = "llvm"; inherit version; @@ -325,7 +324,8 @@ in "-DSPHINX_OUTPUT_MAN=ON" "-DSPHINX_OUTPUT_HTML=OFF" "-DSPHINX_WARNINGS_AS_ERRORS=OFF" - ] ++ optionals (false) [ + ] ++ optionals enableGoldPlugin [ + # For LLVMgold plugin "-DLLVM_BINUTILS_INCDIR=${libbfd.dev}/include" ] ++ optionals isDarwin [ "-DLLVM_ENABLE_LIBCXX=ON" 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 new file mode 100644 index 000000000000..74cdbacc8a71 --- /dev/null +++ b/pkgs/development/compilers/llvm/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/git/clang/default.nix b/pkgs/development/compilers/llvm/git/clang/default.nix index b193ebba3d6d..d8fe08569f3f 100644 --- a/pkgs/development/compilers/llvm/git/clang/default.nix +++ b/pkgs/development/compilers/llvm/git/clang/default.nix @@ -1,6 +1,6 @@ { lib, stdenv, llvm_meta , monorepoSrc, runCommand -, cmake, ninja, libxml2, libllvm, version, python3 +, substituteAll, cmake, ninja, libxml2, libllvm, version, python3 , buildLlvmTools , fixDarwinDylibNames , enableManpages ? false @@ -52,11 +52,10 @@ let # https://reviews.llvm.org/D51899 ./gnu-install-dirs.patch ../../common/clang/add-nostdlibinc-flag.patch - # FIMXE: do we need this patch? - # (substituteAll { - # src = ../../clang-11-12-LLVMgold-path.patch; - # libllvmLibdir = "${libllvm.lib}/lib"; - # }) + (substituteAll { + src = ../../clang-at-least-16-LLVMgold-path.patch; + libllvmLibdir = "${libllvm.lib}/lib"; + }) ]; postPatch = '' diff --git a/pkgs/development/compilers/llvm/git/llvm/default.nix b/pkgs/development/compilers/llvm/git/llvm/default.nix index 3d05837d45da..36edfee8a091 100644 --- a/pkgs/development/compilers/llvm/git/llvm/default.nix +++ b/pkgs/development/compilers/llvm/git/llvm/default.nix @@ -8,8 +8,7 @@ , python3 , python3Packages , libffi -# TODO: Gold plugin on LLVM16 has a severe memory corruption bug: https://github.com/llvm/llvm-project/issues/61350. -, enableGoldPlugin ? false +, enableGoldPlugin ? true , libbfd , libpfm , libxml2 @@ -66,8 +65,8 @@ let else python3; in - assert (lib.assertMsg (!enableGoldPlugin) "Gold plugin cannot be enabled on LLVM16 due to a upstream issue: https://github.com/llvm/llvm-project/issues/61350"); - stdenv.mkDerivation (rec { + +stdenv.mkDerivation (rec { pname = "llvm"; inherit version; @@ -325,7 +324,7 @@ in "-DSPHINX_OUTPUT_MAN=ON" "-DSPHINX_OUTPUT_HTML=OFF" "-DSPHINX_WARNINGS_AS_ERRORS=OFF" - ] ++ optionals (false) [ + ] ++ optionals enableGoldPlugin [ "-DLLVM_BINUTILS_INCDIR=${libbfd.dev}/include" ] ++ optionals isDarwin [ "-DLLVM_ENABLE_LIBCXX=ON" |