LLVM: Always pass host/target info to compiler-rt/libstdcxxClang

This commit is contained in:
Travis Whitaker
2020-04-13 18:49:27 -04:00
committed by John Ericson
parent 79374b9870
commit 74f3b25896
14 changed files with 154 additions and 28 deletions
@@ -20,7 +20,7 @@ stdenv.mkDerivation {
"-DSCUDO_DEFAULT_OPTIONS=DeleteSizeMismatch=0:DeallocationTypeMismatch=0"
];
cmakeFlags = stdenv.lib.optionals (useLLVM || stdenv.isDarwin) [
cmakeFlags = [
"-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON"
"-DCMAKE_C_COMPILER_TARGET=${stdenv.hostPlatform.config}"
"-DCMAKE_ASM_COMPILER_TARGET=${stdenv.hostPlatform.config}"
@@ -1,4 +1,4 @@
{ lowPrio, newScope, pkgs, stdenv, cmake, libstdcxxHook
{ lowPrio, newScope, pkgs, stdenv, cmake, gcc, libstdcxxHook
, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith
, buildLlvmTools # tools, but from the previous stage, for cross
, targetLlvmLibraries # libraries, but from the next stage, for cross
@@ -7,6 +7,7 @@
let
release_version = "8.0.1";
version = release_version; # differentiating these is important for rc's
targetConfig = stdenv.targetPlatform.config;
fetch = name: sha256: fetchurl {
url = "https://github.com/llvm/llvm-project/releases/download/llvmorg-${release_version}/${name}-${version}.src.tar.xz";
@@ -63,7 +64,12 @@ let
extraPackages = [
targetLlvmLibraries.compiler-rt
];
extraBuildCommands = mkExtraBuildCommands cc;
extraBuildCommands = ''
echo "-target ${targetConfig}" >> $out/nix-support/cc-cflags
echo "-B${gcc.cc}/lib/gcc/${targetConfig}/${gcc.version}" >> $out/nix-support/cc-cflags
echo "-L${gcc.cc}/lib/gcc/${targetConfig}/${gcc.version}" >> $out/nix-support/cc-ldflags
echo "-L${gcc.cc.lib}/${targetConfig}/lib" >> $out/nix-support/cc-ldflags
'' + mkExtraBuildCommands cc;
};
libcxxClang = wrapCCWith rec {