Use Default visibility for rustc-generated C symbol declarations
Non-default visibilities should only be used for definitions, not declarations, otherwise linking can fail. Co-authored-by: Collin Baker <collinbaker@chromium.org>
This commit is contained in:
parent
bfe5e8cef6
commit
42c0494499
2 changed files with 19 additions and 4 deletions
|
@ -84,10 +84,9 @@ impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> {
|
|||
unnamed: llvm::UnnamedAddr,
|
||||
fn_type: &'ll Type,
|
||||
) -> &'ll Value {
|
||||
// Declare C ABI functions with the visibility used by C by default.
|
||||
let visibility = Visibility::from_generic(self.tcx.sess.default_visibility());
|
||||
|
||||
declare_raw_fn(self, name, llvm::CCallConv, unnamed, visibility, fn_type)
|
||||
// Visibility should always be default for declarations, otherwise the linker may report an
|
||||
// error.
|
||||
declare_raw_fn(self, name, llvm::CCallConv, unnamed, Visibility::Default, fn_type)
|
||||
}
|
||||
|
||||
/// Declare an entry Function
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue