Add test case
This commit is contained in:
parent
160b194295
commit
cf6efe8137
2 changed files with 28 additions and 0 deletions
13
src/test/codegen/auxiliary/static_dllimport_aux.rs
Normal file
13
src/test/codegen/auxiliary/static_dllimport_aux.rs
Normal file
|
@ -0,0 +1,13 @@
|
|||
use std::sync::atomic::{AtomicPtr, Ordering};
|
||||
|
||||
#[inline(always)]
|
||||
pub fn memrchr() {
|
||||
fn detect() {}
|
||||
|
||||
static CROSS_CRATE_STATIC_ITEM: AtomicPtr<()> = AtomicPtr::new(detect as *mut ());
|
||||
|
||||
unsafe {
|
||||
let fun = CROSS_CRATE_STATIC_ITEM.load(Ordering::SeqCst);
|
||||
std::mem::transmute::<*mut (), fn()>(fun)()
|
||||
}
|
||||
}
|
15
src/test/codegen/issue-81408-dllimport-thinlto-windows.rs
Normal file
15
src/test/codegen/issue-81408-dllimport-thinlto-windows.rs
Normal file
|
@ -0,0 +1,15 @@
|
|||
// compile-flags: -O -C lto=thin -C prefer-dynamic=no
|
||||
// only-windows
|
||||
// aux-build:static_dllimport_aux.rs
|
||||
|
||||
// Test that on Windows, when performing ThinLTO, we do not mark cross-crate static items with
|
||||
// dllimport because lld does not fix the symbol names for us.
|
||||
|
||||
extern crate static_dllimport_aux;
|
||||
|
||||
// CHECK-LABEL: @{{.+}}CROSS_CRATE_STATIC_ITEM{{.+}} =
|
||||
// CHECK-SAME: external dllimport local_unnamed_addr global %"{{.+}}::AtomicPtr
|
||||
|
||||
pub fn main() {
|
||||
static_dllimport_aux::memrchr();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue