Remove Linkage::Private
This is the same as Linkage::Internal except that it doesn't emit any symbol. Some backends may not support it and it isn't all that useful anyway.
This commit is contained in:
parent
550e035a59
commit
382e4031c2
10 changed files with 4 additions and 19 deletions
|
@ -51,7 +51,6 @@ pub fn global_linkage_to_gcc(linkage: Linkage) -> GlobalKind {
|
||||||
Linkage::WeakODR => unimplemented!(),
|
Linkage::WeakODR => unimplemented!(),
|
||||||
Linkage::Appending => unimplemented!(),
|
Linkage::Appending => unimplemented!(),
|
||||||
Linkage::Internal => GlobalKind::Internal,
|
Linkage::Internal => GlobalKind::Internal,
|
||||||
Linkage::Private => GlobalKind::Internal,
|
|
||||||
Linkage::ExternalWeak => GlobalKind::Imported, // TODO(antoyo): should be weak linkage.
|
Linkage::ExternalWeak => GlobalKind::Imported, // TODO(antoyo): should be weak linkage.
|
||||||
Linkage::Common => unimplemented!(),
|
Linkage::Common => unimplemented!(),
|
||||||
}
|
}
|
||||||
|
@ -68,7 +67,6 @@ pub fn linkage_to_gcc(linkage: Linkage) -> FunctionType {
|
||||||
Linkage::WeakODR => unimplemented!(),
|
Linkage::WeakODR => unimplemented!(),
|
||||||
Linkage::Appending => unimplemented!(),
|
Linkage::Appending => unimplemented!(),
|
||||||
Linkage::Internal => FunctionType::Internal,
|
Linkage::Internal => FunctionType::Internal,
|
||||||
Linkage::Private => FunctionType::Internal,
|
|
||||||
Linkage::ExternalWeak => unimplemented!(),
|
Linkage::ExternalWeak => unimplemented!(),
|
||||||
Linkage::Common => unimplemented!(),
|
Linkage::Common => unimplemented!(),
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,10 +61,7 @@ impl<'gcc, 'tcx> PreDefineCodegenMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
|
||||||
// compiler-rt, then we want to implicitly compile everything with hidden
|
// compiler-rt, then we want to implicitly compile everything with hidden
|
||||||
// visibility as we're going to link this object all over the place but
|
// visibility as we're going to link this object all over the place but
|
||||||
// don't want the symbols to get exported.
|
// don't want the symbols to get exported.
|
||||||
if linkage != Linkage::Internal
|
if linkage != Linkage::Internal && self.tcx.is_compiler_builtins(LOCAL_CRATE) {
|
||||||
&& linkage != Linkage::Private
|
|
||||||
&& self.tcx.is_compiler_builtins(LOCAL_CRATE)
|
|
||||||
{
|
|
||||||
#[cfg(feature = "master")]
|
#[cfg(feature = "master")]
|
||||||
decl.add_attribute(FnAttribute::Visibility(gccjit::Visibility::Hidden));
|
decl.add_attribute(FnAttribute::Visibility(gccjit::Visibility::Hidden));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -159,7 +159,6 @@ pub(crate) fn linkage_to_llvm(linkage: Linkage) -> llvm::Linkage {
|
||||||
Linkage::WeakODR => llvm::Linkage::WeakODRLinkage,
|
Linkage::WeakODR => llvm::Linkage::WeakODRLinkage,
|
||||||
Linkage::Appending => llvm::Linkage::AppendingLinkage,
|
Linkage::Appending => llvm::Linkage::AppendingLinkage,
|
||||||
Linkage::Internal => llvm::Linkage::InternalLinkage,
|
Linkage::Internal => llvm::Linkage::InternalLinkage,
|
||||||
Linkage::Private => llvm::Linkage::PrivateLinkage,
|
|
||||||
Linkage::ExternalWeak => llvm::Linkage::ExternalWeakLinkage,
|
Linkage::ExternalWeak => llvm::Linkage::ExternalWeakLinkage,
|
||||||
Linkage::Common => llvm::Linkage::CommonLinkage,
|
Linkage::Common => llvm::Linkage::CommonLinkage,
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,10 +71,7 @@ impl<'tcx> PreDefineCodegenMethods<'tcx> for CodegenCx<'_, 'tcx> {
|
||||||
// compiler-rt, then we want to implicitly compile everything with hidden
|
// compiler-rt, then we want to implicitly compile everything with hidden
|
||||||
// visibility as we're going to link this object all over the place but
|
// visibility as we're going to link this object all over the place but
|
||||||
// don't want the symbols to get exported.
|
// don't want the symbols to get exported.
|
||||||
if linkage != Linkage::Internal
|
if linkage != Linkage::Internal && self.tcx.is_compiler_builtins(LOCAL_CRATE) {
|
||||||
&& linkage != Linkage::Private
|
|
||||||
&& self.tcx.is_compiler_builtins(LOCAL_CRATE)
|
|
||||||
{
|
|
||||||
llvm::set_visibility(lldecl, llvm::Visibility::Hidden);
|
llvm::set_visibility(lldecl, llvm::Visibility::Hidden);
|
||||||
} else {
|
} else {
|
||||||
llvm::set_visibility(lldecl, base::visibility_to_llvm(visibility));
|
llvm::set_visibility(lldecl, base::visibility_to_llvm(visibility));
|
||||||
|
|
|
@ -49,7 +49,6 @@ fn linkage_by_name(tcx: TyCtxt<'_>, def_id: LocalDefId, name: &str) -> Linkage {
|
||||||
"internal" => Internal,
|
"internal" => Internal,
|
||||||
"linkonce" => LinkOnceAny,
|
"linkonce" => LinkOnceAny,
|
||||||
"linkonce_odr" => LinkOnceODR,
|
"linkonce_odr" => LinkOnceODR,
|
||||||
"private" => Private,
|
|
||||||
"weak" => WeakAny,
|
"weak" => WeakAny,
|
||||||
"weak_odr" => WeakODR,
|
"weak_odr" => WeakODR,
|
||||||
_ => tcx.dcx().span_fatal(tcx.def_span(def_id), "invalid linkage specified"),
|
_ => tcx.dcx().span_fatal(tcx.def_span(def_id), "invalid linkage specified"),
|
||||||
|
|
|
@ -187,7 +187,7 @@ fn prefix_and_suffix<'tcx>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Linkage::Internal | Linkage::Private => {
|
Linkage::Internal => {
|
||||||
// write nothing
|
// write nothing
|
||||||
}
|
}
|
||||||
Linkage::Appending => emit_fatal("Only global variables can have appending linkage!"),
|
Linkage::Appending => emit_fatal("Only global variables can have appending linkage!"),
|
||||||
|
|
|
@ -178,7 +178,7 @@ impl CodegenFnAttrs {
|
||||||
|| match self.linkage {
|
|| match self.linkage {
|
||||||
// These are private, so make sure we don't try to consider
|
// These are private, so make sure we don't try to consider
|
||||||
// them external.
|
// them external.
|
||||||
None | Some(Linkage::Internal | Linkage::Private) => false,
|
None | Some(Linkage::Internal) => false,
|
||||||
Some(_) => true,
|
Some(_) => true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -329,7 +329,6 @@ pub enum Linkage {
|
||||||
WeakODR,
|
WeakODR,
|
||||||
Appending,
|
Appending,
|
||||||
Internal,
|
Internal,
|
||||||
Private,
|
|
||||||
ExternalWeak,
|
ExternalWeak,
|
||||||
Common,
|
Common,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1240,7 +1240,6 @@ fn collect_and_partition_mono_items(tcx: TyCtxt<'_>, (): ()) -> MonoItemPartitio
|
||||||
Linkage::WeakODR => "WeakODR",
|
Linkage::WeakODR => "WeakODR",
|
||||||
Linkage::Appending => "Appending",
|
Linkage::Appending => "Appending",
|
||||||
Linkage::Internal => "Internal",
|
Linkage::Internal => "Internal",
|
||||||
Linkage::Private => "Private",
|
|
||||||
Linkage::ExternalWeak => "ExternalWeak",
|
Linkage::ExternalWeak => "ExternalWeak",
|
||||||
Linkage::Common => "Common",
|
Linkage::Common => "Common",
|
||||||
};
|
};
|
||||||
|
|
|
@ -18,9 +18,6 @@ pub static TEST4: bool = true;
|
||||||
#[linkage = "linkonce_odr"]
|
#[linkage = "linkonce_odr"]
|
||||||
pub static TEST5: bool = true;
|
pub static TEST5: bool = true;
|
||||||
|
|
||||||
#[linkage = "private"]
|
|
||||||
pub static TEST6: bool = true;
|
|
||||||
|
|
||||||
#[linkage = "weak"]
|
#[linkage = "weak"]
|
||||||
pub static TEST7: bool = true;
|
pub static TEST7: bool = true;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue