Merge pull request #123551 from sternenseemann/clang-fix-llvmgold-path
llvmPackages*.clang: fix linker invocation with LLVMgold plugin
This commit is contained in:
commit
8a9d3ed361
|
@ -1,4 +1,4 @@
|
|||
{ lib, stdenv, llvm_meta, fetch, cmake, libxml2, libllvm, version, clang-tools-extra_src, python3
|
||||
{ lib, stdenv, llvm_meta, fetch, substituteAll, cmake, libxml2, libllvm, version, clang-tools-extra_src, python3
|
||||
, buildLlvmTools
|
||||
, fixDarwinDylibNames
|
||||
, enableManpages ? false
|
||||
|
@ -46,6 +46,10 @@ let
|
|||
# https://reviews.llvm.org/D51899
|
||||
./compiler-rt-baremetal.patch
|
||||
./gnu-install-dirs.patch
|
||||
(substituteAll {
|
||||
src = ../../clang-6-10-LLVMgold-path.patch;
|
||||
libllvmLibdir = "${libllvm.lib}/lib";
|
||||
})
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
|
@ -64,12 +68,7 @@ let
|
|||
|
||||
outputs = [ "out" "lib" "dev" "python" ];
|
||||
|
||||
# Clang expects to find LLVMgold in its own prefix
|
||||
postInstall = ''
|
||||
if [ -e ${libllvm.lib}/lib/LLVMgold.so ]; then
|
||||
ln -sv ${libllvm.lib}/lib/LLVMgold.so $lib/lib
|
||||
fi
|
||||
|
||||
ln -sv $out/bin/clang $out/bin/cpp
|
||||
|
||||
# Move libclang to 'lib' output
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ lib, stdenv, llvm_meta, fetch, fetchpatch, cmake, libxml2, libllvm, version, clang-tools-extra_src, python3
|
||||
{ lib, stdenv, llvm_meta, fetch, fetchpatch, substituteAll, cmake, libxml2, libllvm, version, clang-tools-extra_src, python3
|
||||
, buildLlvmTools
|
||||
, fixDarwinDylibNames
|
||||
, enableManpages ? false
|
||||
|
@ -57,6 +57,10 @@ let
|
|||
excludes = [ "docs/*" "test/*" ];
|
||||
sha256 = "0gxgmi0qbm89mq911dahallhi8m6wa9vpklklqmxafx4rplrr8ph";
|
||||
})
|
||||
(substituteAll {
|
||||
src = ../../clang-11-12-LLVMgold-path.patch;
|
||||
libllvmLibdir = "${libllvm.lib}/lib";
|
||||
})
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
|
@ -75,12 +79,7 @@ let
|
|||
|
||||
outputs = [ "out" "lib" "dev" "python" ];
|
||||
|
||||
# Clang expects to find LLVMgold in its own prefix
|
||||
postInstall = ''
|
||||
if [ -e ${libllvm.lib}/lib/LLVMgold.so ]; then
|
||||
ln -sv ${libllvm.lib}/lib/LLVMgold.so $lib/lib
|
||||
fi
|
||||
|
||||
ln -sv $out/bin/clang $out/bin/cpp
|
||||
|
||||
# Move libclang to 'lib' output
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ lib, stdenv, llvm_meta, fetch, cmake, libxml2, libllvm, version, clang-tools-extra_src, python3
|
||||
{ lib, stdenv, llvm_meta, fetch, substituteAll, cmake, libxml2, libllvm, version, clang-tools-extra_src, python3
|
||||
, buildLlvmTools
|
||||
, fixDarwinDylibNames
|
||||
, enableManpages ? false
|
||||
|
@ -44,6 +44,10 @@ let
|
|||
./purity.patch
|
||||
# https://reviews.llvm.org/D51899
|
||||
./gnu-install-dirs.patch
|
||||
(substituteAll {
|
||||
src = ../../clang-11-12-LLVMgold-path.patch;
|
||||
libllvmLibdir = "${libllvm.lib}/lib";
|
||||
})
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
|
@ -59,12 +63,7 @@ let
|
|||
|
||||
outputs = [ "out" "lib" "dev" "python" ];
|
||||
|
||||
# Clang expects to find LLVMgold in its own prefix
|
||||
postInstall = ''
|
||||
if [ -e ${libllvm.lib}/lib/LLVMgold.so ]; then
|
||||
ln -sv ${libllvm.lib}/lib/LLVMgold.so $lib/lib
|
||||
fi
|
||||
|
||||
ln -sv $out/bin/clang $out/bin/cpp
|
||||
|
||||
# Move libclang to 'lib' output
|
||||
|
|
14
pkgs/development/compilers/llvm/5/clang/LLVMgold-path.patch
Normal file
14
pkgs/development/compilers/llvm/5/clang/LLVMgold-path.patch
Normal file
|
@ -0,0 +1,14 @@
|
|||
diff --git a/lib/Driver/ToolChains/CommonArgs.cpp b/lib/Driver/ToolChains/CommonArgs.cpp
|
||||
index 00bd60bc24bb..17416b0bd3c0 100644
|
||||
--- a/lib/Driver/ToolChains/CommonArgs.cpp
|
||||
+++ b/lib/Driver/ToolChains/CommonArgs.cpp
|
||||
@@ -376,8 +376,7 @@ void tools::AddGoldPlugin(const ToolChain &ToolChain, const ArgList &Args,
|
||||
// as gold requires -plugin to come before any -plugin-opt that -Wl might
|
||||
// forward.
|
||||
CmdArgs.push_back("-plugin");
|
||||
- std::string Plugin =
|
||||
- ToolChain.getDriver().Dir + "/../lib" CLANG_LIBDIR_SUFFIX "/LLVMgold.so";
|
||||
+ std::string Plugin = "@libllvmLibdir@" "/LLVMgold.so";
|
||||
CmdArgs.push_back(Args.MakeArgString(Plugin));
|
||||
|
||||
// Try to pass driver level flags relevant to LTO code generation down to
|
|
@ -1,4 +1,4 @@
|
|||
{ lib, stdenv, llvm_meta, fetch, cmake, libxml2, libllvm, version, clang-tools-extra_src, python3
|
||||
{ lib, stdenv, llvm_meta, fetch, substituteAll, cmake, libxml2, libllvm, version, clang-tools-extra_src, python3
|
||||
, buildLlvmTools
|
||||
, fixDarwinDylibNames
|
||||
, enableManpages ? false
|
||||
|
@ -43,6 +43,10 @@ let
|
|||
patches = [
|
||||
./purity.patch
|
||||
./gnu-install-dirs.patch
|
||||
(substituteAll {
|
||||
src = ./LLVMgold-path.patch;
|
||||
libllvmLibdir = "${libllvm.lib}/lib";
|
||||
})
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
|
@ -58,12 +62,7 @@ let
|
|||
|
||||
outputs = [ "out" "lib" "dev" "python" ];
|
||||
|
||||
# Clang expects to find LLVMgold in its own prefix
|
||||
postInstall = ''
|
||||
if [ -e ${libllvm.lib}/lib/LLVMgold.so ]; then
|
||||
ln -sv ${libllvm.lib}/lib/LLVMgold.so $lib/lib
|
||||
fi
|
||||
|
||||
ln -sv $out/bin/clang $out/bin/cpp
|
||||
|
||||
# Move libclang to 'lib' output
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ lib, stdenv, llvm_meta, fetch, cmake, libxml2, libllvm, version, clang-tools-extra_src, python3
|
||||
{ lib, stdenv, llvm_meta, fetch, substituteAll, cmake, libxml2, libllvm, version, clang-tools-extra_src, python3
|
||||
, buildLlvmTools
|
||||
, fixDarwinDylibNames
|
||||
, enableManpages ? false
|
||||
|
@ -43,6 +43,10 @@ let
|
|||
patches = [
|
||||
./purity.patch
|
||||
./gnu-install-dirs.patch
|
||||
(substituteAll {
|
||||
src = ../../clang-6-10-LLVMgold-path.patch;
|
||||
libllvmLibdir = "${libllvm.lib}/lib";
|
||||
})
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
|
@ -58,12 +62,7 @@ let
|
|||
|
||||
outputs = [ "out" "lib" "dev" "python" ];
|
||||
|
||||
# Clang expects to find LLVMgold in its own prefix
|
||||
postInstall = ''
|
||||
if [ -e ${libllvm.lib}/lib/LLVMgold.so ]; then
|
||||
ln -sv ${libllvm.lib}/lib/LLVMgold.so $lib/lib
|
||||
fi
|
||||
|
||||
ln -sv $out/bin/clang $out/bin/cpp
|
||||
|
||||
# Move libclang to 'lib' output
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ lib, stdenv, llvm_meta, fetch, cmake, libxml2, libllvm, version, clang-tools-extra_src, python3
|
||||
{ lib, stdenv, llvm_meta, fetch, substituteAll, cmake, libxml2, libllvm, version, clang-tools-extra_src, python3
|
||||
, buildLlvmTools
|
||||
, fixDarwinDylibNames
|
||||
, enableManpages ? false
|
||||
|
@ -52,6 +52,10 @@ let
|
|||
# needed for our bootstrapping to not interfere with C.
|
||||
./unwindlib.patch
|
||||
./gnu-install-dirs.patch
|
||||
(substituteAll {
|
||||
src = ../../clang-6-10-LLVMgold-path.patch;
|
||||
libllvmLibdir = "${libllvm.lib}/lib";
|
||||
})
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
|
@ -70,12 +74,7 @@ let
|
|||
|
||||
outputs = [ "out" "lib" "dev" "python" ];
|
||||
|
||||
# Clang expects to find LLVMgold in its own prefix
|
||||
postInstall = ''
|
||||
if [ -e ${libllvm.lib}/lib/LLVMgold.so ]; then
|
||||
ln -sv ${libllvm.lib}/lib/LLVMgold.so $lib/lib
|
||||
fi
|
||||
|
||||
ln -sv $out/bin/clang $out/bin/cpp
|
||||
|
||||
# Move libclang to 'lib' output
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ lib, stdenv, llvm_meta, fetch, cmake, libxml2, libllvm, version, clang-tools-extra_src, python3
|
||||
{ lib, stdenv, llvm_meta, fetch, substituteAll, cmake, libxml2, libllvm, version, clang-tools-extra_src, python3
|
||||
, buildLlvmTools
|
||||
, fixDarwinDylibNames
|
||||
, enableManpages ? false
|
||||
|
@ -59,6 +59,10 @@ let
|
|||
# make clang -xhip use $PATH to find executables
|
||||
./HIP-use-PATH-8.patch
|
||||
./gnu-install-dirs.patch
|
||||
(substituteAll {
|
||||
src = ../../clang-6-10-LLVMgold-path.patch;
|
||||
libllvmLibdir = "${libllvm.lib}/lib";
|
||||
})
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
|
@ -77,12 +81,7 @@ let
|
|||
|
||||
outputs = [ "out" "lib" "dev" "python" ];
|
||||
|
||||
# Clang expects to find LLVMgold in its own prefix
|
||||
postInstall = ''
|
||||
if [ -e ${libllvm.lib}/lib/LLVMgold.so ]; then
|
||||
ln -sv ${libllvm.lib}/lib/LLVMgold.so $lib/lib
|
||||
fi
|
||||
|
||||
ln -sv $out/bin/clang $out/bin/cpp
|
||||
|
||||
# Move libclang to 'lib' output
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ lib, stdenv, llvm_meta, fetch, cmake, libxml2, libllvm, version, clang-tools-extra_src, python3
|
||||
{ lib, stdenv, llvm_meta, fetch, substituteAll, cmake, libxml2, libllvm, version, clang-tools-extra_src, python3
|
||||
, buildLlvmTools
|
||||
, fixDarwinDylibNames
|
||||
, enableManpages ? false
|
||||
|
@ -52,6 +52,10 @@ let
|
|||
# make clang -xhip use $PATH to find executables
|
||||
./HIP-use-PATH-9.patch
|
||||
./gnu-install-dirs.patch
|
||||
(substituteAll {
|
||||
src = ../../clang-6-10-LLVMgold-path.patch;
|
||||
libllvmLibdir = "${libllvm.lib}/lib";
|
||||
})
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
|
@ -70,12 +74,7 @@ let
|
|||
|
||||
outputs = [ "out" "lib" "dev" "python" ];
|
||||
|
||||
# Clang expects to find LLVMgold in its own prefix
|
||||
postInstall = ''
|
||||
if [ -e ${libllvm.lib}/lib/LLVMgold.so ]; then
|
||||
ln -sv ${libllvm.lib}/lib/LLVMgold.so $lib/lib
|
||||
fi
|
||||
|
||||
ln -sv $out/bin/clang $out/bin/cpp
|
||||
|
||||
# Move libclang to 'lib' output
|
||||
|
|
|
@ -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));
|
||||
}
|
|
@ -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));
|
Loading…
Reference in a new issue