From 9a8f0a8cb050e647fc146363d6558a6c17155ce5 Mon Sep 17 00:00:00 2001 From: Ed Schouten Date: Thu, 4 Jan 2018 17:55:44 +0100 Subject: [PATCH 1/2] Make libpanic_unwind build on CloudABI. CloudABI uses LLVM's libunwind for stack unwinding. There was a small bug that went by unnoticed, namely that it was not built with -fno-rtti. This caused it to (indirectly) depend on the entire C++ runtime. Now that that issue has been resolved, it is also perfectly fine to make use of this library for programming languages other than C++. --- src/libpanic_unwind/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libpanic_unwind/lib.rs b/src/libpanic_unwind/lib.rs index 6b8da7a51ceb8..92e40e8f26d40 100644 --- a/src/libpanic_unwind/lib.rs +++ b/src/libpanic_unwind/lib.rs @@ -68,6 +68,7 @@ mod imp; // i686-pc-windows-gnu and all others #[cfg(any(all(unix, not(target_os = "emscripten")), + target_os = "cloudabi", target_os = "redox", all(windows, target_arch = "x86", target_env = "gnu")))] #[path = "gcc.rs"] From 91611fc3d0ee8a7a0a7accff4377e3a21fd7b6c4 Mon Sep 17 00:00:00 2001 From: Ed Schouten Date: Fri, 5 Jan 2018 22:16:54 +0100 Subject: [PATCH 2/2] Let libpanic_abort call into libc's abort() on CloudABI. Ideally, we should make use of CloudABI's internal proc_raise(SIGABRT) system call. POSIX abort() requires things like flushing of stdios, which may not be what we want under panic conditions. Invoking the raw CloudABI system call would have prevented that. Unfortunately, we have to make use of the "cloudabi" crate to invoke raw CloudABI system calls. This is undesired, as discussed in the pull request (#47190). --- src/libpanic_abort/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libpanic_abort/lib.rs b/src/libpanic_abort/lib.rs index 29a9e1aadaf3c..c3bd6a2bc187d 100644 --- a/src/libpanic_abort/lib.rs +++ b/src/libpanic_abort/lib.rs @@ -53,7 +53,7 @@ pub unsafe extern fn __rust_maybe_catch_panic(f: fn(*mut u8), pub unsafe extern fn __rust_start_panic(_data: usize, _vtable: usize) -> u32 { abort(); - #[cfg(unix)] + #[cfg(any(unix, target_os = "cloudabi"))] unsafe fn abort() -> ! { extern crate libc; libc::abort();