]> git.lizzy.rs Git - rust.git/blob - src/test/codegen/global_asm_x2.rs
Rollup merge of #49162 - tmandry:stabilize-termination-trait, r=nikomatsakis
[rust.git] / src / test / codegen / global_asm_x2.rs
1 // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 // ignore-aarch64
12 // ignore-aarch64_be
13 // ignore-arm
14 // ignore-armeb
15 // ignore-avr
16 // ignore-bpfel
17 // ignore-bpfeb
18 // ignore-hexagon
19 // ignore-mips
20 // ignore-mips64
21 // ignore-msp430
22 // ignore-powerpc64
23 // ignore-powerpc64le
24 // ignore-powerpc
25 // ignore-r600
26 // ignore-amdgcn
27 // ignore-sparc
28 // ignore-sparcv9
29 // ignore-sparcel
30 // ignore-s390x
31 // ignore-tce
32 // ignore-thumb
33 // ignore-thumbeb
34 // ignore-xcore
35 // ignore-nvptx
36 // ignore-nvptx64
37 // ignore-le32
38 // ignore-le64
39 // ignore-amdil
40 // ignore-amdil64
41 // ignore-hsail
42 // ignore-hsail64
43 // ignore-spir
44 // ignore-spir64
45 // ignore-kalimba
46 // ignore-shave
47 // ignore-wasm32
48 // ignore-wasm64
49 // ignore-emscripten
50 // compile-flags: -C no-prepopulate-passes
51
52 #![feature(global_asm)]
53 #![crate_type = "lib"]
54 #[no_std]
55
56 // CHECK-LABEL: foo
57 // CHECK: module asm
58 // CHECK: module asm "{{[[:space:]]+}}jmp baz"
59 // any other global_asm will be appended to this first block, so:
60 // CHECK-LABEL: bar
61 // CHECK: module asm "{{[[:space:]]+}}jmp quux"
62 global_asm!(r#"
63     .global foo
64 foo:
65     jmp baz
66 "#);
67
68 extern "C" {
69     fn foo();
70 }
71
72 // CHECK-LABEL: @baz
73 #[no_mangle]
74 pub unsafe extern "C" fn baz() {}
75
76 // no checks here; this has been appended to the first occurrence
77 global_asm!(r#"
78     .global bar
79 bar:
80     jmp quux
81 "#);
82
83 extern "C" {
84     fn bar();
85 }
86
87 #[no_mangle]
88 pub unsafe extern "C" fn quux() {}