diff options
Diffstat (limited to 'src/test')
52 files changed, 222 insertions, 53 deletions
diff --git a/src/test/codegen/dllimports/auxiliary/dummy.rs b/src/test/codegen/dllimports/auxiliary/dummy.rs new file mode 100644 index 00000000000..06001c6b014 --- /dev/null +++ b/src/test/codegen/dllimports/auxiliary/dummy.rs @@ -0,0 +1,16 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// no-prefer-dynamic +#![crate_type = "staticlib"] + +// Since codegen tests don't actually perform linking, this library doesn't need to export +// any symbols. It's here just to satisfy the compiler looking for a .lib file when processing +// #[link(...)] attributes in wrapper.rs. diff --git a/src/test/codegen/dllimports/auxiliary/wrapper.rs b/src/test/codegen/dllimports/auxiliary/wrapper.rs new file mode 100644 index 00000000000..c03f88092e5 --- /dev/null +++ b/src/test/codegen/dllimports/auxiliary/wrapper.rs @@ -0,0 +1,24 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// no-prefer-dynamic +#![crate_type = "rlib"] + +#[link(name = "dummy", kind="dylib")] +extern "C" { + pub fn dylib_func2(x: i32) -> i32; + pub static dylib_global2: i32; +} + +#[link(name = "dummy", kind="static")] +extern "C" { + pub fn static_func2(x: i32) -> i32; + pub static static_global2: i32; +} diff --git a/src/test/codegen/dllimports/main.rs b/src/test/codegen/dllimports/main.rs new file mode 100644 index 00000000000..64f516aa272 --- /dev/null +++ b/src/test/codegen/dllimports/main.rs @@ -0,0 +1,64 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// This test is for *-windows-msvc only. +// ignore-gnu +// ignore-android +// ignore-bitrig +// ignore-macos +// ignore-dragonfly +// ignore-freebsd +// ignore-haiku +// ignore-ios +// ignore-linux +// ignore-netbsd +// ignore-openbsd +// ignore-solaris +// ignore-emscripten + +// aux-build:dummy.rs +// aux-build:wrapper.rs + +extern crate wrapper; + +// Check that external symbols coming from foreign dylibs are adorned with 'dllimport', +// whereas symbols coming from foreign staticlibs are not. (RFC-1717) + +// CHECK: @dylib_global1 = external dllimport local_unnamed_addr global i32 +// CHECK: @dylib_global2 = external dllimport local_unnamed_addr global i32 +// CHECK: @static_global1 = external local_unnamed_addr global i32 +// CHECK: @static_global2 = external local_unnamed_addr global i32 + +// CHECK: declare dllimport i32 @dylib_func1(i32) +// CHECK: declare dllimport i32 @dylib_func2(i32) +// CHECK: declare i32 @static_func1(i32) +// CHECK: declare i32 @static_func2(i32) + +#[link(name = "dummy", kind="dylib")] +extern "C" { + pub fn dylib_func1(x: i32) -> i32; + pub static dylib_global1: i32; +} + +#[link(name = "dummy", kind="static")] +extern "C" { + pub fn static_func1(x: i32) -> i32; + pub static static_global1: i32; +} + +fn main() { + unsafe { + dylib_func1(dylib_global1); + wrapper::dylib_func2(wrapper::dylib_global2); + + static_func1(static_global1); + wrapper::static_func2(wrapper::static_global2); + } +} diff --git a/src/test/compile-fail/rfc1717/missing-link-attr.rs b/src/test/compile-fail/rfc1717/missing-link-attr.rs new file mode 100644 index 00000000000..810efdedfd6 --- /dev/null +++ b/src/test/compile-fail/rfc1717/missing-link-attr.rs @@ -0,0 +1,14 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-flags: -l foo:bar +// error-pattern: renaming of the library `foo` was specified + +#![crate_type = "lib"] diff --git a/src/test/compile-fail/rfc1717/multiple-renames.rs b/src/test/compile-fail/rfc1717/multiple-renames.rs new file mode 100644 index 00000000000..e75c1a14b24 --- /dev/null +++ b/src/test/compile-fail/rfc1717/multiple-renames.rs @@ -0,0 +1,17 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-flags: -l foo:bar -l foo:baz +// error-pattern: multiple renamings were specified for library + +#![crate_type = "lib"] + +#[link(name = "foo")] +extern "C" {} diff --git a/src/test/compile-fail/rfc1717/rename-to-empty.rs b/src/test/compile-fail/rfc1717/rename-to-empty.rs new file mode 100644 index 00000000000..ab8c238bc27 --- /dev/null +++ b/src/test/compile-fail/rfc1717/rename-to-empty.rs @@ -0,0 +1,17 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-flags: -l foo: +// error-pattern: an empty renaming target was specified for library + +#![crate_type = "lib"] + +#[link(name = "foo")] +extern "C" {} diff --git a/src/test/run-make/c-static-dylib/foo.rs b/src/test/run-make/c-static-dylib/foo.rs index 04253be71d4..44be5ac890d 100644 --- a/src/test/run-make/c-static-dylib/foo.rs +++ b/src/test/run-make/c-static-dylib/foo.rs @@ -10,7 +10,7 @@ #![crate_type = "dylib"] -#[link(name = "cfoo")] +#[link(name = "cfoo", kind = "static")] extern { fn foo(); } diff --git a/src/test/run-make/c-static-rlib/foo.rs b/src/test/run-make/c-static-rlib/foo.rs index a1f01bd2b62..cbd7b020bd8 100644 --- a/src/test/run-make/c-static-rlib/foo.rs +++ b/src/test/run-make/c-static-rlib/foo.rs @@ -10,7 +10,7 @@ #![crate_type = "rlib"] -#[link(name = "cfoo")] +#[link(name = "cfoo", kind = "static")] extern { fn foo(); } diff --git a/src/test/run-make/extern-fn-generic/test.rs b/src/test/run-make/extern-fn-generic/test.rs index ee0485683ec..8f5ff091b3b 100644 --- a/src/test/run-make/extern-fn-generic/test.rs +++ b/src/test/run-make/extern-fn-generic/test.rs @@ -12,7 +12,7 @@ extern crate testcrate; extern "C" fn bar<T>(ts: testcrate::TestStruct<T>) -> T { ts.y } -#[link(name = "test")] +#[link(name = "test", kind = "static")] extern { fn call(c: extern "C" fn(testcrate::TestStruct<i32>) -> i32) -> i32; } diff --git a/src/test/run-make/extern-fn-generic/testcrate.rs b/src/test/run-make/extern-fn-generic/testcrate.rs index 5fd61bb419c..d02c05047c0 100644 --- a/src/test/run-make/extern-fn-generic/testcrate.rs +++ b/src/test/run-make/extern-fn-generic/testcrate.rs @@ -18,7 +18,7 @@ pub struct TestStruct<T> { pub extern "C" fn foo<T>(ts: TestStruct<T>) -> T { ts.y } -#[link(name = "test")] +#[link(name = "test", kind = "static")] extern { pub fn call(c: extern "C" fn(TestStruct<i32>) -> i32) -> i32; } diff --git a/src/test/run-make/interdependent-c-libraries/bar.rs b/src/test/run-make/interdependent-c-libraries/bar.rs index 88fc98615f0..1963976b4b0 100644 --- a/src/test/run-make/interdependent-c-libraries/bar.rs +++ b/src/test/run-make/interdependent-c-libraries/bar.rs @@ -12,7 +12,7 @@ extern crate foo; -#[link(name = "bar")] +#[link(name = "bar", kind = "static")] extern { fn bar(); } diff --git a/src/test/run-make/interdependent-c-libraries/foo.rs b/src/test/run-make/interdependent-c-libraries/foo.rs index f94c6edb97d..7a0fe6bb18f 100644 --- a/src/test/run-make/interdependent-c-libraries/foo.rs +++ b/src/test/run-make/interdependent-c-libraries/foo.rs @@ -10,7 +10,7 @@ #![crate_type = "rlib"] -#[link(name = "foo")] +#[link(name = "foo", kind = "static")] extern { fn foo(); } diff --git a/src/test/run-make/issue-15460/foo.rs b/src/test/run-make/issue-15460/foo.rs index 8b96fe36824..6917fa55579 100644 --- a/src/test/run-make/issue-15460/foo.rs +++ b/src/test/run-make/issue-15460/foo.rs @@ -8,11 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(linked_from)] #![crate_type = "dylib"] #[link(name = "foo", kind = "static")] -#[linked_from = "foo"] extern { pub fn foo(); } diff --git a/src/test/run-make/issue-25581/test.rs b/src/test/run-make/issue-25581/test.rs index e2e86df59cd..6717d16cb7c 100644 --- a/src/test/run-make/issue-25581/test.rs +++ b/src/test/run-make/issue-25581/test.rs @@ -12,7 +12,7 @@ extern crate libc; -#[link(name = "test")] +#[link(name = "test", kind = "static")] extern { fn slice_len(s: &[u8]) -> libc::size_t; fn slice_elem(s: &[u8], idx: libc::size_t) -> u8; diff --git a/src/test/run-make/link-path-order/main.rs b/src/test/run-make/link-path-order/main.rs index 450460cf192..aaac3927f1c 100644 --- a/src/test/run-make/link-path-order/main.rs +++ b/src/test/run-make/link-path-order/main.rs @@ -12,7 +12,7 @@ extern crate libc; -#[link(name="foo")] +#[link(name="foo", kind = "static")] extern { fn should_return_one() -> libc::c_int; } diff --git a/src/test/run-pass/abi-sysv64-arg-passing.rs b/src/test/run-pass/abi-sysv64-arg-passing.rs index 989155bdfd9..23dd0603184 100644 --- a/src/test/run-pass/abi-sysv64-arg-passing.rs +++ b/src/test/run-pass/abi-sysv64-arg-passing.rs @@ -98,7 +98,7 @@ mod tests { #[derive(Copy, Clone)] pub struct Floats { a: f64, b: u8, c: f64 } - #[link(name = "rust_test_helpers")] + #[link(name = "rust_test_helpers", kind = "static")] extern "sysv64" { pub fn rust_int8_to_int32(_: i8) -> i32; pub fn rust_dbg_extern_identity_u8(v: u8) -> u8; diff --git a/src/test/run-pass/anon-extern-mod.rs b/src/test/run-pass/anon-extern-mod.rs index e96b0cc1442..208b4df3c3e 100644 --- a/src/test/run-pass/anon-extern-mod.rs +++ b/src/test/run-pass/anon-extern-mod.rs @@ -14,7 +14,7 @@ extern crate libc; -#[link(name = "rust_test_helpers")] +#[link(name = "rust_test_helpers", kind = "static")] extern { fn rust_get_test_int() -> libc::intptr_t; } diff --git a/src/test/run-pass/auxiliary/anon-extern-mod-cross-crate-1.rs b/src/test/run-pass/auxiliary/anon-extern-mod-cross-crate-1.rs index 197fb9a6d01..741ce351da3 100644 --- a/src/test/run-pass/auxiliary/anon-extern-mod-cross-crate-1.rs +++ b/src/test/run-pass/auxiliary/anon-extern-mod-cross-crate-1.rs @@ -13,7 +13,7 @@ extern crate libc; -#[link(name="rust_test_helpers")] +#[link(name = "rust_test_helpers", kind = "static")] extern { pub fn rust_get_test_int() -> libc::intptr_t; } diff --git a/src/test/run-pass/auxiliary/extern-crosscrate-source.rs b/src/test/run-pass/auxiliary/extern-crosscrate-source.rs index fc2e328f686..150dffeea88 100644 --- a/src/test/run-pass/auxiliary/extern-crosscrate-source.rs +++ b/src/test/run-pass/auxiliary/extern-crosscrate-source.rs @@ -17,7 +17,7 @@ extern crate libc; pub mod rustrt { extern crate libc; - #[link(name = "rust_test_helpers")] + #[link(name = "rust_test_helpers", kind = "static")] extern { pub fn rust_dbg_call(cb: extern "C" fn(libc::uintptr_t) -> libc::uintptr_t, data: libc::uintptr_t) diff --git a/src/test/run-pass/auxiliary/foreign_lib.rs b/src/test/run-pass/auxiliary/foreign_lib.rs index 460d0a0088c..cef36274c62 100644 --- a/src/test/run-pass/auxiliary/foreign_lib.rs +++ b/src/test/run-pass/auxiliary/foreign_lib.rs @@ -15,7 +15,7 @@ pub mod rustrt { extern crate libc; - #[link(name = "rust_test_helpers")] + #[link(name = "rust_test_helpers", kind = "static")] extern { pub fn rust_get_test_int() -> libc::intptr_t; } diff --git a/src/test/run-pass/auxiliary/issue-25185-1.rs b/src/test/run-pass/auxiliary/issue-25185-1.rs index 1ec29501b76..b9da39cbbcb 100644 --- a/src/test/run-pass/auxiliary/issue-25185-1.rs +++ b/src/test/run-pass/auxiliary/issue-25185-1.rs @@ -10,12 +10,9 @@ // no-prefer-dynamic -#![feature(linked_from)] - #![crate_type = "rlib"] #[link(name = "rust_test_helpers", kind = "static")] -#[linked_from = "rust_test_helpers"] extern { pub fn rust_dbg_extern_identity_u32(u: u32) -> u32; } diff --git a/src/test/run-pass/c-stack-as-value.rs b/src/test/run-pass/c-stack-as-value.rs index b678f149fa2..5319693405b 100644 --- a/src/test/run-pass/c-stack-as-value.rs +++ b/src/test/run-pass/c-stack-as-value.rs @@ -15,7 +15,7 @@ mod rustrt { extern crate libc; - #[link(name = "rust_test_helpers")] + #[link(name = "rust_test_helpers", kind = "static")] extern { pub fn rust_get_test_int() -> libc::intptr_t; } diff --git a/src/test/run-pass/cabi-int-widening.rs b/src/test/run-pass/cabi-int-widening.rs index c7a22759333..bf94dd17882 100644 --- a/src/test/run-pass/cabi-int-widening.rs +++ b/src/test/run-pass/cabi-int-widening.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[link(name = "rust_test_helpers")] +#[link(name = "rust_test_helpers", kind = "static")] extern { fn rust_int8_to_int32(_: i8) -> i32; } diff --git a/src/test/run-pass/extern-call-deep.rs b/src/test/run-pass/extern-call-deep.rs index 2138b12fb12..6a9da767ad6 100644 --- a/src/test/run-pass/extern-call-deep.rs +++ b/src/test/run-pass/extern-call-deep.rs @@ -15,7 +15,7 @@ extern crate libc; mod rustrt { extern crate libc; - #[link(name = "rust_test_helpers")] + #[link(name = "rust_test_helpers", kind = "static")] extern { pub fn rust_dbg_call(cb: extern "C" fn(libc::uintptr_t) -> libc::uintptr_t, data: libc::uintptr_t) diff --git a/src/test/run-pass/extern-call-deep2.rs b/src/test/run-pass/extern-call-deep2.rs index 1a0191b7053..3bdc8c18864 100644 --- a/src/test/run-pass/extern-call-deep2.rs +++ b/src/test/run-pass/extern-call-deep2.rs @@ -18,7 +18,7 @@ use std::thread; mod rustrt { extern crate libc; - #[link(name = "rust_test_helpers")] + #[link(name = "rust_test_helpers", kind = "static")] extern { pub fn rust_dbg_call(cb: extern "C" fn(libc::uintptr_t) -> libc::uintptr_t, data: libc::uintptr_t) diff --git a/src/test/run-pass/extern-call-indirect.rs b/src/test/run-pass/extern-call-indirect.rs index 4f1abbeb5c7..256eedccb8b 100644 --- a/src/test/run-pass/extern-call-indirect.rs +++ b/src/test/run-pass/extern-call-indirect.rs @@ -15,7 +15,7 @@ extern crate libc; mod rustrt { extern crate libc; - #[link(name = "rust_test_helpers")] + #[link(name = "rust_test_helpers", kind = "static")] extern { pub fn rust_dbg_call(cb: extern "C" fn(libc::uintptr_t) -> libc::uintptr_t, data: libc::uintptr_t) diff --git a/src/test/run-pass/extern-call-scrub.rs b/src/test/run-pass/extern-call-scrub.rs index 1beb6d3519a..a27474dcf86 100644 --- a/src/test/run-pass/extern-call-scrub.rs +++ b/src/test/run-pass/extern-call-scrub.rs @@ -22,7 +22,7 @@ use std::thread; mod rustrt { extern crate libc; - #[link(name = "rust_test_helpers")] + #[link(name = "rust_test_helpers", kind = "static")] extern { pub fn rust_dbg_call(cb: extern "C" fn(libc::uintptr_t) -> libc::uintptr_t, data: libc::uintptr_t) diff --git a/src/test/run-pass/extern-pass-TwoU16s.rs b/src/test/run-pass/extern-pass-TwoU16s.rs index 9d304ea9e10..afdd53db775 100644 --- a/src/test/run-pass/extern-pass-TwoU16s.rs +++ b/src/test/run-pass/extern-pass-TwoU16s.rs @@ -16,7 +16,7 @@ pub struct TwoU16s { one: u16, two: u16 } -#[link(name = "rust_test_helpers")] +#[link(name = "rust_test_helpers", kind = "static")] extern { pub fn rust_dbg_extern_identity_TwoU16s(v: TwoU16s) -> TwoU16s; } diff --git a/src/test/run-pass/extern-pass-TwoU32s.rs b/src/test/run-pass/extern-pass-TwoU32s.rs index 8dae0473fd5..035084ae9bd 100644 --- a/src/test/run-pass/extern-pass-TwoU32s.rs +++ b/src/test/run-pass/extern-pass-TwoU32s.rs @@ -16,7 +16,7 @@ pub struct TwoU32s { one: u32, two: u32 } -#[link(name = "rust_test_helpers")] +#[link(name = "rust_test_helpers", kind = "static")] extern { pub fn rust_dbg_extern_identity_TwoU32s(v: TwoU32s) -> TwoU32s; } diff --git a/src/test/run-pass/extern-pass-TwoU64s.rs b/src/test/run-pass/extern-pass-TwoU64s.rs index 14aeea34657..cb1a4d27825 100644 --- a/src/test/run-pass/extern-pass-TwoU64s.rs +++ b/src/test/run-pass/extern-pass-TwoU64s.rs @@ -16,7 +16,7 @@ pub struct TwoU64s { one: u64, two: u64 } -#[link(name = "rust_test_helpers")] +#[link(name = "rust_test_helpers", kind = "static")] extern { pub fn rust_dbg_extern_identity_TwoU64s(v: TwoU64s) -> TwoU64s; } diff --git a/src/test/run-pass/extern-pass-TwoU8s.rs b/src/test/run-pass/extern-pass-TwoU8s.rs index 75a109e4429..657348c99aa 100644 --- a/src/test/run-pass/extern-pass-TwoU8s.rs +++ b/src/test/run-pass/extern-pass-TwoU8s.rs @@ -16,7 +16,7 @@ pub struct TwoU8s { one: u8, two: u8 } -#[link(name = "rust_test_helpers")] +#[link(name = "rust_test_helpers", kind = "static")] extern { pub fn rust_dbg_extern_identity_TwoU8s(v: TwoU8s) -> TwoU8s; } diff --git a/src/test/run-pass/extern-pass-char.rs b/src/test/run-pass/extern-pass-char.rs index e75aa2d72c9..9042aed6639 100644 --- a/src/test/run-pass/extern-pass-char.rs +++ b/src/test/run-pass/extern-pass-char.rs @@ -11,7 +11,7 @@ // Test a function that takes/returns a u8. -#[link(name = "rust_test_helpers")] +#[link(name = "rust_test_helpers", kind = "static")] extern { pub fn rust_dbg_extern_identity_u8(v: u8) -> u8; } diff --git a/src/test/run-pass/extern-pass-double.rs b/src/test/run-pass/extern-pass-double.rs index e92f9b6a1a1..38d29180fbc 100644 --- a/src/test/run-pass/extern-pass-double.rs +++ b/src/test/run-pass/extern-pass-double.rs @@ -9,7 +9,7 @@ // except according to those terms. -#[link(name = "rust_test_helpers")] +#[link(name = "rust_test_helpers", kind = "static")] extern { pub fn rust_dbg_extern_identity_double(v: f64) -> f64; } diff --git a/src/test/run-pass/extern-pass-empty.rs b/src/test/run-pass/extern-pass-empty.rs index 801a3c40ab4..cce7dc5bf32 100644 --- a/src/test/run-pass/extern-pass-empty.rs +++ b/src/test/run-pass/extern-pass-empty.rs @@ -30,7 +30,7 @@ struct ManyInts { struct Empty; -#[link(name = "rust_test_helpers")] +#[link(name = "rust_test_helpers", kind = "static")] extern { fn rust_dbg_extern_empty_struct(v1: ManyInts, e: Empty, v2: ManyInts); } diff --git a/src/test/run-pass/extern-pass-u32.rs b/src/test/run-pass/extern-pass-u32.rs index 0753ea1bcfe..ed254ac46f2 100644 --- a/src/test/run-pass/extern-pass-u32.rs +++ b/src/test/run-pass/extern-pass-u32.rs @@ -11,7 +11,7 @@ // Test a function that takes/returns a u32. -#[link(name = "rust_test_helpers")] +#[link(name = "rust_test_helpers", kind = "static")] extern { pub fn rust_dbg_extern_identity_u32(v: u32) -> u32; } diff --git a/src/test/run-pass/extern-pass-u64.rs b/src/test/run-pass/extern-pass-u64.rs index 89faa3bb471..6fc630e6d7e 100644 --- a/src/test/run-pass/extern-pass-u64.rs +++ b/src/test/run-pass/extern-pass-u64.rs @@ -11,7 +11,7 @@ // Test a call to a function that takes/returns a u64. -#[link(name = "rust_test_helpers")] +#[link(name = "rust_test_helpers", kind = "static")] extern { pub fn rust_dbg_extern_identity_u64(v: u64) -> u64; } diff --git a/src/test/run-pass/extern-return-TwoU16s.rs b/src/test/run-pass/extern-return-TwoU16s.rs index 3c58646e0c3..ec1c6130e7a 100644 --- a/src/test/run-pass/extern-return-TwoU16s.rs +++ b/src/test/run-pass/extern-return-TwoU16s.rs @@ -13,7 +13,7 @@ pub struct TwoU16s { one: u16, two: u16 } -#[link(name = "rust_test_helpers")] +#[link(name = "rust_test_helpers", kind = "static")] extern { pub fn rust_dbg_extern_return_TwoU16s() -> TwoU16s; } diff --git a/src/test/run-pass/extern-return-TwoU32s.rs b/src/test/run-pass/extern-return-TwoU32s.rs index 0eb6be2d687..e829e993052 100644 --- a/src/test/run-pass/extern-return-TwoU32s.rs +++ b/src/test/run-pass/extern-return-TwoU32s.rs @@ -13,7 +13,7 @@ pub struct TwoU32s { one: u32, two: u32 } -#[link(name = "rust_test_helpers")] +#[link(name = "rust_test_helpers", kind = "static")] extern { pub fn rust_dbg_extern_return_TwoU32s() -> TwoU32s; } diff --git a/src/test/run-pass/extern-return-TwoU64s.rs b/src/test/run-pass/extern-return-TwoU64s.rs index d5eab86351e..ef7325b33fe 100644 --- a/src/test/run-pass/extern-return-TwoU64s.rs +++ b/src/test/run-pass/extern-return-TwoU64s.rs @@ -13,7 +13,7 @@ pub struct TwoU64s { one: u64, two: u64 } -#[link(name = "rust_test_helpers")] +#[link(name = "rust_test_helpers", kind = "static")] extern { pub fn rust_dbg_extern_return_TwoU64s() -> TwoU64s; } diff --git a/src/test/run-pass/extern-return-TwoU8s.rs b/src/test/run-pass/extern-return-TwoU8s.rs index d8f476bcd0c..46f2e81a556 100644 --- a/src/test/run-pass/extern-return-TwoU8s.rs +++ b/src/test/run-pass/extern-return-TwoU8s.rs @@ -13,7 +13,7 @@ pub struct TwoU8s { one: u8, two: u8 } -#[link(name = "rust_test_helpers")] +#[link(name = "rust_test_helpers", kind = "static")] extern { pub fn rust_dbg_extern_return_TwoU8s() -> TwoU8s; } diff --git a/src/test/run-pass/foreign-call-no-runtime.rs b/src/test/run-pass/foreign-call-no-runtime.rs index ca118899798..697e9074c44 100644 --- a/src/test/run-pass/foreign-call-no-runtime.rs +++ b/src/test/run-pass/foreign-call-no-runtime.rs @@ -18,7 +18,7 @@ extern crate libc; use std::mem; use std::thread; -#[link(name = "rust_test_helpers")] +#[link(name = "rust_test_helpers", kind = "static")] extern { fn rust_dbg_call(cb: extern "C" fn(libc::uintptr_t), data: libc::uintptr_t) -> libc::uintptr_t; diff --git a/src/test/run-pass/foreign-fn-with-byval.rs b/src/test/run-pass/foreign-fn-with-byval.rs index d3d872620c3..2d4542540e7 100644 --- a/src/test/run-pass/foreign-fn-with-byval.rs +++ b/src/test/run-pass/foreign-fn-with-byval.rs @@ -16,7 +16,7 @@ pub struct S { z: u64, } -#[link(name = "rust_test_helpers")] +#[link(name = "rust_test_helpers", kind = "static")] extern { pub fn get_x(x: S) -> u64; pub fn get_y(x: S) -> u64; diff --git a/src/test/run-pass/foreign-no-abi.rs b/src/test/run-pass/foreign-no-abi.rs index a9b3f60566d..979e57eba9d 100644 --- a/src/test/run-pass/foreign-no-abi.rs +++ b/src/test/run-pass/foreign-no-abi.rs @@ -17,7 +17,7 @@ mod rustrt { extern crate libc; - #[link(name = "rust_test_helpers")] + #[link(name = "rust_test_helpers", kind = "static")] extern { pub fn rust_get_test_int() -> libc::intptr_t; } diff --git a/src/test/run-pass/issue-28676.rs b/src/test/run-pass/issue-28676.rs index b8d43c392dd..8f83e51f0a0 100644 --- a/src/test/run-pass/issue-28676.rs +++ b/src/test/run-pass/issue-28676.rs @@ -15,7 +15,7 @@ pub struct Quad { a: u64, b: u64, c: u64, d: u64 } mod rustrt { use super::Quad; - #[link(name = "rust_test_helpers")] + #[link(name = "rust_test_helpers", kind = "static")] extern { pub fn get_c_many_params(_: *const (), _: *const (), _: *const (), _: *const (), f: Quad) -> u64; diff --git a/src/test/run-pass/mir_trans_calls_variadic.rs b/src/test/run-pass/mir_trans_calls_variadic.rs index 4e06738da4f..e4d528e80e1 100644 --- a/src/test/run-pass/mir_trans_calls_variadic.rs +++ b/src/test/run-pass/mir_trans_calls_variadic.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[link(name = "rust_test_helpers")] +#[link(name = "rust_test_helpers", kind = "static")] extern { fn rust_interesting_average(_: i64, ...) -> f64; } diff --git a/src/test/compile-fail/feature-gate-linked-from.rs b/src/test/run-pass/rfc1717/auxiliary/clibrary.rs index 8705684111e..7438ba21bfc 100644 --- a/src/test/compile-fail/feature-gate-linked-from.rs +++ b/src/test/run-pass/rfc1717/auxiliary/clibrary.rs @@ -1,4 +1,4 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // @@ -8,9 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[linked_from = "foo"] //~ ERROR experimental feature -extern { - fn foo(); -} +// no-prefer-dynamic +#![crate_type = "staticlib"] -fn main() {} +#[no_mangle] +pub extern "C" fn foo(x:i32) -> i32 { x } diff --git a/src/test/run-pass/rfc1717/library-override.rs b/src/test/run-pass/rfc1717/library-override.rs new file mode 100644 index 00000000000..d6ef96c5add --- /dev/null +++ b/src/test/run-pass/rfc1717/library-override.rs @@ -0,0 +1,23 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// aux-build:clibrary.rs +// compile-flags: -lstatic=wronglibrary:clibrary + +#[link(name = "wronglibrary", kind = "dylib")] +extern "C" { + pub fn foo(x:i32) -> i32; +} + +fn main() { + unsafe { + foo(42); + } +} diff --git a/src/test/run-pass/segfault-no-out-of-stack.rs b/src/test/run-pass/segfault-no-out-of-stack.rs index df64d7140b4..0f98cfe27f6 100644 --- a/src/test/run-pass/segfault-no-out-of-stack.rs +++ b/src/test/run-pass/segfault-no-out-of-stack.rs @@ -17,7 +17,7 @@ extern crate libc; use std::process::{Command, ExitStatus}; use std::env; -#[link(name = "rust_test_helpers")] +#[link(name = "rust_test_helpers", kind = "static")] extern { fn rust_get_null_ptr() -> *mut ::libc::c_char; } diff --git a/src/test/run-pass/static-mut-foreign.rs b/src/test/run-pass/static-mut-foreign.rs index 4dcb82c4b43..24d58487f06 100644 --- a/src/test/run-pass/static-mut-foreign.rs +++ b/src/test/run-pass/static-mut-foreign.rs @@ -17,7 +17,7 @@ extern crate libc; -#[link(name = "rust_test_helpers")] +#[link(name = "rust_test_helpers", kind = "static")] extern { static mut rust_dbg_static_mut: libc::c_int; pub fn rust_dbg_static_mut_check_four(); diff --git a/src/test/run-pass/struct-return.rs b/src/test/run-pass/struct-return.rs index 6f23263790c..3d4601ad0cf 100644 --- a/src/test/run-pass/struct-return.rs +++ b/src/test/run-pass/struct-return.rs @@ -18,7 +18,7 @@ pub struct Floats { a: f64, b: u8, c: f64 } mod rustrt { use super::{Floats, Quad}; - #[link(name = "rust_test_helpers")] + #[link(name = "rust_test_helpers", kind = "static")] extern { pub fn rust_dbg_abi_1(q: Quad) -> Quad; pub fn rust_dbg_abi_2(f: Floats) -> Floats; diff --git a/src/test/run-pass/union/union-c-interop.rs b/src/test/run-pass/union/union-c-interop.rs index bea4d5f923e..13dfd414615 100644 --- a/src/test/run-pass/union/union-c-interop.rs +++ b/src/test/run-pass/union/union-c-interop.rs @@ -25,7 +25,7 @@ union LARGE_INTEGER { QuadPart: u64, } -#[link(name = "rust_test_helpers")] +#[link(name = "rust_test_helpers", kind = "static")] extern "C" { fn increment_all_parts(_: LARGE_INTEGER) -> LARGE_INTEGER; } diff --git a/src/test/run-pass/variadic-ffi.rs b/src/test/run-pass/variadic-ffi.rs index 0131563d36d..ec6261febc5 100644 --- a/src/test/run-pass/variadic-ffi.rs +++ b/src/test/run-pass/variadic-ffi.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[link(name = "rust_test_helpers")] +#[link(name = "rust_test_helpers", kind = "static")] extern { fn rust_interesting_average(_: u64, ...) -> f64; } |
