Skip to content

Commit

Permalink
Rollup merge of #63604 - Wind-River:master, r=alexcrichton
Browse files Browse the repository at this point in the history
Some update for vxWorks

1. support crt-static
2. change armv7_wrs_vxworks to armv7_wrs_vxworks_eabihf.
3. change vx-cxx to wr-c++,  vx-ar to wr-ar and vx-run to wr-run.
4. code cleanup

r? @alexcrichton
  • Loading branch information
Centril committed Aug 16, 2019
2 parents c53ce3b + 403e672 commit b731131
Show file tree
Hide file tree
Showing 18 changed files with 25 additions and 202 deletions.
2 changes: 1 addition & 1 deletion src/bootstrap/cc_detect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ fn cc2ar(cc: &Path, target: &str) -> Option<PathBuf> {
} else if target.contains("openbsd") {
Some(PathBuf::from("ar"))
} else if target.contains("vxworks") {
Some(PathBuf::from("vx-ar"))
Some(PathBuf::from("wr-ar"))
} else {
let parent = cc.parent().unwrap();
let file = cc.file_name().unwrap().to_str().unwrap();
Expand Down
5 changes: 2 additions & 3 deletions src/librustc_target/spec/aarch64_wrs_vxworks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@ pub fn target() -> TargetResult {
target_endian: "little".to_string(),
target_pointer_width: "64".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(),
arch: "aarch64".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,
options: TargetOptions {
abi_blacklist: super::arm_base::abi_blacklist(),
target_mcount: "\u{1}_mcount".to_string(),
.. base
},
})
Expand Down
25 changes: 0 additions & 25 deletions src/librustc_target/spec/arm_wrs_vxworks_sf.rs

This file was deleted.

31 changes: 0 additions & 31 deletions src/librustc_target/spec/armv7_wrs_vxworks.rs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
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 {
Expand All @@ -14,17 +11,14 @@ pub fn target() -> TargetResult {
arch: "arm".to_string(),
target_os: "vxworks".to_string(),
target_env: "gnu".to_string(),
target_vendor: "unknown".to_string(),
target_vendor: "wrs".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
}
})
Expand Down
8 changes: 0 additions & 8 deletions src/librustc_target/spec/i586_wrs_vxworks.rs

This file was deleted.

2 changes: 1 addition & 1 deletion src/librustc_target/spec/i686_wrs_vxworks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub fn target() -> TargetResult {
arch: "x86".to_string(),
target_os: "vxworks".to_string(),
target_env: "gnu".to_string(),
target_vendor: "unknown".to_string(),
target_vendor: "wrs".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: base,
})
Expand Down
23 changes: 0 additions & 23 deletions src/librustc_target/spec/i686_wrs_vxworks_gnu.rs

This file was deleted.

5 changes: 2 additions & 3 deletions src/librustc_target/spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -493,10 +493,9 @@ supported_targets! {

("nvptx64-nvidia-cuda", nvptx64_nvidia_cuda),

("x86_64-wrs-vxworks", x86_64_wrs_vxworks),
("i686-wrs-vxworks", i686_wrs_vxworks),
("i586-wrs-vxworks", i586_wrs_vxworks),
("armv7-wrs-vxworks", armv7_wrs_vxworks),
("x86_64-wrs-vxworks", x86_64_wrs_vxworks),
("armv7-wrs-vxworks-eabihf", armv7_wrs_vxworks_eabihf),
("aarch64-wrs-vxworks", aarch64_wrs_vxworks),
("powerpc-wrs-vxworks", powerpc_wrs_vxworks),
("powerpc-wrs-vxworks-spe", powerpc_wrs_vxworks_spe),
Expand Down
3 changes: 1 addition & 2 deletions src/librustc_target/spec/powerpc64_wrs_vxworks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ pub fn target() -> TargetResult {
arch: "powerpc64".to_string(),
target_os: "vxworks".to_string(),
target_env: "gnu".to_string(),
target_vendor: "unknown".to_string(),
target_vendor: "wrs".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions {
target_mcount: "_mcount".to_string(),
.. base
},
})
Expand Down
26 changes: 0 additions & 26 deletions src/librustc_target/spec/powerpc64_wrs_vxworks_gnusf.rs

This file was deleted.

1 change: 0 additions & 1 deletion src/librustc_target/spec/powerpc_wrs_vxworks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ pub fn target() -> TargetResult {
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions {
features: "+secure-plt".to_string(),
target_mcount: "_mcount".to_string(),
.. base
},
})
Expand Down
26 changes: 0 additions & 26 deletions src/librustc_target/spec/powerpc_wrs_vxworks_gnusf.rs

This file was deleted.

27 changes: 0 additions & 27 deletions src/librustc_target/spec/powerpc_wrs_vxworks_gnuspesf.rs

This file was deleted.

1 change: 0 additions & 1 deletion src/librustc_target/spec/powerpc_wrs_vxworks_spe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ pub fn target() -> TargetResult {
options: TargetOptions {
// feature msync would disable instruction 'fsync' which is not supported by fsl_p1p2
features: "+secure-plt,+msync".to_string(),
target_mcount: "_mcount".to_string(),
.. base
},
})
Expand Down
27 changes: 13 additions & 14 deletions src/librustc_target/spec/vxworks_base.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
use crate::spec::{LinkArgs, LinkerFlavor, TargetOptions, RelroLevel};
use crate::spec::{LinkArgs, LinkerFlavor, TargetOptions};
use std::default::Default;

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();
args.insert(LinkerFlavor::Gcc, vec![
// We want to be able to strip as much executable code as possible
Expand All @@ -12,30 +16,25 @@ pub fn opts() -> TargetOptions {
// following libraries so we're sure to pass it as one of the first
// arguments.
"-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 {
linker: Some("vx-cxx".to_string()),
linker: Some("wr-c++".to_string()),
exe_suffix: ".vxe".to_string(),
late_link_args: late_lk_args,
dynamic_linking: true,
executables: true,
target_family: Some("unix".to_string()),
linker_is_gnu: true,
has_rpath: true,
pre_link_args: args,
position_independent_executables: true,
relro_level: RelroLevel::Full,
position_independent_executables: false,
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()
}
}
1 change: 1 addition & 0 deletions src/librustc_target/spec/x86_64_wrs_vxworks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ pub fn target() -> TargetResult {
base.max_atomic_width = Some(64);
base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string());
base.stack_probes = true;
base.disable_redzone = true;

Ok(Target {
llvm_target: "x86_64-unknown-linux-gnu".to_string(),
Expand Down
6 changes: 3 additions & 3 deletions src/tools/compiletest/src/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1659,10 +1659,10 @@ impl<'test> TestCx<'test> {
_ if self.config.target.contains("vxworks") => {
let aux_dir = self.aux_output_dir_name();
let ProcArgs { prog, args } = self.make_run_args();
let mut vx_run = Command::new("vx-run");
vx_run.args(&[&prog]).args(args).envs(env.clone());
let mut wr_run = Command::new("wr-run");
wr_run.args(&[&prog]).args(args).envs(env.clone());
self.compose_and_run(
vx_run,
wr_run,
self.config.run_lib_path.to_str().unwrap(),
Some(aux_dir.to_str().unwrap()),
None,
Expand Down

0 comments on commit b731131

Please sign in to comment.