1 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
13 // ignore-emscripten doesn't support this linkage
14 // aux-build:linkage1.rs
18 extern crate linkage1 as other;
21 #[linkage = "extern_weak"]
22 static foo: *const isize;
23 #[linkage = "extern_weak"]
24 static something_that_should_never_exist: *mut isize;
28 // It appears that the --as-needed flag to linkers will not pull in a dynamic
29 // library unless it satisfies a non weak undefined symbol. The 'other' crate
30 // is compiled as a dynamic library where it would only be used for a
31 // weak-symbol as part of an executable, so the dynamic library would be
32 // discarded. By adding and calling `other::bar`, we get around this problem.
36 assert!(!foo.is_null());
38 assert!(something_that_should_never_exist.is_null());