<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/140953>140953</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[LLVM] LTO usage errors incorrectly reported to the user as crashes/bugs
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
bd1976bris
</td>
</tr>
</table>
<pre>
Usage errors in `LTOBackend.cpp` are incorrectly reported to users as crashes/bugs.
For example, see the COFF LLD test [`lto-cache-errors.ll`](https://github.com/llvm/llvm-project/blob/e165bea1d4ec2de96ee0548cece79d71a75ce8f8/lld/test/COFF/lto-cache-errors.ll) and note the use of `not --crash` in this test.
This issue is more problematic on Windows than on Linux. On Windows, fatal errors typically produce additional output, including a stack trace and a message urging users to report a bug. For example, using the official LLVM 19 toolchain binaries, specifying an overly long cache directory results in the following output on my Windows 11 machine:
```
"lld-link.exe" msvc.bc /lldltocache:<too long dir name> /entry:main /out:a.out
LLVM ERROR: can't create cache directory <too long dir name>: invalid argument
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Exception Code: 0xC000001D
#0 0x00007ff6b392cf36 xmlLinkGetData (c:\x\clang+llvm-19.1.0-x86_64-pc-windows-msvc\bin\lld-link.exe+0x180cf36)
#1 0x00007ff6b38622d2 xmlLinkGetData (c:\x\clang+llvm-19.1.0-x86_64-pc-windows-msvc\bin\lld-link.exe+0x17422d2)
<...>
```
This kind of reporting is not appropriate for usage errors and recently confused one of Sony’s customers, who submitted a bug report (as instructed by the toolchain) after specifying an invalid LTO cache directory.
**Internal tracker:** TOOLCHAIN-17744
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJy8lU9v4zYTxj8NfRlYkKj_Bx8cJ37fBdy62E3bY0GRI5s1RQokldjfvhjJ2TbZ7aE91BBgSCLFZ-b5zYwIQZ8s4oaVD6x8XIkpnp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