Skip to content

Commit 708a246

Browse files
committed
Export rust_eh_unwind_resume symbol
1 parent f531f3b commit 708a246

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

src/librustc_codegen_ssa/back/symbol_export.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,12 @@ fn exported_symbols_provider_local(
182182
symbols.push((exported_symbol, SymbolExportLevel::C));
183183
}
184184

185+
if tcx.is_panic_runtime(LOCAL_CRATE) && tcx.sess.target.target.options.custom_unwind_resume {
186+
let exported_symbol = ExportedSymbol::NoDefId(SymbolName::new("rust_eh_unwind_resume"));
187+
188+
symbols.push((exported_symbol, SymbolExportLevel::Rust));
189+
}
190+
185191
if tcx.allocator_kind().is_some() {
186192
for method in ALLOCATOR_METHODS {
187193
let symbol_name = format!("__rust_{}", method.name);

src/librustc_codegen_ssa/mir/block.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -178,15 +178,10 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
178178
let lp1 = bx.load_operand(lp1).immediate();
179179
slot.storage_dead(&mut bx);
180180

181-
if !bx.sess().target.target.options.custom_unwind_resume {
182-
let mut lp = bx.const_undef(self.landing_pad_type());
183-
lp = bx.insert_value(lp, lp0, 0);
184-
lp = bx.insert_value(lp, lp1, 1);
185-
bx.resume(lp);
186-
} else {
187-
bx.call(bx.eh_unwind_resume(), &[lp0], helper.funclet(self));
188-
bx.unreachable();
189-
}
181+
let mut lp = bx.const_undef(self.landing_pad_type());
182+
lp = bx.insert_value(lp, lp0, 0);
183+
lp = bx.insert_value(lp, lp1, 1);
184+
bx.resume(lp);
190185
}
191186
}
192187

src/librustc_target/spec/windows_base.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ pub fn opts() -> TargetOptions {
6464
],
6565
late_link_args,
6666
post_link_objects: vec!["rsend.o".to_string()],
67-
custom_unwind_resume: false,
67+
custom_unwind_resume: true,
6868
abi_return_struct_as_int: true,
6969
emit_debug_gdb_scripts: false,
7070
requires_uwtable: true,

0 commit comments

Comments
 (0)