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
..
2023-03-20 10:25:29 +00:00
2023-07-08 15:38:40 +02:00
2023-01-17 16:23:22 +01:00
2023-02-09 12:29:43 +09:00
2023-07-08 15:38:40 +02:00
2023-06-11 00:04:53 -04:00
2023-04-30 00:06:26 +08:00
2023-01-11 09:32:08 +00:00
2023-04-07 15:46:45 -04:00
2023-07-08 15:38:40 +02:00
2023-07-08 15:38:40 +02:00
2023-01-11 09:32:08 +00:00
2023-05-23 16:54:35 +02:00
2023-07-10 19:19:40 -04:00
2023-01-11 20:42:13 -05:00
2023-04-30 00:06:26 +08:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-17 16:23:22 +01:00
2023-01-11 09:32:08 +00:00
2023-01-17 16:23:22 +01:00
2023-07-10 19:19:36 -04:00
2023-03-16 15:07:04 +01:00
2023-07-10 19:19:36 -04:00
2023-07-14 17:48:13 -04:00
2023-01-11 09:32:08 +00:00
2023-04-16 06:31:08 +00:00
2023-05-05 04:22:51 -07:00
2023-01-11 09:32:08 +00:00
2023-05-11 14:35:09 +00:00
2023-01-11 09:32:08 +00:00
2023-07-08 15:38:40 +02:00
2023-03-01 14:42:06 -08:00
2023-07-10 19:19:35 -04:00
2023-05-03 22:09:33 -07:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-05-30 20:45:40 -07:00
2023-05-12 21:59:26 -07:00
2023-01-11 09:32:08 +00:00
2023-05-23 16:54:33 +02:00
2023-05-23 16:54:34 +02:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-17 16:23:22 +01:00
2023-04-30 00:06:26 +08:00
2023-05-23 16:54:30 +02:00
2023-04-30 00:06:26 +08:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-02-16 23:59:13 -08:00
2023-01-17 08:14:35 +01:00
2023-05-31 14:07:16 +00:00
2023-07-08 15:38:40 +02:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-05-23 16:54:30 +02:00
2023-01-11 09:32:08 +00:00
2023-03-31 07:28:39 -04:00
2023-03-31 07:28:39 -04:00
2023-03-31 07:28:39 -04:00
2023-01-11 09:32:08 +00:00
2023-05-11 14:35:10 +00:00
2023-04-22 23:41:48 +02:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-05-22 20:20:45 -04:00
2023-05-23 16:54:35 +02:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-05-03 22:41:29 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-06-10 08:31:06 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-07-08 15:38:40 +02:00
2023-06-10 16:58:51 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-05-23 16:54:33 +02:00
2023-01-17 08:14:35 +01:00
2023-01-11 09:32:08 +00:00
2023-07-08 15:38:40 +02:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-17 16:23:22 +01:00
2023-07-10 19:19:30 -04:00
2023-07-10 19:19:30 -04:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-04-30 00:06:26 +08:00
2023-04-30 00:06:26 +08:00
2023-04-30 00:06:26 +08:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-03-15 14:22:26 -04:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-04-11 11:07:48 +10:00
2023-04-07 15:46:43 -04:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-07-20 11:33:49 -07:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-05-23 16:54:33 +02:00
2023-01-11 09:32:08 +00:00
2023-07-21 22:01:50 +02:00
2023-01-17 16:23:22 +01:00
2023-04-07 15:46:43 -04:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-07-08 15:38:40 +02:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:13 +00:00
2023-07-08 15:38:40 +02:00
2023-07-08 15:38:40 +02:00
2023-02-10 16:06:25 -08:00
2023-01-11 09:32:08 +00:00
2023-05-23 16:54:30 +02:00
2023-07-19 09:59:12 +00:00
2023-01-17 16:23:22 +01:00
2023-06-14 12:52:02 +02:00
2023-05-23 16:54:33 +02:00
2023-07-18 22:15:47 +08:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-05-20 19:41:28 -04:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-05-08 03:55:41 -07:00
2023-04-17 09:16:07 +02:00
2023-04-16 11:50:20 -07:00
2023-05-18 10:28:36 -07:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-05-23 16:54:35 +02:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-17 16:23:22 +01:00
2023-01-17 16:23:22 +01:00
2023-05-23 16:54:33 +02:00
2023-01-11 09:32:08 +00:00
2023-01-17 16:23:22 +01:00
2023-07-08 15:38:40 +02:00
2023-07-02 02:22:22 +02:00
2023-04-30 00:06:26 +08:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-04-30 00:06:26 +08:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-05-03 22:41:29 +00:00
2023-05-03 22:41:29 +00:00
2023-05-03 22:41:29 +00:00
2023-05-03 22:41:29 +00:00
2023-05-03 22:41:29 +00:00
2023-06-22 15:36:46 +00:00
2023-05-03 22:41:29 +00:00
2023-05-03 22:41:29 +00:00
2023-05-03 22:41:29 +00:00
2023-05-03 22:41:29 +00:00
2023-05-23 16:44:03 +00:00
2023-05-03 22:41:29 +00:00
2023-05-03 22:41:29 +00:00
2023-02-14 20:54:25 -05:00
2023-01-11 09:32:08 +00:00
2023-05-03 22:41:29 +00:00
2023-05-03 22:41:29 +00:00
2023-05-03 22:41:29 +00:00
2023-05-03 22:41:29 +00:00
2023-05-03 22:41:29 +00:00
2023-05-03 22:41:29 +00:00
2023-05-23 16:44:03 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-17 16:23:22 +01:00
2023-05-26 15:18:54 -04:00
2023-01-17 08:14:35 +01:00
2023-01-11 09:32:08 +00:00
2023-07-08 15:38:40 +02:00
2023-07-11 20:21:32 -07:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-03-05 15:15:22 -08:00
2023-07-10 16:01:18 +00:00
2023-06-12 23:47:08 +02:00
2023-07-20 11:33:49 -07:00
2023-07-20 11:33:49 -07:00
2023-01-11 09:32:08 +00:00
2023-07-10 16:01:18 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-17 16:23:22 +01:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-05-03 22:41:29 +00:00
2023-02-10 16:06:25 -08:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-06-23 09:48:00 -04:00
2023-01-17 16:23:22 +01:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-06-04 00:51:49 -07:00
2023-06-04 00:51:49 -07:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:13 +00:00
2023-04-17 10:53:18 -04:00
2023-05-22 14:46:40 +01:00
2023-01-11 09:32:08 +00:00
2023-04-19 23:17:35 -07:00
2023-07-08 15:38:40 +02:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-05-23 16:54:33 +02:00
2023-06-16 16:03:19 -07:00
2023-01-11 09:32:08 +00:00
2023-07-08 15:38:40 +02:00
2023-07-08 15:38:40 +02:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-05-23 16:54:35 +02:00
2023-05-23 16:54:35 +02:00
2023-01-11 09:32:08 +00:00
2023-07-08 15:38:40 +02:00
2023-02-19 14:30:21 -05:00
2023-01-11 09:32:08 +00:00
2023-01-19 08:04:26 +00:00
2023-04-03 15:29:46 +02:00
2023-01-11 09:32:08 +00:00
2023-05-11 14:35:09 +00:00
2023-06-14 22:22:41 +02:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-04-05 15:59:29 +00:00
2023-01-11 09:32:08 +00:00
2023-07-01 20:24:15 +02:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-17 16:23:22 +01:00