Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit dfa9504

Browse files
committedJun 19, 2024
Auto merge of #126534 - Rejyr:comment-section-migration, r=<try>
Migrate `run-make/comment-section` to `rmake.rs` Part of #121876. r? `@jieyouxu` try-job: x86_64-msvc try-job: aarch64-gnu try-job: aarch64-apple
2 parents 5c8459f + f44494c commit dfa9504

File tree

3 files changed

+47
-19
lines changed

3 files changed

+47
-19
lines changed
 

‎src/tools/tidy/src/allowed_run_make_makefiles.txt

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ run-make/c-unwind-abi-catch-panic/Makefile
1010
run-make/cat-and-grep-sanity-check/Makefile
1111
run-make/cdylib-dylib-linkage/Makefile
1212
run-make/cdylib-fewer-symbols/Makefile
13-
run-make/comment-section/Makefile
1413
run-make/compiler-lookup-paths-2/Makefile
1514
run-make/compiler-lookup-paths/Makefile
1615
run-make/compiler-rt-works-on-mingw/Makefile

‎tests/run-make/comment-section/Makefile

-18
This file was deleted.
+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// Both GCC and Clang write by default a `.comment` section with compiler information.
2+
// Rustc received a similar .comment section, so this tests checks that this section
3+
// properly appears.
4+
// See https://github.com/rust-lang/rust/commit/74b8d324eb77a8f337b35dc68ac91b0c2c06debc
5+
6+
//@ only-linux
7+
// FIXME(jieyouxu): check cross-compile setup
8+
//@ ignore-cross-compile
9+
10+
use std::path::PathBuf;
11+
12+
use run_make_support::llvm_readobj;
13+
use run_make_support::rustc;
14+
use run_make_support::{cwd, env_var, read_dir, run_in_tmpdir};
15+
16+
fn main() {
17+
let target = env_var("TARGET");
18+
19+
rustc()
20+
.arg("-")
21+
.stdin("fn main() {}")
22+
.emit("link,obj")
23+
.arg("-Csave-temps")
24+
.target(&target)
25+
.run();
26+
27+
// Check linked output has a `.comment` section with the expected content.
28+
llvm_readobj()
29+
.section(".comment")
30+
.input("rust_out")
31+
.run()
32+
.assert_stdout_contains("rustc version 1.");
33+
34+
// Check all object files (including temporary outputs) have a `.comment`
35+
// section with the expected content.
36+
read_dir(cwd(), |f| {
37+
if !f.extension().is_some_and(|ext| ext == "o") {
38+
return;
39+
}
40+
41+
llvm_readobj()
42+
.section(".comment")
43+
.input(&f)
44+
.run()
45+
.assert_stdout_contains("rustc version 1.");
46+
});
47+
}

0 commit comments

Comments
 (0)
Failed to load comments.