3 files changed +47
-19
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,6 @@ run-make/c-unwind-abi-catch-panic/Makefile
10
10
run-make/cat-and-grep-sanity-check/Makefile
11
11
run-make/cdylib-dylib-linkage/Makefile
12
12
run-make/cdylib-fewer-symbols/Makefile
13
- run-make/comment-section/Makefile
14
13
run-make/compiler-lookup-paths-2/Makefile
15
14
run-make/compiler-lookup-paths/Makefile
16
15
run-make/compiler-rt-works-on-mingw/Makefile
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
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