Auto merge of #126698 - Oneirical:tessteract, r=Kobzol · rust-lang/rust@38d0f87 (original) (raw)

File tree

12 files changed

lines changed

12 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -53,6 +53,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
53 53 "ignore-gnu",
54 54 "ignore-haiku",
55 55 "ignore-horizon",
56 +"ignore-i686-pc-windows-gnu",
56 57 "ignore-i686-pc-windows-msvc",
57 58 "ignore-illumos",
58 59 "ignore-ios",
@@ -174,6 +175,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
174 175 "only-bpf",
175 176 "only-cdb",
176 177 "only-gnu",
178 +"only-i686-pc-windows-gnu",
177 179 "only-i686-pc-windows-msvc",
178 180 "only-ios",
179 181 "only-linux",
Original file line number Diff line number Diff line change
@@ -70,7 +70,6 @@ run-make/issue-37839/Makefile
70 70 run-make/issue-40535/Makefile
71 71 run-make/issue-47384/Makefile
72 72 run-make/issue-47551/Makefile
73 -run-make/issue-68794-textrel-on-minimal-lib/Makefile
74 73 run-make/issue-69368/Makefile
75 74 run-make/issue-83045/Makefile
76 75 run-make/issue-83112-incr-test-moved-file/Makefile
@@ -137,7 +136,6 @@ run-make/profile/Makefile
137 136 run-make/prune-link-args/Makefile
138 137 run-make/raw-dylib-alt-calling-convention/Makefile
139 138 run-make/raw-dylib-c/Makefile
140 -run-make/raw-dylib-cross-compilation/Makefile
141 139 run-make/raw-dylib-custom-dlltool/Makefile
142 140 run-make/raw-dylib-import-name-type/Makefile
143 141 run-make/raw-dylib-inline-cross-dylib/Makefile
@@ -187,9 +185,7 @@ run-make/track-path-dep-info/Makefile
187 185 run-make/track-pgo-dep-info/Makefile
188 186 run-make/translation/Makefile
189 187 run-make/type-mismatch-same-crate-name/Makefile
190 -run-make/unknown-mod-stdin/Makefile
191 188 run-make/unstable-flag-required/Makefile
192 -run-make/used-cdylib-macos/Makefile
193 189 run-make/volatile-intrinsics/Makefile
194 190 run-make/wasm-exceptions-nostd/Makefile
195 191 run-make/wasm-override-linker/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
1 +// When cross-compiling using `raw-dylib`, rustc would try to fetch some
2 +// very specific `dlltool` to complete the cross-compilation (such as `i686-w64-mingw32-dlltool`)
3 +// when Windows only calls it `dlltool`. This test performs some cross-compilation in a
4 +// way that previously failed due to this bug, and checks that it succeeds.
5 +// See https://github.com/rust-lang/rust/pull/108355
6 +
7 +//@ ignore-i686-pc-windows-gnu
8 +// Reason: dlltool on this distribution is unable to produce x64 binaries
9 +//@ needs-dlltool
10 +// Reason: this is the utility being checked by this test
11 +
12 +use run_make_support::{llvm_objdump, rust_lib_name, rustc};
13 +
14 +fn main() {
15 +// Build as x86 and make sure that we have x86 objects only.
16 +rustc()
17 +.crate_type("lib")
18 +.crate_name("i686_raw_dylib_test")
19 +.target("i686-pc-windows-gnu")
20 +.input("lib.rs")
21 +.run();
22 +llvm_objdump()
23 +.arg("-a")
24 +.input(rust_lib_name("i686_raw_dylib_test"))
25 +.run()
26 +.assert_stdout_contains("file format coff-i386")
27 +.assert_stdout_not_contains("file format coff-x86-64");
28 +// Build as x64 and make sure that we have x64 objects only.
29 +rustc()
30 +.crate_type("lib")
31 +.crate_name("x64_raw_dylib_test")
32 +.target("x86_64-pc-windows-gnu")
33 +.input("lib.rs")
34 +.run();
35 +llvm_objdump()
36 +.arg("-a")
37 +.input(rust_lib_name("x64_raw_dylib_test"))
38 +.run()
39 +.assert_stdout_not_contains("file format coff-i386")
40 +.assert_stdout_contains("file format coff-x86-64");
41 +}

File renamed without changes.

File renamed without changes.

Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
1 +// Verify that no text relocations are accidentally introduced by linking a
2 +// minimal rust staticlib.
3 +// The test links a rust static library into a shared library, and checks that
4 +// the linker doesn't have to flag the resulting file as containing TEXTRELs.
5 +// This bug otherwise breaks Android builds, which forbid TEXTRELs.
6 +// See https://github.com/rust-lang/rust/issues/68794
7 +
8 +//@ ignore-cross-compile
9 +//@ ignore-windows
10 +// Reason: There is no `bar.dll` produced by CC to run readobj on
11 +
12 +use run_make_support::{
13 + cc, dynamic_lib_name, extra_c_flags, extra_cxx_flags, llvm_readobj, rustc, static_lib_name,
14 +};
15 +
16 +fn main() {
17 +rustc().input("foo.rs").run();
18 +cc().input("bar.c")
19 +.input(static_lib_name("foo"))
20 +.out_exe(&dynamic_lib_name("bar"))
21 +.arg("-fPIC")
22 +.arg("-shared")
23 +.args(&extra_c_flags())
24 +.args(&extra_cxx_flags())
25 +.run();
26 +llvm_readobj()
27 +.input(dynamic_lib_name("bar"))
28 +.arg("--dynamic")
29 +.run()
30 +.assert_stdout_not_contains("TEXTREL");
31 +}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
1 +// Rustc displays a compilation error when it finds a `mod` (module)
2 +// statement referencing a file that does not exist. However, a bug from 2019
3 +// caused invalid `mod` statements to silently insert empty inline modules
4 +// instead of showing an error if the invalid `mod` statement had been passed
5 +// through standard input. This test checks that this bug does not make a resurgence.
6 +// See https://github.com/rust-lang/rust/issues/65601
7 +
8 +// NOTE: This is not a UI test, because the bug which this test
9 +// is checking for is specifically tied to passing
10 +// `mod unknown;` through standard input.
11 +
12 +use run_make_support::{diff, rustc};
13 +
14 +fn main() {
15 +let out = rustc().crate_type("rlib").stdin(b"mod unknown;").arg("-").run_fail();
16 +diff()
17 +.actual_text("actual-stdout", out.stdout_utf8())
18 +.expected_file("unknown-mod.stdout")
19 +.run();
20 +diff()
21 +.actual_text("actual-stderr", out.stderr_utf8())
22 +.expected_file("unknown-mod.stderr")
23 +.normalize(r#"\\"#, "/")
24 +.run();
25 +}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
1 +// This checks that `#[used]` passes through to the linker on
2 +// Apple targets. This is subject to change in the future.
3 +// See https://github.com/rust-lang/rust/pull/93718
4 +
5 +//@ only-apple
6 +
7 +use run_make_support::{dynamic_lib_name, llvm_readobj, rustc};
8 +
9 +fn main() {
10 +rustc().opt_level("3").input("dylib_used.rs").run();
11 +llvm_readobj()
12 +.input(dynamic_lib_name("dylib_used"))
13 +.arg("--all")
14 +.run()
15 +.assert_stdout_contains("VERY_IMPORTANT_SYMBOL");
16 +}