1
Fork 0

Add test case

This commit is contained in:
Wesley Wiser 2022-10-25 16:57:21 -04:00
parent 160b194295
commit cf6efe8137
2 changed files with 28 additions and 0 deletions

View 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)()
}
}

View 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();
}