about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorBaoshan Pang <baoshan.pang@windriver.com>2019-08-12 10:46:57 -0700
committerBaoshan Pang <baoshan.pang@windriver.com>2019-08-13 22:07:43 -0700
commitf161efac2bb37b40d4082256ca776ca2dbc7c0e6 (patch)
tree1e7589e142dd65f5b8acfbfd735c4aa9caa11a5a /src
parent60960a260f7b5c695fd0717311d72ce62dd4eb43 (diff)
downloadrust-f161efac2bb37b40d4082256ca776ca2dbc7c0e6.tar.gz
rust-f161efac2bb37b40d4082256ca776ca2dbc7c0e6.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/cc_detect.rs2
-rw-r--r--src/librustc_target/spec/aarch64_wrs_vxworks.rs5
-rw-r--r--src/librustc_target/spec/arm_wrs_vxworks_sf.rs25
-rw-r--r--src/librustc_target/spec/armv7_wrs_vxworks.rs31
-rw-r--r--src/librustc_target/spec/armv7_wrs_vxworks_eabihf.rs (renamed from src/librustc_target/spec/arm_wrs_vxworks.rs)8
-rw-r--r--src/librustc_target/spec/i586_wrs_vxworks.rs8
-rw-r--r--src/librustc_target/spec/i686_wrs_vxworks.rs2
-rw-r--r--src/librustc_target/spec/i686_wrs_vxworks_gnu.rs23
-rw-r--r--src/librustc_target/spec/mod.rs5
-rw-r--r--src/librustc_target/spec/powerpc64_wrs_vxworks.rs3
-rw-r--r--src/librustc_target/spec/powerpc64_wrs_vxworks_gnusf.rs26
-rw-r--r--src/librustc_target/spec/powerpc_wrs_vxworks.rs1
-rw-r--r--src/librustc_target/spec/powerpc_wrs_vxworks_gnusf.rs26
-rw-r--r--src/librustc_target/spec/powerpc_wrs_vxworks_gnuspesf.rs27
-rw-r--r--src/librustc_target/spec/powerpc_wrs_vxworks_spe.rs1
-rw-r--r--src/librustc_target/spec/vxworks_base.rs27
-rw-r--r--src/librustc_target/spec/x86_64_wrs_vxworks.rs1
-rw-r--r--src/tools/compiletest/src/runtest.rs6
18 files changed, 25 insertions, 202 deletions
diff --git a/src/bootstrap/cc_detect.rs b/src/bootstrap/cc_detect.rs
index c58a98bac36..a4cb81d3d1b 100644
--- a/src/bootstrap/cc_detect.rs
+++ b/src/bootstrap/cc_detect.rs
@@ -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();
diff --git a/src/librustc_target/spec/aarch64_wrs_vxworks.rs b/src/librustc_target/spec/aarch64_wrs_vxworks.rs
index 6ad6632341c..65caeac5ed1 100644
--- a/src/librustc_target/spec/aarch64_wrs_vxworks.rs
+++ b/src/librustc_target/spec/aarch64_wrs_vxworks.rs
@@ -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
         },
     })
diff --git a/src/librustc_target/spec/arm_wrs_vxworks_sf.rs b/src/librustc_target/spec/arm_wrs_vxworks_sf.rs
deleted file mode 100644
index bde903de102..00000000000
--- a/src/librustc_target/spec/arm_wrs_vxworks_sf.rs
+++ /dev/null
@@ -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
-        },
-    })
-}
diff --git a/src/librustc_target/spec/armv7_wrs_vxworks.rs b/src/librustc_target/spec/armv7_wrs_vxworks.rs
deleted file mode 100644
index 06c51ae6106..00000000000
--- a/src/librustc_target/spec/armv7_wrs_vxworks.rs
+++ /dev/null
@@ -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
-        }
-    })
-}
diff --git a/src/librustc_target/spec/arm_wrs_vxworks.rs b/src/librustc_target/spec/armv7_wrs_vxworks_eabihf.rs
index 06c51ae6106..9e3b24dd327 100644
--- a/src/librustc_target/spec/arm_wrs_vxworks.rs
+++ b/src/librustc_target/spec/armv7_wrs_vxworks_eabihf.rs
@@ -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 {
@@ -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
         }
     })
