about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-02-14 01:41:46 -0800
committerbors <bors@rust-lang.org>2014-02-14 01:41:46 -0800
commitd40b5374055086df88727925872f0733843f9d2e (patch)
treef15eb3389b4a9e181e7e2d7e9fd5b964cb34f9f9
parent03b324ff4481255a371bb234fc3e53bcb8d08e7e (diff)
parentffdda22aa28b9231bd3d62ee4db5239f616fce8d (diff)
downloadrust-d40b5374055086df88727925872f0733843f9d2e.tar.gz
rust-d40b5374055086df88727925872f0733843f9d2e.zip
auto merge of #12192 : luqmana/rust/fix-cross, r=alexcrichton
Fix some fall out from the big command line option changes.
-rw-r--r--mk/platform.mk17
-rw-r--r--mk/tests.mk3
-rw-r--r--src/compiletest/common.rs7
-rw-r--r--src/compiletest/compiletest.rs9
-rw-r--r--src/compiletest/runtest.rs14
5 files changed, 31 insertions, 19 deletions
diff --git a/mk/platform.mk b/mk/platform.mk
index 5a69013892c..26222f74fe6 100644
--- a/mk/platform.mk
+++ b/mk/platform.mk
@@ -300,7 +300,7 @@ CFG_PATH_MUNGE_arm-linux-androideabi := true
 CFG_LDPATH_arm-linux-androideabi :=
 CFG_RUN_arm-linux-androideabi=
 CFG_RUN_TARG_arm-linux-androideabi=
-RUSTC_FLAGS_arm-linux-androideabi :=-C android-cross-path=$(CFG_ANDROID_CROSS_PATH)
+RUSTC_FLAGS_arm-linux-androideabi :=
 RUSTC_CROSS_FLAGS_arm-linux-androideabi :=-C android-cross-path=$(CFG_ANDROID_CROSS_PATH)
 
 # arm-unknown-linux-gnueabihf configuration
@@ -331,7 +331,7 @@ CFG_LDPATH_arm-unknown-linux-gnueabihf :=
 CFG_RUN_arm-unknown-linux-gnueabihf=$(2)
 CFG_RUN_TARG_arm-unknown-linux-gnueabihf=$(call CFG_RUN_arm-unknown-linux-gnueabihf,,$(2))
 RUSTC_FLAGS_arm-unknown-linux-gnueabihf :=
-RUSTC_CROSS_FLAGS_arm-unknown-linux-gnueabihf := --linker=$(CROSS_PREFIX_arm-unknown-linux-gnueabihf)$(CXX_arm-unknown-linux-gnueabihf)
+RUSTC_CROSS_FLAGS_arm-unknown-linux-gnueabihf :=
 
 # arm-unknown-linux-gnueabi configuration
 CROSS_PREFIX_arm-unknown-linux-gnueabi=arm-linux-gnueabi-
@@ -343,7 +343,7 @@ CFG_LIB_NAME_arm-unknown-linux-gnueabi=lib$(1).so
 CFG_STATIC_LIB_NAME_arm-unknown-linux-gnueabi=lib$(1).a
 CFG_LIB_GLOB_arm-unknown-linux-gnueabi=lib$(1)-*.so
 CFG_LIB_DSYM_GLOB_arm-unknown-linux-gnueabi=lib$(1)-*.dylib.dSYM
-CFG_GCCISH_CFLAGS_arm-unknown-linux-gnueabi := -Wall -g -fPIC -D__arm__
+CFG_GCCISH_CFLAGS_arm-unknown-linux-gnueabi := -Wall -g -fPIC -D__arm__ -mfpu=vfp
 CFG_GCCISH_CXXFLAGS_arm-unknown-linux-gnueabi := -fno-rtti
 CFG_GCCISH_LINK_FLAGS_arm-unknown-linux-gnueabi := -shared -fPIC -g
 CFG_GCCISH_DEF_FLAG_arm-unknown-linux-gnueabi := -Wl,--export-dynamic,--dynamic-list=
@@ -361,7 +361,7 @@ CFG_LDPATH_arm-unknown-linux-gnueabi :=
 CFG_RUN_arm-unknown-linux-gnueabi=$(2)
 CFG_RUN_TARG_arm-unknown-linux-gnueabi=$(call CFG_RUN_arm-unknown-linux-gnueabi,,$(2))
 RUSTC_FLAGS_arm-unknown-linux-gnueabi :=
-RUSTC_CROSS_FLAGS_arm-unknown-linux-gnueabi := --linker=$(CROSS_PREFIX_arm-unknown-linux-gnueabi)$(CXX_arm-unknown-linux-gnueabi)
+RUSTC_CROSS_FLAGS_arm-unknown-linux-gnueabi :=
 
 # mips-unknown-linux-gnu configuration
 CC_mips-unknown-linux-gnu=mips-linux-gnu-gcc
@@ -389,7 +389,7 @@ CFG_PATH_MUNGE_mips-unknown-linux-gnu := true
 CFG_LDPATH_mips-unknown-linux-gnu :=
 CFG_RUN_mips-unknown-linux-gnu=
 CFG_RUN_TARG_mips-unknown-linux-gnu=
