The `needs-asm-support` directive checks whether the host architecture supports inline assembly, not the target architecture. For tests that explicitly specify a target via `--target` in their compile-flags, this directive is incorrect and unnecessary. These tests are cross-compiling to specific targets (like x86_64, arm, aarch64, riscv, etc.) that are already known to have stable asm support. The directive was causing these tests to be incorrectly skipped on hosts that don't support asm, even though the target does. Tests with explicit targets should rely on `needs-llvm-components` to ensure the appropriate backend is available, rather than checking host asm support. Improve documentation about `needs-asm-support` directive.
52 lines
1.6 KiB
Rust
52 lines
1.6 KiB
Rust
//@ add-core-stubs
|
|
//@ revisions: x86_64 arm
|
|
//@[x86_64] compile-flags: --target x86_64-unknown-linux-gnu
|
|
//@[x86_64] check-pass
|
|
//@[x86_64] needs-llvm-components: x86
|
|
// LLVM 19+ has full support for 64-bit cookies.
|
|
//@[arm] compile-flags: --target armv7-unknown-linux-gnueabihf
|
|
//@[arm] build-fail
|
|
//@[arm] needs-llvm-components: arm
|
|
//@ ignore-backends: gcc
|
|
|
|
#![feature(no_core)]
|
|
#![crate_type = "rlib"]
|
|
#![no_core]
|
|
|
|
extern crate minicore;
|
|
use minicore::*;
|
|
|
|
pub fn main() {
|
|
unsafe {
|
|
asm!(".intel_syntax noprefix", "nop");
|
|
//[x86_64]~^ WARN avoid using `.intel_syntax`
|
|
//[arm]~^^ ERROR unknown directive
|
|
asm!(".intel_syntax aaa noprefix", "nop");
|
|
//[x86_64]~^ WARN avoid using `.intel_syntax`
|
|
//[arm]~^^ ERROR unknown directive
|
|
asm!(".att_syntax noprefix", "nop");
|
|
//[x86_64]~^ WARN avoid using `.att_syntax`
|
|
//[arm]~^^ ERROR unknown directive
|
|
asm!(".att_syntax bbb noprefix", "nop");
|
|
//[x86_64]~^ WARN avoid using `.att_syntax`
|
|
//[arm]~^^ ERROR unknown directive
|
|
asm!(".intel_syntax noprefix; nop");
|
|
//[x86_64]~^ WARN avoid using `.intel_syntax`
|
|
//[arm]~^^ ERROR unknown directive
|
|
|
|
asm!(
|
|
r"
|
|
.intel_syntax noprefix
|
|
nop"
|
|
);
|
|
//[x86_64]~^^^ WARN avoid using `.intel_syntax`
|
|
//[arm]~^^^^ ERROR unknown directive
|
|
}
|
|
}
|
|
|
|
global_asm!(".intel_syntax noprefix", "nop");
|
|
//[x86_64]~^ WARN avoid using `.intel_syntax`
|
|
// Global assembly errors don't have line numbers, so no error on ARM.
|
|
|
|
//[arm]~? ERROR unknown directive
|
|
//[arm]~? ERROR unknown directive
|