about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-01-21 11:26:13 -0800
committerbors <bors@rust-lang.org>2014-01-21 11:26:13 -0800
commit505572b3f830c8f5140efaaf2adf8293e29b0db9 (patch)
tree3a19f772ea175bda23c09e8e0c8251c38d527e51 /src
parent232d8e560561e07b3ba54c5d0234816e50342fb3 (diff)
parent50d0e07065b7cc9a08427a009740abd12397fc9d (diff)
downloadrust-505572b3f830c8f5140efaaf2adf8293e29b0db9.tar.gz
rust-505572b3f830c8f5140efaaf2adf8293e29b0db9.zip
auto merge of #11700 : bharrisau/rust/thumb, r=alexcrichton
To build for the cortex-M series ARM processors LLC needs to be told to build for the thumb instruction set. There are two ways to do this, either with the triple "thumb\*-\*-\*" or with -march=thumb (which just overrides the triple anyway). I chose the first way.

The following will fail because the local cc doesn't know what to do with -mthumb.
````
rustc test.rs --lib --target thumb-linux-eab
error: linking with `cc` failed: exit code: 1
note: cc: error: unrecognized command line option ‘-mthumb’
````

Changing the linker works as expected.
````
rustc test.rs --lib --target thumb-linux-eabi --linker arm-none-eabi-gcc
````

Ideally I'd have the triple thumb-none-eabi, but adding a new OS looks like much more work (and I'm not familiar enough with what it does to know if it is needed).
Diffstat (limited to 'src')
-rw-r--r--src/librustc/back/arm.rs7
-rw-r--r--src/librustc/driver/driver.rs1
2 files changed, 7 insertions, 1 deletions
diff --git a/src/librustc/back/arm.rs b/src/librustc/back/arm.rs
index c155f4bd15b..92a0c90cd9d 100644
--- a/src/librustc/back/arm.rs
+++ b/src/librustc/back/arm.rs
@@ -14,6 +14,11 @@ use metadata::loader::meta_section_name;
 use syntax::abi;
 
 pub fn get_target_strs(target_triple: ~str, target_os: abi::Os) -> target_strs::t {
+    let cc_args = if target_triple.contains("thumb") {
+        ~[~"-mthumb"]
+    } else {
+        ~[~"-marm"]
+    };
     return target_strs::t {
         module_asm: ~"",
 
@@ -63,6 +68,6 @@ pub fn get_target_strs(target_triple: ~str, target_os: abi::Os) -> target_strs::
 
         target_triple: target_triple,
 
-        cc_args: ~[~"-marm"],
+        cc_args: cc_args,
     };
 }
diff --git a/src/librustc/driver/driver.rs b/src/librustc/driver/driver.rs
index dcab4376cd1..9cc12caa478 100644
--- a/src/librustc/driver/driver.rs
+++ b/src/librustc/driver/driver.rs
@@ -661,6 +661,7 @@ static architecture_abis : &'static [(&'static str, abi::Architecture)] = &'stat
 
     ("arm",    abi::Arm),
     ("xscale", abi::Arm),
+    ("thumb",  abi::Arm),
 
     ("mips",   abi::Mips)];