Merge pull request #273788 from sternenseemann/llvmgold-clang-16-and-above

This commit is contained in:
Bernardo Meurer 2023-12-22 20:06:56 -03:00 committed by GitHub
commit 8e5a5551e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 45 additions and 34 deletions

View file

@ -50,7 +50,7 @@ let
# https://reviews.llvm.org/D51899
./gnu-install-dirs.patch
(substituteAll {
src = ../../clang-11-12-LLVMgold-path.patch;
src = ../../clang-11-15-LLVMgold-path.patch;
libllvmLibdir = "${libllvm.lib}/lib";
})
];

View file

@ -47,7 +47,7 @@ let
# https://reviews.llvm.org/D51899
./gnu-install-dirs.patch
(substituteAll {
src = ../../clang-11-12-LLVMgold-path.patch;
src = ../../clang-11-15-LLVMgold-path.patch;
libllvmLibdir = "${libllvm.lib}/lib";
})
];

View file

@ -43,7 +43,7 @@ let
./revert-malloc-alignment-assumption.patch
../../common/clang/add-nostdlibinc-flag.patch
(substituteAll {
src = ../../clang-11-12-LLVMgold-path.patch;
src = ../../clang-11-15-LLVMgold-path.patch;
libllvmLibdir = "${libllvm.lib}/lib";
})
];

View file

@ -46,7 +46,7 @@ let
./gnu-install-dirs.patch
../../common/clang/add-nostdlibinc-flag.patch
(substituteAll {
src = ../../clang-11-12-LLVMgold-path.patch;
src = ../../clang-11-15-LLVMgold-path.patch;
libllvmLibdir = "${libllvm.lib}/lib";
})
];

View file

@ -52,7 +52,7 @@ let
./gnu-install-dirs.patch
../../common/clang/add-nostdlibinc-flag.patch
(substituteAll {
src = ../../clang-11-12-LLVMgold-path.patch;
src = ../../clang-11-15-LLVMgold-path.patch;
libllvmLibdir = "${libllvm.lib}/lib";
})
];

View file

@ -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 = ''

View file

@ -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"

View file

@ -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 = ''

View file

@ -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"

View file

@ -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));

View file

@ -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 = ''

View file

@ -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"