Skip to content

Commit

Permalink
Rollup merge of #78929 - petrochenkov:linuxbase, r=joshtriplett
Browse files Browse the repository at this point in the history
rustc_target: Move target env "gnu" from `linux_base` to `linux_gnu_base`

Follow up to #77729.

Changes the target spec hierarchy for Linux from
```
linux_base
├── linux_musl_base
└── linux_uclibc_base
```
where `linux_base` is really `linux_gnu_base` and the inheriting targets replace target env "gnu" with "musl"/"uclibc" to
```
linux_base
├── linux_gnu_base
├── linux_musl_base
└── linux_uclibc_base
```
which is slightly less confusing (I think).
  • Loading branch information
jonas-schievink committed Nov 11, 2020
2 parents a8a0c65 + ca17a91 commit 5ac0ae4
Show file tree
Hide file tree
Showing 32 changed files with 35 additions and 30 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::spec::{Target, TargetOptions};

pub fn target() -> Target {
let mut base = super::linux_base::opts();
let mut base = super::linux_gnu_base::opts();
base.max_atomic_width = Some(128);

Target {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_target/src/spec/android_base.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::spec::{LinkerFlavor, TargetOptions};

pub fn opts() -> TargetOptions {
let mut base = super::linux_base::opts();
let mut base = super::linux_gnu_base::opts();
base.os = "android".to_string();
// Many of the symbols defined in compiler-rt are also defined in libgcc.
// Android's linker doesn't like that by default.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::spec::{Target, TargetOptions};

pub fn target() -> Target {
let mut base = super::linux_base::opts();
let mut base = super::linux_gnu_base::opts();
base.max_atomic_width = Some(64);
Target {
llvm_target: "arm-unknown-linux-gnueabi".to_string(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::spec::{Target, TargetOptions};

pub fn target() -> Target {
let mut base = super::linux_base::opts();
let mut base = super::linux_gnu_base::opts();
base.max_atomic_width = Some(64);
Target {
llvm_target: "arm-unknown-linux-gnueabihf".to_string(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::spec::{Target, TargetOptions};

pub fn target() -> Target {
let base = super::linux_base::opts();
let base = super::linux_gnu_base::opts();
Target {
llvm_target: "armv4t-unknown-linux-gnueabi".to_string(),
pointer_width: 32,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::spec::{Target, TargetOptions};

pub fn target() -> Target {
let base = super::linux_base::opts();
let base = super::linux_gnu_base::opts();
Target {
llvm_target: "armv5te-unknown-linux-gnueabi".to_string(),
pointer_width: 32,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::spec::{Target, TargetOptions};
// hardfloat.

pub fn target() -> Target {
let base = super::linux_base::opts();
let base = super::linux_gnu_base::opts();
Target {
llvm_target: "armv7-unknown-linux-gnueabi".to_string(),
pointer_width: 32,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::spec::{Target, TargetOptions};
// thumb-mode. See the thumbv7neon variant for enabling both.

pub fn target() -> Target {
let base = super::linux_base::opts();
let base = super::linux_gnu_base::opts();
Target {
llvm_target: "armv7-unknown-linux-gnueabihf".to_string(),
pointer_width: 32,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_target/src/spec/i686_unknown_linux_gnu.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::spec::{LinkerFlavor, Target};

pub fn target() -> Target {
let mut base = super::linux_base::opts();
let mut base = super::linux_gnu_base::opts();
base.cpu = "pentium4".to_string();
base.max_atomic_width = Some(64);
base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m32".to_string());
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_target/src/spec/linux_base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ pub fn opts() -> TargetOptions {

TargetOptions {
os: "linux".to_string(),
env: "gnu".to_string(),
dynamic_linking: true,
executables: true,
os_family: Some("unix".to_string()),
Expand Down
5 changes: 5 additions & 0 deletions compiler/rustc_target/src/spec/linux_gnu_base.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
use crate::spec::TargetOptions;

pub fn opts() -> TargetOptions {
TargetOptions { env: "gnu".to_string(), ..super::linux_base::opts() }
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub fn target() -> Target {
max_atomic_width: Some(64),
mcount: "_mcount".to_string(),

..super::linux_base::opts()
..super::linux_gnu_base::opts()
},
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub fn target() -> Target {
max_atomic_width: Some(64),
mcount: "_mcount".to_string(),

..super::linux_base::opts()
..super::linux_gnu_base::opts()
},
}
}
2 changes: 1 addition & 1 deletion compiler/rustc_target/src/spec/mips_unknown_linux_gnu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub fn target() -> Target {
max_atomic_width: Some(32),
mcount: "_mcount".to_string(),

..super::linux_base::opts()
..super::linux_gnu_base::opts()
},
}
}
2 changes: 1 addition & 1 deletion compiler/rustc_target/src/spec/mipsel_unknown_linux_gnu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub fn target() -> Target {
max_atomic_width: Some(32),
mcount: "_mcount".to_string(),

..super::linux_base::opts()
..super::linux_gnu_base::opts()
},
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub fn target() -> Target {
max_atomic_width: Some(32),
mcount: "_mcount".to_string(),

..super::linux_base::opts()
..super::linux_gnu_base::opts()
},
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub fn target() -> Target {
max_atomic_width: Some(32),
mcount: "_mcount".to_string(),

..super::linux_base::opts()
..super::linux_gnu_base::opts()
},
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub fn target() -> Target {
max_atomic_width: Some(64),
mcount: "_mcount".to_string(),

..super::linux_base::opts()
..super::linux_gnu_base::opts()
},
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub fn target() -> Target {
max_atomic_width: Some(64),
mcount: "_mcount".to_string(),

..super::linux_base::opts()
..super::linux_gnu_base::opts()
},
}
}
1 change: 1 addition & 0 deletions compiler/rustc_target/src/spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ mod hermit_kernel_base;
mod illumos_base;
mod l4re_base;
mod linux_base;
mod linux_gnu_base;
mod linux_kernel_base;
mod linux_musl_base;
mod linux_uclibc_base;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::spec::{LinkerFlavor, RelroLevel, Target, TargetOptions};

pub fn target() -> Target {
let mut base = super::linux_base::opts();
let mut base = super::linux_gnu_base::opts();
base.cpu = "ppc64".to_string();
base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string());
base.max_atomic_width = Some(64);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions};

pub fn target() -> Target {
let mut base = super::linux_base::opts();
let mut base = super::linux_gnu_base::opts();
base.cpu = "ppc64le".to_string();
base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string());
base.max_atomic_width = Some(64);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions};

pub fn target() -> Target {
let mut base = super::linux_base::opts();
let mut base = super::linux_gnu_base::opts();
base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m32".to_string());
base.max_atomic_width = Some(32);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions};

pub fn target() -> Target {
let mut base = super::linux_base::opts();
let mut base = super::linux_gnu_base::opts();
base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-mspe".to_string());
base.max_atomic_width = Some(32);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub fn target() -> Target {
features: "+m,+a,+f,+d,+c".to_string(),
llvm_abiname: "ilp32d".to_string(),
max_atomic_width: Some(32),
..super::linux_base::opts()
..super::linux_gnu_base::opts()
},
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub fn target() -> Target {
features: "+m,+a,+f,+d,+c".to_string(),
llvm_abiname: "lp64d".to_string(),
max_atomic_width: Some(64),
..super::linux_base::opts()
..super::linux_gnu_base::opts()
},
}
}
2 changes: 1 addition & 1 deletion compiler/rustc_target/src/spec/s390x_unknown_linux_gnu.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::spec::Target;

pub fn target() -> Target {
let mut base = super::linux_base::opts();
let mut base = super::linux_gnu_base::opts();
base.endian = "big".to_string();
// z10 is the oldest CPU supported by LLVM
base.cpu = "z10".to_string();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::spec::Target;

pub fn target() -> Target {
let mut base = super::linux_base::opts();
let mut base = super::linux_gnu_base::opts();
base.endian = "big".to_string();
base.cpu = "v9".to_string();
base.max_atomic_width = Some(64);
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_target/src/spec/sparc_unknown_linux_gnu.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::spec::{LinkerFlavor, Target};

pub fn target() -> Target {
let mut base = super::linux_base::opts();
let mut base = super::linux_gnu_base::opts();
base.endian = "big".to_string();
base.cpu = "v9".to_string();
base.max_atomic_width = Some(64);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::spec::{Target, TargetOptions};
// https://static.docs.arm.com/ddi0406/cd/DDI0406C_d_armv7ar_arm.pdf

pub fn target() -> Target {
let base = super::linux_base::opts();
let base = super::linux_gnu_base::opts();
Target {
llvm_target: "armv7-unknown-linux-gnueabihf".to_string(),
pointer_width: 32,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_target/src/spec/x86_64_unknown_linux_gnu.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::spec::{LinkerFlavor, Target};

pub fn target() -> Target {
let mut base = super::linux_base::opts();
let mut base = super::linux_gnu_base::opts();
base.cpu = "x86-64".to_string();
base.max_atomic_width = Some(64);
base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::spec::{LinkerFlavor, Target};

pub fn target() -> Target {
let mut base = super::linux_base::opts();
let mut base = super::linux_gnu_base::opts();
base.cpu = "x86-64".to_string();
base.max_atomic_width = Some(64);
base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-mx32".to_string());
Expand Down

0 comments on commit 5ac0ae4

Please sign in to comment.