3 // aux-build:msvc-imp-present.rs
4 // compile-flags: -Z thinlto -C codegen-units=8
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.
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.
18 extern crate msvc_imp_present as bar;
21 println!("{}", bar::A);