From de2c3e08c090907b555a8e26f4af73cebf800d71 Mon Sep 17 00:00:00 2001 From: mschwaig Date: Sun, 21 Mar 2021 21:12:12 +0100 Subject: [PATCH] openblas: apply patch to prevent SIGILL on aarch64 (#117004) The applied patch contains the changes from this PR: https://github.com/xianyi/OpenBLAS/pull/3060 This patch prevents gcc from reordering instructions in a way that can cause crashes with SIGILL on aarch64. This issue crashes python when importing numpy on aarch64: https://github.com/numpy/numpy/issues/18131 --- .../libraries/science/math/openblas/default.nix | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/science/math/openblas/default.nix b/pkgs/development/libraries/science/math/openblas/default.nix index 23a82f483dc..c66e4ba44ef 100644 --- a/pkgs/development/libraries/science/math/openblas/default.nix +++ b/pkgs/development/libraries/science/math/openblas/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchFromGitHub, perl, which +{ lib, stdenv, fetchFromGitHub, fetchpatch, perl, which # Most packages depending on openblas expect integer width to match # pointer width, but some expect to use 32-bit integers always # (for compatibility with reference BLAS). @@ -124,6 +124,16 @@ stdenv.mkDerivation rec { sha256 = "14jxh0v3jfbw4mfjx4mcz4dd51lyq7pqvh9k8dg94539ypzjr2lj"; }; + # apply https://github.com/xianyi/OpenBLAS/pull/3060 to fix a crash on arm + # remove this when updating to 0.3.14 or newer + patches = [ + (fetchpatch { + name = "label-get_cpu_ftr-as-volatile.patch"; + url = "https://github.com/xianyi/OpenBLAS/commit/6fe0f1fab9d6a7f46d71d37ebb210fbf56924fbc.diff"; + sha256 = "06gwh73k4sas1ap2fi3jvpifbjkys2vhmnbj4mzrsvj279ljsfdk"; + }) + ]; + inherit blas64; # Some hardening features are disabled due to sporadic failures in