Skip to content

Commit 3a65646

Browse files
committed
rewrite and rename issue-47384 to rmake
1 parent 86bd349 commit 3a65646

File tree

6 files changed

+29
-13
lines changed

6 files changed

+29
-13
lines changed

src/tools/tidy/src/allowed_run_make_makefiles.txt

-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ run-make/issue-35164/Makefile
6565
run-make/issue-36710/Makefile
6666
run-make/issue-37839/Makefile
6767
run-make/issue-40535/Makefile
68-
run-make/issue-47384/Makefile
6968
run-make/issue-47551/Makefile
7069
run-make/issue-69368/Makefile
7170
run-make/issue-83045/Makefile
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

-12
This file was deleted.

0 commit comments

Comments
 (0)