From 64509dbd186f11a9b7213e3cce413abb5bd8f7dc Mon Sep 17 00:00:00 2001 From: Zhaofeng Li Date: Fri, 4 Jun 2021 19:39:28 -0700 Subject: [PATCH 1/2] all-packages: Use LLVM libunwind on RISC-V --- pkgs/top-level/all-packages.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 2b52ef3ba876..bbcc8958686e 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -16823,8 +16823,9 @@ in libutempter = callPackage ../development/libraries/libutempter { }; - libunwind = if stdenv.isDarwin - then darwin.libunwind + libunwind = + if stdenv.isDarwin then darwin.libunwind + else if stdenv.hostPlatform.isRiscV then llvmPackages_latest.libunwind else callPackage ../development/libraries/libunwind { }; libuv = callPackage ../development/libraries/libuv { From 9a8b5d6e154f703278b68b4d8952ce2d1c791c02 Mon Sep 17 00:00:00 2001 From: Zhaofeng Li Date: Fri, 4 Jun 2021 19:02:19 -0700 Subject: [PATCH 2/2] nongnu-libunwind: Disable package for RISC-V The author has stated that he does not have time to implement support. There is no use for the `supportsHost` passthru attribute anymore, so let's remove that as well. --- pkgs/development/libraries/libunwind/default.nix | 3 +-- pkgs/development/tools/misc/strace/default.nix | 8 +++----- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/pkgs/development/libraries/libunwind/default.nix b/pkgs/development/libraries/libunwind/default.nix index b2b5db2309c1..bda7f72a5576 100644 --- a/pkgs/development/libraries/libunwind/default.nix +++ b/pkgs/development/libraries/libunwind/default.nix @@ -38,8 +38,7 @@ stdenv.mkDerivation rec { description = "A portable and efficient API to determine the call-chain of a program"; maintainers = with maintainers; [ orivej ]; platforms = platforms.linux; + badPlatforms = [ "riscv32-linux" "riscv64-linux" ]; license = licenses.mit; }; - - passthru.supportsHost = !stdenv.hostPlatform.isRiscV; } diff --git a/pkgs/development/tools/misc/strace/default.nix b/pkgs/development/tools/misc/strace/default.nix index 756f1b947ede..4da1a2cba09b 100644 --- a/pkgs/development/tools/misc/strace/default.nix +++ b/pkgs/development/tools/misc/strace/default.nix @@ -1,9 +1,5 @@ { lib, stdenv, fetchurl, perl, libunwind, buildPackages }: -# libunwind does not have the supportsHost attribute on darwin, thus -# when this package is evaluated it causes an evaluation error -assert stdenv.isLinux; - stdenv.mkDerivation rec { pname = "strace"; version = "5.12"; @@ -16,7 +12,9 @@ stdenv.mkDerivation rec { depsBuildBuild = [ buildPackages.stdenv.cc ]; nativeBuildInputs = [ perl ]; - buildInputs = [ perl.out ] ++ lib.optional libunwind.supportsHost libunwind; # support -k + # On RISC-V platforms, LLVM's libunwind implementation is unsupported by strace. + # The build will silently fall back and -k will not work on RISC-V. + buildInputs = [ perl.out libunwind ]; # support -k postPatch = "patchShebangs --host strace-graph";