rust/tests
Miguel Ojeda 74b8d324eb Support .comment section like GCC/Clang (!llvm.ident)
Both GCC and Clang write by default a `.comment` section with compiler
information:

```txt
$ gcc -c -xc /dev/null && readelf -p '.comment' null.o

String dump of section '.comment':
  [     1]  GCC: (GNU) 11.2.0

$ clang -c -xc /dev/null && readelf -p '.comment' null.o

String dump of section '.comment':
  [     1]  clang version 14.0.1 (https://github.com/llvm/llvm-project.git c62053979489ccb002efe411c3af059addcb5d7d)
```

They also implement the `-Qn` flag to avoid doing so:

```txt
$ gcc -Qn -c -xc /dev/null && readelf -p '.comment' null.o
readelf: Warning: Section '.comment' was not dumped because it does not exist!

$ clang -Qn -c -xc /dev/null && readelf -p '.comment' null.o
readelf: Warning: Section '.comment' was not dumped because it does not exist!
```

So far, `rustc` only does it for WebAssembly targets and only
when debug info is enabled:

```txt
$ echo 'fn main(){}' | rustc --target=wasm32-unknown-unknown --emit=llvm-ir -Cdebuginfo=2 - && grep llvm.ident rust_out.ll
!llvm.ident = !{!27}
```

In the RFC part of this PR it was decided to always add
the information, which gets us closer to other popular compilers.
An opt-out flag like GCC and Clang may be added later on if deemed
necessary.

Implementation-wise, this covers both `ModuleLlvm::new()` and
`ModuleLlvm::new_metadata()` cases by moving the addition to
`context::create_module` and adds a few test cases.

ThinLTO also sees the `llvm.ident` named metadata duplicated (in
temporary outputs), so this deduplicates it like it is done for
`wasm.custom_sections`. The tests also check this duplication does
not take place.

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2023-07-21 22:01:50 +02:00
..
assembly test-various: run codegen and assembly tests 2023-07-02 02:22:22 +02:00
auxiliary
codegen Support .comment section like GCC/Clang (!llvm.ident) 2023-07-21 22:01:50 +02:00
codegen-units
debuginfo Update natvis to match full type names for Arc, Rc, Weak, etc 2023-07-17 15:51:46 -04:00
incremental Querify unused trait check. 2023-07-16 21:51:00 +00:00
mir-opt Auto merge of #113344 - scottmcm:alt-slice-zst-handing, r=the8472 2023-07-21 00:11:41 +00:00
pretty
run-coverage refactor(rustc_middle): Substs -> GenericArg 2023-07-14 13:27:35 +01:00
run-coverage-rustdoc Re-bless the newly-migrated tests 2023-06-28 11:09:19 +10:00
run-make Support .comment section like GCC/Clang (!llvm.ident) 2023-07-21 22:01:50 +02:00
run-make-fulldeps On nightly, dump ICE backtraces to disk 2023-07-19 14:10:07 +00:00
run-pass-valgrind
rustdoc Rollup merge of #110765 - wackbyte:fix-defaultness-position, r=fmease,GuillaumeGomez 2023-07-20 17:19:32 +02:00
rustdoc-gui Update rustdoc GUI tests 2023-07-18 14:34:24 +02:00
rustdoc-js Auto merge of #112233 - notriddle:notriddle/search-unify, r=GuillaumeGomez 2023-06-15 03:04:46 +00:00
rustdoc-js-std Auto merge of #108537 - GuillaumeGomez:rustdoc-search-whitespace-as-separator, r=notriddle 2023-07-02 18:49:29 +00:00
rustdoc-json Auto merge of #113574 - GuillaumeGomez:rustdoc-json-strip-hidden-impl, r=aDotInTheVoid,notriddle 2023-07-18 02:47:03 +00:00
rustdoc-ui Auto merge of #113622 - RickleAndMortimer:issue-113184-fix, r=oli-obk 2023-07-20 03:18:41 +00:00
ui Auto merge of #113922 - matthiaskrgr:rollup-90cj2vv, r=matthiaskrgr 2023-07-21 16:52:21 +00:00
ui-fulldeps Rollup merge of #113373 - jyn514:download-rustc-fixes, r=albertlarsan68 2023-07-11 21:00:27 -07:00
COMPILER_TESTS.md