mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-17 05:25:37 +03:00
Add test case
This commit is contained in:
@@ -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)()
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
Reference in New Issue
Block a user