Add tests
This commit is contained in:
parent
fc41d4bf35
commit
fb5539b475
5 changed files with 66 additions and 2 deletions
|
@ -1,5 +1,5 @@
|
||||||
use super::{InlineAsmArch, InlineAsmType};
|
use super::{InlineAsmArch, InlineAsmType};
|
||||||
use crate::spec::{Target, RelocModel};
|
use crate::spec::{RelocModel, Target};
|
||||||
use rustc_data_structures::stable_set::FxHashSet;
|
use rustc_data_structures::stable_set::FxHashSet;
|
||||||
use rustc_macros::HashStable_Generic;
|
use rustc_macros::HashStable_Generic;
|
||||||
use rustc_span::{sym, Symbol};
|
use rustc_span::{sym, Symbol};
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use super::{InlineAsmArch, InlineAsmType};
|
use super::{InlineAsmArch, InlineAsmType};
|
||||||
use crate::spec::{Target, RelocModel};
|
use crate::spec::{RelocModel, Target};
|
||||||
use rustc_data_structures::stable_set::FxHashSet;
|
use rustc_data_structures::stable_set::FxHashSet;
|
||||||
use rustc_macros::HashStable_Generic;
|
use rustc_macros::HashStable_Generic;
|
||||||
use rustc_span::Symbol;
|
use rustc_span::Symbol;
|
||||||
|
|
26
src/test/ui/asm/issue-85247.rs
Normal file
26
src/test/ui/asm/issue-85247.rs
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
// revisions: ropi rwpi
|
||||||
|
|
||||||
|
// [ropi] compile-flags: --target armv7-unknown-linux-gnueabihf -C relocation-model=ropi
|
||||||
|
// [rwpi] compile-flags: --target armv7-unknown-linux-gnueabihf -C relocation-model=rwpi
|
||||||
|
// [ropi] needs-llvm-components: arm
|
||||||
|
// [rwpi] needs-llvm-components: arm
|
||||||
|
// [ropi] build-pass
|
||||||
|
|
||||||
|
#![feature(no_core, lang_items, rustc_attrs)]
|
||||||
|
#![no_core]
|
||||||
|
#![crate_type = "rlib"]
|
||||||
|
|
||||||
|
#[rustc_builtin_macro]
|
||||||
|
macro_rules! asm {
|
||||||
|
() => {};
|
||||||
|
}
|
||||||
|
#[lang = "sized"]
|
||||||
|
trait Sized {}
|
||||||
|
|
||||||
|
// R9 is reserved as the RWPI base register
|
||||||
|
fn main() {
|
||||||
|
unsafe {
|
||||||
|
asm!("", out("r9") _);
|
||||||
|
//[rwpi]~^ cannot use register `r9`
|
||||||
|
}
|
||||||
|
}
|
8
src/test/ui/asm/issue-85247.rwpi.stderr
Normal file
8
src/test/ui/asm/issue-85247.rwpi.stderr
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
error: cannot use register `r9`: the RWPI static base register (r9) cannot be used as an operand for inline asm
|
||||||
|
--> $DIR/issue-85247.rs:23:18
|
||||||
|
|
|
||||||
|
LL | asm!("", out("r9") _);
|
||||||
|
| ^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
30
src/test/ui/asm/issue-92378.rs
Normal file
30
src/test/ui/asm/issue-92378.rs
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
// compile-flags: --target armv5te-unknown-linux-gnueabi
|
||||||
|
// needs-llvm-components: arm
|
||||||
|
// build-pass
|
||||||
|
|
||||||
|
#![feature(no_core, lang_items, rustc_attrs, isa_attribute)]
|
||||||
|
#![no_core]
|
||||||
|
#![crate_type = "rlib"]
|
||||||
|
|
||||||
|
#[rustc_builtin_macro]
|
||||||
|
macro_rules! asm {
|
||||||
|
() => {};
|
||||||
|
}
|
||||||
|
#[lang = "sized"]
|
||||||
|
trait Sized {}
|
||||||
|
|
||||||
|
// ARM uses R11 for the frame pointer, make sure R7 is usable.
|
||||||
|
#[instruction_set(arm::a32)]
|
||||||
|
pub fn arm() {
|
||||||
|
unsafe {
|
||||||
|
asm!("", out("r7") _);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Thumb uses R7 for the frame pointer, make sure R11 is usable.
|
||||||
|
#[instruction_set(arm::t32)]
|
||||||
|
pub fn thumb() {
|
||||||
|
unsafe {
|
||||||
|
asm!("", out("r11") _);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue