This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +8
-4
lines changed Expand file tree Collapse file tree 3 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -134,7 +134,8 @@ fn create_wrapper_function(
134134 llvm:: LLVMRustSetVisibility ( llfn, llvm:: Visibility :: Hidden ) ;
135135 }
136136 if tcx. sess . must_emit_unwind_tables ( ) {
137- let uwtable = attributes:: uwtable_attr ( llcx) ;
137+ let uwtable =
138+ attributes:: uwtable_attr ( llcx, tcx. sess . opts . unstable_opts . use_sync_unwind ) ;
138139 attributes:: apply_to_llfn ( llfn, llvm:: AttributePlace :: Function , & [ uwtable] ) ;
139140 }
140141
Original file line number Diff line number Diff line change @@ -95,11 +95,12 @@ pub fn sanitize_attrs<'ll>(
9595
9696/// Tell LLVM to emit or not emit the information necessary to unwind the stack for the function.
9797#[ inline]
98- pub fn uwtable_attr ( llcx : & llvm:: Context ) -> & Attribute {
98+ pub fn uwtable_attr ( llcx : & llvm:: Context , use_sync_unwind : Option < bool > ) -> & Attribute {
9999 // NOTE: We should determine if we even need async unwind tables, as they
100100 // take have more overhead and if we can use sync unwind tables we
101101 // probably should.
102- llvm:: CreateUWTableAttr ( llcx, true )
102+ let async_unwind = !use_sync_unwind. unwrap_or ( false ) ;
103+ llvm:: CreateUWTableAttr ( llcx, async_unwind)
103104}
104105
105106pub fn frame_pointer_type_attr < ' ll > ( cx : & CodegenCx < ' ll , ' _ > ) -> Option < & ' ll Attribute > {
@@ -333,7 +334,7 @@ pub fn from_fn_attrs<'ll, 'tcx>(
333334 // You can also find more info on why Windows always requires uwtables here:
334335 // https://bugzilla.mozilla.org/show_bug.cgi?id=1302078
335336 if cx. sess ( ) . must_emit_unwind_tables ( ) {
336- to_add. push ( uwtable_attr ( cx. llcx ) ) ;
337+ to_add. push ( uwtable_attr ( cx. llcx , cx . sess ( ) . opts . unstable_opts . use_sync_unwind ) ) ;
337338 }
338339
339340 if cx. sess ( ) . opts . unstable_opts . profile_sample_use . is_some ( ) {
Original file line number Diff line number Diff line change @@ -1991,6 +1991,8 @@ written to standard error output)"),
19911991 "adds unstable command line options to rustc interface (default: no)" ) ,
19921992 use_ctors_section: Option <bool > = ( None , parse_opt_bool, [ TRACKED ] ,
19931993 "use legacy .ctors section for initializers rather than .init_array" ) ,
1994+ use_sync_unwind: Option <bool > = ( None , parse_opt_bool, [ TRACKED ] ,
1995+ "Generate sync unwind tables instead of async unwind tables (default: no)" ) ,
19941996 validate_mir: bool = ( false , parse_bool, [ UNTRACKED ] ,
19951997 "validate MIR after each transformation" ) ,
19961998 #[ rustc_lint_opt_deny_field_access( "use `Session::verbose_internals` instead of this field" ) ]
You can’t perform that action at this time.
0 commit comments