]> git.lizzy.rs Git - rust.git/blob - tests/codegen/static-relocation-model-msvc.rs
Auto merge of #107843 - bjorn3:sync_cg_clif-2023-02-09, r=bjorn3
[rust.git] / tests / codegen / static-relocation-model-msvc.rs
1 // Verify linkage of external symbols in the static relocation model on MSVC.
2 //
3 // compile-flags: -O -C relocation-model=static
4 // aux-build: extern_decl.rs
5 // only-x86_64-pc-windows-msvc
6
7 #![crate_type = "rlib"]
8
9 extern crate extern_decl;
10
11 // The `extern_decl` definitions are imported from a statically linked rust
12 // crate, thus they are expected to be marked `dso_local` without `dllimport`.
13 //
14 // The `access_extern()` symbol is from this compilation unit, thus we expect
15 // it to be marked `dso_local` as well, given the static relocation model.
16 //
17 // CHECK: @extern_static = external dso_local local_unnamed_addr global i8
18 // CHECK: define dso_local noundef i8 @access_extern() {{.*}}
19 // CHECK: declare dso_local noundef i8 @extern_fn() {{.*}}
20
21 #[no_mangle]
22 pub fn access_extern() -> u8 {
23     unsafe {
24         extern_decl::extern_fn() + extern_decl::extern_static
25     }
26 }