about summary refs log tree commit diff
path: root/src/libstd/sys/common
diff options
context:
space:
mode:
authorBjörn Steinbrink <bsteinbr@gmail.com>2015-09-11 20:10:43 +0200
committerBjörn Steinbrink <bsteinbr@gmail.com>2015-09-14 11:36:09 +0200
commit3ef75d5774cb9a7cf839a69341c620b98fa9c7df (patch)
tree390d168efade16f67b4651405d89a0884d51ee0a /src/libstd/sys/common
parente4e67bd489934702e4958a03bb4c948919d38920 (diff)
downloadrust-3ef75d5774cb9a7cf839a69341c620b98fa9c7df.tar.gz
rust-3ef75d5774cb9a7cf839a69341c620b98fa9c7df.zip
Mark all extern functions as nounwind
Unwinding across an FFI boundary is undefined behaviour, so we can mark
all external function as nounwind. The obvious exception are those
functions that actually perform the unwinding.
Diffstat (limited to 'src/libstd/sys/common')
-rw-r--r--src/libstd/sys/common/libunwind.rs2
-rw-r--r--src/libstd/sys/common/unwind/mod.rs1
-rw-r--r--src/libstd/sys/common/unwind/seh.rs1
-rw-r--r--src/libstd/sys/common/unwind/seh64_gnu.rs2
4 files changed, 6 insertions, 0 deletions
diff --git a/src/libstd/sys/common/libunwind.rs b/src/libstd/sys/common/libunwind.rs
index fde612014e9..c6bffb0f733 100644
--- a/src/libstd/sys/common/libunwind.rs
+++ b/src/libstd/sys/common/libunwind.rs
@@ -124,10 +124,12 @@ extern "C" {
     // iOS on armv7 uses SjLj exceptions and requires to link
     // against corresponding routine (..._SjLj_...)
     #[cfg(not(all(target_os = "ios", target_arch = "arm")))]
+    #[unwind]
     pub fn _Unwind_RaiseException(exception: *mut _Unwind_Exception)
                                   -> _Unwind_Reason_Code;
 
     #[cfg(all(target_os = "ios", target_arch = "arm"))]
+    #[unwind]
     fn _Unwind_SjLj_RaiseException(e: *mut _Unwind_Exception)
                                    -> _Unwind_Reason_Code;
 
diff --git a/src/libstd/sys/common/unwind/mod.rs b/src/libstd/sys/common/unwind/mod.rs
index ff93d0526b7..738681c3cfe 100644
--- a/src/libstd/sys/common/unwind/mod.rs
+++ b/src/libstd/sys/common/unwind/mod.rs
@@ -192,6 +192,7 @@ fn rust_panic(cause: Box<Any + Send + 'static>) -> ! {
 #[cfg(not(test))]
 /// Entry point of panic from the libcore crate.
 #[lang = "panic_fmt"]
+#[unwind]
 pub extern fn rust_begin_unwind(msg: fmt::Arguments,
                                 file: &'static str, line: u32) -> ! {
     begin_unwind_fmt(msg, &(file, line))
diff --git a/src/libstd/sys/common/unwind/seh.rs b/src/libstd/sys/common/unwind/seh.rs
index a201e406a23..a89e8b499ac 100644
--- a/src/libstd/sys/common/unwind/seh.rs
+++ b/src/libstd/sys/common/unwind/seh.rs
@@ -62,6 +62,7 @@ static PANIC_DATA: StaticKey = StaticKey::new(None);
 
 // This function is provided by kernel32.dll
 extern "system" {
+    #[unwind]
     fn RaiseException(dwExceptionCode: DWORD,
                       dwExceptionFlags: DWORD,
                       nNumberOfArguments: DWORD,
diff --git a/src/libstd/sys/common/unwind/seh64_gnu.rs b/src/libstd/sys/common/unwind/seh64_gnu.rs
index 4d23794de24..9478678fda9 100644
--- a/src/libstd/sys/common/unwind/seh64_gnu.rs
+++ b/src/libstd/sys/common/unwind/seh64_gnu.rs
@@ -93,6 +93,7 @@ pub enum EXCEPTION_DISPOSITION {
 
 // From kernel32.dll
 extern "system" {
+    #[unwind]
     fn RaiseException(dwExceptionCode: DWORD,
                       dwExceptionFlags: DWORD,
                       nNumberOfArguments: DWORD,
@@ -198,6 +199,7 @@ unsafe extern fn rust_eh_personality(
 
 #[lang = "eh_unwind_resume"]
 #[cfg(not(test))]
+#[unwind]
 unsafe extern fn rust_eh_unwind_resume(panic_ctx: LPVOID) {
     let params = [panic_ctx as ULONG_PTR];
     RaiseException(RUST_PANIC,