Skip to content

Commit f974f88

Browse files
author
Jorge Aparicio
committed
teach travis how to test thumb* targets
1 parent 885431e commit f974f88

File tree

7 files changed

+38
-3
lines changed

7 files changed

+38
-3
lines changed

build.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,4 +408,9 @@ fn main() {
408408
if llvm_target.last() == Some(&"gnueabihf") {
409409
println!("cargo:rustc-cfg=gnueabihf")
410410
}
411+
412+
// To compile intrinsics.rs for thumb targets, where there is no libc
413+
if llvm_target[0].starts_with("thumb") {
414+
println!("cargo:rustc-cfg=thumb")
415+
}
411416
}

ci/env.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ if [[ $TARGET != $HOST && ! $TARGET =~ ^i.86- ]]; then
4141
esac
4242

4343
export CARGO_TARGET_$(echo $TARGET | tr a-z- A-Z_)_LINKER=$GCC_TRIPLE-gcc
44+
export AR_$(echo $TARGET | tr - _)=$GCC_TRIPLE-ar
45+
export CC_$(echo $TARGET | tr - _)=$GCC_TRIPLE-gcc
4446

4547
if [[ $RUN_TESTS == y ]]; then
4648
# NOTE(export) so this can reach the processes that `cargo test` spawns

src/bin/intrinsics.rs

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
#![feature(libc)]
1111
#![feature(start)]
1212
#![no_std]
13+
#![cfg_attr(thumb, no_main)]
1314

15+
#[cfg(not(thumb))]
1416
extern crate libc;
1517
extern crate rustc_builtins;
1618

@@ -236,8 +238,7 @@ mod intrinsics {
236238
}
237239

238240
#[cfg(feature = "c")]
239-
#[start]
240-
fn main(_: isize, _: *const *const u8) -> isize {
241+
fn run() {
241242
use intrinsics::*;
242243

243244
aeabi_d2f(2.);
@@ -284,16 +285,35 @@ fn main(_: isize, _: *const *const u8) -> isize {
284285
powidf2(2., 3);
285286
powisf2(2., 3);
286287
umoddi3(2, 3);
288+
}
289+
290+
#[cfg(all(feature = "c", not(thumb)))]
291+
#[start]
292+
fn main(_: isize, _: *const *const u8) -> isize {
293+
run();
287294

288295
0
289296
}
290297

291-
#[cfg(not(feature = "c"))]
298+
#[cfg(all(not(feature = "c"), not(thumb)))]
292299
#[start]
293300
fn main(_: isize, _: *const *const u8) -> isize {
294301
0
295302
}
296303

304+
#[cfg(all(feature = "c", thumb))]
305+
#[no_mangle]
306+
pub fn _start() -> ! {
307+
run();
308+
loop {}
309+
}
310+
311+
#[cfg(all(not(feature = "c"), thumb))]
312+
#[no_mangle]
313+
pub fn _start() -> ! {
314+
loop {}
315+
}
316+
297317
// ARM targets need these symbols
298318
#[no_mangle]
299319
pub fn __aeabi_unwind_cpp_pr0() {}

thumbv6m-none-eabi.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
{
22
"arch": "arm",
33
"data-layout": "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64",
4+
"executables": true,
45
"features": "+strict-align",
56
"llvm-target": "thumbv6m-none-eabi",
67
"max-atomic-width": 0,
78
"os": "none",
9+
"pre-link-args": ["-nostartfiles"],
810
"target-endian": "little",
911
"target-pointer-width": "32"
1012
}

thumbv7em-none-eabi.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
{
22
"arch": "arm",
33
"data-layout": "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64",
4+
"executables": true,
45
"llvm-target": "thumbv7em-none-eabi",
56
"os": "none",
7+
"pre-link-args": ["-nostartfiles"],
68
"target-endian": "little",
79
"target-pointer-width": "32"
810
}

thumbv7em-none-eabihf.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
{
22
"arch": "arm",
33
"data-layout": "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64",
4+
"executables": true,
45
"features": "+vfp4",
56
"llvm-target": "thumbv7em-none-eabihf",
67
"os": "none",
8+
"pre-link-args": ["-nostartfiles"],
79
"target-endian": "little",
810
"target-pointer-width": "32"
911
}

thumbv7m-none-eabi.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
{
22
"arch": "arm",
33
"data-layout": "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64",
4+
"executables": true,
45
"llvm-target": "thumbv7m-none-eabi",
56
"os": "none",
7+
"pre-link-args": ["-nostartfiles"],
68
"target-endian": "little",
79
"target-pointer-width": "32"
810
}

0 commit comments

Comments
 (0)