-RUSTC_FLAGS_mips-unknown-linux-gnu := --linker=$(CXX_mips-unknown-linux-gnu) --target-cpu mips32r2 --target-feature +mips32r2,+o32 -Z soft-float
+RUSTC_FLAGS_mips-unknown-linux-gnu := -C target-cpu=mips32r2 -C target-feature="+mips32r2,+o32" -C soft-float
 
 # i686-pc-mingw32 configuration
 CC_i686-pc-mingw32=$(CC)
@@ -475,7 +475,7 @@ CFG_PATH_MUNGE_i686-w64-mingw32 :=
 CFG_LDPATH_i686-w64-mingw32 :=$(CFG_LDPATH_i686-w64-mingw32):$(PATH)
 CFG_RUN_i686-w64-mingw32=PATH="$(CFG_LDPATH_i686-w64-mingw32):$(1)" $(2)
 CFG_RUN_TARG_i686-w64-mingw32=$(call CFG_RUN_i686-w64-mingw32,$(HLIB$(1)_H_$(CFG_BUILD)),$(2))
-RUSTC_CROSS_FLAGS_i686-w64-mingw32 := --linker=$(CROSS_PREFIX_i686-w64-mingw32)$(CXX_i686-w64-mingw32)
+RUSTC_CROSS_FLAGS_i686-w64-mingw32 :=
 
 # x86_64-w64-mingw32 configuration
 CROSS_PREFIX_x86_64-w64-mingw32=x86_64-w64-mingw32-
@@ -504,7 +504,7 @@ CFG_PATH_MUNGE_x86_64-w64-mingw32 :=
 CFG_LDPATH_x86_64-w64-mingw32 :=$(CFG_LDPATH_x86_64-w64-mingw32):$(PATH)
 CFG_RUN_x86_64-w64-mingw32=PATH="$(CFG_LDPATH_x86_64-w64-mingw32):$(1)" $(2)
 CFG_RUN_TARG_x86_64-w64-mingw32=$(call CFG_RUN_x86_64-w64-mingw32,$(HLIB$(1)_H_$(CFG_BUILD)),$(2))
-RUSTC_CROSS_FLAGS_x86_64-w64-mingw32 := --linker=$(CROSS_PREFIX_x86_64-w64-mingw32)$(CXX_x86_64-w64-mingw32)
+RUSTC_CROSS_FLAGS_x86_64-w64-mingw32 :=
 
 # x86_64-unknown-freebsd configuration
 CC_x86_64-unknown-freebsd=$(CC)
@@ -549,8 +549,9 @@ define CFG_MAKE_TOOLCHAIN
 	CXX_$(1)=$(CROSS_PREFIX_$(1))$(CXX_$(1))
 	CPP_$(1)=$(CROSS_PREFIX_$(1))$(CPP_$(1))
 	AR_$(1)=$(CROSS_PREFIX_$(1))$(AR_$(1))
+	RUSTC_CROSS_FLAGS_$(1)=-C linker=$$(CXX_$(1)) -C ar=$$(AR_$(1)) $(RUSTC_CROSS_FLAGS_$(1))
 
-	RUSTC_FLAGS_$(1)=$(RUSTC_CROSS_FLAGS_$(1))
+	RUSTC_FLAGS_$(1)=$$(RUSTC_CROSS_FLAGS_$(1)) $(RUSTC_FLAGS_$(1))
   endif
 
   CFG_COMPILE_C_$(1) = $$(CC_$(1))  \
diff --git a/mk/tests.mk b/mk/tests.mk
index a8ad51409d9..7dec48b8372 100644
--- a/mk/tests.mk
+++ b/mk/tests.mk
@@ -554,7 +554,8 @@ CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) :=						\
         --host $(3)                                       \
         --adb-path=$(CFG_ADB)                          \
         --adb-test-dir=$(CFG_ADB_TEST_DIR)                  \
-        --rustcflags "$(RUSTC_FLAGS_$(2)) $$(CTEST_RUSTC_FLAGS) -L $$(RT_OUTPUT_DIR_$(2))" \
+        --host-rustcflags "$(RUSTC_FLAGS_$(3)) $$(CTEST_RUSTC_FLAGS) -L $$(RT_OUTPUT_DIR_$(2))" \
+        --target-rustcflags "$(RUSTC_FLAGS_$(2)) $$(CTEST_RUSTC_FLAGS) -L $$(RT_OUTPUT_DIR_$(2))" \
         $$(CTEST_TESTARGS)
 
 CTEST_DEPS_rpass_$(1)-T-$(2)-H-$(3) = $$(RPASS_TESTS)
