Description
Usage errors in LTOBackend.cpp
are incorrectly reported to users as crashes/bugs.
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.
As another example, see the COFF LLD test lto-cache-errors.ll
and note the use of not --crash
in this test.
This issue is a bit more problematic on Windows than on Linux. On Windows, the use of reportFatalUsageError
, which might be assumed to be a fix for this issue, produces a message asking users to report a bug.
Internal tracker: TOOLCHAIN-17744