From f506019942dd95af422c6b848765478cde994efa Mon Sep 17 00:00:00 2001 From: sternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org> Date: Sat, 15 May 2021 00:26:27 +0200 Subject: [PATCH] llvmPackages_*.lldClang: pass -lunwind if exceptions are enabled To successfully compile C++ with useLLVM we need an unwinder and thus to explicitly -lunwind like it has been done for the android cross targets. --- pkgs/development/compilers/llvm/10/default.nix | 2 +- pkgs/development/compilers/llvm/11/default.nix | 2 +- pkgs/development/compilers/llvm/12/default.nix | 2 +- pkgs/development/compilers/llvm/7/default.nix | 2 +- pkgs/development/compilers/llvm/8/default.nix | 2 +- pkgs/development/compilers/llvm/9/default.nix | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pkgs/development/compilers/llvm/10/default.nix b/pkgs/development/compilers/llvm/10/default.nix index bf3784c97946..e236e4f4ee89 100644 --- a/pkgs/development/compilers/llvm/10/default.nix +++ b/pkgs/development/compilers/llvm/10/default.nix @@ -132,7 +132,7 @@ let echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags '' + lib.optionalString (!stdenv.targetPlatform.isWasm) '' echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags - '' + lib.optionalString (stdenv.targetPlatform.isAndroid && stdenv.targetPlatform.useLLVM) '' + '' + lib.optionalString (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false) '' echo "-lunwind" >> $out/nix-support/cc-ldflags '' + lib.optionalString stdenv.targetPlatform.isWasm '' echo "-fno-exceptions" >> $out/nix-support/cc-cflags diff --git a/pkgs/development/compilers/llvm/11/default.nix b/pkgs/development/compilers/llvm/11/default.nix index 0e12bbbb2fc9..5efd75550a83 100644 --- a/pkgs/development/compilers/llvm/11/default.nix +++ b/pkgs/development/compilers/llvm/11/default.nix @@ -133,7 +133,7 @@ let echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags '' + lib.optionalString (!stdenv.targetPlatform.isWasm) '' echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags - '' + lib.optionalString (stdenv.targetPlatform.isAndroid && stdenv.targetPlatform.useLLVM) '' + '' + lib.optionalString (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false) '' echo "-lunwind" >> $out/nix-support/cc-ldflags '' + lib.optionalString stdenv.targetPlatform.isWasm '' echo "-fno-exceptions" >> $out/nix-support/cc-cflags diff --git a/pkgs/development/compilers/llvm/12/default.nix b/pkgs/development/compilers/llvm/12/default.nix index 2b4648642220..7db9e453ce7a 100644 --- a/pkgs/development/compilers/llvm/12/default.nix +++ b/pkgs/development/compilers/llvm/12/default.nix @@ -139,7 +139,7 @@ let echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags '' + lib.optionalString (!stdenv.targetPlatform.isWasm) '' echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags - '' + lib.optionalString (stdenv.targetPlatform.isAndroid && stdenv.targetPlatform.useLLVM) '' + '' + lib.optionalString (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false) '' echo "-lunwind" >> $out/nix-support/cc-ldflags '' + lib.optionalString stdenv.targetPlatform.isWasm '' echo "-fno-exceptions" >> $out/nix-support/cc-cflags diff --git a/pkgs/development/compilers/llvm/7/default.nix b/pkgs/development/compilers/llvm/7/default.nix index 5dbe4e0d8f34..c28b5b24ae6b 100644 --- a/pkgs/development/compilers/llvm/7/default.nix +++ b/pkgs/development/compilers/llvm/7/default.nix @@ -138,7 +138,7 @@ let echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags '' + lib.optionalString (!stdenv.targetPlatform.isWasm) '' echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags - '' + lib.optionalString (stdenv.targetPlatform.isAndroid && stdenv.targetPlatform.useLLVM) '' + '' + lib.optionalString (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false) '' echo "-lunwind" >> $out/nix-support/cc-ldflags '' + lib.optionalString stdenv.targetPlatform.isWasm '' echo "-fno-exceptions" >> $out/nix-support/cc-cflags diff --git a/pkgs/development/compilers/llvm/8/default.nix b/pkgs/development/compilers/llvm/8/default.nix index 9131a873b3b7..f6616b8ea808 100644 --- a/pkgs/development/compilers/llvm/8/default.nix +++ b/pkgs/development/compilers/llvm/8/default.nix @@ -139,7 +139,7 @@ let echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags '' + lib.optionalString (!stdenv.targetPlatform.isWasm) '' echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags - '' + lib.optionalString (stdenv.targetPlatform.isAndroid && stdenv.targetPlatform.useLLVM) '' + '' + lib.optionalString (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false) '' echo "-lunwind" >> $out/nix-support/cc-ldflags '' + lib.optionalString stdenv.targetPlatform.isWasm '' echo "-fno-exceptions" >> $out/nix-support/cc-cflags diff --git a/pkgs/development/compilers/llvm/9/default.nix b/pkgs/development/compilers/llvm/9/default.nix index 383a12602719..5da98ead052a 100644 --- a/pkgs/development/compilers/llvm/9/default.nix +++ b/pkgs/development/compilers/llvm/9/default.nix @@ -139,7 +139,7 @@ let echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags '' + lib.optionalString (!stdenv.targetPlatform.isWasm) '' echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags - '' + lib.optionalString (stdenv.targetPlatform.isAndroid && stdenv.targetPlatform.useLLVM) '' + '' + lib.optionalString (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false) '' echo "-lunwind" >> $out/nix-support/cc-ldflags '' + lib.optionalString stdenv.targetPlatform.isWasm '' echo "-fno-exceptions" >> $out/nix-support/cc-cflags