Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 27ea1de

Browse files
committed
Auto merge of rust-lang#127044 - Oneirical:fantestic-journey, r=<try>
Migrate `dylib-chain`, `rlib-chain`, `issue-47384`, `msvc-opt-minsize` and `test-harness` `run-make` tests to ui/rmake Part of rust-lang#121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html). `issue-47384` demands a Windows/Apple try-job. try-job: x86_64-msvc try-job: aarch64-apple
2 parents 2495953 + 2019f15 commit 27ea1de

File tree

19 files changed

+127
-75
lines changed

19 files changed

+127
-75
lines changed

src/tools/tidy/src/allowed_run_make_makefiles.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ run-make/dep-info-spaces/Makefile
2424
run-make/dep-info/Makefile
2525
run-make/dump-ice-to-disk/Makefile
2626
run-make/dump-mono-stats/Makefile
27-
run-make/dylib-chain/Makefile
2827
run-make/emit-path-unhashed/Makefile
2928
run-make/emit-shared-files/Makefile
3029
run-make/emit-stack-sizes/Makefile
@@ -68,7 +67,6 @@ run-make/issue-35164/Makefile
6867
run-make/issue-36710/Makefile
6968
run-make/issue-37839/Makefile
7069
run-make/issue-40535/Makefile
71-
run-make/issue-47384/Makefile
7270
run-make/issue-47551/Makefile
7371
run-make/issue-68794-textrel-on-minimal-lib/Makefile
7472
run-make/issue-69368/Makefile
@@ -107,7 +105,6 @@ run-make/mingw-export-call-convention/Makefile
107105
run-make/mismatching-target-triples/Makefile
108106
run-make/missing-crate-dependency/Makefile
109107
run-make/mixing-libs/Makefile
110-
run-make/msvc-opt-minsize/Makefile
111108
run-make/native-link-modifier-bundle/Makefile
112109
run-make/native-link-modifier-whole-archive/Makefile
113110
run-make/no-alloc-shim/Makefile
@@ -153,7 +150,6 @@ run-make/reproducible-build-2/Makefile
153150
run-make/reproducible-build/Makefile
154151
run-make/return-non-c-like-enum-from-c/Makefile
155152
run-make/return-non-c-like-enum/Makefile
156-
run-make/rlib-chain/Makefile
157153
run-make/rlib-format-packed-bundled-libs-2/Makefile
158154
run-make/rlib-format-packed-bundled-libs-3/Makefile
159155
run-make/rlib-format-packed-bundled-libs/Makefile
@@ -183,7 +179,6 @@ run-make/target-cpu-native/Makefile
183179
run-make/target-specs/Makefile
184180
run-make/target-without-atomic-cas/Makefile
185181
run-make/test-benches/Makefile
186-
run-make/test-harness/Makefile
187182
run-make/thumb-none-cortex-m/Makefile
188183
run-make/thumb-none-qemu/Makefile
189184
run-make/track-path-dep-info/Makefile

tests/run-make/dylib-chain/Makefile

Lines changed: 0 additions & 13 deletions
This file was deleted.

tests/run-make/dylib-chain/rmake.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// In this test, m4 depends on m3, which depends on m2, which depends on m1.
2+
// Even though dependencies are chained like this and there is no direct mention
3+
// of m1 or m2 in m4.rs, compilation and execution should still succeed. Unlike the
4+
// rlib-chain test, dynamic libraries contain upstream dependencies, and breaking
5+
// the chain by removing the dylibs causes execution to fail.
6+
// See https://github.com/rust-lang/rust/issues/10434
7+
8+
//@ ignore-cross-compile
9+
// Reason: the compiled binary is executed
10+
11+
use run_make_support::{dynamic_lib_name, fs_wrapper, run, run_fail, rustc};
12+
13+
fn main() {
14+
rustc().input("m1.rs").arg("-Cprefer-dynamic").run();
15+
rustc().input("m2.rs").arg("-Cprefer-dynamic").run();
16+
rustc().input("m3.rs").arg("-Cprefer-dynamic").run();
17+
rustc().input("m4.rs").run();
18+
run("m4");
19+
fs_wrapper::remove_file(dynamic_lib_name("m1"));
20+
fs_wrapper::remove_file(dynamic_lib_name("m2"));
21+
fs_wrapper::remove_file(dynamic_lib_name("m3"));
22+
run_fail("m4");
23+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Linkers treat archives differently from object files: all object files participate in linking,
2+
// while archives will only participate in linking if they can satisfy at least one undefined
3+
// reference (version scripts doesn't count). This causes `#[no_mangle]` or `#[used]` items to
4+
// be ignored by the linker, and since they never participate in the linking, using `KEEP` in the
5+
// linker scripts can't keep them either. This causes #47384. After the fix in #95604, this test
6+
// checks that these symbols and sections successfully appear in the output dynamic library.
7+
// See https://github.com/rust-lang/rust/pull/95604
8+
// See https://github.com/rust-lang/rust/issues/47384
9+
10+
//FIXME(Oneirical): ignore flags: only linux and cross compile
11+
12+
use run_make_support::{dynamic_lib_name, llvm_objdump, llvm_readobj, rustc};
13+
14+
fn main() {
15+
rustc().crate_type("lib").input("lib.rs").run();
16+
rustc().crate_type("cdylib").link_args("-Tlinker.ld").input("main.rs").run();
17+
// Ensure `#[used]` and `KEEP`-ed section is there
18+
llvm_objdump()
19+
.arg("--full-contents")
20+
.arg("--section=.static")
21+
.input(dynamic_lib_name("main"))
22+
.run();
23+
// Ensure `#[no_mangle]` symbol is there
24+
llvm_readobj()
25+
.arg("--symbols")
26+
.input(dynamic_lib_name("main"))
27+
.run()
28+
.assert_stdout_contains("bar");
29+
}

tests/run-make/issue-47384/Makefile

Lines changed: 0 additions & 12 deletions
This file was deleted.

tests/run-make/msvc-opt-minsize/Makefile

Lines changed: 0 additions & 6 deletions
This file was deleted.

tests/run-make/msvc-opt-minsize/foo.rs

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)