Rollup merge of #130875 - folkertdev:naked-asm-bootstrap, r=tgross35 · qinheping/verify-rust-std@fdf84bf (original) (raw)
`@@ -3,6 +3,9 @@
`
3
3
`#[allow(unused_imports)]
`
4
4
`#[stable(feature = "simd_arch", since = "1.27.0")]
`
5
5
`pub use crate::core_arch::arch::*;
`
``
6
`+
#[unstable(feature = "naked_functions", issue = "90957")]
`
``
7
`+
#[cfg(bootstrap)]
`
``
8
`+
pub use crate::naked_asm;
`
6
9
``
7
10
`/// Inline assembly.
`
8
11
`///
`
`@@ -17,6 +20,37 @@ pub macro asm("assembly template", (operands,)∗(operands,)* (operands,)∗(options($(option),*))?) {
`
17
20
`/* compiler built-in */
`
18
21
`}
`
19
22
``
``
23
`` +
/// Inline assembly used in combination with #[naked]
functions.
``
``
24
`+
///
`
``
25
`+
/// Refer to [Rust By Example] for a usage guide and the [reference] for
`
``
26
`+
/// detailed information about the syntax and available options.
`
``
27
`+
///
`
``
28
`+
/// [Rust By Example]: https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html
`
``
29
`+
/// [reference]: https://doc.rust-lang.org/nightly/reference/inline-assembly.html
`
``
30
`+
#[unstable(feature = "naked_functions", issue = "90957")]
`
``
31
`+
#[macro_export]
`
``
32
`+
#[cfg(bootstrap)]
`
``
33
`+
macro_rules! naked_asm {
`
``
34
`+
([$last:expr], [$($pushed:expr),*]) => {
`
``
35
`+
#[cfg(any(target_arch = "x86_64", target_arch = "x86"))]
`
``
36
`+
{
`
``
37
`+
core::arch::asm!($($pushed),*, options(att_syntax, noreturn))
`
``
38
`+
}
`
``
39
`+
#[cfg(not(any(target_arch = "x86_64", target_arch = "x86")))]
`
``
40
`+
{
`
``
41
`+
core::arch::asm!($($pushed),* , $last, options(noreturn))
`
``
42
`+
}
`
``
43
`+
};
`
``
44
+
``
45
`+
([$first:expr (,(, (,rest:expr)], [$($pushed:expr),]) => {
`
``
46
`+
naked_asm!([$($rest),], [$($pushed,) $first]);
`
``
47
`+
};
`
``
48
+
``
49
`+
($($expr:expr),* $(,)?) => {
`
``
50
`+
naked_asm!([$($expr),*], []);
`
``
51
`+
};
`
``
52
`+
}
`
``
53
+
20
54
`` /// Inline assembly used in combination with #[naked]
functions.
``
21
55
`///
`
22
56
`/// Refer to [Rust By Example] for a usage guide and the [reference] for
`