about summary refs log tree commit diff
path: root/pkgs/development/libraries/libunwind
diff options
context:
space:
mode:
authorWill Dietz <w@wdtz.org>2018-01-11 14:27:52 -0600
committerWill Dietz <w@wdtz.org>2018-02-13 09:44:29 -0600
commitbc2ad5a9683d772ace19cf28f79ef98f0722b29a (patch)
treea2f359b3a360a578feb0d28701110d09d4743e11 /pkgs/development/libraries/libunwind
parent41026550e2afb0182fca1ca59c57437b554359c6 (diff)
libunwind: patch to fix build on non-glibc
Diffstat (limited to 'pkgs/development/libraries/libunwind')
-rw-r--r--pkgs/development/libraries/libunwind/backtrace-only-with-glibc.patch45
-rw-r--r--pkgs/development/libraries/libunwind/default.nix1
2 files changed, 46 insertions, 0 deletions
diff --git a/pkgs/development/libraries/libunwind/backtrace-only-with-glibc.patch b/pkgs/development/libraries/libunwind/backtrace-only-with-glibc.patch
new file mode 100644
index 0000000000000..5fcaa72c0c013
--- /dev/null
+++ b/pkgs/development/libraries/libunwind/backtrace-only-with-glibc.patch
@@ -0,0 +1,45 @@
+From 04437142399662b576bd55a85485c6dcc14d0812 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem at gmail.com>
+Date: Thu, 31 Dec 2015 06:44:07 +0000
+Subject: [PATCH] backtrace: Use only with glibc and uclibc
+
+backtrace API is glibc specific not linux specific
+so make it behave so.
+
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+---
+Upstream-Status: Pending
+
+ tests/test-coredump-unwind.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/tests/test-coredump-unwind.c b/tests/test-coredump-unwind.c
+index 5254708..8767b42 100644
+--- a/tests/test-coredump-unwind.c
++++ b/tests/test-coredump-unwind.c
+@@ -57,7 +57,9 @@
+ #include <grp.h>
+ 
+ /* For SIGSEGV handler code */
++#ifdef __GLIBC__
+ #include <execinfo.h>
++#endif
+ #include <sys/ucontext.h>
+ 
+ #include <libunwind-coredump.h>
+@@ -238,11 +240,11 @@ void handle_sigsegv(int sig, siginfo_t *info, void *ucontext)
+ 			ip);
+ 
+   {
++#ifdef __GLIBC__
+     /* glibc extension */
+     void *array[50];
+     int size;
+     size = backtrace(array, 50);
+-#ifdef __linux__
+     backtrace_symbols_fd(array, size, 2);
+ #endif
+   }
+-- 
+2.6.4
+
diff --git a/pkgs/development/libraries/libunwind/default.nix b/pkgs/development/libraries/libunwind/default.nix
index 8565bc75ff9fb..6afdac3fdf5c3 100644
--- a/pkgs/development/libraries/libunwind/default.nix
+++ b/pkgs/development/libraries/libunwind/default.nix
@@ -11,6 +11,7 @@ stdenv.mkDerivation rec {
 
   patches = [
     ./version-1.2.1.patch
+    ./backtrace-only-with-glibc.patch
   ];
 
   nativeBuildInputs = [ autoreconfHook ];