4 // ignore-emscripten doesn't support this linkage
5 // ignore-sgx weak linkage not permitted
6 // aux-build:linkage1.rs
10 extern crate linkage1 as other;
13 #[linkage = "extern_weak"]
14 static foo: *const isize;
15 #[linkage = "extern_weak"]
16 static something_that_should_never_exist: *mut isize;
20 // It appears that the --as-needed flag to linkers will not pull in a dynamic
21 // library unless it satisfies a non weak undefined symbol. The 'other' crate
22 // is compiled as a dynamic library where it would only be used for a
23 // weak-symbol as part of an executable, so the dynamic library would be
24 // discarded. By adding and calling `other::bar`, we get around this problem.
28 assert!(!foo.is_null());
30 assert!(something_that_should_never_exist.is_null());