]> git.lizzy.rs Git - rust.git/blob - src/test/ui/lto/msvc-imp-present.rs
Auto merge of #106025 - matthiaskrgr:rollup-vz5rqah, r=matthiaskrgr
[rust.git] / src / test / ui / lto / msvc-imp-present.rs
1 // run-pass
2
3 // aux-build:msvc-imp-present.rs
4 // compile-flags: -Z thinlto -C codegen-units=8
5 // no-prefer-dynamic
6
7 // On MSVC we have a "hack" where we emit symbols that look like `_imp_$name`
8 // for all exported statics. This is done because we apply `dllimport` to all
9 // imported constants and this allows everything to actually link correctly.
10 //
11 // The ThinLTO passes aggressively remove symbols if they can, and this test
12 // asserts that the ThinLTO passes don't remove these compiler-generated
13 // `_imp_*` symbols. The external library that we link in here is compiled with
14 // ThinLTO and multiple codegen units and has a few exported constants. Note
15 // that we also namely compile the library as both a dylib and an rlib, but we
16 // link the rlib to ensure that we assert those generated symbols exist.
17
18 extern crate msvc_imp_present as bar;
19
20 fn main() {
21     println!("{}", bar::A);
22 }