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
This commit is contained in:
Vadim Petrochenkov 2020-11-11 20:40:51 +03:00
parent 443b45fa9f
commit 1def24c5f4
14 changed files with 3 additions and 19 deletions

View File

@ -10,7 +10,6 @@ use super::{LinkerFlavor, LldFlavor, PanicStrategy, RelocModel, Target, TargetOp
pub fn target() -> Target {
let opts = TargetOptions {
vendor: String::new(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
linker: Some("rust-lld".to_owned()),
features: "+strict-align,+neon,+fp-armv8".to_string(),

View File

@ -10,7 +10,6 @@ use super::{LinkerFlavor, LldFlavor, PanicStrategy, RelocModel, Target, TargetOp
pub fn target() -> Target {
let opts = TargetOptions {
vendor: String::new(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
linker: Some("rust-lld".to_owned()),
features: "+strict-align,-neon,-fp-armv8".to_string(),

View File

@ -12,7 +12,6 @@ pub fn target() -> Target {
options: TargetOptions {
endian: "big".to_string(),
vendor: String::new(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
executables: true,
linker: Some("rust-lld".to_owned()),

View File

@ -12,7 +12,6 @@ pub fn target() -> Target {
options: TargetOptions {
endian: "big".to_string(),
vendor: String::new(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
executables: true,
linker: Some("rust-lld".to_owned()),

View File

@ -10,9 +10,6 @@
// bare-metal binaries (the `gcc` linker has the advantage that it knows where C
// libraries and crt*.o are but it's not much of an advantage here); LLD is also
// faster
// - `os` set to `none`. rationale: matches `thumb` targets
// - `env` and `vendor` are set to an empty string. rationale: matches `thumb`
// targets
// - `panic_strategy` set to `abort`. rationale: matches `thumb` targets
// - `relocation-model` set to `static`; also no PIE, no relro and no dynamic
// linking. rationale: matches `thumb` targets
@ -21,7 +18,6 @@ use super::{LinkerFlavor, LldFlavor, PanicStrategy, RelocModel, Target, TargetOp
pub fn target() -> Target {
let opts = TargetOptions {
vendor: String::new(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
linker: Some("rust-lld".to_owned()),
features: "+v7,+thumb2,+soft-float,-neon,+strict-align".to_string(),

View File

@ -9,7 +9,6 @@ use super::{LinkerFlavor, LldFlavor, PanicStrategy, RelocModel, Target, TargetOp
pub fn target() -> Target {
let opts = TargetOptions {
vendor: String::new(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
linker: Some("rust-lld".to_owned()),
features: "+v7,+vfp3,-d32,+thumb2,-neon,+strict-align".to_string(),

View File

@ -11,7 +11,6 @@ pub fn target() -> Target {
arch: "arm".to_string(),
options: TargetOptions {
vendor: String::new(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
executables: true,
linker: Some("rust-lld".to_owned()),

View File

@ -11,7 +11,6 @@ pub fn target() -> Target {
arch: "arm".to_string(),
options: TargetOptions {
vendor: String::new(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
executables: true,
linker: Some("rust-lld".to_owned()),

View File

@ -21,7 +21,6 @@ pub fn opts() -> TargetOptions {
TargetOptions {
os: "fuchsia".to_string(),
vendor: String::new(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
linker: Some("rust-lld".to_owned()),
lld_flavor: LldFlavor::Ld,

View File

@ -14,7 +14,6 @@ pub fn target() -> Target {
arch: "mips".to_string(),
options: TargetOptions {
vendor: String::new(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
cpu: "mips32r2".to_string(),
features: "+mips32r2,+soft-float,+noabicalls".to_string(),

View File

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

View File

@ -9,7 +9,6 @@ pub fn target() -> Target {
options: TargetOptions {
c_int_width: "16".to_string(),
vendor: String::new(),
executables: true,
// The LLVM backend currently can't generate object files. To

View File

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

View File

@ -79,7 +79,6 @@ pub fn target() -> Target {
let mut options = wasm32_base::options();
options.os = "wasi".to_string();
options.vendor = String::new();
options.linker_flavor = LinkerFlavor::Lld(LldFlavor::Wasm);
options
.pre_link_args