[Support] Better error msg when cache dir can't be created. (#69575)
commita6d509fadbf7565baf336c2e25d1798fd40e59c9
authorTobias Hieta <tobias@hieta.se>
Thu, 26 Oct 2023 06:31:33 +0000 (26 08:31 +0200)
committerGitHub <noreply@github.com>
Thu, 26 Oct 2023 06:31:33 +0000 (26 08:31 +0200)
tree9986782c9e877fd85f7668de628f9c496f62519f
parent926173c614784149889b2c975adccf52bcece75b
[Support] Better error msg when cache dir can't be created. (#69575)

On windows if you passed /lldltocache:D:\tmp to lld and you didn't have
D: mounted it fail to create the cache dir D:\tmp, but the error message
is pretty hard to understand:

```
c:\code\llvm\llvm-project\out\debug>bin\lld-link.exe /lldltocache:D:\tmp
hello.obj
LLVM ERROR: no such file or directory

PLEASE submit a bug report to
https://github.com/llvm/llvm-project/issues/ and include the crash
backtrace.
Exception Code: 0xC000001D
```

Which lead one of our users to report this as a crash. I have just added
a bit better message so it now says:

```
c:\code\llvm\llvm-project\out\debug>bin\lld-link.exe /lldltocache:D:\tmp
hello.obj
LLVM ERROR: Can't create cache directory: D:\tmp

PLEASE submit a bug report to
https://github.com/llvm/llvm-project/issues/ and include the crash
backtrace.
```

I am not sure this is a fatal error because it's not something that
really should be reported as a bug to LLVM. But at least this gives a
bit more visibility on what to change.
lld/test/COFF/lto-cache-errors.ll [new file with mode: 0644]
llvm/lib/Support/Caching.cpp