Skip to content

Commit 1def24c

Browse files
committed
rustc_target: Normalize vendor from "" to "unknown" for all targets
Majority of targets use "unknown" vendor and changing it from "unknown" to omitted doesn't make sense. From the LLVM docs (https://clang.llvm.org/docs/CrossCompilation.html#target-triple): >Most of the time it can be omitted (and Unknown) will be assumed, which sets the defaults for the specified architecture. >When a parameter is not important, it can be omitted, or you can choose unknown and the defaults will be used. If you choose a parameter that Clang doesn’t know, like blerg, it’ll ignore and assume unknown
1 parent 443b45f commit 1def24c

14 files changed

+3
-19
lines changed

compiler/rustc_target/src/spec/aarch64_unknown_none.rs

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ use super::{LinkerFlavor, LldFlavor, PanicStrategy, RelocModel, Target, TargetOp
1010

1111
pub fn target() -> Target {
1212
let opts = TargetOptions {
13-
vendor: String::new(),
1413
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
1514
linker: Some("rust-lld".to_owned()),
1615
features: "+strict-align,+neon,+fp-armv8".to_string(),

compiler/rustc_target/src/spec/aarch64_unknown_none_softfloat.rs

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ use super::{LinkerFlavor, LldFlavor, PanicStrategy, RelocModel, Target, TargetOp
1010

1111
pub fn target() -> Target {
1212
let opts = TargetOptions {
13-
vendor: String::new(),
1413
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
1514
linker: Some("rust-lld".to_owned()),
1615
features: "+strict-align,-neon,-fp-armv8".to_string(),

compiler/rustc_target/src/spec/armebv7r_none_eabi.rs

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ pub fn target() -> Target {
1212

1313
options: TargetOptions {
1414
endian: "big".to_string(),
15-
vendor: String::new(),
1615
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
1716
executables: true,
1817
linker: Some("rust-lld".to_owned()),

compiler/rustc_target/src/spec/armebv7r_none_eabihf.rs

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ pub fn target() -> Target {
1212

1313
options: TargetOptions {
1414
endian: "big".to_string(),
15-
vendor: String::new(),
1615
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
1716
executables: true,
1817
linker: Some("rust-lld".to_owned()),

compiler/rustc_target/src/spec/armv7a_none_eabi.rs

-4
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
// bare-metal binaries (the `gcc` linker has the advantage that it knows where C
1111
// libraries and crt*.o are but it's not much of an advantage here); LLD is also
1212
// faster
13-
// - `os` set to `none`. rationale: matches `thumb` targets
14-
// - `env` and `vendor` are set to an empty string. rationale: matches `thumb`
15-
// targets
1613
// - `panic_strategy` set to `abort`. rationale: matches `thumb` targets
1714
// - `relocation-model` set to `static`; also no PIE, no relro and no dynamic
1815
// linking. rationale: matches `thumb` targets
@@ -21,7 +18,6 @@ use super::{LinkerFlavor, LldFlavor, PanicStrategy, RelocModel, Target, TargetOp
2118

2219
pub fn target() -> Target {
2320
let opts = TargetOptions {
24-
vendor: String::new(),
2521
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
2622
linker: Some("rust-lld".to_owned()),
2723
features: "+v7,+thumb2,+soft-float,-neon,+strict-align".to_string(),

compiler/rustc_target/src/spec/armv7a_none_eabihf.rs

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use super::{LinkerFlavor, LldFlavor, PanicStrategy, RelocModel, Target, TargetOp
99

1010
pub fn target() -> Target {
1111
let opts = TargetOptions {
12-
vendor: String::new(),
1312
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
1413
linker: Some("rust-lld".to_owned()),
1514
features: "+v7,+vfp3,-d32,+thumb2,-neon,+strict-align".to_string(),

compiler/rustc_target/src/spec/armv7r_none_eabi.rs

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ pub fn target() -> Target {
1111
arch: "arm".to_string(),
1212

1313
options: TargetOptions {
14-
vendor: String::new(),
1514
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
1615
executables: true,
1716
linker: Some("rust-lld".to_owned()),

compiler/rustc_target/src/spec/armv7r_none_eabihf.rs

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ pub fn target() -> Target {
1111
arch: "arm".to_string(),
1212

1313
options: TargetOptions {
14-
vendor: String::new(),
1514
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
1615
executables: true,
1716
linker: Some("rust-lld".to_owned()),

compiler/rustc_target/src/spec/fuchsia_base.rs

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ pub fn opts() -> TargetOptions {
2121

2222
TargetOptions {
2323
os: "fuchsia".to_string(),
24-
vendor: String::new(),
2524
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
2625
linker: Some("rust-lld".to_owned()),
2726
lld_flavor: LldFlavor::Ld,

compiler/rustc_target/src/spec/mipsel_unknown_none.rs

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ pub fn target() -> Target {
1414
arch: "mips".to_string(),
1515

1616
options: TargetOptions {
17-
vendor: String::new(),
1817
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
1918
cpu: "mips32r2".to_string(),
2019
features: "+mips32r2,+soft-float,+noabicalls".to_string(),

compiler/rustc_target/src/spec/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -712,14 +712,14 @@ pub struct TargetOptions {
712712
pub endian: String,
713713
/// Width of c_int type. Defaults to "32".
714714
pub c_int_width: String,
715-
/// OS name to use for conditional compilation. Defaults to "none".
715+
/// OS name to use for conditional compilation (`target_os`). Defaults to "none".
716716
/// "none" implies a bare metal target without `std` library.
717717
/// A couple of targets having `std` also use "unknown" as an `os` value,
718718
/// but they are exceptions.
719719
pub os: String,
720-
/// Environment name to use for conditional compilation. Defaults to "".
720+
/// Environment name to use for conditional compilation (`target_env`). Defaults to "".
721721
pub env: String,
722-
/// Vendor name to use for conditional compilation. Defaults to "unknown".
722+
/// Vendor name to use for conditional compilation (`target_vendor`). Defaults to "unknown".
723723
pub vendor: String,
724724
/// Default linker flavor used if `-C linker-flavor` or `-C linker` are not passed
725725
/// on the command line. Defaults to `LinkerFlavor::Gcc`.

compiler/rustc_target/src/spec/msp430_none_elf.rs

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ pub fn target() -> Target {
99

1010
options: TargetOptions {
1111
c_int_width: "16".to_string(),
12-
vendor: String::new(),
1312
executables: true,
1413

1514
// The LLVM backend currently can't generate object files. To

compiler/rustc_target/src/spec/thumb_base.rs

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ use crate::spec::{LinkerFlavor, LldFlavor, PanicStrategy, RelocModel, TargetOpti
3232
pub fn opts() -> TargetOptions {
3333
// See rust-lang/rfcs#1645 for a discussion about these defaults
3434
TargetOptions {
35-
vendor: String::new(),
3635
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
3736
executables: true,
3837
// In most cases, LLD is good enough

compiler/rustc_target/src/spec/wasm32_wasi.rs

-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ pub fn target() -> Target {
7979
let mut options = wasm32_base::options();
8080

8181
options.os = "wasi".to_string();
82-
options.vendor = String::new();
8382
options.linker_flavor = LinkerFlavor::Lld(LldFlavor::Wasm);
8483
options
8584
.pre_link_args

0 commit comments

Comments
 (0)