Skip to content

Commit

Permalink
Rollup merge of rust-lang#126534 - Rejyr:comment-section-migration, r…
Browse files Browse the repository at this point in the history
…=jieyouxu

Migrate `run-make/comment-section` to `rmake.rs`

Part of rust-lang#121876.

r? ``@jieyouxu``

try-job: x86_64-msvc
try-job: aarch64-gnu
try-job: aarch64-apple
  • Loading branch information
jieyouxu authored Jun 19, 2024
2 parents 562a495 + f44494c commit de12d6b
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 19 deletions.
1 change: 0 additions & 1 deletion src/tools/tidy/src/allowed_run_make_makefiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ run-make/c-unwind-abi-catch-panic/Makefile
run-make/cat-and-grep-sanity-check/Makefile
run-make/cdylib-dylib-linkage/Makefile
run-make/cdylib-fewer-symbols/Makefile
run-make/comment-section/Makefile
run-make/compiler-lookup-paths-2/Makefile
run-make/compiler-lookup-paths/Makefile
run-make/compiler-rt-works-on-mingw/Makefile
Expand Down
18 changes: 0 additions & 18 deletions tests/run-make/comment-section/Makefile

This file was deleted.

47 changes: 47 additions & 0 deletions tests/run-make/comment-section/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// Both GCC and Clang write by default a `.comment` section with compiler information.
// Rustc received a similar .comment section, so this tests checks that this section
// properly appears.
// See https://github.com/rust-lang/rust/commit/74b8d324eb77a8f337b35dc68ac91b0c2c06debc

//@ only-linux
// FIXME(jieyouxu): check cross-compile setup
//@ ignore-cross-compile

use std::path::PathBuf;

use run_make_support::llvm_readobj;
use run_make_support::rustc;
use run_make_support::{cwd, env_var, read_dir, run_in_tmpdir};

fn main() {
let target = env_var("TARGET");

rustc()
.arg("-")
.stdin("fn main() {}")
.emit("link,obj")
.arg("-Csave-temps")
.target(&target)
.run();

// Check linked output has a `.comment` section with the expected content.
llvm_readobj()
.section(".comment")
.input("rust_out")
.run()
.assert_stdout_contains("rustc version 1.");

// Check all object files (including temporary outputs) have a `.comment`
// section with the expected content.
read_dir(cwd(), |f| {
if !f.extension().is_some_and(|ext| ext == "o") {
return;
}

llvm_readobj()
.section(".comment")
.input(&f)
.run()
.assert_stdout_contains("rustc version 1.");
});
}

0 comments on commit de12d6b

Please sign in to comment.