|
1 | 1 | # ignore-cross-compile -- compiling C++ code does not work well when cross-compiling
|
2 | 2 |
|
3 |
| -# This test case makes sure that native libraries are linked with --whole-archive semantics |
4 |
| -# when the `-bundle,+whole-archive` modifiers are applied to them. |
| 3 | +# This test case makes sure that native libraries are linked with appropriate semantics |
| 4 | +# when the `[+-]bundle,[+-]whole-archive` modifiers are applied to them. |
5 | 5 | #
|
6 | 6 | # The test works by checking that the resulting executables produce the expected output,
|
7 | 7 | # part of which is emitted by otherwise unreferenced C code. If +whole-archive didn't work
|
|
10 | 10 |
|
11 | 11 | -include ../../run-make-fulldeps/tools.mk
|
12 | 12 |
|
13 |
| -all: $(TMPDIR)/$(call BIN,directly_linked) $(TMPDIR)/$(call BIN,indirectly_linked) $(TMPDIR)/$(call BIN,indirectly_linked_via_attr) |
| 13 | +all: $(TMPDIR)/$(call BIN,directly_linked) \ |
| 14 | + $(TMPDIR)/$(call BIN,directly_linked_test_plus_whole_archive) \ |
| 15 | + $(TMPDIR)/$(call BIN,directly_linked_test_minus_whole_archive) \ |
| 16 | + $(TMPDIR)/$(call BIN,indirectly_linked) \ |
| 17 | + $(TMPDIR)/$(call BIN,indirectly_linked_via_attr) |
14 | 18 | $(call RUN,directly_linked) | $(CGREP) 'static-initializer.directly_linked.'
|
| 19 | + $(call RUN,directly_linked_test_plus_whole_archive) --nocapture | $(CGREP) 'static-initializer.' |
| 20 | + $(call RUN,directly_linked_test_minus_whole_archive) --nocapture | $(CGREP) -v 'static-initializer.' |
15 | 21 | $(call RUN,indirectly_linked) | $(CGREP) 'static-initializer.indirectly_linked.'
|
16 | 22 | $(call RUN,indirectly_linked_via_attr) | $(CGREP) 'static-initializer.native_lib_in_src.'
|
17 | 23 |
|
18 | 24 | # Native lib linked directly into executable
|
19 | 25 | $(TMPDIR)/$(call BIN,directly_linked): $(call NATIVE_STATICLIB,c_static_lib_with_constructor)
|
20 | 26 | $(RUSTC) directly_linked.rs -l static:+whole-archive=c_static_lib_with_constructor
|
21 | 27 |
|
| 28 | +# Native lib linked into test executable, +whole-archive |
| 29 | +$(TMPDIR)/$(call BIN,directly_linked_test_plus_whole_archive): $(call NATIVE_STATICLIB,c_static_lib_with_constructor) |
| 30 | + $(RUSTC) directly_linked_test_plus_whole_archive.rs --test -l static:+whole-archive=c_static_lib_with_constructor |
| 31 | +# Native lib linked into test executable, -whole-archive |
| 32 | +$(TMPDIR)/$(call BIN,directly_linked_test_minus_whole_archive): $(call NATIVE_STATICLIB,c_static_lib_with_constructor) |
| 33 | + $(RUSTC) directly_linked_test_minus_whole_archive.rs --test -l static:-whole-archive=c_static_lib_with_constructor |
| 34 | + |
22 | 35 | # Native lib linked into RLIB via `-l static:-bundle,+whole-archive`, RLIB linked into executable
|
23 | 36 | $(TMPDIR)/$(call BIN,indirectly_linked): $(TMPDIR)/librlib_with_cmdline_native_lib.rlib
|
24 | 37 | $(RUSTC) indirectly_linked.rs
|
|
0 commit comments