Skip to content

Commit 5d189a7

Browse files
committed
Cleanup
1 parent 943c3e4 commit 5d189a7

File tree

2 files changed

+2
-24
lines changed

2 files changed

+2
-24
lines changed

src/context.rs

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -412,29 +412,6 @@ impl<'gcc, 'tcx> MiscMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
412412
};
413413
let func = self.declare_func(name, self.type_i32(), &[], true);
414414

415-
// NOTE: using a weak alias to rust_eh_personality doesn't seem to work
416-
// (perhaps because it is not exported from the object file?). So
417-
// create a weak wrapper function.
418-
/*let void_ptr_type = self.context.new_type::<*mut ()>();
419-
let param1 = self.context.new_parameter(None, self.type_i32(), "state");
420-
let param2 = self.context.new_parameter(None, void_ptr_type, "exception_object");
421-
let param3 = self.context.new_parameter(None, void_ptr_type, "context");
422-
let gcc_func = self.context.new_function(None, FunctionType::Exported, self.type_i32(), &[param1, param2, param3], "__gcc_personality_v0", false);
423-
gcc_func.add_attribute(FnAttribute::Weak);
424-
let block = gcc_func.new_block("block");
425-
block.end_with_return(None, self.context.new_call(None, func, &[param1.to_rvalue(), param2.to_rvalue(), param3.to_rvalue()]));*/
426-
427-
// FIXME FIXME FIXME: the handling of aliases doesn't seem to work in
428-
// libgccjit.
429-
// Probably because the alias needs to be in the crate where
430-
// rust_eh_personality is defined. Here, we only create an extern for
431-
// rust_eh_personality.
432-
/*
433-
let gcc_func = self.context.new_function(None, FunctionType::Extern, self.type_i32(), &[], "__gcc_personality_v0", true);
434-
gcc_func.add_attribute(FnAttribute::Weak);
435-
gcc_func.add_attribute(FnAttribute::Alias("rust_eh_personality"));
436-
*/
437-
438415
unsafe { std::mem::transmute(func) }
439416
}
440417
};

src/declare.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ fn declare_raw_fn<'gcc>(cx: &CodegenCx<'gcc, '_>, name: &str, _callconv: () /*ll
122122
// rust_eh_personality in order to avoid a linker error.
123123
// This needs to be weak in order to still allow using the standard
124124
// __gcc_personality_v0 when the linking to it.
125+
// Since aliases don't work (maybe because of a bug in LTO partitioning?), we
126+
// create a wrapper function that calls rust_eh_personality.
125127

126128
let params: Vec<_> = param_types.into_iter().enumerate()
127129
.map(|(index, param)| cx.context.new_parameter(None, *param, &format!("param{}", index))) // TODO(antoyo): set name.
@@ -134,7 +136,6 @@ fn declare_raw_fn<'gcc>(cx: &CodegenCx<'gcc, '_>, name: &str, _callconv: () /*ll
134136
// For the crate defining it, that needs to be a weak alias instead.
135137
gcc_func.add_attribute(FnAttribute::Weak);
136138

137-
// TODO: just make a normal wrapper function, calling rust_eh_personality.
138139
let block = gcc_func.new_block("start");
139140
let mut args = vec![];
140141
for param in &params {

0 commit comments

Comments
 (0)