about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-03-14 10:34:29 -0700
committerAlex Crichton <alex@alexcrichton.com>2014-03-14 10:34:29 -0700
commit8e5ca4b793e928b5a7545f6d1010b7663a9d30ae (patch)
tree683c20d70e0328f8867dcccba4ebefa5646d7efa
parent770b6e2fc2f8749466487e4c2ae031b8ceecae04 (diff)
downloadrust-8e5ca4b793e928b5a7545f6d1010b7663a9d30ae.tar.gz
rust-8e5ca4b793e928b5a7545f6d1010b7663a9d30ae.zip
std: Fix backtraces on arm linux
On android, libgcc is missing the _Unwind_GetIP symbol because it's defined as a
macro. This is the same case for arm linux, so this commit adds the necessary
cfgs in place to use the "expanded macro" in rust for arm linux.
-rw-r--r--src/libstd/rt/libunwind.rs15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/libstd/rt/libunwind.rs b/src/libstd/rt/libunwind.rs
index bdb049fbb5f..a556db2a053 100644
--- a/src/libstd/rt/libunwind.rs
+++ b/src/libstd/rt/libunwind.rs
@@ -98,9 +98,18 @@ extern "C" {
     pub fn _Unwind_Backtrace(trace: _Unwind_Trace_Fn,
                              trace_argument: *libc::c_void)
                 -> _Unwind_Reason_Code;
-    #[cfg(not(target_os = "android"))]
+    #[cfg(stage0, not(target_os = "android"))]
     pub fn _Unwind_GetIP(ctx: *_Unwind_Context) -> libc::uintptr_t;
-    #[cfg(not(target_os = "android"))]
+    #[cfg(stage0, not(target_os = "android"))]
+    pub fn _Unwind_FindEnclosingFunction(pc: *libc::c_void) -> *libc::c_void;
+
+    #[cfg(not(stage0),
+          not(target_os = "android"),
+          not(target_os = "linux", target_arch = "arm"))]
+    pub fn _Unwind_GetIP(ctx: *_Unwind_Context) -> libc::uintptr_t;
+    #[cfg(not(stage0),
+          not(target_os = "android"),
+          not(target_os = "linux", target_arch = "arm"))]
     pub fn _Unwind_FindEnclosingFunction(pc: *libc::c_void) -> *libc::c_void;
 }
 
@@ -108,6 +117,7 @@ extern "C" {
 // of the macro. This is all copy/pasted directly from the header file with the
 // definition of _Unwind_GetIP.
 #[cfg(target_os = "android")]
+#[cfg(target_os = "linux", target_os = "arm")]
 pub unsafe fn _Unwind_GetIP(ctx: *_Unwind_Context) -> libc::uintptr_t {
     #[repr(C)]
     enum _Unwind_VRS_Result {
@@ -151,6 +161,7 @@ pub unsafe fn _Unwind_GetIP(ctx: *_Unwind_Context) -> libc::uintptr_t {
 
 // This function also doesn't exist on android, so make it a no-op
 #[cfg(target_os = "android")]
+#[cfg(target_os = "linux", target_os = "arm")]
 pub unsafe fn _Unwind_FindEnclosingFunction(pc: *libc::c_void) -> *libc::c_void{
     pc
 }