Use lld linker for clangOmpss2 for LTO

This commit is contained in:
2023-03-06 11:47:01 +01:00
parent 5753f0c312
commit 84623ea9d0
4 changed files with 69 additions and 2 deletions

View File

@@ -67,7 +67,7 @@ stdenv.mkDerivation rec {
"-DCMAKE_CXX_FLAGS_DEBUG=-g -ggnu-pubnames"
"-DCMAKE_EXE_LINKER_FLAGS_DEBUG=-Wl,-gdb-index"
"-DLLVM_LIT_ARGS=-sv --xunit-xml-output=xunit.xml"
"-DLLVM_ENABLE_PROJECTS=clang;openmp;compiler-rt;flang"
"-DLLVM_ENABLE_PROJECTS=clang;openmp;compiler-rt;flang;lld"
"-DLLVM_ENABLE_ASSERTIONS=${enableAssertions}"
"-DLLVM_INSTALL_TOOLCHAIN_ONLY=ON"
"-DCMAKE_INSTALL_BINDIR=bin"

View File

@@ -4,14 +4,27 @@
, nanos6
, clangOmpss2Unwrapped
, wrapCCWith
, llvmPackages
}:
let
# We need to replace the lld linker from bintools with our linker just built,
# otherwise we run into incompatibility issues when mixing compiler and linker
# versions.
bintools-unwrapped = llvmPackages.tools.bintools-unwrapped.override {
lld = clangOmpss2Unwrapped;
};
bintools = llvmPackages.tools.bintools.override {
bintools = bintools-unwrapped;
};
targetConfig = stdenv.targetPlatform.config;
inherit gcc nanos6;
in wrapCCWith rec {
cc = clangOmpss2Unwrapped;
in wrapCCWith {
inherit cc bintools;
extraBuildCommands = ''
echo "-target ${targetConfig}" >> $out/nix-support/cc-cflags
echo "-B${gcc.cc}/lib/gcc/${targetConfig}/${gcc.version}" >> $out/nix-support/cc-cflags