]> git.proxmox.com Git - rustc.git/blame - tests/codegen/static-relocation-model-msvc.rs
New upstream version 1.69.0+dfsg1
[rustc.git] / tests / codegen / static-relocation-model-msvc.rs
CommitLineData
487cf647
FG
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
9extern 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
9c376795
FG
18// CHECK: define dso_local noundef i8 @access_extern() {{.*}}
19// CHECK: declare dso_local noundef i8 @extern_fn() {{.*}}
487cf647
FG
20
21#[no_mangle]
22pub fn access_extern() -> u8 {
23 unsafe {
24 extern_decl::extern_fn() + extern_decl::extern_static
25 }
26}