diff --git a/src/librustc_target/spec/i586_wrs_vxworks.rs b/src/librustc_target/spec/i586_wrs_vxworks.rs
deleted file mode 100644
index 355250e6eca..00000000000
--- a/src/librustc_target/spec/i586_wrs_vxworks.rs
+++ /dev/null
@@ -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)
-}
diff --git a/src/librustc_target/spec/i686_wrs_vxworks.rs b/src/librustc_target/spec/i686_wrs_vxworks.rs
index 4b1ff5ccbe8..c5f9583a358 100644
--- a/src/librustc_target/spec/i686_wrs_vxworks.rs
+++ b/src/librustc_target/spec/i686_wrs_vxworks.rs
@@ -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,
     })
diff --git a/src/librustc_target/spec/i686_wrs_vxworks_gnu.rs b/src/librustc_target/spec/i686_wrs_vxworks_gnu.rs
deleted file mode 100644
index 4b1ff5ccbe8..00000000000
--- a/src/librustc_target/spec/i686_wrs_vxworks_gnu.rs
+++ /dev/null
@@ -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,
-    })
-}
diff --git a/src/librustc_target/spec/mod.rs b/src/librustc_target/spec/mod.rs
index ec72c00c28f..aed31bd2fb2 100644
--- a/src/librustc_target/spec/mod.rs
+++ b/src/librustc_target/spec/mod.rs
@@ -485,10 +485,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),
diff --git a/src/librustc_target/spec/powerpc64_wrs_vxworks.rs b/src/librustc_target/spec/powerpc64_wrs_vxworks.rs
index a9520709e66..27a84b953dd 100644
--- a/src/librustc_target/spec/powerpc64_wrs_vxworks.rs
+++ b/src/librustc_target/spec/powerpc64_wrs_vxworks.rs
@@ -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
         },
     })
diff --git a/src/librustc_target/spec/powerpc64_wrs_vxworks_gnusf.rs b/src/librustc_target/spec/powerpc64_wrs_vxworks_gnusf.rs
deleted file mode 100644
index c2dae8535a2..00000000000
--- a/src/librustc_target/spec/powerpc64_wrs_vxworks_gnusf.rs
+++ /dev/null
@@ -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
-        },
-    })
-}
diff --git a/src/librustc_target/spec/powerpc_wrs_vxworks.rs b/src/librustc_target/spec/powerpc_wrs_vxworks.rs
index 2e833ee1d48..a4d2897f892 100644
--- a/src/librustc_target/spec/powerpc_wrs_vxworks.rs
+++ b/src/librustc_target/spec/powerpc_wrs_vxworks.rs
@@ -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
         },
     })
diff --git a/src/librustc_target/spec/powerpc_wrs_vxworks_gnusf.rs b/src/librustc_target/spec/powerpc_wrs_vxworks_gnusf.rs
deleted file mode 100644
index 43723ea7c0c..00000000000
--- a/src/librustc_target/spec/powerpc_wrs_vxworks_gnusf.rs
+++ /dev/null
@@ -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
-        },
-    })
-}
diff --git a/src/librustc_target/spec/powerpc_wrs_vxworks_gnuspesf.rs b/src/librustc_target/spec/powerpc_wrs_vxworks_gnuspesf.rs
deleted file mode 100644
index 8f236235867..00000000000
--- a/src/librustc_target/spec/powerpc_wrs_vxworks_gnuspesf.rs
+++ /dev/null
@@ -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
-        },
-    })
-}
diff --git a/src/librustc_target/spec/powerpc_wrs_vxworks_spe.rs b/src/librustc_target/spec/powerpc_wrs_vxworks_spe.rs
index 2305b4b7ab8..90118a14852 100644
--- a/src/librustc_target/spec/powerpc_wrs_vxworks_spe.rs
+++ b/src/librustc_target/spec/powerpc_wrs_vxworks_spe.rs
@@ -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
         },
     })
diff --git a/src/librustc_target/spec/vxworks_base.rs b/src/librustc_target/spec/vxworks_base.rs
index 6db56c553a9..16acd411dca 100644
--- a/src/librustc_target/spec/vxworks_base.rs
+++ b/src/librustc_target/spec/vxworks_base.rs
@@ -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
@@ -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()
     }
 }
diff --git a/src/librustc_target/spec/x86_64_wrs_vxworks.rs b/src/librustc_target/spec/x86_64_wrs_vxworks.rs
index eac7cd7502d..1ab2f3a47c4 100644
--- a/src/librustc_target/spec/x86_64_wrs_vxworks.rs
+++ b/src/librustc_target/spec/x86_64_wrs_vxworks.rs
@@ -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(),
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index 05cfdf1ce53..3da6be74129 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -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,