clang_11: Fix RISC-V builds for compiler-rt. (#135718)

Closes: #135628
This commit is contained in:
Tom Repetti 2021-08-29 19:31:30 -04:00 committed by GitHub
parent f659bd7695
commit c33c7c3d5f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -112,5 +112,8 @@ stdenv.mkDerivation {
# "All of the code in the compiler-rt project is dual licensed under the MIT
# license and the UIUC License (a BSD-like license)":
license = with lib.licenses; [ mit ncsa ];
# compiler-rt requires a Clang stdenv on 32-bit RISC-V:
# https://reviews.llvm.org/D43106#1019077
broken = stdenv.hostPlatform.isRiscV && stdenv.hostPlatform.is32bit && !stdenv.cc.isClang;
};
}

View file

@ -227,7 +227,7 @@ let
compiler-rt-libc = callPackage ./compiler-rt {
inherit llvm_meta;
stdenv = if (stdenv.hostPlatform.useLLVM or false) || (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64)
stdenv = if (stdenv.hostPlatform.useLLVM or false) || (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) || (stdenv.hostPlatform.isRiscV && stdenv.hostPlatform.is32bit)
then overrideCC stdenv buildLlvmTools.clangNoCompilerRtWithLibc
else stdenv;
};
@ -240,7 +240,7 @@ let
};
# N.B. condition is safe because without useLLVM both are the same.
compiler-rt = if stdenv.hostPlatform.isAndroid || (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64)
compiler-rt = if stdenv.hostPlatform.isAndroid || (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) || (stdenv.hostPlatform.libc == "newlib")
then libraries.compiler-rt-libc
else libraries.compiler-rt-no-libc;