2018-08-30 12:18:55 +00:00
|
|
|
// run-pass
|
2014-08-01 22:45:24 +00:00
|
|
|
// compile-flags: -C codegen-units=3
|
|
|
|
// aux-build:sepcomp-extern-lib.rs
|
|
|
|
|
|
|
|
// Test accessing external items from multiple compilation units.
|
|
|
|
|
2015-04-24 01:41:37 +00:00
|
|
|
extern crate sepcomp_extern_lib;
|
2015-03-22 20:13:15 +00:00
|
|
|
|
2020-09-01 21:12:52 +00:00
|
|
|
extern "C" {
|
2015-03-26 00:06:52 +00:00
|
|
|
fn foo() -> usize;
|
2014-08-01 22:45:24 +00:00
|
|
|
}
|
|
|
|
|
2015-03-26 00:06:52 +00:00
|
|
|
fn call1() -> usize {
|
2014-08-01 22:45:24 +00:00
|
|
|
unsafe { foo() }
|
|
|
|
}
|
|
|
|
|
|
|
|
mod a {
|
2015-03-26 00:06:52 +00:00
|
|
|
pub fn call2() -> usize {
|
2014-08-01 22:45:24 +00:00
|
|
|
unsafe { ::foo() }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
mod b {
|
2015-03-26 00:06:52 +00:00
|
|
|
pub fn call3() -> usize {
|
2014-08-01 22:45:24 +00:00
|
|
|
unsafe { ::foo() }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
assert_eq!(call1(), 1234);
|
|
|
|
assert_eq!(a::call2(), 1234);
|
|
|
|
assert_eq!(b::call3(), 1234);
|
|
|
|
}
|