summaryrefslogtreecommitdiffstats
path: root/src/test/run-make/native-link-modifier-whole-archive
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/run-make/native-link-modifier-whole-archive')
-rw-r--r--src/test/run-make/native-link-modifier-whole-archive/Makefile52
-rw-r--r--src/test/run-make/native-link-modifier-whole-archive/c_static_lib_with_constructor.cpp11
-rw-r--r--src/test/run-make/native-link-modifier-whole-archive/directly_linked.rs6
-rw-r--r--src/test/run-make/native-link-modifier-whole-archive/directly_linked_test_minus_whole_archive.rs7
-rw-r--r--src/test/run-make/native-link-modifier-whole-archive/directly_linked_test_plus_whole_archive.rs7
-rw-r--r--src/test/run-make/native-link-modifier-whole-archive/indirectly_linked.rs5
-rw-r--r--src/test/run-make/native-link-modifier-whole-archive/indirectly_linked_via_attr.rs5
-rw-r--r--src/test/run-make/native-link-modifier-whole-archive/native_lib_in_src.rs11
-rw-r--r--src/test/run-make/native-link-modifier-whole-archive/rlib_with_cmdline_native_lib.rs6
9 files changed, 0 insertions, 110 deletions
diff --git a/src/test/run-make/native-link-modifier-whole-archive/Makefile b/src/test/run-make/native-link-modifier-whole-archive/Makefile
deleted file mode 100644
index f26bd864c..000000000
--- a/src/test/run-make/native-link-modifier-whole-archive/Makefile
+++ /dev/null
@@ -1,52 +0,0 @@
-# ignore-cross-compile -- compiling C++ code does not work well when cross-compiling
-
-# This test case makes sure that native libraries are linked with appropriate semantics
-# when the `[+-]bundle,[+-]whole-archive` modifiers are applied to them.
-#
-# The test works by checking that the resulting executables produce the expected output,
-# part of which is emitted by otherwise unreferenced C code. If +whole-archive didn't work
-# that code would never make it into the final executable and we'd thus be missing some
-# of the output.
-
-include ../../run-make-fulldeps/tools.mk
-
-all: $(TMPDIR)/$(call BIN,directly_linked) \
- $(TMPDIR)/$(call BIN,directly_linked_test_plus_whole_archive) \
- $(TMPDIR)/$(call BIN,directly_linked_test_minus_whole_archive) \
- $(TMPDIR)/$(call BIN,indirectly_linked) \
- $(TMPDIR)/$(call BIN,indirectly_linked_via_attr)
- $(call RUN,directly_linked) | $(CGREP) 'static-initializer.directly_linked.'
- $(call RUN,directly_linked_test_plus_whole_archive) --nocapture | $(CGREP) 'static-initializer.'
- $(call RUN,directly_linked_test_minus_whole_archive) --nocapture | $(CGREP) -v 'static-initializer.'
- $(call RUN,indirectly_linked) | $(CGREP) 'static-initializer.indirectly_linked.'
- $(call RUN,indirectly_linked_via_attr) | $(CGREP) 'static-initializer.native_lib_in_src.'
-
-# Native lib linked directly into executable
-$(TMPDIR)/$(call BIN,directly_linked): $(call NATIVE_STATICLIB,c_static_lib_with_constructor)
- $(RUSTC) directly_linked.rs -l static:+whole-archive=c_static_lib_with_constructor
-
-# Native lib linked into test executable, +whole-archive
-$(TMPDIR)/$(call BIN,directly_linked_test_plus_whole_archive): $(call NATIVE_STATICLIB,c_static_lib_with_constructor)
- $(RUSTC) directly_linked_test_plus_whole_archive.rs --test -l static:+whole-archive=c_static_lib_with_constructor
-# Native lib linked into test executable, -whole-archive
-$(TMPDIR)/$(call BIN,directly_linked_test_minus_whole_archive): $(call NATIVE_STATICLIB,c_static_lib_with_constructor)
- $(RUSTC) directly_linked_test_minus_whole_archive.rs --test -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
- $(RUSTC) indirectly_linked.rs
-
-# Native lib linked into RLIB via #[link] attribute, RLIB linked into executable
-$(TMPDIR)/$(call BIN,indirectly_linked_via_attr): $(TMPDIR)/libnative_lib_in_src.rlib
- $(RUSTC) indirectly_linked_via_attr.rs
-
-# 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 --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)
- $(RUSTC) native_lib_in_src.rs --crate-type=rlib
-
-$(TMPDIR)/libc_static_lib_with_constructor.o: c_static_lib_with_constructor.cpp
- $(call COMPILE_OBJ_CXX,$@,$<)
diff --git a/src/test/run-make/native-link-modifier-whole-archive/c_static_lib_with_constructor.cpp b/src/test/run-make/native-link-modifier-whole-archive/c_static_lib_with_constructor.cpp
deleted file mode 100644
index c687eb0f0..000000000
--- a/src/test/run-make/native-link-modifier-whole-archive/c_static_lib_with_constructor.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <cstdio>
-
-// Since this is a global variable, its constructor will be called before
-// main() is executed. But only if the object file containing it actually
-// gets linked into the executable.
-struct Foo {
- Foo() {
- printf("static-initializer.");
- fflush(stdout);
- }
-} FOO;
diff --git a/src/test/run-make/native-link-modifier-whole-archive/directly_linked.rs b/src/test/run-make/native-link-modifier-whole-archive/directly_linked.rs
deleted file mode 100644
index 17518e8b2..000000000
--- a/src/test/run-make/native-link-modifier-whole-archive/directly_linked.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-use std::io::Write;
-
-fn main() {
- print!("directly_linked.");
- std::io::stdout().flush().unwrap();
-}
diff --git a/src/test/run-make/native-link-modifier-whole-archive/directly_linked_test_minus_whole_archive.rs b/src/test/run-make/native-link-modifier-whole-archive/directly_linked_test_minus_whole_archive.rs
deleted file mode 100644
index 20ed8d9d4..000000000
--- a/src/test/run-make/native-link-modifier-whole-archive/directly_linked_test_minus_whole_archive.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-use std::io::Write;
-
-#[test]
-fn test_thing() {
- print!("ran the test");
- std::io::stdout().flush().unwrap();
-}
diff --git a/src/test/run-make/native-link-modifier-whole-archive/directly_linked_test_plus_whole_archive.rs b/src/test/run-make/native-link-modifier-whole-archive/directly_linked_test_plus_whole_archive.rs
deleted file mode 100644
index 20ed8d9d4..000000000
--- a/src/test/run-make/native-link-modifier-whole-archive/directly_linked_test_plus_whole_archive.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-use std::io::Write;
-
-#[test]
-fn test_thing() {
- print!("ran the test");
- std::io::stdout().flush().unwrap();
-}
diff --git a/src/test/run-make/native-link-modifier-whole-archive/indirectly_linked.rs b/src/test/run-make/native-link-modifier-whole-archive/indirectly_linked.rs
deleted file mode 100644
index c8b83fcfe..000000000
--- a/src/test/run-make/native-link-modifier-whole-archive/indirectly_linked.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-extern crate rlib_with_cmdline_native_lib;
-
-fn main() {
- rlib_with_cmdline_native_lib::hello();
-}
diff --git a/src/test/run-make/native-link-modifier-whole-archive/indirectly_linked_via_attr.rs b/src/test/run-make/native-link-modifier-whole-archive/indirectly_linked_via_attr.rs
deleted file mode 100644
index b9e347609..000000000
--- a/src/test/run-make/native-link-modifier-whole-archive/indirectly_linked_via_attr.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-extern crate native_lib_in_src;
-
-fn main() {
- native_lib_in_src::hello();
-}
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
deleted file mode 100644
index 971f3be7a..000000000
--- a/src/test/run-make/native-link-modifier-whole-archive/native_lib_in_src.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-use std::io::Write;
-
-#[link(name = "c_static_lib_with_constructor",
- kind = "static",
- modifiers = "-bundle,+whole-archive")]
-extern {}
-
-pub fn hello() {
- print!("native_lib_in_src.");
- std::io::stdout().flush().unwrap();
-}
diff --git a/src/test/run-make/native-link-modifier-whole-archive/rlib_with_cmdline_native_lib.rs b/src/test/run-make/native-link-modifier-whole-archive/rlib_with_cmdline_native_lib.rs
deleted file mode 100644
index ef2b702dd..000000000
--- a/src/test/run-make/native-link-modifier-whole-archive/rlib_with_cmdline_native_lib.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-use std::io::Write;
-
-pub fn hello() {
- print!("indirectly_linked.");
- std::io::stdout().flush().unwrap();
-}