]> git.lizzy.rs Git - rust.git/blob - tests/assembly/pic-relocation-model.rs
Rollup merge of #107692 - Swatinem:printsizeyield, r=compiler-errors
[rust.git] / tests / assembly / pic-relocation-model.rs
1 // revisions: x64
2 // assembly-output: emit-asm
3 // [x64] compile-flags: --target x86_64-unknown-linux-gnu -Crelocation-model=pic
4 // [x64] needs-llvm-components: x86
5
6
7 #![feature(no_core, lang_items)]
8 #![no_core]
9 #![crate_type="rlib"]
10
11 #[lang = "sized"]
12 trait Sized {}
13 #[lang = "copy"]
14 trait Copy {}
15
16 // CHECK-LABEL: call_other_fn:
17 // CHECK:       {{(jmpq|callq)}} *other_fn@GOTPCREL(%rip)
18 #[no_mangle]
19 pub fn call_other_fn() -> u8 {
20     unsafe {
21         other_fn()
22     }
23 }
24
25 // CHECK-LABEL: other_fn:
26 // CHECK:       callq *foreign_fn@GOTPCREL(%rip)
27 #[no_mangle]
28 #[inline(never)]
29 pub fn other_fn() -> u8 {
30     unsafe {
31         foreign_fn()
32     }
33 }
34
35 extern "C" {fn foreign_fn() -> u8;}