libunwind: Fix build against compiler-rt-using clang

This commit is contained in:
Shea Levy 2022-05-03 10:51:22 -04:00
parent 4c0d5f80fc
commit 078a07708a
No known key found for this signature in database
GPG Key ID: 5C0BD6957D86FE27
7 changed files with 20 additions and 4 deletions

View File

@ -17,6 +17,7 @@
, isGNU ? false, isClang ? cc.isClang or false, gnugrep ? null
, buildPackages ? {}
, libcxx ? null
, isCompilerRT ? false
}:
with lib;
@ -145,7 +146,7 @@ stdenv.mkDerivation {
# Binutils, and Apple's "cctools"; "bintools" as an attempt to find an
# unused middle-ground name that evokes both.
inherit bintools;
inherit libc nativeTools nativeLibc nativePrefix isGNU isClang;
inherit libc nativeTools nativeLibc nativePrefix isGNU isClang isCompilerRT;
emacsBufferSetup = pkgs: ''
; We should handle propagation here too

View File

@ -168,6 +168,7 @@ let
'' + lib.optionalString stdenv.targetPlatform.isWasm ''
echo "-fno-exceptions" >> $out/nix-support/cc-cflags
'' + mkExtraBuildCommands cc;
isCompilerRT = true;
};
clangNoLibcxx = wrapCCWith rec {
@ -182,6 +183,7 @@ let
echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
echo "-nostdlib++" >> $out/nix-support/cc-cflags
'' + mkExtraBuildCommands cc;
isCompilerRT = true;
};
clangNoLibc = wrapCCWith rec {
@ -195,6 +197,7 @@ let
echo "-rtlib=compiler-rt" >> $out/nix-support/cc-cflags
echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
'' + mkExtraBuildCommands cc;
isCompilerRT = true;
};
clangNoCompilerRt = wrapCCWith rec {

View File

@ -17,7 +17,9 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ cmake ];
cmakeFlags = lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF";
cmakeFlags =
lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF"
++ lib.optional (stdenv.cc.isCompilerRT) "-DLIBUNWIND_USE_COMPILER_RT=TRUE";
meta = llvm_meta // {
# Details: https://github.com/llvm/llvm-project/blob/main/libunwind/docs/index.rst

View File

@ -168,6 +168,7 @@ let
'' + lib.optionalString stdenv.targetPlatform.isWasm ''
echo "-fno-exceptions" >> $out/nix-support/cc-cflags
'' + mkExtraBuildCommands cc;
isCompilerRT = true;
};
clangNoLibcxx = wrapCCWith rec {
@ -182,6 +183,7 @@ let
echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
echo "-nostdlib++" >> $out/nix-support/cc-cflags
'' + mkExtraBuildCommands cc;
isCompilerRT = true;
};
clangNoLibc = wrapCCWith rec {
@ -195,6 +197,7 @@ let
echo "-rtlib=compiler-rt" >> $out/nix-support/cc-cflags
echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
'' + mkExtraBuildCommands cc;
isCompilerRT = true;
};
clangNoCompilerRt = wrapCCWith rec {

View File

@ -31,7 +31,9 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ cmake ];
cmakeFlags = lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF";
cmakeFlags =
lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF"
++ lib.optional (stdenv.cc.isCompilerRT) "-DLIBUNWIND_USE_COMPILER_RT=TRUE";
meta = llvm_meta // {
# Details: https://github.com/llvm/llvm-project/blob/main/libunwind/docs/index.rst

View File

@ -168,6 +168,7 @@ let
'' + lib.optionalString stdenv.targetPlatform.isWasm ''
echo "-fno-exceptions" >> $out/nix-support/cc-cflags
'' + mkExtraBuildCommands cc;
isCompilerRT = true;
};
clangNoLibcxx = wrapCCWith rec {
@ -182,6 +183,7 @@ let
echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
echo "-nostdlib++" >> $out/nix-support/cc-cflags
'' + mkExtraBuildCommands cc;
isCompilerRT = true;
};
clangNoLibc = wrapCCWith rec {
@ -195,6 +197,7 @@ let
echo "-rtlib=compiler-rt" >> $out/nix-support/cc-cflags
echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
'' + mkExtraBuildCommands cc;
isCompilerRT = true;
};
clangNoCompilerRt = wrapCCWith rec {

View File

@ -31,7 +31,9 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ cmake ];
cmakeFlags = lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF";
cmakeFlags =
lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF"
++ lib.optional stdenv.cc.isCompilerRT "-DLIBUNWIND_USE_COMPILER_RT=TRUE";
meta = llvm_meta // {
# Details: https://github.com/llvm/llvm-project/blob/main/libunwind/docs/index.rst