Skip to content

Commit 0c8f194

Browse files
committed
rewrite share-generics-dylib to rmake
1 parent 56c698c commit 0c8f194

File tree

3 files changed

+32
-24
lines changed

3 files changed

+32
-24
lines changed

src/tools/tidy/src/allowed_run_make_makefiles.txt

-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ run-make/reproducible-build-2/Makefile
5050
run-make/reproducible-build/Makefile
5151
run-make/rlib-format-packed-bundled-libs-2/Makefile
5252
run-make/rlib-format-packed-bundled-libs/Makefile
53-
run-make/share-generics-dylib/Makefile
5453
run-make/simd-ffi/Makefile
5554
run-make/split-debuginfo/Makefile
5655
run-make/stable-symbol-names/Makefile

tests/run-make/share-generics-dylib/Makefile

-23
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// This test makes sure all generic instances get re-exported from Rust dylibs for use by
2+
// `-Zshare-generics`. There are two rlibs (`instance_provider_a` and `instance_provider_b`)
3+
// which both provide an instance of `Cell<i32>::set`. There is `instance_user_dylib` which is
4+
// supposed to re-export both these instances, and then there are `instance_user_a_rlib` and
5+
// `instance_user_b_rlib` which each rely on a specific instance to be available.
6+
//
7+
// In the end everything is linked together into `linked_leaf`. If `instance_user_dylib` does
8+
// not export both then we'll get an `undefined reference` error for one of the instances.
9+
//
10+
// This is regression test for https://github.com/rust-lang/rust/issues/67276.
11+
12+
//FIXME(Oneirical): ignore-cross-compile
13+
14+
use run_make_support::rustc;
15+
16+
fn main() {
17+
compile("rlib", "instance_provider_a.rs");
18+
compile("rlib", "instance_provider_b.rs");
19+
compile("dylib", "instance_user_dylib.rs");
20+
compile("rlib", "instance_user_a_rlib.rs");
21+
compile("rlib", "instance_user_b_rlib.rs");
22+
compile("bin", "linked_leaf.rs");
23+
}
24+
25+
fn compile(crate_type: &str, input: &str) {
26+
rustc()
27+
.input(input)
28+
.crate_type(crate_type)
29+
.args(&["-Cprefer-dynamic", "-Zshare-generics=yes", "-Csymbol-mangling-version=v0"])
30+
.codegen_units(1)
31+
.run();
32+
}

0 commit comments

Comments
 (0)