Replace every Vec in Target(Options) with it's Cow equivalent
This commit is contained in:
parent
ccff48f97b
commit
ce61d4044d
31 changed files with 117 additions and 53 deletions
|
@ -674,10 +674,10 @@ fn link_natively<'a, B: ArchiveBuilder<'a>>(
|
||||||
|
|
||||||
linker::disable_localization(&mut cmd);
|
linker::disable_localization(&mut cmd);
|
||||||
|
|
||||||
for &(ref k, ref v) in &sess.target.link_env {
|
for &(ref k, ref v) in sess.target.link_env.iter() {
|
||||||
cmd.env(k.as_ref(), v.as_ref());
|
cmd.env(k.as_ref(), v.as_ref());
|
||||||
}
|
}
|
||||||
for k in &sess.target.link_env_remove {
|
for k in sess.target.link_env_remove.iter() {
|
||||||
cmd.env_remove(k.as_ref());
|
cmd.env_remove(k.as_ref());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2247,6 +2247,15 @@ impl<A: ToJson> ToJson for Vec<A> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'a, A: ToJson> ToJson for Cow<'a, [A]>
|
||||||
|
where
|
||||||
|
[A]: ToOwned,
|
||||||
|
{
|
||||||
|
fn to_json(&self) -> Json {
|
||||||
|
Json::Array(self.iter().map(|elt| elt.to_json()).collect())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<T: ToString, A: ToJson> ToJson for BTreeMap<T, A> {
|
impl<T: ToString, A: ToJson> ToJson for BTreeMap<T, A> {
|
||||||
fn to_json(&self) -> Json {
|
fn to_json(&self) -> Json {
|
||||||
let mut d = BTreeMap::new();
|
let mut d = BTreeMap::new();
|
||||||
|
|
|
@ -956,7 +956,7 @@ fn default_configuration(sess: &Session) -> CrateConfig {
|
||||||
ret.reserve(7); // the minimum number of insertions
|
ret.reserve(7); // the minimum number of insertions
|
||||||
// Target bindings.
|
// Target bindings.
|
||||||
ret.insert((sym::target_os, Some(Symbol::intern(os))));
|
ret.insert((sym::target_os, Some(Symbol::intern(os))));
|
||||||
for fam in &sess.target.families {
|
for fam in sess.target.families.iter() {
|
||||||
ret.insert((sym::target_family, Some(Symbol::intern(fam))));
|
ret.insert((sym::target_family, Some(Symbol::intern(fam))));
|
||||||
if fam == "windows" {
|
if fam == "windows" {
|
||||||
ret.insert((sym::windows, None));
|
ret.insert((sym::windows, None));
|
||||||
|
|
|
@ -9,7 +9,7 @@ pub fn target() -> Target {
|
||||||
base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::CFI | SanitizerSet::THREAD;
|
base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::CFI | SanitizerSet::THREAD;
|
||||||
|
|
||||||
base.pre_link_args.insert(LinkerFlavor::Gcc, vec!["-arch".into(), "arm64".into()]);
|
base.pre_link_args.insert(LinkerFlavor::Gcc, vec!["-arch".into(), "arm64".into()]);
|
||||||
base.link_env_remove.extend(super::apple_base::macos_link_env_remove());
|
base.link_env_remove.to_mut().extend(super::apple_base::macos_link_env_remove());
|
||||||
|
|
||||||
// Clang automatically chooses a more specific target based on
|
// Clang automatically chooses a more specific target based on
|
||||||
// MACOSX_DEPLOYMENT_TARGET. To enable cross-language LTO to work
|
// MACOSX_DEPLOYMENT_TARGET. To enable cross-language LTO to work
|
||||||
|
|
|
@ -2,6 +2,8 @@ use std::{borrow::Cow, env};
|
||||||
|
|
||||||
use crate::spec::{FramePointer, LldFlavor, SplitDebuginfo, TargetOptions};
|
use crate::spec::{FramePointer, LldFlavor, SplitDebuginfo, TargetOptions};
|
||||||
|
|
||||||
|
use super::cvs;
|
||||||
|
|
||||||
pub fn opts(os: &'static str) -> TargetOptions {
|
pub fn opts(os: &'static str) -> TargetOptions {
|
||||||
// ELF TLS is only available in macOS 10.7+. If you try to compile for 10.6
|
// ELF TLS is only available in macOS 10.7+. If you try to compile for 10.6
|
||||||
// either the linker will complain if it is used or the binary will end up
|
// either the linker will complain if it is used or the binary will end up
|
||||||
|
@ -26,7 +28,7 @@ pub fn opts(os: &'static str) -> TargetOptions {
|
||||||
dynamic_linking: true,
|
dynamic_linking: true,
|
||||||
linker_is_gnu: false,
|
linker_is_gnu: false,
|
||||||
executables: true,
|
executables: true,
|
||||||
families: vec!["unix".into()],
|
families: cvs!["unix"],
|
||||||
is_like_osx: true,
|
is_like_osx: true,
|
||||||
dwarf_version: Some(2),
|
dwarf_version: Some(2),
|
||||||
frame_pointer: FramePointer::Always,
|
frame_pointer: FramePointer::Always,
|
||||||
|
@ -51,7 +53,7 @@ pub fn opts(os: &'static str) -> TargetOptions {
|
||||||
// this environment variable too in recent versions.
|
// this environment variable too in recent versions.
|
||||||
//
|
//
|
||||||
// For some more info see the commentary on #47086
|
// For some more info see the commentary on #47086
|
||||||
link_env: vec![("ZERO_AR_DATE".into(), "1".into())],
|
link_env: Cow::Borrowed(&[(Cow::Borrowed("ZERO_AR_DATE"), Cow::Borrowed("1"))]),
|
||||||
|
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::spec::TargetOptions;
|
use crate::{spec::cvs, spec::TargetOptions};
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
|
|
||||||
use Arch::*;
|
use Arch::*;
|
||||||
|
@ -36,12 +36,12 @@ fn target_cpu(arch: Arch) -> &'static str {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn link_env_remove(arch: Arch) -> Vec<Cow<'static, str>> {
|
fn link_env_remove(arch: Arch) -> Cow<'static, [Cow<'static, str>]> {
|
||||||
match arch {
|
match arch {
|
||||||
Armv7 | Armv7s | Arm64 | I386 | X86_64 | Arm64_sim => {
|
Armv7 | Armv7s | Arm64 | I386 | X86_64 | Arm64_sim => {
|
||||||
vec!["MACOSX_DEPLOYMENT_TARGET".into()]
|
cvs!["MACOSX_DEPLOYMENT_TARGET"]
|
||||||
}
|
}
|
||||||
X86_64_macabi | Arm64_macabi => vec!["IPHONEOS_DEPLOYMENT_TARGET".into()],
|
X86_64_macabi | Arm64_macabi => cvs!["IPHONEOS_DEPLOYMENT_TARGET"],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
use crate::spec::{LinkArgs, LinkerFlavor, RelocModel, Target, TargetOptions};
|
use crate::spec::{LinkArgs, LinkerFlavor, RelocModel, Target, TargetOptions};
|
||||||
|
|
||||||
|
use super::cvs;
|
||||||
|
|
||||||
/// A base target for Nintendo 3DS devices using the devkitARM toolchain.
|
/// A base target for Nintendo 3DS devices using the devkitARM toolchain.
|
||||||
///
|
///
|
||||||
/// Requires the devkitARM toolchain for 3DS targets on the host system.
|
/// Requires the devkitARM toolchain for 3DS targets on the host system.
|
||||||
|
@ -30,7 +32,7 @@ pub fn target() -> Target {
|
||||||
linker_flavor: LinkerFlavor::Gcc,
|
linker_flavor: LinkerFlavor::Gcc,
|
||||||
cpu: "mpcore".into(),
|
cpu: "mpcore".into(),
|
||||||
executables: true,
|
executables: true,
|
||||||
families: vec!["unix".into()],
|
families: cvs!["unix"],
|
||||||
linker: Some("arm-none-eabi-gcc".into()),
|
linker: Some("arm-none-eabi-gcc".into()),
|
||||||
relocation_model: RelocModel::Static,
|
relocation_model: RelocModel::Static,
|
||||||
features: "+vfp2".into(),
|
features: "+vfp2".into(),
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
use crate::spec::{RelroLevel, TargetOptions};
|
use crate::spec::{RelroLevel, TargetOptions};
|
||||||
|
|
||||||
|
use super::cvs;
|
||||||
|
|
||||||
pub fn opts() -> TargetOptions {
|
pub fn opts() -> TargetOptions {
|
||||||
TargetOptions {
|
TargetOptions {
|
||||||
os: "dragonfly".into(),
|
os: "dragonfly".into(),
|
||||||
dynamic_linking: true,
|
dynamic_linking: true,
|
||||||
executables: true,
|
executables: true,
|
||||||
families: vec!["unix".into()],
|
families: cvs!["unix"],
|
||||||
has_rpath: true,
|
has_rpath: true,
|
||||||
position_independent_executables: true,
|
position_independent_executables: true,
|
||||||
relro_level: RelroLevel::Full,
|
relro_level: RelroLevel::Full,
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
use crate::spec::{RelroLevel, TargetOptions};
|
use crate::spec::{RelroLevel, TargetOptions};
|
||||||
|
|
||||||
|
use super::cvs;
|
||||||
|
|
||||||
pub fn opts() -> TargetOptions {
|
pub fn opts() -> TargetOptions {
|
||||||
TargetOptions {
|
TargetOptions {
|
||||||
os: "freebsd".into(),
|
os: "freebsd".into(),
|
||||||
dynamic_linking: true,
|
dynamic_linking: true,
|
||||||
executables: true,
|
executables: true,
|
||||||
families: vec!["unix".into()],
|
families: cvs!["unix"],
|
||||||
has_rpath: true,
|
has_rpath: true,
|
||||||
position_independent_executables: true,
|
position_independent_executables: true,
|
||||||
relro_level: RelroLevel::Full,
|
relro_level: RelroLevel::Full,
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
use crate::spec::{crt_objects, LinkArgs, LinkOutputKind, LinkerFlavor, LldFlavor, TargetOptions};
|
use crate::spec::{crt_objects, LinkArgs, LinkOutputKind, LinkerFlavor, LldFlavor, TargetOptions};
|
||||||
|
|
||||||
|
use super::cvs;
|
||||||
|
|
||||||
pub fn opts() -> TargetOptions {
|
pub fn opts() -> TargetOptions {
|
||||||
let mut pre_link_args = LinkArgs::new();
|
let mut pre_link_args = LinkArgs::new();
|
||||||
pre_link_args.insert(
|
pre_link_args.insert(
|
||||||
|
@ -25,7 +27,7 @@ pub fn opts() -> TargetOptions {
|
||||||
linker: Some("rust-lld".into()),
|
linker: Some("rust-lld".into()),
|
||||||
dynamic_linking: true,
|
dynamic_linking: true,
|
||||||
executables: true,
|
executables: true,
|
||||||
families: vec!["unix".into()],
|
families: cvs!["unix"],
|
||||||
is_like_fuchsia: true,
|
is_like_fuchsia: true,
|
||||||
pre_link_args,
|
pre_link_args,
|
||||||
pre_link_objects: crt_objects::new(&[
|
pre_link_objects: crt_objects::new(&[
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
use crate::spec::{RelroLevel, TargetOptions};
|
use crate::spec::{RelroLevel, TargetOptions};
|
||||||
|
|
||||||
|
use super::cvs;
|
||||||
|
|
||||||
pub fn opts() -> TargetOptions {
|
pub fn opts() -> TargetOptions {
|
||||||
TargetOptions {
|
TargetOptions {
|
||||||
os: "haiku".into(),
|
os: "haiku".into(),
|
||||||
dynamic_linking: true,
|
dynamic_linking: true,
|
||||||
executables: true,
|
executables: true,
|
||||||
families: vec!["unix".into()],
|
families: cvs!["unix"],
|
||||||
relro_level: RelroLevel::Full,
|
relro_level: RelroLevel::Full,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ pub fn target() -> Target {
|
||||||
base.cpu = "yonah".into();
|
base.cpu = "yonah".into();
|
||||||
base.max_atomic_width = Some(64);
|
base.max_atomic_width = Some(64);
|
||||||
base.pre_link_args.insert(LinkerFlavor::Gcc, vec!["-m32".into()]);
|
base.pre_link_args.insert(LinkerFlavor::Gcc, vec!["-m32".into()]);
|
||||||
base.link_env_remove.extend(super::apple_base::macos_link_env_remove());
|
base.link_env_remove.to_mut().extend(super::apple_base::macos_link_env_remove());
|
||||||
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
|
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
|
||||||
base.stack_probes = StackProbeType::Call;
|
base.stack_probes = StackProbeType::Call;
|
||||||
base.frame_pointer = FramePointer::Always;
|
base.frame_pointer = FramePointer::Always;
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
use crate::spec::{FramePointer, LinkArgs, LinkerFlavor, TargetOptions};
|
use crate::spec::{FramePointer, LinkArgs, LinkerFlavor, TargetOptions};
|
||||||
use std::default::Default;
|
use std::default::Default;
|
||||||
|
|
||||||
|
use super::cvs;
|
||||||
|
|
||||||
pub fn opts() -> TargetOptions {
|
pub fn opts() -> TargetOptions {
|
||||||
let mut late_link_args = LinkArgs::new();
|
let mut late_link_args = LinkArgs::new();
|
||||||
late_link_args.insert(
|
late_link_args.insert(
|
||||||
|
@ -31,7 +33,7 @@ pub fn opts() -> TargetOptions {
|
||||||
dynamic_linking: true,
|
dynamic_linking: true,
|
||||||
executables: true,
|
executables: true,
|
||||||
has_rpath: true,
|
has_rpath: true,
|
||||||
families: vec!["unix".into()],
|
families: cvs!["unix"],
|
||||||
is_like_solaris: true,
|
is_like_solaris: true,
|
||||||
linker_is_gnu: false,
|
linker_is_gnu: false,
|
||||||
limit_rdylib_exports: false, // Linker doesn't support this
|
limit_rdylib_exports: false, // Linker doesn't support this
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
use crate::spec::{LinkerFlavor, PanicStrategy, TargetOptions};
|
use crate::spec::{LinkerFlavor, PanicStrategy, TargetOptions};
|
||||||
use std::default::Default;
|
use std::default::Default;
|
||||||
|
|
||||||
|
use super::cvs;
|
||||||
|
|
||||||
pub fn opts() -> TargetOptions {
|
pub fn opts() -> TargetOptions {
|
||||||
TargetOptions {
|
TargetOptions {
|
||||||
os: "l4re".into(),
|
os: "l4re".into(),
|
||||||
|
@ -10,7 +12,7 @@ pub fn opts() -> TargetOptions {
|
||||||
panic_strategy: PanicStrategy::Abort,
|
panic_strategy: PanicStrategy::Abort,
|
||||||
linker: Some("l4-bender".into()),
|
linker: Some("l4-bender".into()),
|
||||||
linker_is_gnu: false,
|
linker_is_gnu: false,
|
||||||
families: vec!["unix".into()],
|
families: cvs!["unix"],
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
use crate::spec::{RelroLevel, TargetOptions};
|
use crate::spec::{RelroLevel, TargetOptions};
|
||||||
|
|
||||||
|
use super::cvs;
|
||||||
|
|
||||||
pub fn opts() -> TargetOptions {
|
pub fn opts() -> TargetOptions {
|
||||||
TargetOptions {
|
TargetOptions {
|
||||||
os: "linux".into(),
|
os: "linux".into(),
|
||||||
dynamic_linking: true,
|
dynamic_linking: true,
|
||||||
executables: true,
|
executables: true,
|
||||||
families: vec!["unix".into()],
|
families: cvs!["unix"],
|
||||||
has_rpath: true,
|
has_rpath: true,
|
||||||
position_independent_executables: true,
|
position_independent_executables: true,
|
||||||
relro_level: RelroLevel::Full,
|
relro_level: RelroLevel::Full,
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
use crate::spec::{LinkArgs, LinkerFlavor, LldFlavor, RelocModel};
|
use crate::spec::{LinkArgs, LinkerFlavor, LldFlavor, RelocModel};
|
||||||
use crate::spec::{Target, TargetOptions};
|
use crate::spec::{Target, TargetOptions};
|
||||||
|
|
||||||
|
use super::cvs;
|
||||||
|
|
||||||
// The PSP has custom linker requirements.
|
// The PSP has custom linker requirements.
|
||||||
const LINKER_SCRIPT: &str = include_str!("./mipsel_sony_psp_linker_script.ld");
|
const LINKER_SCRIPT: &str = include_str!("./mipsel_sony_psp_linker_script.ld");
|
||||||
|
|
||||||
|
@ -27,7 +29,7 @@ pub fn target() -> Target {
|
||||||
features: "+single-float".into(),
|
features: "+single-float".into(),
|
||||||
|
|
||||||
// PSP does not support trap-on-condition instructions.
|
// PSP does not support trap-on-condition instructions.
|
||||||
llvm_args: vec!["-mno-check-zero-division".into()],
|
llvm_args: cvs!["-mno-check-zero-division"],
|
||||||
pre_link_args,
|
pre_link_args,
|
||||||
link_script: Some(LINKER_SCRIPT.into()),
|
link_script: Some(LINKER_SCRIPT.into()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
|
|
@ -1027,6 +1027,25 @@ supported_targets! {
|
||||||
("mips64-openwrt-linux-musl", mips64_openwrt_linux_musl),
|
("mips64-openwrt-linux-musl", mips64_openwrt_linux_musl),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Cow-Vec-Str: Cow<'static, [Cow<'static, str>]>
|
||||||
|
// FIXME(Urgau): Figure out why the obvious form `["".into()].into()` doesn't work.
|
||||||
|
macro_rules! cvs {
|
||||||
|
() => {
|
||||||
|
::std::borrow::Cow::Borrowed(&[])
|
||||||
|
};
|
||||||
|
($($x:expr),+ $(,)?) => {
|
||||||
|
{
|
||||||
|
::std::borrow::Cow::Borrowed(&[
|
||||||
|
$(
|
||||||
|
::std::borrow::Cow::Borrowed($x),
|
||||||
|
)*
|
||||||
|
])
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) use cvs;
|
||||||
|
|
||||||
/// Warnings encountered when parsing the target `json`.
|
/// Warnings encountered when parsing the target `json`.
|
||||||
///
|
///
|
||||||
/// Includes fields that weren't recognized and fields that don't have the expected type.
|
/// Includes fields that weren't recognized and fields that don't have the expected type.
|
||||||
|
@ -1160,12 +1179,12 @@ pub struct TargetOptions {
|
||||||
pub link_script: Option<Cow<'static, str>>,
|
pub link_script: Option<Cow<'static, str>>,
|
||||||
|
|
||||||
/// Environment variables to be set for the linker invocation.
|
/// Environment variables to be set for the linker invocation.
|
||||||
pub link_env: Vec<(Cow<'static, str>, Cow<'static, str>)>,
|
pub link_env: Cow<'static, [(Cow<'static, str>, Cow<'static, str>)]>,
|
||||||
/// Environment variables to be removed for the linker invocation.
|
/// Environment variables to be removed for the linker invocation.
|
||||||
pub link_env_remove: Vec<Cow<'static, str>>,
|
pub link_env_remove: Cow<'static, [Cow<'static, str>]>,
|
||||||
|
|
||||||
/// Extra arguments to pass to the external assembler (when used)
|
/// Extra arguments to pass to the external assembler (when used)
|
||||||
pub asm_args: Vec<Cow<'static, str>>,
|
pub asm_args: Cow<'static, [Cow<'static, str>]>,
|
||||||
|
|
||||||
/// Default CPU to pass to LLVM. Corresponds to `llc -mcpu=$cpu`. Defaults
|
/// Default CPU to pass to LLVM. Corresponds to `llc -mcpu=$cpu`. Defaults
|
||||||
/// to "generic".
|
/// to "generic".
|
||||||
|
@ -1211,7 +1230,7 @@ pub struct TargetOptions {
|
||||||
/// Common options are: "unix", "windows". Defaults to no families.
|
/// Common options are: "unix", "windows". Defaults to no families.
|
||||||
///
|
///
|
||||||
/// See <https://doc.rust-lang.org/reference/conditional-compilation.html#target_family>.
|
/// See <https://doc.rust-lang.org/reference/conditional-compilation.html#target_family>.
|
||||||
pub families: Vec<Cow<'static, str>>,
|
pub families: Cow<'static, [Cow<'static, str>]>,
|
||||||
/// Whether the target toolchain's ABI supports returning small structs as an integer.
|
/// Whether the target toolchain's ABI supports returning small structs as an integer.
|
||||||
pub abi_return_struct_as_int: bool,
|
pub abi_return_struct_as_int: bool,
|
||||||
/// Whether the target toolchain is like macOS's. Only useful for compiling against iOS/macOS,
|
/// Whether the target toolchain is like macOS's. Only useful for compiling against iOS/macOS,
|
||||||
|
@ -1371,7 +1390,7 @@ pub struct TargetOptions {
|
||||||
|
|
||||||
/// If set, have the linker export exactly these symbols, instead of using
|
/// If set, have the linker export exactly these symbols, instead of using
|
||||||
/// the usual logic to figure this out from the crate itself.
|
/// the usual logic to figure this out from the crate itself.
|
||||||
pub override_export_symbols: Option<Vec<Cow<'static, str>>>,
|
pub override_export_symbols: Option<Cow<'static, [Cow<'static, str>]>>,
|
||||||
|
|
||||||
/// Determines how or whether the MergeFunctions LLVM pass should run for
|
/// Determines how or whether the MergeFunctions LLVM pass should run for
|
||||||
/// this target. Either "disabled", "trampolines", or "aliases".
|
/// this target. Either "disabled", "trampolines", or "aliases".
|
||||||
|
@ -1391,7 +1410,7 @@ pub struct TargetOptions {
|
||||||
pub relax_elf_relocations: bool,
|
pub relax_elf_relocations: bool,
|
||||||
|
|
||||||
/// Additional arguments to pass to LLVM, similar to the `-C llvm-args` codegen option.
|
/// Additional arguments to pass to LLVM, similar to the `-C llvm-args` codegen option.
|
||||||
pub llvm_args: Vec<Cow<'static, str>>,
|
pub llvm_args: Cow<'static, [Cow<'static, str>]>,
|
||||||
|
|
||||||
/// Whether to use legacy .ctors initialization hooks rather than .init_array. Defaults
|
/// Whether to use legacy .ctors initialization hooks rather than .init_array. Defaults
|
||||||
/// to false (uses .init_array).
|
/// to false (uses .init_array).
|
||||||
|
@ -1449,7 +1468,7 @@ impl Default for TargetOptions {
|
||||||
pre_link_args: LinkArgs::new(),
|
pre_link_args: LinkArgs::new(),
|
||||||
post_link_args: LinkArgs::new(),
|
post_link_args: LinkArgs::new(),
|
||||||
link_script: None,
|
link_script: None,
|
||||||
asm_args: Vec::new(),
|
asm_args: Cow::Borrowed(&[]),
|
||||||
cpu: "generic".into(),
|
cpu: "generic".into(),
|
||||||
features: Cow::from(""),
|
features: Cow::from(""),
|
||||||
dynamic_linking: false,
|
dynamic_linking: false,
|
||||||
|
@ -1466,7 +1485,7 @@ impl Default for TargetOptions {
|
||||||
exe_suffix: Cow::from(""),
|
exe_suffix: Cow::from(""),
|
||||||
staticlib_prefix: "lib".into(),
|
staticlib_prefix: "lib".into(),
|
||||||
staticlib_suffix: ".a".into(),
|
staticlib_suffix: ".a".into(),
|
||||||
families: Vec::new(),
|
families: cvs![],
|
||||||
abi_return_struct_as_int: false,
|
abi_return_struct_as_int: false,
|
||||||
is_like_osx: false,
|
is_like_osx: false,
|
||||||
is_like_solaris: false,
|
is_like_solaris: false,
|
||||||
|
@ -1492,8 +1511,8 @@ impl Default for TargetOptions {
|
||||||
late_link_args: LinkArgs::new(),
|
late_link_args: LinkArgs::new(),
|
||||||
late_link_args_dynamic: LinkArgs::new(),
|
late_link_args_dynamic: LinkArgs::new(),
|
||||||
late_link_args_static: LinkArgs::new(),
|
late_link_args_static: LinkArgs::new(),
|
||||||
link_env: Vec::new(),
|
link_env: Cow::Borrowed(&[]),
|
||||||
link_env_remove: Vec::new(),
|
link_env_remove: Cow::Borrowed(&[]),
|
||||||
archive_format: "gnu".into(),
|
archive_format: "gnu".into(),
|
||||||
main_needs_argc_argv: true,
|
main_needs_argc_argv: true,
|
||||||
allow_asm: true,
|
allow_asm: true,
|
||||||
|
@ -1526,7 +1545,7 @@ impl Default for TargetOptions {
|
||||||
mcount: "mcount".into(),
|
mcount: "mcount".into(),
|
||||||
llvm_abiname: "".into(),
|
llvm_abiname: "".into(),
|
||||||
relax_elf_relocations: false,
|
relax_elf_relocations: false,
|
||||||
llvm_args: vec![],
|
llvm_args: cvs![],
|
||||||
use_ctors_section: false,
|
use_ctors_section: false,
|
||||||
eh_frame_header: true,
|
eh_frame_header: true,
|
||||||
has_thumb_interworking: false,
|
has_thumb_interworking: false,
|
||||||
|
@ -1978,7 +1997,7 @@ impl Target {
|
||||||
if p.len() == 2 {
|
if p.len() == 2 {
|
||||||
let k = p[0].to_string();
|
let k = p[0].to_string();
|
||||||
let v = p[1].to_string();
|
let v = p[1].to_string();
|
||||||
base.$key_name.push((k.into(), v.into()));
|
base.$key_name.to_mut().push((k.into(), v.into()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2004,7 +2023,7 @@ impl Target {
|
||||||
.map(|a| a.as_string().unwrap().to_string().into())
|
.map(|a| a.as_string().unwrap().to_string().into())
|
||||||
.collect();
|
.collect();
|
||||||
} else if let Some(v) = Json::as_string(&value) {
|
} else if let Some(v) = Json::as_string(&value) {
|
||||||
base.$key_name = vec![v.to_string().into()];
|
base.$key_name = vec![v.to_string().into()].into();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
use super::cvs;
|
||||||
use crate::spec::{PanicStrategy, RelocModel, Target, TargetOptions};
|
use crate::spec::{PanicStrategy, RelocModel, Target, TargetOptions};
|
||||||
|
|
||||||
pub fn target() -> Target {
|
pub fn target() -> Target {
|
||||||
|
@ -15,7 +16,7 @@ pub fn target() -> Target {
|
||||||
// workaround this LLVM generates assembly files which then we feed
|
// workaround this LLVM generates assembly files which then we feed
|
||||||
// to gcc to get object files. For this reason we have a hard
|
// to gcc to get object files. For this reason we have a hard
|
||||||
// dependency on this specific gcc.
|
// dependency on this specific gcc.
|
||||||
asm_args: vec!["-mcpu=msp430".into()],
|
asm_args: cvs!["-mcpu=msp430"],
|
||||||
linker: Some("msp430-elf-gcc".into()),
|
linker: Some("msp430-elf-gcc".into()),
|
||||||
linker_is_gnu: false,
|
linker_is_gnu: false,
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
use crate::spec::{RelroLevel, TargetOptions};
|
use crate::spec::{RelroLevel, TargetOptions};
|
||||||
|
|
||||||
|
use super::cvs;
|
||||||
|
|
||||||
pub fn opts() -> TargetOptions {
|
pub fn opts() -> TargetOptions {
|
||||||
TargetOptions {
|
TargetOptions {
|
||||||
os: "netbsd".into(),
|
os: "netbsd".into(),
|
||||||
dynamic_linking: true,
|
dynamic_linking: true,
|
||||||
executables: true,
|
executables: true,
|
||||||
families: vec!["unix".into()],
|
families: cvs!["unix"],
|
||||||
no_default_libraries: false,
|
no_default_libraries: false,
|
||||||
has_rpath: true,
|
has_rpath: true,
|
||||||
position_independent_executables: true,
|
position_independent_executables: true,
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
use crate::spec::{FramePointer, RelroLevel, TargetOptions};
|
use crate::spec::{FramePointer, RelroLevel, TargetOptions};
|
||||||
|
|
||||||
|
use super::cvs;
|
||||||
|
|
||||||
pub fn opts() -> TargetOptions {
|
pub fn opts() -> TargetOptions {
|
||||||
TargetOptions {
|
TargetOptions {
|
||||||
os: "openbsd".into(),
|
os: "openbsd".into(),
|
||||||
dynamic_linking: true,
|
dynamic_linking: true,
|
||||||
executables: true,
|
executables: true,
|
||||||
families: vec!["unix".into()],
|
families: cvs!["unix"],
|
||||||
has_rpath: true,
|
has_rpath: true,
|
||||||
abi_return_struct_as_int: true,
|
abi_return_struct_as_int: true,
|
||||||
position_independent_executables: true,
|
position_independent_executables: true,
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
use crate::spec::{RelroLevel, TargetOptions};
|
use crate::spec::{RelroLevel, TargetOptions};
|
||||||
|
|
||||||
|
use super::cvs;
|
||||||
|
|
||||||
pub fn opts() -> TargetOptions {
|
pub fn opts() -> TargetOptions {
|
||||||
TargetOptions {
|
TargetOptions {
|
||||||
os: "redox".into(),
|
os: "redox".into(),
|
||||||
env: "relibc".into(),
|
env: "relibc".into(),
|
||||||
dynamic_linking: true,
|
dynamic_linking: true,
|
||||||
executables: true,
|
executables: true,
|
||||||
families: vec!["unix".into()],
|
families: cvs!["unix"],
|
||||||
has_rpath: true,
|
has_rpath: true,
|
||||||
position_independent_executables: true,
|
position_independent_executables: true,
|
||||||
relro_level: RelroLevel::Full,
|
relro_level: RelroLevel::Full,
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
use crate::spec::{LinkerFlavor, PanicStrategy, RelocModel};
|
use crate::spec::{LinkerFlavor, PanicStrategy, RelocModel};
|
||||||
use crate::spec::{Target, TargetOptions};
|
use crate::spec::{Target, TargetOptions};
|
||||||
|
|
||||||
|
use super::cvs;
|
||||||
|
|
||||||
pub fn target() -> Target {
|
pub fn target() -> Target {
|
||||||
Target {
|
Target {
|
||||||
data_layout: "e-m:e-p:32:32-i64:64-n32-S128".into(),
|
data_layout: "e-m:e-p:32:32-i64:64-n32-S128".into(),
|
||||||
|
@ -9,7 +11,7 @@ pub fn target() -> Target {
|
||||||
arch: "riscv32".into(),
|
arch: "riscv32".into(),
|
||||||
|
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
families: vec!["unix".into()],
|
families: cvs!["unix"],
|
||||||
os: "espidf".into(),
|
os: "espidf".into(),
|
||||||
env: "newlib".into(),
|
env: "newlib".into(),
|
||||||
vendor: "espressif".into(),
|
vendor: "espressif".into(),
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
use crate::spec::TargetOptions;
|
use crate::spec::TargetOptions;
|
||||||
|
|
||||||
|
use super::cvs;
|
||||||
|
|
||||||
pub fn opts() -> TargetOptions {
|
pub fn opts() -> TargetOptions {
|
||||||
TargetOptions {
|
TargetOptions {
|
||||||
os: "solaris".into(),
|
os: "solaris".into(),
|
||||||
dynamic_linking: true,
|
dynamic_linking: true,
|
||||||
executables: true,
|
executables: true,
|
||||||
has_rpath: true,
|
has_rpath: true,
|
||||||
families: vec!["unix".into()],
|
families: cvs!["unix"],
|
||||||
is_like_solaris: true,
|
is_like_solaris: true,
|
||||||
linker_is_gnu: false,
|
linker_is_gnu: false,
|
||||||
limit_rdylib_exports: false, // Linker doesn't support this
|
limit_rdylib_exports: false, // Linker doesn't support this
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
//!
|
//!
|
||||||
//! **Important:** This target profile **does not** specify a linker script. You just get the default link script when you build a binary for this target. The default link script is very likely wrong, so you should use `-Clink-arg=-Tmy_script.ld` to override that with a correct linker script.
|
//! **Important:** This target profile **does not** specify a linker script. You just get the default link script when you build a binary for this target. The default link script is very likely wrong, so you should use `-Clink-arg=-Tmy_script.ld` to override that with a correct linker script.
|
||||||
|
|
||||||
|
use super::cvs;
|
||||||
use crate::spec::{LinkerFlavor, Target, TargetOptions};
|
use crate::spec::{LinkerFlavor, Target, TargetOptions};
|
||||||
|
|
||||||
pub fn target() -> Target {
|
pub fn target() -> Target {
|
||||||
|
@ -34,11 +35,7 @@ pub fn target() -> Target {
|
||||||
// * activate t32/a32 interworking
|
// * activate t32/a32 interworking
|
||||||
// * use arch ARMv4T
|
// * use arch ARMv4T
|
||||||
// * use little-endian
|
// * use little-endian
|
||||||
asm_args: vec![
|
asm_args: cvs!["-mthumb-interwork", "-march=armv4t", "-mlittle-endian",],
|
||||||
"-mthumb-interwork".into(),
|
|
||||||
"-march=armv4t".into(),
|
|
||||||
"-mlittle-endian".into(),
|
|
||||||
],
|
|
||||||
|
|
||||||
// minimum extra features, these cannot be disabled via -C
|
// minimum extra features, these cannot be disabled via -C
|
||||||
features: "+soft-float,+strict-align".into(),
|
features: "+soft-float,+strict-align".into(),
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
use crate::spec::TargetOptions;
|
use crate::spec::TargetOptions;
|
||||||
|
|
||||||
|
use super::cvs;
|
||||||
|
|
||||||
pub fn opts() -> TargetOptions {
|
pub fn opts() -> TargetOptions {
|
||||||
TargetOptions {
|
TargetOptions {
|
||||||
os: "vxworks".into(),
|
os: "vxworks".into(),
|
||||||
|
@ -9,7 +11,7 @@ pub fn opts() -> TargetOptions {
|
||||||
exe_suffix: ".vxe".into(),
|
exe_suffix: ".vxe".into(),
|
||||||
dynamic_linking: true,
|
dynamic_linking: true,
|
||||||
executables: true,
|
executables: true,
|
||||||
families: vec!["unix".into()],
|
families: cvs!["unix"],
|
||||||
has_rpath: true,
|
has_rpath: true,
|
||||||
has_thread_local: true,
|
has_thread_local: true,
|
||||||
crt_static_default: true,
|
crt_static_default: true,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use super::wasm_base;
|
use super::{cvs, wasm_base};
|
||||||
use super::{LinkArgs, LinkerFlavor, PanicStrategy, Target, TargetOptions};
|
use super::{LinkArgs, LinkerFlavor, PanicStrategy, Target, TargetOptions};
|
||||||
|
|
||||||
pub fn target() -> Target {
|
pub fn target() -> Target {
|
||||||
|
@ -37,7 +37,7 @@ pub fn target() -> Target {
|
||||||
is_like_emscripten: true,
|
is_like_emscripten: true,
|
||||||
panic_strategy: PanicStrategy::Unwind,
|
panic_strategy: PanicStrategy::Unwind,
|
||||||
post_link_args,
|
post_link_args,
|
||||||
families: vec!["unix".into(), "wasm".into()],
|
families: cvs!["unix", "wasm"],
|
||||||
..options
|
..options
|
||||||
};
|
};
|
||||||
Target {
|
Target {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use super::crt_objects::CrtObjectsFallback;
|
use super::crt_objects::CrtObjectsFallback;
|
||||||
use super::{LinkerFlavor, LldFlavor, PanicStrategy, RelocModel, TargetOptions, TlsModel};
|
use super::{cvs, LinkerFlavor, LldFlavor, PanicStrategy, RelocModel, TargetOptions, TlsModel};
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
|
|
||||||
pub fn options() -> TargetOptions {
|
pub fn options() -> TargetOptions {
|
||||||
|
@ -61,7 +61,7 @@ pub fn options() -> TargetOptions {
|
||||||
|
|
||||||
TargetOptions {
|
TargetOptions {
|
||||||
is_like_wasm: true,
|
is_like_wasm: true,
|
||||||
families: vec!["wasm".into()],
|
families: cvs!["wasm"],
|
||||||
|
|
||||||
// we allow dynamic linking, but only cdylibs. Basically we allow a
|
// we allow dynamic linking, but only cdylibs. Basically we allow a
|
||||||
// final library artifact that exports some symbols (a wasm module) but
|
// final library artifact that exports some symbols (a wasm module) but
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
use crate::spec::crt_objects::{self, CrtObjectsFallback};
|
use crate::spec::crt_objects::{self, CrtObjectsFallback};
|
||||||
use crate::spec::{LinkArgs, LinkerFlavor, LldFlavor, TargetOptions};
|
use crate::spec::{LinkArgs, LinkerFlavor, LldFlavor, TargetOptions};
|
||||||
|
|
||||||
|
use super::cvs;
|
||||||
|
|
||||||
pub fn opts() -> TargetOptions {
|
pub fn opts() -> TargetOptions {
|
||||||
let mut pre_link_args = LinkArgs::new();
|
let mut pre_link_args = LinkArgs::new();
|
||||||
pre_link_args.insert(
|
pre_link_args.insert(
|
||||||
|
@ -71,7 +73,7 @@ pub fn opts() -> TargetOptions {
|
||||||
dll_prefix: "".into(),
|
dll_prefix: "".into(),
|
||||||
dll_suffix: ".dll".into(),
|
dll_suffix: ".dll".into(),
|
||||||
exe_suffix: ".exe".into(),
|
exe_suffix: ".exe".into(),
|
||||||
families: vec!["windows".into()],
|
families: cvs!["windows"],
|
||||||
is_like_windows: true,
|
is_like_windows: true,
|
||||||
allows_weak_linkage: false,
|
allows_weak_linkage: false,
|
||||||
pre_link_args,
|
pre_link_args,
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
use crate::spec::TargetOptions;
|
use crate::spec::TargetOptions;
|
||||||
|
|
||||||
|
use super::cvs;
|
||||||
|
|
||||||
pub fn opts() -> TargetOptions {
|
pub fn opts() -> TargetOptions {
|
||||||
let base = super::msvc_base::opts();
|
let base = super::msvc_base::opts();
|
||||||
|
|
||||||
|
@ -13,7 +15,7 @@ pub fn opts() -> TargetOptions {
|
||||||
exe_suffix: ".exe".into(),
|
exe_suffix: ".exe".into(),
|
||||||
staticlib_prefix: "".into(),
|
staticlib_prefix: "".into(),
|
||||||
staticlib_suffix: ".lib".into(),
|
staticlib_suffix: ".lib".into(),
|
||||||
families: vec!["windows".into()],
|
families: cvs!["windows"],
|
||||||
crt_static_allows_dylibs: true,
|
crt_static_allows_dylibs: true,
|
||||||
crt_static_respected: true,
|
crt_static_respected: true,
|
||||||
requires_uwtable: true,
|
requires_uwtable: true,
|
||||||
|
|
|
@ -8,7 +8,7 @@ pub fn target() -> Target {
|
||||||
base.frame_pointer = FramePointer::Always;
|
base.frame_pointer = FramePointer::Always;
|
||||||
base.pre_link_args
|
base.pre_link_args
|
||||||
.insert(LinkerFlavor::Gcc, vec!["-m64".into(), "-arch".into(), "x86_64".into()]);
|
.insert(LinkerFlavor::Gcc, vec!["-m64".into(), "-arch".into(), "x86_64".into()]);
|
||||||
base.link_env_remove.extend(super::apple_base::macos_link_env_remove());
|
base.link_env_remove.to_mut().extend(super::apple_base::macos_link_env_remove());
|
||||||
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
|
// don't use probe-stack=inline-asm until rust#83139 and rust#84667 are resolved
|
||||||
base.stack_probes = StackProbeType::Call;
|
base.stack_probes = StackProbeType::Call;
|
||||||
base.supported_sanitizers =
|
base.supported_sanitizers =
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
use std::{borrow::Cow, iter};
|
use std::{borrow::Cow, iter};
|
||||||
|
|
||||||
|
use crate::spec::cvs;
|
||||||
|
|
||||||
use super::{LinkerFlavor, LldFlavor, Target, TargetOptions};
|
use super::{LinkerFlavor, LldFlavor, Target, TargetOptions};
|
||||||
|
|
||||||
pub fn target() -> Target {
|
pub fn target() -> Target {
|
||||||
|
@ -62,7 +64,7 @@ pub fn target() -> Target {
|
||||||
max_atomic_width: Some(64),
|
max_atomic_width: Some(64),
|
||||||
cpu: "x86-64".into(),
|
cpu: "x86-64".into(),
|
||||||
features: "+rdrnd,+rdseed,+lvi-cfi,+lvi-load-hardening".into(),
|
features: "+rdrnd,+rdseed,+lvi-cfi,+lvi-load-hardening".into(),
|
||||||
llvm_args: vec!["--x86-experimental-lvi-inline-asm-hardening".into()],
|
llvm_args: cvs!["--x86-experimental-lvi-inline-asm-hardening"],
|
||||||
position_independent_executables: true,
|
position_independent_executables: true,
|
||||||
pre_link_args: iter::once((
|
pre_link_args: iter::once((
|
||||||
LinkerFlavor::Lld(LldFlavor::Ld),
|
LinkerFlavor::Lld(LldFlavor::Ld),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue