]>
Commit | Line | Data |
---|---|---|
c295e0f8 XL |
1 | // compile-flags: -C relocation-model=pie |
2 | // only-x86_64-unknown-linux-gnu | |
3 | ||
4 | #![crate_type = "rlib"] | |
5 | ||
6 | // With PIE we know local functions cannot be interpositioned, we can mark them | |
7 | // as dso_local. | |
8 | // CHECK: define dso_local i8 @call_foreign_fn() | |
9 | #[no_mangle] | |
10 | pub fn call_foreign_fn() -> u8 { | |
11 | unsafe { | |
12 | foreign_fn() | |
13 | } | |
14 | } | |
15 | ||
16 | // External functions are still marked as non-dso_local, since we don't know if the symbol | |
17 | // is defined in the binary or in the shared library. | |
18 | // CHECK: declare zeroext i8 @foreign_fn() | |
19 | extern "C" {fn foreign_fn() -> u8;} | |
20 | ||
f2b60f7d | 21 | // CHECK: !{i32 {{[78]}}, !"PIC Level", i32 2} |
c295e0f8 | 22 | // CHECK: !{i32 7, !"PIE Level", i32 2} |