Skip to content

Commit

Permalink
Auto merge of #116515 - petrochenkov:nolegflavor, r=lqd
Browse files Browse the repository at this point in the history
linker: Remove unstable legacy CLI linker flavors
  • Loading branch information
bors committed Oct 8, 2023
2 parents 4f4a413 + 7ecb09d commit bf9a1c8
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 23 deletions.
15 changes: 3 additions & 12 deletions compiler/rustc_target/src/spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,6 @@ pub enum LinkerFlavorCli {
Ld,
Lld(LldFlavor),
Em,
BpfLinker,
PtxLinker,
}

impl LinkerFlavorCli {
Expand All @@ -199,9 +197,7 @@ impl LinkerFlavorCli {
| LinkerFlavorCli::Msvc(Lld::Yes)
| LinkerFlavorCli::EmCc
| LinkerFlavorCli::Bpf
| LinkerFlavorCli::Ptx
| LinkerFlavorCli::BpfLinker
| LinkerFlavorCli::PtxLinker => true,
| LinkerFlavorCli::Ptx => true,
LinkerFlavorCli::Gcc
| LinkerFlavorCli::Ld
| LinkerFlavorCli::Lld(..)
Expand Down Expand Up @@ -279,8 +275,6 @@ impl LinkerFlavor {
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,
}
}

Expand All @@ -299,8 +293,8 @@ impl LinkerFlavor {
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,
}
}

Expand All @@ -320,7 +314,6 @@ impl LinkerFlavor {
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),
}
}

Expand Down Expand Up @@ -519,8 +512,6 @@ linker_flavor_cli_impls! {
(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 {
Expand Down
8 changes: 3 additions & 5 deletions src/doc/rustc/src/codegen-options/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/linkage-attr/unstable-flavor.bpf.stderr
Original file line number Diff line number Diff line change
@@ -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

2 changes: 1 addition & 1 deletion tests/ui/linkage-attr/unstable-flavor.ptx.stderr
Original file line number Diff line number Diff line change
@@ -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

8 changes: 4 additions & 4 deletions tests/ui/linkage-attr/unstable-flavor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down

0 comments on commit bf9a1c8

Please sign in to comment.