4 files changed +42
-19
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,6 @@ run-make/c-unwind-abi-catch-panic/Makefile
11
11
run-make/cat-and-grep-sanity-check/Makefile
12
12
run-make/cdylib-dylib-linkage/Makefile
13
13
run-make/cdylib-fewer-symbols/Makefile
14
- run-make/comment-section/Makefile
15
14
run-make/compiler-lookup-paths-2/Makefile
16
15
run-make/compiler-lookup-paths/Makefile
17
16
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
+ fn main ( ) { }
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
+
8
+ use std:: path:: PathBuf ;
9
+
10
+ use run_make_support:: llvm_readobj;
11
+ use run_make_support:: rustc;
12
+ use run_make_support:: { cwd, env_var, read_dir, run_in_tmpdir} ;
13
+
14
+ fn main ( ) {
15
+ let target = env_var ( "TARGET" ) ;
16
+ let p = cwd ( ) ;
17
+
18
+ rustc ( ) . input ( "main.rs" ) . emit ( "link,obj" ) . arg ( "-Csave-temps" ) . target ( & target) . run ( ) ;
19
+
20
+ // Check linked output has a `.comment` section with the expected content.
21
+ llvm_readobj ( )
22
+ . gnu_elf_style ( )
23
+ . section ( ".comment" )
24
+ . arg ( PathBuf :: from ( & p) . join ( "main" ) )
25
+ . run ( )
26
+ . assert_stdout_contains ( "rustc version 1." ) ;
27
+
28
+ // Check all object files (including temporary outputs) have a `.comment`
29
+ // section with the expected content.
30
+ read_dir ( p, |f| {
31
+ if f. extension ( ) != Some ( ".o" . as_ref ( ) ) {
32
+ return ;
33
+ }
34
+ llvm_readobj ( )
35
+ . gnu_elf_style ( )
36
+ . section ( ".comment" )
37
+ . arg ( & f)
38
+ . run ( )
39
+ . assert_stdout_contains ( "rustc version 1." ) ;
40
+ } ) ;
41
+ }
0 commit comments