Skip to content

Commit b01b9c9

Browse files
committed
Condition EH ABI on target_arch, not target_os.
More precise unwinder private data size specification.
1 parent 19cff91 commit b01b9c9

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/libstd/rt/unwind.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ mod libunwind {
7777

7878
use libc::{uintptr_t, uint64_t};
7979

80-
#[cfg(not(target_os = "android"))]
80+
#[cfg(not(target_arch = "arm"))]
8181
#[repr(C)]
8282
pub enum _Unwind_Action
8383
{
@@ -88,7 +88,7 @@ mod libunwind {
8888
_UA_END_OF_STACK = 16,
8989
}
9090

91-
#[cfg(target_os = "android")]
91+
#[cfg(target_arch = "arm")]
9292
#[repr(C)]
9393
pub enum _Unwind_State
9494
{
@@ -118,10 +118,16 @@ mod libunwind {
118118

119119
pub type _Unwind_Word = uintptr_t;
120120

121+
#[cfg(not(target_arch = "arm"))]
122+
pub static unwinder_private_data_size: int = 2;
123+
124+
#[cfg(target_arch = "arm")]
125+
pub static unwinder_private_data_size: int = 20;
126+
121127
pub struct _Unwind_Exception {
122128
exception_class: _Unwind_Exception_Class,
123129
exception_cleanup: _Unwind_Exception_Cleanup_Fn,
124-
private: [_Unwind_Word, ..20],
130+
private: [_Unwind_Word, ..unwinder_private_data_size],
125131
}
126132

127133
pub enum _Unwind_Context {}
@@ -202,7 +208,7 @@ impl Unwinder {
202208
let exception = ~uw::_Unwind_Exception {
203209
exception_class: rust_exception_class(),
204210
exception_cleanup: exception_cleanup,
205-
private: [0, ..20],
211+
private: [0, ..uw::unwinder_private_data_size],
206212
};
207213
let error = uw::_Unwind_RaiseException(cast::transmute(exception));
208214
rtabort!("Could not unwind stack, error = {}", error as int)
@@ -253,7 +259,7 @@ fn rust_exception_class() -> uw::_Unwind_Exception_Class {
253259
// This is achieved by overriding the return value in search phase to always
254260
// say "catch!".
255261

256-
#[cfg(not(target_os = "android"))]
262+
#[cfg(not(target_arch = "arm"))]
257263
pub mod eabi {
258264
use uw = super::libunwind;
259265
use libc::c_int;
@@ -310,7 +316,7 @@ pub mod eabi {
310316

311317
// ARM EHABI uses a slightly different personality routine signature,
312318
// but otherwise works the same.
313-
#[cfg(target_os = "android")]
319+
#[cfg(target_arch = "arm")]
314320
pub mod eabi {
315321
use uw = super::libunwind;
316322
use libc::c_int;

0 commit comments

Comments
 (0)