diff options
| author | bjorn3 <bjorn3@users.noreply.github.com> | 2020-07-09 16:55:38 +0200 |
|---|---|---|
| committer | bjorn3 <bjorn3@users.noreply.github.com> | 2020-07-09 17:02:09 +0200 |
| commit | 037d411bf44a9a7c70d41773e355b74155bfea3a (patch) | |
| tree | ff02b3fb534f495e465c7a0a895cd09cef5ede10 /example | |
| parent | 1987a3b6c099e069368ac7caf30ea6d46595ca5f (diff) | |
| download | rust-037d411bf44a9a7c70d41773e355b74155bfea3a.tar.gz rust-037d411bf44a9a7c70d41773e355b74155bfea3a.zip | |
Implement global_asm! using an external assembler
Fixes #1061
Diffstat (limited to 'example')
| -rw-r--r-- | example/mini_core.rs | 4 | ||||
| -rw-r--r-- | example/mini_core_hello_world.rs | 20 |
2 files changed, 24 insertions, 0 deletions
diff --git a/example/mini_core.rs b/example/mini_core.rs index a8db81fa06d..94336154748 100644 --- a/example/mini_core.rs +++ b/example/mini_core.rs @@ -562,6 +562,10 @@ pub macro line() { /* compiler built-in */ } #[rustc_macro_transparency = "semitransparent"] pub macro cfg() { /* compiler built-in */ } +#[rustc_builtin_macro] +#[rustc_macro_transparency = "semitransparent"] +pub macro global_asm() { /* compiler built-in */ } + pub static A_STATIC: u8 = 42; #[lang = "panic_location"] diff --git a/example/mini_core_hello_world.rs b/example/mini_core_hello_world.rs index 12c6638dd92..d83fb2aece9 100644 --- a/example/mini_core_hello_world.rs +++ b/example/mini_core_hello_world.rs @@ -284,6 +284,26 @@ fn main() { #[cfg(not(jit))] test_tls(); + + #[cfg(not(jit))] + unsafe { + global_asm_test(); + } +} + +#[cfg(not(jit))] +extern "C" { + fn global_asm_test(); +} + +#[cfg(not(jit))] +global_asm! { + " + .global global_asm_test + global_asm_test: + // comment that would normally be removed by LLVM + ret + " } #[repr(C)] |