diff --git a/src/compiletest/common.rs b/src/compiletest/common.rs
index 4cf224cf404..4d1f7ab5956 100644
--- a/src/compiletest/common.rs
+++ b/src/compiletest/common.rs
@@ -77,8 +77,11 @@ pub struct config {
     // for running under valgrind
     runtool: Option<~str>,
 
-    // Flags to pass to the compiler
-    rustcflags: Option<~str>,
+    // Flags to pass to the compiler when building for the host
+    host_rustcflags: Option<~str>,
+
+    // Flags to pass to the compiler when building for the target
+    target_rustcflags: Option<~str>,
 
     // Run tests using the JIT
     jit: bool,
diff --git a/src/compiletest/compiletest.rs b/src/compiletest/compiletest.rs
index 970ee535e0b..94153c169ac 100644
--- a/src/compiletest/compiletest.rs
+++ b/src/compiletest/compiletest.rs
@@ -64,7 +64,8 @@ pub fn parse_config(args: ~[~str]) -> config {
           optflag("", "ignored", "run tests marked as ignored"),
           optopt("", "runtool", "supervisor program to run tests under \
                                  (eg. emulator, valgrind)", "PROGRAM"),
-          optopt("", "rustcflags", "flags to pass to rustc", "FLAGS"),
+          optopt("", "host-rustcflags", "flags to pass to rustc for host", "FLAGS"),
+          optopt("", "target-rustcflags", "flags to pass to rustc for target", "FLAGS"),
           optflag("", "verbose", "run tests verbosely, showing all output"),
           optopt("", "logfile", "file to log test execution to", "FILE"),
           optopt("", "save-metrics", "file to save metrics to", "FILE"),
@@ -132,7 +133,8 @@ pub fn parse_config(args: ~[~str]) -> config {
         ratchet_noise_percent:
             matches.opt_str("ratchet-noise-percent").and_then(|s| from_str::<f64>(s)),
         runtool: matches.opt_str("runtool"),
-        rustcflags: matches.opt_str("rustcflags"),
+        host_rustcflags: matches.opt_str("host-rustcflags"),
+        target_rustcflags: matches.opt_str("target-rustcflags"),
         jit: matches.opt_present("jit"),
         target: opt_str2(matches.opt_str("target")).to_str(),
         host: opt_str2(matches.opt_str("host")).to_str(),
@@ -161,7 +163,8 @@ pub fn log_config(config: &config) {
     logv(c, format!("run_ignored: {}", config.run_ignored));
     logv(c, format!("filter: {}", opt_str(&config.filter)));
     logv(c, format!("runtool: {}", opt_str(&config.runtool)));
-    logv(c, format!("rustcflags: {}", opt_str(&config.rustcflags)));
+    logv(c, format!("host-rustcflags: {}", opt_str(&config.host_rustcflags)));
+    logv(c, format!("target-rustcflags: {}", opt_str(&config.target_rustcflags)));
     logv(c, format!("jit: {}", config.jit));
     logv(c, format!("target: {}", config.target));
     logv(c, format!("host: {}", config.host));
diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs
index f906c0fc4e1..a2c61352e6f 100644
--- a/src/compiletest/runtest.rs
+++ b/src/compiletest/runtest.rs
@@ -250,7 +250,7 @@ actual:\n\
                          ~"-L", config.build_base.as_str().unwrap().to_owned(),
                          ~"-L",
                          aux_dir.as_str().unwrap().to_owned()];
-        args.push_all_move(split_maybe_args(&config.rustcflags));
+        args.push_all_move(split_maybe_args(&config.target_rustcflags));
         args.push_all_move(split_maybe_args(&props.compile_flags));
         // FIXME (#9639): This needs to handle non-utf8 paths
         return ProcArgs {prog: config.rustc_path.as_str().unwrap().to_owned(), args: args};
@@ -260,9 +260,9 @@ actual:\n\
 fn run_debuginfo_test(config: &config, props: &TestProps, testfile: &Path) {
 
     // do not optimize debuginfo tests
-    let mut config = match config.rustcflags {
+    let mut config = match config.target_rustcflags {
         Some(ref flags) => config {
-            rustcflags: Some(flags.replace("-O", "")),
+            target_rustcflags: Some(flags.replace("-O", "")),
             .. (*config).clone()
         },
         None => (*config).clone()
@@ -329,7 +329,7 @@ fn run_debuginfo_test(config: &config, props: &TestProps, testfile: &Path) {
                 break;
             }
 
-            let args = split_maybe_args(&config.rustcflags);
+            let args = split_maybe_args(&config.target_rustcflags);
             let mut tool_path:~str = ~"";
             for arg in args.iter() {
                 if arg.contains("android-cross-path=") {
@@ -770,7 +770,11 @@ fn make_compile_args(config: &config,
         ThisDirectory(path) => { args.push(~"--out-dir"); path }
     };
     args.push(path.as_str().unwrap().to_owned());
-    args.push_all_move(split_maybe_args(&config.rustcflags));
+    if props.force_host {
+        args.push_all_move(split_maybe_args(&config.host_rustcflags));
+    } else {
+        args.push_all_move(split_maybe_args(&config.target_rustcflags));
+    }
     args.push_all_move(split_maybe_args(&props.compile_flags));
     return ProcArgs {prog: config.rustc_path.as_str().unwrap().to_owned(), args: args};
 }