forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d71ae5e
commit 043550d
Showing
21 changed files
with
191 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
shepmaster
Author
Member
|
||
// 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. | ||
|
||
#![allow(non_upper_case_globals)] | ||
|
||
use crate::abi::call::{FnType, ArgType}; | ||
|
||
fn classify_ret_ty<Ty>(ret: &mut ArgType<'_, Ty>) { | ||
if ret.layout.is_aggregate() { | ||
ret.make_indirect(); | ||
} else { | ||
ret.extend_integer_width_to(8); // Is 8 correct? | ||
} | ||
} | ||
|
||
fn classify_arg_ty<Ty>(arg: &mut ArgType<'_, Ty>) { | ||
if arg.layout.is_aggregate() { | ||
arg.make_indirect(); | ||
} else { | ||
arg.extend_integer_width_to(8); | ||
} | ||
} | ||
|
||
pub fn compute_abi_info<Ty>(fty: &mut FnType<'_, Ty>) { | ||
if !fty.ret.is_ignore() { | ||
classify_ret_ty(&mut fty.ret); | ||
} | ||
|
||
for arg in &mut fty.args { | ||
if arg.is_ignore() { | ||
continue; | ||
} | ||
|
||
classify_arg_ty(arg); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright 2015 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 crate::spec::{LinkerFlavor, Target, TargetResult}; | ||
|
||
pub fn target() -> TargetResult { | ||
Ok(Target { | ||
llvm_target: "avr-unknown-unknown".to_string(), | ||
target_endian: "little".to_string(), | ||
target_pointer_width: "16".to_string(), | ||
data_layout: "e-P1-p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8-a:8".to_string(), | ||
arch: "avr".to_string(), | ||
linker_flavor: LinkerFlavor::Gcc, | ||
target_os: "unknown".to_string(), | ||
target_env: "".to_string(), | ||
target_vendor: "unknown".to_string(), | ||
target_c_int_width: 16.to_string(), | ||
options: super::none_base::opts(), | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright 2014 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 std::default::Default; | ||
use crate::spec::{LinkerFlavor, LinkArgs, TargetOptions}; | ||
|
||
pub fn opts() -> TargetOptions { | ||
let mut args = LinkArgs::new(); | ||
|
||
args.insert(LinkerFlavor::Gcc, vec![ | ||
// We want to be able to strip as much executable code as possible | ||
// from the linker command line, and this flag indicates to the | ||
// linker that it can avoid linking in dynamic libraries that don't | ||
// actually satisfy any symbols up to that point (as with many other | ||
// resolutions the linker does). This option only applies to all | ||
// following libraries so we're sure to pass it as one of the first | ||
// arguments. | ||
"-Wl,--as-needed".to_string(), | ||
]); | ||
|
||
TargetOptions { | ||
dynamic_linking: false, | ||
executables: true, | ||
linker_is_gnu: true, | ||
has_rpath: false, | ||
pre_link_args: args, | ||
position_independent_executables: true, | ||
.. Default::default() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/test/ui/feature-gates/feature-gate-abi-avr-interrupt.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright 2018 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. | ||
|
||
// Test that the AVR interrupt ABI cannot be used when avr_interrupt | ||
// feature gate is not used. | ||
|
||
extern "avr-interrupt" fn foo() {} | ||
//~^ ERROR avr-interrupt and avr-non-blocking-interrupt ABIs are experimental and subject to change | ||
|
||
fn main() { | ||
foo(); | ||
} |
11 changes: 11 additions & 0 deletions
11
src/test/ui/feature-gates/feature-gate-abi-avr-interrupt.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
error[E0658]: avr-interrupt and avr-non-blocking-interrupt ABIs are experimental and subject to change | ||
--> $DIR/feature-gate-abi-avr-interrupt.rs:14:1 | ||
| | ||
LL | extern "avr-interrupt" fn foo() {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= help: add #![feature(abi_avr_interrupt)] to the crate attributes to enable | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0658`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,7 @@ const OS_TABLE: &'static [(&'static str, &'static str)] = &[ | |
("mingw32", "windows"), | ||
("none", "none"), | ||
("netbsd", "netbsd"), | ||
("none", "none"), | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
shepmaster
Author
Member
|
||
("openbsd", "openbsd"), | ||
("redox", "redox"), | ||
("sgx", "sgx"), | ||
|
@@ -42,6 +43,7 @@ const ARCH_TABLE: &'static [(&'static str, &'static str)] = &[ | |
("armv7", "arm"), | ||
("armv7s", "arm"), | ||
("asmjs", "asmjs"), | ||
("avr", "avr"), | ||
("hexagon", "hexagon"), | ||
("i386", "x86"), | ||
("i586", "x86"), | ||
|
These comments were removed from rust a while ago, right? I don't see them in any of the files that this commit modifies, only in the ones that are newly created.