@@ -94,33 +94,34 @@ impl<'tcx> UnwindContext<'tcx> {
94
94
// =======================================================================
95
95
// Everything after this line up to the end of the file is loosly based on
96
96
// https://github.com/bytecodealliance/wasmtime/blob/4471a82b0c540ff48960eca6757ccce5b1b5c3e4/crates/jit/src/unwind/systemv.rs
97
- cfg_if:: cfg_if! {
98
- if #[ cfg( target_os = "macos" ) ] {
99
- // On macOS, `__register_frame` takes a pointer to a single FDE
100
- let start = eh_frame. as_ptr( ) ;
101
- let end = start. add( eh_frame. len( ) ) ;
102
- let mut current = start;
103
-
104
- // Walk all of the entries in the frame table and register them
105
- while current < end {
106
- let len = std:: ptr:: read:: <u32 >( current as * const u32 ) as usize ;
107
-
108
- // Skip over the CIE
109
- if current != start {
110
- __register_frame( current) ;
111
- registrations. push( current as usize ) ;
112
- }
113
-
114
- // Move to the next table entry (+4 because the length itself is not inclusive)
115
- current = current. add( len + 4 ) ;
97
+ #[ cfg( target_os = "macos" ) ]
98
+ {
99
+ // On macOS, `__register_frame` takes a pointer to a single FDE
100
+ let start = eh_frame. as_ptr ( ) ;
101
+ let end = start. add ( eh_frame. len ( ) ) ;
102
+ let mut current = start;
103
+
104
+ // Walk all of the entries in the frame table and register them
105
+ while current < end {
106
+ let len = std:: ptr:: read :: < u32 > ( current as * const u32 ) as usize ;
107
+
108
+ // Skip over the CIE
109
+ if current != start {
110
+ __register_frame ( current) ;
111
+ registrations. push ( current as usize ) ;
116
112
}
117
- } else {
118
- // On other platforms, `__register_frame` will walk the FDEs until an entry of length 0
119
- let ptr = eh_frame. as_ptr( ) ;
120
- __register_frame( ptr) ;
121
- registrations. push( ptr as usize ) ;
113
+
114
+ // Move to the next table entry (+4 because the length itself is not inclusive)
115
+ current = current. add ( len + 4 ) ;
122
116
}
123
117
}
118
+ #[ cfg( not( target_os = "macos" ) ) ]
119
+ {
120
+ // On other platforms, `__register_frame` will walk the FDEs until an entry of length 0
121
+ let ptr = eh_frame. as_ptr ( ) ;
122
+ __register_frame ( ptr) ;
123
+ registrations. push ( ptr as usize ) ;
124
+ }
124
125
125
126
Some ( UnwindRegistry {
126
127
_frame_table : eh_frame,
0 commit comments