diff options
Diffstat (limited to 'src/test')
25 files changed, 60 insertions, 130 deletions
diff --git a/src/test/run-make-fulldeps/static-nobundle/Makefile b/src/test/run-make-fulldeps/static-nobundle/Makefile deleted file mode 100644 index 001081798a6..00000000000 --- a/src/test/run-make-fulldeps/static-nobundle/Makefile +++ /dev/null @@ -1,23 +0,0 @@ --include ../tools.mk - -# aaa is a native static library -# bbb is a rlib -# ccc is a dylib -# ddd is an executable - -all: $(call NATIVE_STATICLIB,aaa) - $(RUSTC) bbb.rs --crate-type=rlib - - # Check that bbb does NOT contain the definition of `native_func` - # We're using the llvm-nm instead of the system nm to ensure it - # is compatible with the LLVM bitcode generated by rustc. - "$(LLVM_BIN_DIR)/llvm-nm" $(TMPDIR)/libbbb.rlib | $(CGREP) -ve "T _*native_func" - "$(LLVM_BIN_DIR)/llvm-nm" $(TMPDIR)/libbbb.rlib | $(CGREP) -e "U _*native_func" - - # Check that aaa gets linked (either as `-l aaa` or `aaa.lib`) when building ccc. - $(RUSTC) ccc.rs -C prefer-dynamic --crate-type=dylib --print link-args | $(CGREP) -e '-l[" ]*aaa|aaa\.lib' - - # Check that aaa does NOT get linked when building ddd. - $(RUSTC) ddd.rs --print link-args | $(CGREP) -ve '-l[" ]*aaa|aaa\.lib' - - $(call RUN,ddd) diff --git a/src/test/run-make-fulldeps/static-nobundle/bbb.rs b/src/test/run-make-fulldeps/static-nobundle/bbb.rs deleted file mode 100644 index 69d1668d4f6..00000000000 --- a/src/test/run-make-fulldeps/static-nobundle/bbb.rs +++ /dev/null @@ -1,13 +0,0 @@ -#![crate_type = "rlib"] -#![feature(static_nobundle)] - -#[link(name = "aaa", kind = "static-nobundle")] -extern "C" { - pub fn native_func(); -} - -pub fn wrapped_func() { - unsafe { - native_func(); - } -} diff --git a/src/test/run-make-fulldeps/static-nobundle/ccc.rs b/src/test/run-make-fulldeps/static-nobundle/ccc.rs deleted file mode 100644 index a1f875a52d5..00000000000 --- a/src/test/run-make-fulldeps/static-nobundle/ccc.rs +++ /dev/null @@ -1,13 +0,0 @@ -#![crate_type = "dylib"] - -extern crate bbb; - -pub fn do_work() { - unsafe { bbb::native_func(); } - bbb::wrapped_func(); -} - -pub fn do_work_generic<T>() { - unsafe { bbb::native_func(); } - bbb::wrapped_func(); -} diff --git a/src/test/run-make-fulldeps/static-nobundle/ddd.rs b/src/test/run-make-fulldeps/static-nobundle/ddd.rs deleted file mode 100644 index 50b41211ff0..00000000000 --- a/src/test/run-make-fulldeps/static-nobundle/ddd.rs +++ /dev/null @@ -1,7 +0,0 @@ -extern crate ccc; - -fn main() { - ccc::do_work(); - ccc::do_work_generic::<i16>(); - ccc::do_work_generic::<i32>(); -} diff --git a/src/test/run-make-fulldeps/tools.mk b/src/test/run-make-fulldeps/tools.mk index 9655d09df0f..a14f6e3ab95 100644 --- a/src/test/run-make-fulldeps/tools.mk +++ b/src/test/run-make-fulldeps/tools.mk @@ -120,7 +120,7 @@ else # So we end up with the following hack: we link use static:-bundle to only # link the parts of libstdc++ that we actually use, which doesn't include # the dependency on the pthreads DLL. - EXTRARSCXXFLAGS := -l static:-bundle=stdc++ -Z unstable-options + EXTRARSCXXFLAGS := -l static:-bundle=stdc++ endif else ifeq ($(UNAME),Darwin) diff --git a/src/test/run-make/native-link-modifier-bundle/Makefile b/src/test/run-make/native-link-modifier-bundle/Makefile new file mode 100644 index 00000000000..723bb4689fe --- /dev/null +++ b/src/test/run-make/native-link-modifier-bundle/Makefile @@ -0,0 +1,29 @@ +# ignore-cross-compile +# ignore-windows-msvc + +-include ../../run-make-fulldeps/tools.mk + +all: $(call NATIVE_STATICLIB,native-staticlib) + # Build a staticlib and a rlib, the `native_func` symbol will be bundled into them + $(RUSTC) bundled.rs --crate-type=staticlib --crate-type=rlib + nm $(TMPDIR)/libbundled.a | $(CGREP) -e "T _*native_func" + nm $(TMPDIR)/libbundled.a | $(CGREP) -e "U _*native_func" + nm $(TMPDIR)/libbundled.rlib | $(CGREP) -e "T _*native_func" + nm $(TMPDIR)/libbundled.rlib | $(CGREP) -e "U _*native_func" + + # Build a staticlib and a rlib, the `native_func` symbol will not be bundled into it + $(RUSTC) non-bundled.rs --crate-type=staticlib --crate-type=rlib + nm $(TMPDIR)/libnon_bundled.a | $(CGREP) -ve "T _*native_func" + nm $(TMPDIR)/libnon_bundled.a | $(CGREP) -e "U _*native_func" + nm $(TMPDIR)/libnon_bundled.rlib | $(CGREP) -ve "T _*native_func" + nm $(TMPDIR)/libnon_bundled.rlib | $(CGREP) -e "U _*native_func" + + # Build a cdylib, `native-staticlib` will not appear on the linker line because it was bundled previously + # The cdylib will contain the `native_func` symbol in the end + $(RUSTC) cdylib-bundled.rs --crate-type=cdylib --print link-args | $(CGREP) -ve '-l[" ]*native-staticlib' + nm $(call DYLIB,cdylib_bundled) | $(CGREP) -e "[Tt] _*native_func" + + # Build a cdylib, `native-staticlib` will appear on the linker line because it was not bundled previously + # The cdylib will contain the `native_func` symbol in the end + $(RUSTC) cdylib-non-bundled.rs --crate-type=cdylib --print link-args | $(CGREP) -e '-l[" ]*native-staticlib' + nm $(call DYLIB,cdylib_non_bundled) | $(CGREP) -e "[Tt] _*native_func" diff --git a/src/test/run-make/native-link-modifier-bundle/bundled.rs b/src/test/run-make/native-link-modifier-bundle/bundled.rs new file mode 100644 index 00000000000..0bbae8752d7 --- /dev/null +++ b/src/test/run-make/native-link-modifier-bundle/bundled.rs @@ -0,0 +1,11 @@ +#[link(name = "native-staticlib", kind = "static", modifiers = "+bundle")] +extern "C" { + pub fn native_func(); +} + +#[no_mangle] +pub extern "C" fn wrapped_func() { + unsafe { + native_func(); + } +} diff --git a/src/test/run-make/native-link-modifier-bundle/cdylib-bundled.rs b/src/test/run-make/native-link-modifier-bundle/cdylib-bundled.rs new file mode 100644 index 00000000000..7291309168a --- /dev/null +++ b/src/test/run-make/native-link-modifier-bundle/cdylib-bundled.rs @@ -0,0 +1 @@ +extern crate bundled; diff --git a/src/test/run-make/native-link-modifier-bundle/cdylib-non-bundled.rs b/src/test/run-make/native-link-modifier-bundle/cdylib-non-bundled.rs new file mode 100644 index 00000000000..1df81fd101f --- /dev/null +++ b/src/test/run-make/native-link-modifier-bundle/cdylib-non-bundled.rs @@ -0,0 +1 @@ +extern crate non_bundled; diff --git a/src/test/run-make-fulldeps/static-nobundle/aaa.c b/src/test/run-make/native-link-modifier-bundle/native-staticlib.c index d300fdf1c17..d300fdf1c17 100644 --- a/src/test/run-make-fulldeps/static-nobundle/aaa.c +++ b/src/test/run-make/native-link-modifier-bundle/native-staticlib.c diff --git a/src/test/run-make/native-link-modifier-bundle/non-bundled.rs b/src/test/run-make/native-link-modifier-bundle/non-bundled.rs new file mode 100644 index 00000000000..8181e6387c5 --- /dev/null +++ b/src/test/run-make/native-link-modifier-bundle/non-bundled.rs @@ -0,0 +1,11 @@ +#[link(name = "native-staticlib", kind = "static", modifiers = "-bundle")] +extern "C" { + pub fn native_func(); +} + +#[no_mangle] +pub extern "C" fn wrapped_func() { + unsafe { + native_func(); + } +} diff --git a/src/test/run-make/native-link-modifier-whole-archive/Makefile b/src/test/run-make/native-link-modifier-whole-archive/Makefile index 799b5f6f5fc..3b49d1188ae 100644 --- a/src/test/run-make/native-link-modifier-whole-archive/Makefile +++ b/src/test/run-make/native-link-modifier-whole-archive/Makefile @@ -17,7 +17,7 @@ all: $(TMPDIR)/$(call BIN,directly_linked) $(TMPDIR)/$(call BIN,indirectly_linke # Native lib linked directly into executable $(TMPDIR)/$(call BIN,directly_linked): $(call NATIVE_STATICLIB,c_static_lib_with_constructor) - $(RUSTC) directly_linked.rs -Z unstable-options -l static:+whole-archive=c_static_lib_with_constructor + $(RUSTC) directly_linked.rs -l static:+whole-archive=c_static_lib_with_constructor # Native lib linked into RLIB via `-l static:-bundle,+whole-archive`, RLIB linked into executable $(TMPDIR)/$(call BIN,indirectly_linked): $(TMPDIR)/librlib_with_cmdline_native_lib.rlib @@ -29,7 +29,7 @@ $(TMPDIR)/$(call BIN,indirectly_linked_via_attr): $(TMPDIR)/libnative_lib_in_src # Native lib linked into rlib with via commandline $(TMPDIR)/librlib_with_cmdline_native_lib.rlib: $(call NATIVE_STATICLIB,c_static_lib_with_constructor) - $(RUSTC) rlib_with_cmdline_native_lib.rs -Z unstable-options --crate-type=rlib -l static:-bundle,+whole-archive=c_static_lib_with_constructor + $(RUSTC) rlib_with_cmdline_native_lib.rs --crate-type=rlib -l static:-bundle,+whole-archive=c_static_lib_with_constructor # Native lib linked into rlib via `#[link()]` attribute on extern block. $(TMPDIR)/libnative_lib_in_src.rlib: $(call NATIVE_STATICLIB,c_static_lib_with_constructor) diff --git a/src/test/run-make/native-link-modifier-whole-archive/native_lib_in_src.rs b/src/test/run-make/native-link-modifier-whole-archive/native_lib_in_src.rs index 2436c36e6eb..971f3be7a61 100644 --- a/src/test/run-make/native-link-modifier-whole-archive/native_lib_in_src.rs +++ b/src/test/run-make/native-link-modifier-whole-archive/native_lib_in_src.rs @@ -1,5 +1,3 @@ -#![feature(native_link_modifiers_bundle)] - use std::io::Write; #[link(name = "c_static_lib_with_constructor", diff --git a/src/test/ui/feature-gates/feature-gate-native_link_modifiers_bundle-2.rs b/src/test/ui/feature-gates/feature-gate-native_link_modifiers_bundle-2.rs deleted file mode 100644 index e229564950f..00000000000 --- a/src/test/ui/feature-gates/feature-gate-native_link_modifiers_bundle-2.rs +++ /dev/null @@ -1,9 +0,0 @@ -// Test native_link_modifiers_bundle don't need static-nobundle -// check-pass - -#![feature(native_link_modifiers_bundle)] - -#[link(name = "foo", kind = "static", modifiers = "-bundle")] -extern "C" {} - -fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-native_link_modifiers_bundle-3.rs b/src/test/ui/feature-gates/feature-gate-native_link_modifiers_bundle-3.rs deleted file mode 100644 index 3da943ee4a9..00000000000 --- a/src/test/ui/feature-gates/feature-gate-native_link_modifiers_bundle-3.rs +++ /dev/null @@ -1,3 +0,0 @@ -// compile-flags: -l static:-bundle=nonexistent - -fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-native_link_modifiers_bundle-3.stderr b/src/test/ui/feature-gates/feature-gate-native_link_modifiers_bundle-3.stderr deleted file mode 100644 index 743bcc9a1b3..00000000000 --- a/src/test/ui/feature-gates/feature-gate-native_link_modifiers_bundle-3.stderr +++ /dev/null @@ -1,2 +0,0 @@ -error: linking modifier `bundle` is unstable and only accepted on the nightly compiler - diff --git a/src/test/ui/feature-gates/feature-gate-native_link_modifiers_bundle.rs b/src/test/ui/feature-gates/feature-gate-native_link_modifiers_bundle.rs deleted file mode 100644 index c1d5a31aaa4..00000000000 --- a/src/test/ui/feature-gates/feature-gate-native_link_modifiers_bundle.rs +++ /dev/null @@ -1,5 +0,0 @@ -#[link(name = "foo", kind = "static", modifiers = "+bundle")] -//~^ ERROR: linking modifier `bundle` is unstable -extern "C" {} - -fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-native_link_modifiers_bundle.stderr b/src/test/ui/feature-gates/feature-gate-native_link_modifiers_bundle.stderr deleted file mode 100644 index dcaa7fcc64f..00000000000 --- a/src/test/ui/feature-gates/feature-gate-native_link_modifiers_bundle.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0658]: linking modifier `bundle` is unstable - --> $DIR/feature-gate-native_link_modifiers_bundle.rs:1:51 - | -LL | #[link(name = "foo", kind = "static", modifiers = "+bundle")] - | ^^^^^^^^^ - | - = note: see issue #81490 <https://github.com/rust-lang/rust/issues/81490> for more information - = help: add `#![feature(native_link_modifiers_bundle)]` to the crate attributes to enable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/feature-gates/feature-gate-static-nobundle-2.rs b/src/test/ui/feature-gates/feature-gate-static-nobundle-2.rs deleted file mode 100644 index ad0662b6892..00000000000 --- a/src/test/ui/feature-gates/feature-gate-static-nobundle-2.rs +++ /dev/null @@ -1,4 +0,0 @@ -// check-pass -// compile-flags: -l static-nobundle=nonexistent - -fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-static-nobundle-2.stderr b/src/test/ui/feature-gates/feature-gate-static-nobundle-2.stderr deleted file mode 100644 index 782d9e39456..00000000000 --- a/src/test/ui/feature-gates/feature-gate-static-nobundle-2.stderr +++ /dev/null @@ -1,2 +0,0 @@ -warning: library kind `static-nobundle` has been superseded by specifying modifier `-bundle` with library kind `static`. Try `static:-bundle` - diff --git a/src/test/ui/feature-gates/feature-gate-static-nobundle.rs b/src/test/ui/feature-gates/feature-gate-static-nobundle.rs deleted file mode 100644 index 50f1b7ff3fc..00000000000 --- a/src/test/ui/feature-gates/feature-gate-static-nobundle.rs +++ /dev/null @@ -1,6 +0,0 @@ -#[link(name = "foo", kind = "static-nobundle")] -//~^ WARNING: link kind `static-nobundle` has been superseded by specifying modifier `-bundle` with link kind `static` -//~^^ ERROR: link kind `static-nobundle` is unstable -extern "C" {} - -fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-static-nobundle.stderr b/src/test/ui/feature-gates/feature-gate-static-nobundle.stderr deleted file mode 100644 index 094661aeb57..00000000000 --- a/src/test/ui/feature-gates/feature-gate-static-nobundle.stderr +++ /dev/null @@ -1,18 +0,0 @@ -warning: link kind `static-nobundle` has been superseded by specifying modifier `-bundle` with link kind `static` - --> $DIR/feature-gate-static-nobundle.rs:1:29 - | -LL | #[link(name = "foo", kind = "static-nobundle")] - | ^^^^^^^^^^^^^^^^^ - -error[E0658]: link kind `static-nobundle` is unstable - --> $DIR/feature-gate-static-nobundle.rs:1:29 - | -LL | #[link(name = "foo", kind = "static-nobundle")] - | ^^^^^^^^^^^^^^^^^ - | - = note: see issue #37403 <https://github.com/rust-lang/rust/issues/37403> for more information - = help: add `#![feature(static_nobundle)]` to the crate attributes to enable - -error: aborting due to previous error; 1 warning emitted - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/native-library-link-flags/mix-bundle-and-whole-archive-link-attr.rs b/src/test/ui/native-library-link-flags/mix-bundle-and-whole-archive-link-attr.rs index b153ef94626..066048795c8 100644 --- a/src/test/ui/native-library-link-flags/mix-bundle-and-whole-archive-link-attr.rs +++ b/src/test/ui/native-library-link-flags/mix-bundle-and-whole-archive-link-attr.rs @@ -2,8 +2,6 @@ // build-fail // error-pattern: the linking modifiers `+bundle` and `+whole-archive` are not compatible with each other when generating rlibs -#![feature(native_link_modifiers_bundle)] - #[link(name = "mylib", kind = "static", modifiers = "+bundle,+whole-archive")] extern "C" { } diff --git a/src/test/ui/native-library-link-flags/modifiers-override.rs b/src/test/ui/native-library-link-flags/modifiers-override.rs index 3912ac9f13d..42cdb5004ad 100644 --- a/src/test/ui/native-library-link-flags/modifiers-override.rs +++ b/src/test/ui/native-library-link-flags/modifiers-override.rs @@ -1,7 +1,5 @@ // compile-flags:-ldylib:+as-needed=foo -lstatic=bar -Zunstable-options -#![feature(native_link_modifiers_bundle)] - #[link(name = "foo")] #[link( name = "bar", diff --git a/src/test/ui/native-library-link-flags/modifiers-override.stderr b/src/test/ui/native-library-link-flags/modifiers-override.stderr index 55362910e71..eb3ab55c310 100644 --- a/src/test/ui/native-library-link-flags/modifiers-override.stderr +++ b/src/test/ui/native-library-link-flags/modifiers-override.stderr @@ -1,23 +1,23 @@ error: multiple `modifiers` arguments in a single `#[link]` attribute - --> $DIR/modifiers-override.rs:11:5 + --> $DIR/modifiers-override.rs:9:5 | LL | modifiers = "+bundle" | ^^^^^^^^^^^^^^^^^^^^^ error: multiple `whole-archive` modifiers in a single `modifiers` argument - --> $DIR/modifiers-override.rs:9:17 + --> $DIR/modifiers-override.rs:7:17 | LL | modifiers = "+whole-archive,-whole-archive", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: overriding linking modifiers from command line is not supported - --> $DIR/modifiers-override.rs:14:1 + --> $DIR/modifiers-override.rs:12:1 | LL | extern "C" {} | ^^^^^^^^^^^^^ error: overriding linking modifiers from command line is not supported - --> $DIR/modifiers-override.rs:14:1 + --> $DIR/modifiers-override.rs:12:1 | LL | extern "C" {} | ^^^^^^^^^^^^^ |
