From 7ecb09d05c05daa437fba557b0f6733d6759c96c Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Sat, 7 Oct 2023 14:27:58 +0300 Subject: [PATCH] linker: Remove unstable legacy CLI linker flavors --- compiler/rustc_target/src/spec/mod.rs | 15 +++------------ src/doc/rustc/src/codegen-options/index.md | 8 +++----- tests/ui/linkage-attr/unstable-flavor.bpf.stderr | 2 +- tests/ui/linkage-attr/unstable-flavor.ptx.stderr | 2 +- tests/ui/linkage-attr/unstable-flavor.rs | 8 ++++---- 5 files changed, 12 insertions(+), 23 deletions(-) diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs index 1bcb1f35315..d4774386e2e 100644 --- a/compiler/rustc_target/src/spec/mod.rs +++ b/compiler/rustc_target/src/spec/mod.rs @@ -184,8 +184,6 @@ pub enum LinkerFlavorCli { Ld, Lld(LldFlavor), Em, - BpfLinker, - PtxLinker, } impl LinkerFlavorCli { @@ -199,9 +197,7 @@ pub fn is_unstable(&self) -> bool { | LinkerFlavorCli::Msvc(Lld::Yes) | LinkerFlavorCli::EmCc | LinkerFlavorCli::Bpf - | LinkerFlavorCli::Ptx - | LinkerFlavorCli::BpfLinker - | LinkerFlavorCli::PtxLinker => true, + | LinkerFlavorCli::Ptx => true, LinkerFlavorCli::Gcc | LinkerFlavorCli::Ld | LinkerFlavorCli::Lld(..) @@ -279,8 +275,6 @@ fn from_cli_json(cli: LinkerFlavorCli, lld_flavor: LldFlavor, is_gnu: bool) -> L LinkerFlavorCli::Lld(LldFlavor::Wasm) => LinkerFlavor::WasmLld(Cc::No), LinkerFlavorCli::Lld(LldFlavor::Link) => LinkerFlavor::Msvc(Lld::Yes), LinkerFlavorCli::Em => LinkerFlavor::EmCc, - LinkerFlavorCli::BpfLinker => LinkerFlavor::Bpf, - LinkerFlavorCli::PtxLinker => LinkerFlavor::Ptx, } } @@ -299,8 +293,8 @@ fn to_cli(self) -> LinkerFlavorCli { LinkerFlavor::Msvc(Lld::Yes) => LinkerFlavorCli::Lld(LldFlavor::Link), LinkerFlavor::Msvc(..) => LinkerFlavorCli::Msvc(Lld::No), LinkerFlavor::EmCc => LinkerFlavorCli::Em, - LinkerFlavor::Bpf => LinkerFlavorCli::BpfLinker, - LinkerFlavor::Ptx => LinkerFlavorCli::PtxLinker, + LinkerFlavor::Bpf => LinkerFlavorCli::Bpf, + LinkerFlavor::Ptx => LinkerFlavorCli::Ptx, } } @@ -320,7 +314,6 @@ fn infer_cli_hints(cli: LinkerFlavorCli) -> (Option, Option) { LinkerFlavorCli::Ld => (Some(Cc::No), Some(Lld::No)), LinkerFlavorCli::Lld(_) => (Some(Cc::No), Some(Lld::Yes)), LinkerFlavorCli::Em => (Some(Cc::Yes), Some(Lld::Yes)), - LinkerFlavorCli::BpfLinker | LinkerFlavorCli::PtxLinker => (None, None), } } @@ -519,8 +512,6 @@ pub fn desc(self) -> &'static str { (LinkerFlavorCli::Lld(LldFlavor::Link)) "lld-link" (LinkerFlavorCli::Lld(LldFlavor::Wasm)) "wasm-ld" (LinkerFlavorCli::Em) "em" - (LinkerFlavorCli::BpfLinker) "bpf-linker" - (LinkerFlavorCli::PtxLinker) "ptx-linker" } impl ToJson for LinkerFlavorCli { diff --git a/src/doc/rustc/src/codegen-options/index.md b/src/doc/rustc/src/codegen-options/index.md index d72543c7e02..cfbe1e09cde 100644 --- a/src/doc/rustc/src/codegen-options/index.md +++ b/src/doc/rustc/src/codegen-options/index.md @@ -249,11 +249,9 @@ flavor. Valid options are: * `gcc`: use the `cc` executable, which is typically gcc or clang on many systems. * `ld`: use the `ld` executable. * `msvc`: use the `link.exe` executable from Microsoft Visual Studio MSVC. -* `ptx-linker`: use - [`rust-ptx-linker`](https://github.com/denzp/rust-ptx-linker) for Nvidia - NVPTX GPGPU support. -* `bpf-linker`: use - [`bpf-linker`](https://github.com/alessandrod/bpf-linker) for eBPF support. +* `ptx`: use [`rust-ptx-linker`](https://github.com/denzp/rust-ptx-linker) + for Nvidia NVPTX GPGPU support. +* `bpf`: use [`bpf-linker`](https://github.com/alessandrod/bpf-linker) for eBPF support. * `wasm-ld`: use the [`wasm-ld`](https://lld.llvm.org/WebAssembly.html) executable, a port of LLVM `lld` for WebAssembly. * `ld64.lld`: use the LLVM `lld` executable with the [`-flavor darwin` diff --git a/tests/ui/linkage-attr/unstable-flavor.bpf.stderr b/tests/ui/linkage-attr/unstable-flavor.bpf.stderr index 594a461769b..819da2fb017 100644 --- a/tests/ui/linkage-attr/unstable-flavor.bpf.stderr +++ b/tests/ui/linkage-attr/unstable-flavor.bpf.stderr @@ -1,2 +1,2 @@ -error: the linker flavor `bpf-linker` is unstable, the `-Z unstable-options` flag must also be passed to use the unstable values +error: the linker flavor `bpf` is unstable, the `-Z unstable-options` flag must also be passed to use the unstable values diff --git a/tests/ui/linkage-attr/unstable-flavor.ptx.stderr b/tests/ui/linkage-attr/unstable-flavor.ptx.stderr index 714c09df53f..2ebdc1a9033 100644 --- a/tests/ui/linkage-attr/unstable-flavor.ptx.stderr +++ b/tests/ui/linkage-attr/unstable-flavor.ptx.stderr @@ -1,2 +1,2 @@ -error: the linker flavor `ptx-linker` is unstable, the `-Z unstable-options` flag must also be passed to use the unstable values +error: the linker flavor `ptx` is unstable, the `-Z unstable-options` flag must also be passed to use the unstable values diff --git a/tests/ui/linkage-attr/unstable-flavor.rs b/tests/ui/linkage-attr/unstable-flavor.rs index b58fd055fdc..c2c16b28bff 100644 --- a/tests/ui/linkage-attr/unstable-flavor.rs +++ b/tests/ui/linkage-attr/unstable-flavor.rs @@ -3,11 +3,11 @@ // caller). If it passes, all the other unstable options are rejected as well. // // revisions: bpf ptx -// [bpf] compile-flags: --target=bpfel-unknown-none -C linker-flavor=bpf-linker --crate-type=rlib -// [bpf] error-pattern: linker flavor `bpf-linker` is unstable, the `-Z unstable-options` flag +// [bpf] compile-flags: --target=bpfel-unknown-none -C linker-flavor=bpf --crate-type=rlib +// [bpf] error-pattern: linker flavor `bpf` is unstable, the `-Z unstable-options` flag // [bpf] needs-llvm-components: -// [ptx] compile-flags: --target=nvptx64-nvidia-cuda -C linker-flavor=ptx-linker --crate-type=rlib -// [ptx] error-pattern: linker flavor `ptx-linker` is unstable, the `-Z unstable-options` flag +// [ptx] compile-flags: --target=nvptx64-nvidia-cuda -C linker-flavor=ptx --crate-type=rlib +// [ptx] error-pattern: linker flavor `ptx` is unstable, the `-Z unstable-options` flag // [ptx] needs-llvm-components: #![feature(no_core)]