2024-12-20 14:19:12 +00:00
|
|
|
//@ add-core-stubs
|
2021-06-13 18:19:39 +00:00
|
|
|
// FIXME(nagisa): remove the flags below once all targets support `asm!`.
|
2024-02-22 12:10:29 +00:00
|
|
|
//@ compile-flags: --target x86_64-unknown-linux-gnu -Copt-level=0
|
|
|
|
//@ needs-llvm-components: x86
|
2021-02-06 00:26:35 +00:00
|
|
|
|
|
|
|
// Verify we sanitize the special tokens for the LLVM inline-assembly, ensuring people won't
|
|
|
|
// inadvertently rely on the LLVM-specific syntax and features.
|
|
|
|
#![no_core]
|
2024-12-20 14:19:12 +00:00
|
|
|
#![feature(no_core)]
|
2021-02-06 00:26:35 +00:00
|
|
|
#![crate_type = "rlib"]
|
2021-07-22 23:26:16 +00:00
|
|
|
#![allow(named_asm_labels)]
|
2021-02-06 00:26:35 +00:00
|
|
|
|
2024-12-20 14:19:12 +00:00
|
|
|
extern crate minicore;
|
|
|
|
use minicore::*;
|
2021-02-06 00:26:35 +00:00
|
|
|
|
|
|
|
pub unsafe fn we_escape_dollar_signs() {
|
|
|
|
// CHECK: call void asm sideeffect alignstack inteldialect "banana$$:"
|
2024-05-29 04:11:20 +00:00
|
|
|
asm!(r"banana$:",)
|
2021-02-06 00:26:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pub unsafe fn we_escape_escapes_too() {
|
|
|
|
// CHECK: call void asm sideeffect alignstack inteldialect "banana\{{(\\|5C)}}36:"
|
2024-05-29 04:11:20 +00:00
|
|
|
asm!(r"banana\36:",)
|
2021-02-06 00:26:35 +00:00
|
|
|
}
|