-
Notifications
You must be signed in to change notification settings - Fork 13.4k
add Thumbs to the compiler #36874
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add Thumbs to the compiler #36874
Changes from 4 commits
901c5f2
e4c3263
396b757
6d0b8ae
cbc56f1
470eff7
251f04e
6136069
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
use target::TargetOptions; | ||
use std::default::Default; | ||
|
||
pub fn opts() -> TargetOptions { | ||
TargetOptions { | ||
executables: true, | ||
linker: "arm-none-eabi-gcc".to_string(), | ||
panic_strategy: "abort".to_string(), | ||
relocation_model: "static".to_string(), | ||
.. Default::default() | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
use target::{Target, TargetOptions, TargetResult}; | ||
|
||
pub fn target() -> TargetResult { | ||
Ok(Target { | ||
llvm_target: "thumbv6m-none-eabi".to_string(), | ||
target_endian: "little".to_string(), | ||
target_pointer_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: "none".to_string(), | ||
target_env: "".to_string(), | ||
target_vendor: "".to_string(), | ||
|
||
options: TargetOptions { | ||
// The ARMv6-M architecture doesn't support unaligned loads/stores so we disable them | ||
// with +strict-align. | ||
features: "+strict-align".to_string(), | ||
// There are no atomic instructions available in the instruction set of the ARMv6-M | ||
// architecture | ||
max_atomic_width: 0, | ||
.. super::thumb_base::opts() | ||
} | ||
}) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
use target::{Target, TargetOptions, TargetResult}; | ||
|
||
pub fn target() -> TargetResult { | ||
Ok(Target { | ||
llvm_target: "thumbv7em-none-eabi".to_string(), | ||
target_endian: "little".to_string(), | ||
target_pointer_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: "none".to_string(), | ||
target_env: "".to_string(), | ||
target_vendor: "".to_string(), | ||
|
||
options: TargetOptions { | ||
max_atomic_width: 32, | ||
.. super::thumb_base::opts() | ||
}, | ||
}) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
use target::{Target, TargetOptions, TargetResult}; | ||
|
||
pub fn target() -> TargetResult { | ||
Ok(Target { | ||
llvm_target: "thumbv7em-none-eabihf".to_string(), | ||
target_endian: "little".to_string(), | ||
target_pointer_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: "none".to_string(), | ||
target_env: "".to_string(), | ||
target_vendor: "".to_string(), | ||
|
||
options: TargetOptions { | ||
// vfp4 lowest common denominator between the Cortex-M4 (vfp4) and the Cortex-M7 (vfp5) | ||
features: "+vfp4".to_string(), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe you also need +fp-only-sp There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, won't that preclude a user from enabling double precision hardware acceleration? Perhaps they'll have to pass There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done! Thank you @parched. |
||
max_atomic_width: 32, | ||
.. super::thumb_base::opts() | ||
} | ||
}) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
use target::{Target, TargetOptions, TargetResult}; | ||
|
||
pub fn target() -> TargetResult { | ||
Ok(Target { | ||
llvm_target: "thumbv7m-none-eabi".to_string(), | ||
target_endian: "little".to_string(), | ||
target_pointer_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: "none".to_string(), | ||
target_env: "".to_string(), | ||
target_vendor: "".to_string(), | ||
|
||
options: TargetOptions { | ||
max_atomic_width: 32, | ||
.. super::thumb_base::opts() | ||
}, | ||
}) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
-include ../tools.mk | ||
|
||
# The target used below doesn't support atomic operations. Verify that's the case | ||
all: | ||
$(RUSTC) --print cfg --target thumbv6m-none-eabi | grep -qv target_has_atomic |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alexcrichton this fixes the problem I was seeing where setting
max_atomic_width
to0
in theTarget
declaration was being converted into32
due to the JSON roundtrip. I've also added a rmake test for this.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Woah can't we use
Option
instead of magic0
treatment or similar? Granted, I'm arriving late to this issue so apologies if that has already been ruled out for good reason.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was the simplest change necessary to make this work but using
Option
here sounds better; I'll give it a try.