Use existing declaration of rust_eh_personality
If crate declares `rust_eh_personality`, re-use existing declaration as otherwise attempts to set function attributes that follow the declaration will fail (unless it happens to have exactly the same type signature as the one predefined in the compiler).
This commit is contained in:
parent
ae33a9714e
commit
f612ba1f84
2 changed files with 32 additions and 3 deletions
|
@ -385,11 +385,16 @@ impl MiscMethods<'tcx> for CodegenCx<'ll, 'tcx> {
|
|||
} else {
|
||||
"rust_eh_personality"
|
||||
};
|
||||
let fty = self.type_variadic_func(&[], self.type_i32());
|
||||
self.declare_cfn(name, llvm::UnnamedAddr::Global, fty)
|
||||
if let Some(llfn) = self.get_declared_value(name) {
|
||||
llfn
|
||||
} else {
|
||||
let fty = self.type_variadic_func(&[], self.type_i32());
|
||||
let llfn = self.declare_cfn(name, llvm::UnnamedAddr::Global, fty);
|
||||
attributes::apply_target_cpu_attr(self, llfn);
|
||||
llfn
|
||||
}
|
||||
}
|
||||
};
|
||||
attributes::apply_target_cpu_attr(self, llfn);
|
||||
self.eh_personality.set(Some(llfn));
|
||||
llfn
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue