[lld][COFF] Retry failed paths to take advantage of winsysroot search paths
authorArthur Eubanks <aeubanks@google.com>
Wed, 31 May 2023 15:52:21 +0000 (08:52 -0700)
committerArthur Eubanks <aeubanks@google.com>
Thu, 1 Jun 2023 22:37:02 +0000 (15:37 -0700)
commitc8ea66937bdf2f11e5c4f884e3164c98cc6520bb
treeb93bbee36f443235d170af93fe7e5c644168ceaa
parent8609df7c6e91301af72080caab01b2edcef78b33
[lld][COFF] Retry failed paths to take advantage of winsysroot search paths

With /winsysroot and without /machine, we don't know which paths to add to the search paths.

We do autodetect machine type and add winsysroot search paths in SymbolTable::addFile(), but that happens after all input files are opened. So in the loop where we read files, if we fail to open a file we can retry with the winsysroot search path potentially added by reading a previous file. This will fail if we try to open something in the winsysroot before reading a file that can give us the architecture, but shrug.

Fixes #54409

Reviewed By: rnk

Differential Revision: https://reviews.llvm.org/D151815
lld/COFF/Driver.cpp
lld/test/COFF/winsysroot.test