1. support crt-static
2. change armv7_wrs_vxworks to armv7_wrs_vxworks_eabihf. 3. use wr-** instead of vx-** 4. set PIE to false 5. code cleanup
This commit is contained in:
parent
60960a260f
commit
f161efac2b
18 changed files with 25 additions and 202 deletions
|
@ -46,7 +46,7 @@ fn cc2ar(cc: &Path, target: &str) -> Option<PathBuf> {
|
||||||
} else if target.contains("openbsd") {
|
} else if target.contains("openbsd") {
|
||||||
Some(PathBuf::from("ar"))
|
Some(PathBuf::from("ar"))
|
||||||
} else if target.contains("vxworks") {
|
} else if target.contains("vxworks") {
|
||||||
Some(PathBuf::from("vx-ar"))
|
Some(PathBuf::from("wr-ar"))
|
||||||
} else {
|
} else {
|
||||||
let parent = cc.parent().unwrap();
|
let parent = cc.parent().unwrap();
|
||||||
let file = cc.file_name().unwrap().to_str().unwrap();
|
let file = cc.file_name().unwrap().to_str().unwrap();
|
||||||
|
|
|
@ -9,15 +9,14 @@ pub fn target() -> TargetResult {
|
||||||
target_endian: "little".to_string(),
|
target_endian: "little".to_string(),
|
||||||
target_pointer_width: "64".to_string(),
|
target_pointer_width: "64".to_string(),
|
||||||
target_c_int_width: "32".to_string(),
|
target_c_int_width: "32".to_string(),
|
||||||
target_env: "gnu".to_string(),
|
|
||||||
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
|
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
|
||||||
arch: "aarch64".to_string(),
|
arch: "aarch64".to_string(),
|
||||||
target_os: "vxworks".to_string(),
|
target_os: "vxworks".to_string(),
|
||||||
target_vendor: "unknown".to_string(),
|
target_env: "gnu".to_string(),
|
||||||
|
target_vendor: "wrs".to_string(),
|
||||||
linker_flavor: LinkerFlavor::Gcc,
|
linker_flavor: LinkerFlavor::Gcc,
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
abi_blacklist: super::arm_base::abi_blacklist(),
|
abi_blacklist: super::arm_base::abi_blacklist(),
|
||||||
target_mcount: "\u{1}_mcount".to_string(),
|
|
||||||
.. base
|
.. base
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult};
|
|
||||||
|
|
||||||
pub fn target() -> TargetResult {
|
|
||||||
let mut base = super::vxworks_base::opts();
|
|
||||||
base.max_atomic_width = Some(64);
|
|
||||||
Ok(Target {
|
|
||||||
llvm_target: "arm-unknown-linux-gnueabi".to_string(),
|
|
||||||
target_endian: "little".to_string(),
|
|
||||||
target_pointer_width: "32".to_string(),
|
|
||||||
target_c_int_width: "32".to_string(),
|
|
||||||
data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
|
|
||||||
arch: "arm".to_string(),
|
|
||||||
target_os: "vxworks".to_string(),
|
|
||||||
target_env: "gnu".to_string(),
|
|
||||||
target_vendor: "unknown".to_string(),
|
|
||||||
linker_flavor: LinkerFlavor::Gcc,
|
|
||||||
|
|
||||||
options: TargetOptions {
|
|
||||||
features: "+strict-align,+v6".to_string(),
|
|
||||||
abi_blacklist: super::arm_base::abi_blacklist(),
|
|
||||||
target_mcount: "\u{1}__gnu_mcount_nc".to_string(),
|
|
||||||
.. base
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
|
@ -1,31 +0,0 @@
|
||||||
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult};
|
|
||||||
|
|
||||||
// This target is for glibc Linux on ARMv7 without NEON or
|
|
||||||
// thumb-mode. See the thumbv7neon variant for enabling both.
|
|
||||||
|
|
||||||
pub fn target() -> TargetResult {
|
|
||||||
let base = super::vxworks_base::opts();
|
|
||||||
Ok(Target {
|
|
||||||
llvm_target: "armv7-unknown-linux-gnueabihf".to_string(),
|
|
||||||
target_endian: "little".to_string(),
|
|
||||||
target_pointer_width: "32".to_string(),
|
|
||||||
target_c_int_width: "32".to_string(),
|
|
||||||
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
|
|
||||||
arch: "arm".to_string(),
|
|
||||||
target_os: "vxworks".to_string(),
|
|
||||||
target_env: "gnu".to_string(),
|
|
||||||
target_vendor: "unknown".to_string(),
|
|
||||||
linker_flavor: LinkerFlavor::Gcc,
|
|
||||||
|
|
||||||
options: TargetOptions {
|
|
||||||
// Info about features at https://wiki.debian.org/ArmHardFloatPort
|
|
||||||
features: "+v7,+vfp3,-d32,+thumb2,-neon".to_string(),
|
|
||||||
cpu: "generic".to_string(),
|
|
||||||
max_atomic_width: Some(64),
|
|
||||||
abi_blacklist: super::arm_base::abi_blacklist(),
|
|
||||||
target_mcount: "\u{1}__gnu_mcount_nc".to_string(),
|
|
||||||
position_independent_executables: false,
|
|
||||||
.. base
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
|
@ -1,8 +1,5 @@
|
||||||
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult};
|
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult};
|
||||||
|
|
||||||
// This target is for glibc Linux on ARMv7 without NEON or
|
|
||||||
// thumb-mode. See the thumbv7neon variant for enabling both.
|
|
||||||
|
|
||||||
pub fn target() -> TargetResult {
|
pub fn target() -> TargetResult {
|
||||||
let base = super::vxworks_base::opts();
|
let base = super::vxworks_base::opts();
|
||||||
Ok(Target {
|
Ok(Target {
|
||||||
|
@ -14,17 +11,14 @@ pub fn target() -> TargetResult {
|
||||||
arch: "arm".to_string(),
|
arch: "arm".to_string(),
|
||||||
target_os: "vxworks".to_string(),
|
target_os: "vxworks".to_string(),
|
||||||
target_env: "gnu".to_string(),
|
target_env: "gnu".to_string(),
|
||||||
target_vendor: "unknown".to_string(),
|
target_vendor: "wrs".to_string(),
|
||||||
linker_flavor: LinkerFlavor::Gcc,
|
linker_flavor: LinkerFlavor::Gcc,
|
||||||
|
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
// Info about features at https://wiki.debian.org/ArmHardFloatPort
|
// Info about features at https://wiki.debian.org/ArmHardFloatPort
|
||||||
features: "+v7,+vfp3,-d32,+thumb2,-neon".to_string(),
|
features: "+v7,+vfp3,-d32,+thumb2,-neon".to_string(),
|
||||||
cpu: "generic".to_string(),
|
cpu: "generic".to_string(),
|
||||||
max_atomic_width: Some(64),
|
max_atomic_width: Some(64),
|
||||||
abi_blacklist: super::arm_base::abi_blacklist(),
|
abi_blacklist: super::arm_base::abi_blacklist(),
|
||||||
target_mcount: "\u{1}__gnu_mcount_nc".to_string(),
|
|
||||||
position_independent_executables: false,
|
|
||||||
.. base
|
.. base
|
||||||
}
|
}
|
||||||
})
|
})
|
|
@ -1,8 +0,0 @@
|
||||||
use crate::spec::TargetResult;
|
|
||||||
|
|
||||||
pub fn target() -> TargetResult {
|
|
||||||
let mut base = super::i686_wrs_vxworks::target()?;
|
|
||||||
base.options.cpu = "pentium".to_string();
|
|
||||||
base.llvm_target = "i586-unknown-linux-gnu".to_string();
|
|
||||||
Ok(base)
|
|
||||||
}
|
|
|
@ -16,7 +16,7 @@ pub fn target() -> TargetResult {
|
||||||
arch: "x86".to_string(),
|
arch: "x86".to_string(),
|
||||||
target_os: "vxworks".to_string(),
|
target_os: "vxworks".to_string(),
|
||||||
target_env: "gnu".to_string(),
|
target_env: "gnu".to_string(),
|
||||||
target_vendor: "unknown".to_string(),
|
target_vendor: "wrs".to_string(),
|
||||||
linker_flavor: LinkerFlavor::Gcc,
|
linker_flavor: LinkerFlavor::Gcc,
|
||||||
options: base,
|
options: base,
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
use crate::spec::{LinkerFlavor, Target, TargetResult};
|
|
||||||
|
|
||||||
pub fn target() -> TargetResult {
|
|
||||||
let mut base = super::vxworks_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());
|
|
||||||
base.stack_probes = true;
|
|
||||||
|
|
||||||
Ok(Target {
|
|
||||||
llvm_target: "i686-unknown-linux-gnu".to_string(),
|
|
||||||
target_endian: "little".to_string(),
|
|
||||||
target_pointer_width: "32".to_string(),
|
|
||||||
target_c_int_width: "32".to_string(),
|
|
||||||
data_layout: "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128".to_string(),
|
|
||||||
arch: "x86".to_string(),
|
|
||||||
target_os: "vxworks".to_string(),
|
|
||||||
target_env: "gnu".to_string(),
|
|
||||||
target_vendor: "unknown".to_string(),
|
|
||||||
linker_flavor: LinkerFlavor::Gcc,
|
|
||||||
options: base,
|
|
||||||
})
|
|
||||||
}
|
|
|
@ -485,10 +485,9 @@ supported_targets! {
|
||||||
|
|
||||||
("nvptx64-nvidia-cuda", nvptx64_nvidia_cuda),
|
("nvptx64-nvidia-cuda", nvptx64_nvidia_cuda),
|
||||||
|
|
||||||
("x86_64-wrs-vxworks", x86_64_wrs_vxworks),
|
|
||||||
("i686-wrs-vxworks", i686_wrs_vxworks),
|
("i686-wrs-vxworks", i686_wrs_vxworks),
|
||||||
("i586-wrs-vxworks", i586_wrs_vxworks),
|
("x86_64-wrs-vxworks", x86_64_wrs_vxworks),
|
||||||
("armv7-wrs-vxworks", armv7_wrs_vxworks),
|
("armv7-wrs-vxworks-eabihf", armv7_wrs_vxworks_eabihf),
|
||||||
("aarch64-wrs-vxworks", aarch64_wrs_vxworks),
|
("aarch64-wrs-vxworks", aarch64_wrs_vxworks),
|
||||||
("powerpc-wrs-vxworks", powerpc_wrs_vxworks),
|
("powerpc-wrs-vxworks", powerpc_wrs_vxworks),
|
||||||
("powerpc-wrs-vxworks-spe", powerpc_wrs_vxworks_spe),
|
("powerpc-wrs-vxworks-spe", powerpc_wrs_vxworks_spe),
|
||||||
|
|
|
@ -15,10 +15,9 @@ pub fn target() -> TargetResult {
|
||||||
arch: "powerpc64".to_string(),
|
arch: "powerpc64".to_string(),
|
||||||
target_os: "vxworks".to_string(),
|
target_os: "vxworks".to_string(),
|
||||||
target_env: "gnu".to_string(),
|
target_env: "gnu".to_string(),
|
||||||
target_vendor: "unknown".to_string(),
|
target_vendor: "wrs".to_string(),
|
||||||
linker_flavor: LinkerFlavor::Gcc,
|
linker_flavor: LinkerFlavor::Gcc,
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
target_mcount: "_mcount".to_string(),
|
|
||||||
.. base
|
.. base
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult};
|
|
||||||
|
|
||||||
pub fn target() -> TargetResult {
|
|
||||||
let mut base = super::vxworks_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);
|
|
||||||
|
|
||||||
Ok(Target {
|
|
||||||
llvm_target: "powerpc64-unknown-linux-gnu".to_string(),
|
|
||||||
target_endian: "big".to_string(),
|
|
||||||
target_pointer_width: "64".to_string(),
|
|
||||||
target_c_int_width: "32".to_string(),
|
|
||||||
data_layout: "E-m:e-i64:64-n32:64".to_string(),
|
|
||||||
arch: "powerpc64".to_string(),
|
|
||||||
target_os: "vxworks".to_string(),
|
|
||||||
target_env: "gnu".to_string(),
|
|
||||||
target_vendor: "unknown".to_string(),
|
|
||||||
linker_flavor: LinkerFlavor::Gcc,
|
|
||||||
options: TargetOptions {
|
|
||||||
features: "-hard-float".to_string(),
|
|
||||||
target_mcount: "_mcount".to_string(),
|
|
||||||
.. base
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
|
@ -19,7 +19,6 @@ pub fn target() -> TargetResult {
|
||||||
linker_flavor: LinkerFlavor::Gcc,
|
linker_flavor: LinkerFlavor::Gcc,
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
features: "+secure-plt".to_string(),
|
features: "+secure-plt".to_string(),
|
||||||
target_mcount: "_mcount".to_string(),
|
|
||||||
.. base
|
.. base
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult};
|
|
||||||
|
|
||||||
pub fn target() -> TargetResult {
|
|
||||||
let mut base = super::vxworks_base::opts();
|
|
||||||
base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m32".to_string());
|
|
||||||
base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("--secure-plt".to_string());
|
|
||||||
base.max_atomic_width = Some(32);
|
|
||||||
|
|
||||||
Ok(Target {
|
|
||||||
llvm_target: "powerpc-unknown-linux-gnu".to_string(),
|
|
||||||
target_endian: "big".to_string(),
|
|
||||||
target_pointer_width: "32".to_string(),
|
|
||||||
target_c_int_width: "32".to_string(),
|
|
||||||
data_layout: "E-m:e-p:32:32-i64:64-n32".to_string(),
|
|
||||||
arch: "powerpc".to_string(),
|
|
||||||
target_os: "vxworks".to_string(),
|
|
||||||
target_env: "gnu".to_string(),
|
|
||||||
target_vendor: "wrs".to_string(),
|
|
||||||
linker_flavor: LinkerFlavor::Gcc,
|
|
||||||
options: TargetOptions {
|
|
||||||
features: "+secure-plt,-hard-float".to_string(),
|
|
||||||
target_mcount: "_mcount".to_string(),
|
|
||||||
.. base
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
|
@ -1,27 +0,0 @@
|
||||||
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult};
|
|
||||||
|
|
||||||
pub fn target() -> TargetResult {
|
|
||||||
let mut base = super::vxworks_base::opts();
|
|
||||||
base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-mspe".to_string());
|
|
||||||
base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("--secure-plt".to_string());
|
|
||||||
base.max_atomic_width = Some(32);
|
|
||||||
|
|
||||||
Ok(Target {
|
|
||||||
llvm_target: "powerpc-unknown-linux-gnuspe".to_string(),
|
|
||||||
target_endian: "big".to_string(),
|
|
||||||
target_pointer_width: "32".to_string(),
|
|
||||||
target_c_int_width: "32".to_string(),
|
|
||||||
data_layout: "E-m:e-p:32:32-i64:64-n32".to_string(),
|
|
||||||
arch: "powerpc".to_string(),
|
|
||||||
target_os: "vxworks".to_string(),
|
|
||||||
target_env: "gnu".to_string(),
|
|
||||||
target_vendor: "wrs".to_string(),
|
|
||||||
linker_flavor: LinkerFlavor::Gcc,
|
|
||||||
options: TargetOptions {
|
|
||||||
// feature msync would disable instruction 'fsync' which is not supported by fsl_p1p2
|
|
||||||
features: "+secure-plt,+msync,-hard-float".to_string(),
|
|
||||||
target_mcount: "_mcount".to_string(),
|
|
||||||
.. base
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
|
@ -20,7 +20,6 @@ pub fn target() -> TargetResult {
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
// feature msync would disable instruction 'fsync' which is not supported by fsl_p1p2
|
// feature msync would disable instruction 'fsync' which is not supported by fsl_p1p2
|
||||||
features: "+secure-plt,+msync".to_string(),
|
features: "+secure-plt,+msync".to_string(),
|
||||||
target_mcount: "_mcount".to_string(),
|
|
||||||
.. base
|
.. base
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
use crate::spec::{LinkArgs, LinkerFlavor, TargetOptions, RelroLevel};
|
use crate::spec::{LinkArgs, LinkerFlavor, TargetOptions};
|
||||||
use std::default::Default;
|
use std::default::Default;
|
||||||
|
|
||||||
pub fn opts() -> TargetOptions {
|
pub fn opts() -> TargetOptions {
|
||||||
|
let mut args_crt = LinkArgs::new();
|
||||||
|
args_crt.insert(LinkerFlavor::Gcc, vec![
|
||||||
|
"--static-crt".to_string(),
|
||||||
|
]);
|
||||||
let mut args = LinkArgs::new();
|
let mut args = LinkArgs::new();
|
||||||
args.insert(LinkerFlavor::Gcc, vec![
|
args.insert(LinkerFlavor::Gcc, vec![
|
||||||
// We want to be able to strip as much executable code as possible
|
// We want to be able to strip as much executable code as possible
|
||||||
|
@ -12,30 +16,25 @@ pub fn opts() -> TargetOptions {
|
||||||
// following libraries so we're sure to pass it as one of the first
|
// following libraries so we're sure to pass it as one of the first
|
||||||
// arguments.
|
// arguments.
|
||||||
"-Wl,--as-needed".to_string(),
|
"-Wl,--as-needed".to_string(),
|
||||||
|
|
||||||
// Always enable NX protection when it is available
|
|
||||||
"-Wl,-z,noexecstack".to_string(),
|
|
||||||
]);
|
|
||||||
|
|
||||||
let mut late_lk_args = LinkArgs::new();
|
|
||||||
late_lk_args.insert(LinkerFlavor::Gcc, vec![
|
|
||||||
"-lnet".to_string(),
|
|
||||||
"-lunix".to_string(),
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
TargetOptions {
|
TargetOptions {
|
||||||
linker: Some("vx-cxx".to_string()),
|
linker: Some("wr-c++".to_string()),
|
||||||
exe_suffix: ".vxe".to_string(),
|
exe_suffix: ".vxe".to_string(),
|
||||||
late_link_args: late_lk_args,
|
|
||||||
dynamic_linking: true,
|
dynamic_linking: true,
|
||||||
executables: true,
|
executables: true,
|
||||||
target_family: Some("unix".to_string()),
|
target_family: Some("unix".to_string()),
|
||||||
linker_is_gnu: true,
|
linker_is_gnu: true,
|
||||||
has_rpath: true,
|
has_rpath: true,
|
||||||
pre_link_args: args,
|
pre_link_args: args,
|
||||||
position_independent_executables: true,
|
position_independent_executables: false,
|
||||||
relro_level: RelroLevel::Full,
|
|
||||||
has_elf_tls: true,
|
has_elf_tls: true,
|
||||||
|
pre_link_args_crt: args_crt,
|
||||||
|
crt_static_default: true,
|
||||||
|
crt_static_respected: true,
|
||||||
|
crt_static_allows_dylibs: true,
|
||||||
|
// VxWorks needs to implement this to support profiling
|
||||||
|
target_mcount: "_mcount".to_string(),
|
||||||
.. Default::default()
|
.. Default::default()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ pub fn target() -> TargetResult {
|
||||||
base.max_atomic_width = Some(64);
|
base.max_atomic_width = Some(64);
|
||||||
base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string());
|
base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string());
|
||||||
base.stack_probes = true;
|
base.stack_probes = true;
|
||||||
|
base.disable_redzone = true;
|
||||||
|
|
||||||
Ok(Target {
|
Ok(Target {
|
||||||
llvm_target: "x86_64-unknown-linux-gnu".to_string(),
|
llvm_target: "x86_64-unknown-linux-gnu".to_string(),
|
||||||
|
|
|
@ -1659,10 +1659,10 @@ impl<'test> TestCx<'test> {
|
||||||
_ if self.config.target.contains("vxworks") => {
|
_ if self.config.target.contains("vxworks") => {
|
||||||
let aux_dir = self.aux_output_dir_name();
|
let aux_dir = self.aux_output_dir_name();
|
||||||
let ProcArgs { prog, args } = self.make_run_args();
|
let ProcArgs { prog, args } = self.make_run_args();
|
||||||
let mut vx_run = Command::new("vx-run");
|
let mut wr_run = Command::new("wr-run");
|
||||||
vx_run.args(&[&prog]).args(args).envs(env.clone());
|
wr_run.args(&[&prog]).args(args).envs(env.clone());
|
||||||
self.compose_and_run(
|
self.compose_and_run(
|
||||||
vx_run,
|
wr_run,
|
||||||
self.config.run_lib_path.to_str().unwrap(),
|
self.config.run_lib_path.to_str().unwrap(),
|
||||||
Some(aux_dir.to_str().unwrap()),
|
Some(aux_dir.to_str().unwrap()),
|
||||||
None,
|
None,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue