Skip to content

Commit 5157c68

Browse files
committed
[HACK]
1 parent ae6259a commit 5157c68

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

src/abi/mod.rs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,21 @@ pub(crate) fn get_function_sig<'tcx>(
7878
default_call_conv: CallConv,
7979
inst: Instance<'tcx>,
8080
) -> Signature {
81+
// FIXME remove this hack
82+
if tcx.symbol_name(inst).name == "rust_eh_personality" {
83+
return Signature {
84+
params: vec![
85+
AbiParam::new(types::I32),
86+
AbiParam::new(types::I32),
87+
AbiParam::new(types::I64),
88+
AbiParam::new(types::I64 /* FIXME fx.pointer_type */),
89+
AbiParam::new(types::I64 /* FIXME fx.pointer_type */),
90+
],
91+
returns: vec![AbiParam::new(types::I32)],
92+
call_conv: default_call_conv,
93+
};
94+
}
95+
8196
assert!(!inst.args.has_infer());
8297
clif_sig_from_fn_abi(
8398
tcx,
@@ -303,7 +318,10 @@ pub(crate) fn codegen_fn_prelude<'tcx>(fx: &mut FunctionCx<'_, '_, 'tcx>, start_
303318
}
304319

305320
assert!(arg_abis_iter.next().is_none(), "ArgAbi left behind");
306-
assert!(block_params_iter.next().is_none(), "arg_value left behind");
321+
// FIXME remove hack
322+
if fx.symbol_name != "rust_eh_personality" {
323+
assert!(block_params_iter.next().is_none(), "arg_value left behind");
324+
}
307325

308326
self::comments::add_locals_header_comment(fx);
309327

src/debuginfo/unwind.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ impl UnwindContext {
5656
gimli::DwEhPe(gimli::DW_EH_PE_indirect.0 | gimli::DW_EH_PE_absptr.0)
5757
};
5858

59+
// FIXME only add personality function and lsda when necessary: https://github.com/rust-lang/rust/blob/1f76d219c906f0112bb1872f33aa977164c53fa6/compiler/rustc_codegen_ssa/src/mir/mod.rs#L200-L204
60+
5961
cie.fde_address_encoding = ptr_encoding;
6062
cie.lsda_encoding = Some(ptr_encoding);
6163

0 commit comments

Comments
 (0)