Skip to content

Commit a8d29ef

Browse files
authored
Unrolled build for rust-lang#136691
Rollup merge of rust-lang#136691 - bjorn3:linkage_cleanup, r=jieyouxu Remove Linkage::Private and Linkage::Appending Neither of them has any use case. Neither known nor theoretical.
2 parents d2f335d + f68cd90 commit a8d29ef

File tree

10 files changed

+4
-26
lines changed

10 files changed

+4
-26
lines changed

compiler/rustc_codegen_gcc/src/base.rs

-4
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,7 @@ pub fn global_linkage_to_gcc(linkage: Linkage) -> GlobalKind {
4949
Linkage::LinkOnceODR => unimplemented!(),
5050
Linkage::WeakAny => unimplemented!(),
5151
Linkage::WeakODR => unimplemented!(),
52-
Linkage::Appending => unimplemented!(),
5352
Linkage::Internal => GlobalKind::Internal,
54-
Linkage::Private => GlobalKind::Internal,
5553
Linkage::ExternalWeak => GlobalKind::Imported, // TODO(antoyo): should be weak linkage.
5654
Linkage::Common => unimplemented!(),
5755
}
@@ -66,9 +64,7 @@ pub fn linkage_to_gcc(linkage: Linkage) -> FunctionType {
6664
Linkage::LinkOnceODR => unimplemented!(),
6765
Linkage::WeakAny => FunctionType::Exported, // FIXME(antoyo): should be similar to linkonce.
6866
Linkage::WeakODR => unimplemented!(),
69-
Linkage::Appending => unimplemented!(),
7067
Linkage::Internal => FunctionType::Internal,
71-
Linkage::Private => FunctionType::Internal,
7268
Linkage::ExternalWeak => unimplemented!(),
7369
Linkage::Common => unimplemented!(),
7470
}

compiler/rustc_codegen_gcc/src/mono_item.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,7 @@ impl<'gcc, 'tcx> PreDefineCodegenMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
6161
// compiler-rt, then we want to implicitly compile everything with hidden
6262
// visibility as we're going to link this object all over the place but
6363
// don't want the symbols to get exported.
64-
if linkage != Linkage::Internal
65-
&& linkage != Linkage::Private
66-
&& self.tcx.is_compiler_builtins(LOCAL_CRATE)
67-
{
64+
if linkage != Linkage::Internal && self.tcx.is_compiler_builtins(LOCAL_CRATE) {
6865
#[cfg(feature = "master")]
6966
decl.add_attribute(FnAttribute::Visibility(gccjit::Visibility::Hidden));
7067
} else {

compiler/rustc_codegen_llvm/src/base.rs

-2
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,7 @@ pub(crate) fn linkage_to_llvm(linkage: Linkage) -> llvm::Linkage {
157157
Linkage::LinkOnceODR => llvm::Linkage::LinkOnceODRLinkage,
158158
Linkage::WeakAny => llvm::Linkage::WeakAnyLinkage,
159159
Linkage::WeakODR => llvm::Linkage::WeakODRLinkage,
160-
Linkage::Appending => llvm::Linkage::AppendingLinkage,
161160
Linkage::Internal => llvm::Linkage::InternalLinkage,
162-
Linkage::Private => llvm::Linkage::PrivateLinkage,
163161
Linkage::ExternalWeak => llvm::Linkage::ExternalWeakLinkage,
164162
Linkage::Common => llvm::Linkage::CommonLinkage,
165163
}

compiler/rustc_codegen_llvm/src/mono_item.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,7 @@ impl<'tcx> PreDefineCodegenMethods<'tcx> for CodegenCx<'_, 'tcx> {
7171
// compiler-rt, then we want to implicitly compile everything with hidden
7272
// visibility as we're going to link this object all over the place but
7373
// don't want the symbols to get exported.
74-
if linkage != Linkage::Internal
75-
&& linkage != Linkage::Private
76-
&& self.tcx.is_compiler_builtins(LOCAL_CRATE)
77-
{
74+
if linkage != Linkage::Internal && self.tcx.is_compiler_builtins(LOCAL_CRATE) {
7875
llvm::set_visibility(lldecl, llvm::Visibility::Hidden);
7976
} else {
8077
llvm::set_visibility(lldecl, base::visibility_to_llvm(visibility));

compiler/rustc_codegen_ssa/src/codegen_attrs.rs

-2
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,13 @@ fn linkage_by_name(tcx: TyCtxt<'_>, def_id: LocalDefId, name: &str) -> Linkage {
4141
// ghost, dllimport, dllexport and linkonce_odr_autohide are not supported
4242
// and don't have to be, LLVM treats them as no-ops.
4343
match name {
44-
"appending" => Appending,
4544
"available_externally" => AvailableExternally,
4645
"common" => Common,
4746
"extern_weak" => ExternalWeak,
4847
"external" => External,
4948
"internal" => Internal,
5049
"linkonce" => LinkOnceAny,
5150
"linkonce_odr" => LinkOnceODR,
52-
"private" => Private,
5351
"weak" => WeakAny,
5452
"weak_odr" => WeakODR,
5553
_ => tcx.dcx().span_fatal(tcx.def_span(def_id), "invalid linkage specified"),

compiler/rustc_codegen_ssa/src/mir/naked_asm.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,9 @@ fn prefix_and_suffix<'tcx>(
187187
}
188188
}
189189
}
190-
Linkage::Internal | Linkage::Private => {
190+
Linkage::Internal => {
191191
// write nothing
192192
}
193-
Linkage::Appending => emit_fatal("Only global variables can have appending linkage!"),
194193
Linkage::Common => emit_fatal("Functions may not have common linkage"),
195194
Linkage::AvailableExternally => {
196195
// this would make the function equal an extern definition

compiler/rustc_middle/src/middle/codegen_fn_attrs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ impl CodegenFnAttrs {
178178
|| match self.linkage {
179179
// These are private, so make sure we don't try to consider
180180
// them external.
181-
None | Some(Linkage::Internal | Linkage::Private) => false,
181+
None | Some(Linkage::Internal) => false,
182182
Some(_) => true,
183183
}
184184
}

compiler/rustc_middle/src/mir/mono.rs

-2
Original file line numberDiff line numberDiff line change
@@ -327,9 +327,7 @@ pub enum Linkage {
327327
LinkOnceODR,
328328
WeakAny,
329329
WeakODR,
330-
Appending,
331330
Internal,
332-
Private,
333331
ExternalWeak,
334332
Common,
335333
}

compiler/rustc_monomorphize/src/partitioning.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1238,9 +1238,7 @@ fn collect_and_partition_mono_items(tcx: TyCtxt<'_>, (): ()) -> MonoItemPartitio
12381238
Linkage::LinkOnceODR => "OnceODR",
12391239
Linkage::WeakAny => "WeakAny",
12401240
Linkage::WeakODR => "WeakODR",
1241-
Linkage::Appending => "Appending",
12421241
Linkage::Internal => "Internal",
1243-
Linkage::Private => "Private",
12441242
Linkage::ExternalWeak => "ExternalWeak",
12451243
Linkage::Common => "Common",
12461244
};

tests/ui/linkage-attr/linkage-attr-does-not-panic-llvm-issue-33992.rs

-3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ pub static TEST4: bool = true;
1818
#[linkage = "linkonce_odr"]
1919
pub static TEST5: bool = true;
2020

21-
#[linkage = "private"]
22-
pub static TEST6: bool = true;
23-
2421
#[linkage = "weak"]
2522
pub static TEST7: bool = true;
2623

0 commit comments

Comments
 (0)