Skip to content

Commit c01e8cd

Browse files
committed
rewrite and rename issue-97463-abi-param-passing to rmake
1 parent f1747f4 commit c01e8cd

File tree

7 files changed

+31
-20
lines changed

7 files changed

+31
-20
lines changed

src/tools/run-make-support/src/external_deps/llvm.rs

+2
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,8 @@ impl LlvmAr {
229229
Self { cmd }
230230
}
231231

232+
/// Automatically pass the commonly used arguments `rcus`, used for combining one or more
233+
/// input object files into one output static library file.
232234
pub fn obj_to_ar(&mut self) -> &mut Self {
233235
self.cmd.arg("rcus");
234236
self

src/tools/tidy/src/allowed_run_make_makefiles.txt

-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ run-make/issue-47551/Makefile
4848
run-make/issue-69368/Makefile
4949
run-make/issue-84395-lto-embed-bitcode/Makefile
5050
run-make/issue-88756-default-output/Makefile
51-
run-make/issue-97463-abi-param-passing/Makefile
5251
run-make/jobserver-error/Makefile
5352
run-make/libs-through-symlinks/Makefile
5453
run-make/libtest-json/Makefile

tests/run-make/issue-97463-abi-param-passing/Makefile

-15
This file was deleted.

tests/run-make/rlib-format-packed-bundled-libs-3/rmake.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
// See https://github.com/rust-lang/rust/pull/105601
77

88
use run_make_support::{
9-
build_native_static_lib, fs_wrapper, is_msvc, llvm_ar, regex, rust_lib_name, rustc,
10-
static_lib_name,
9+
build_native_static_lib, is_msvc, llvm_ar, regex, rfs, rust_lib_name, rustc, static_lib_name,
1110
};
1211

1312
// FIXME only-linux test-various
@@ -64,8 +63,8 @@ fn main() {
6463
.assert_stdout_not_contains("native_dep_4");
6564

6665
// The compiler shouldn't use files which it doesn't know about.
67-
fs_wrapper::remove_file(static_lib_name("native_dep_1"));
68-
fs_wrapper::remove_file(static_lib_name("native_dep_3"));
66+
rfs::remove_file(static_lib_name("native_dep_1"));
67+
rfs::remove_file(static_lib_name("native_dep_3"));
6968

7069
let out = rustc()
7170
.input("main.rs")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// This test was created in response to an obscure miscompilation bug, only
2+
// visible with the -O3 flag passed to the cc compiler when trying to obtain
3+
// a native static library for the sake of foreign function interface. This
4+
// flag could cause certain integer types to fail to be zero-extended, resulting
5+
// in type casting errors. After the fix in #97800, this test attempts integer casting
6+
// while simultaneously interfacing with a C library and using the -O3 flag.
7+
// See https://github.com/rust-lang/rust/issues/97463
8+
9+
// FIXME(Oneirical): ignore-msvc
10+
11+
//@ ignore-cross-compile
12+
// Reason: The compiled binary is executed.
13+
14+
use run_make_support::{cc, is_msvc, llvm_ar, run, rustc, static_lib_name};
15+
16+
fn main() {
17+
// The issue exercised by this test specifically needs needs `-O`
18+
// flags (like `-O3`) to reproduce. Thus, we call `cc()` instead of
19+
// the nicer `build_native_static_lib`.
20+
let obj_file = if is_msvc() { "bad" } else { "bad.o" };
21+
cc().arg("-c").arg("-O3").out_exe(&obj_file).input("bad.c").run();
22+
let obj_file = if is_msvc() { "bad.obj" } else { "bad.o" };
23+
llvm_ar().obj_to_ar().output_input(static_lib_name("bad"), &obj_file).run();
24+
rustc().input("param_passing.rs").arg("-lbad").opt_level("3").run();
25+
run("param_passing");
26+
}

0 commit comments

Comments
 (0)