rewrite and rename issue-47384 to rmake
This commit is contained in:
parent
86bd3498b2
commit
3a656462ef
@ -65,7 +65,6 @@ run-make/issue-35164/Makefile
|
||||
run-make/issue-36710/Makefile
|
||||
run-make/issue-37839/Makefile
|
||||
run-make/issue-40535/Makefile
|
||||
run-make/issue-47384/Makefile
|
||||
run-make/issue-47551/Makefile
|
||||
run-make/issue-69368/Makefile
|
||||
run-make/issue-83045/Makefile
|
||||
|
29
tests/run-make/include-all-symbols-linking/rmake.rs
Normal file
29
tests/run-make/include-all-symbols-linking/rmake.rs
Normal file
@ -0,0 +1,29 @@
|
||||
// Linkers treat archives differently from object files: all object files participate in linking,
|
||||
// while archives will only participate in linking if they can satisfy at least one undefined
|
||||
// reference (version scripts doesn't count). This causes `#[no_mangle]` or `#[used]` items to
|
||||
// be ignored by the linker, and since they never participate in the linking, using `KEEP` in the
|
||||
// linker scripts can't keep them either. This causes #47384. After the fix in #95604, this test
|
||||
// checks that these symbols and sections successfully appear in the output dynamic library.
|
||||
// See https://github.com/rust-lang/rust/pull/95604
|
||||
// See https://github.com/rust-lang/rust/issues/47384
|
||||
|
||||
//FIXME(Oneirical): ignore flags: only linux and cross compile
|
||||
|
||||
use run_make_support::{dynamic_lib_name, llvm_objdump, llvm_readobj, rustc};
|
||||
|
||||
fn main() {
|
||||
rustc().crate_type("lib").input("lib.rs").run();
|
||||
rustc().crate_type("cdylib").link_args("-Tlinker.ld").input("main.rs").run();
|
||||
// Ensure `#[used]` and `KEEP`-ed section is there
|
||||
llvm_objdump()
|
||||
.arg("--full-contents")
|
||||
.arg("--section=.static")
|
||||
.input(dynamic_lib_name("main"))
|
||||
.run();
|
||||
// Ensure `#[no_mangle]` symbol is there
|
||||
llvm_readobj()
|
||||
.arg("--symbols")
|
||||
.input(dynamic_lib_name("main"))
|
||||
.run()
|
||||
.assert_stdout_contains("bar");
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
include ../tools.mk
|
||||
|
||||
# only-linux
|
||||
# ignore-cross-compile
|
||||
|
||||
all: main.rs
|
||||
$(RUSTC) --crate-type lib lib.rs
|
||||
$(RUSTC) --crate-type cdylib -Clink-args="-Tlinker.ld" main.rs
|
||||
# Ensure `#[used]` and `KEEP`-ed section is there
|
||||
objdump -s -j".static" $(TMPDIR)/libmain.so
|
||||
# Ensure `#[no_mangle]` symbol is there
|
||||
nm $(TMPDIR)/libmain.so | $(CGREP) bar
|
Loading…
Reference in New Issue
Block a user