Skip to content

Commit e95aef0

Browse files
committed
[LLD][COFF] Update nodefaultlibs after updating search paths
1 parent b01c71b commit e95aef0

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lld/COFF/Driver.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -786,6 +786,13 @@ void LinkerDriver::addWinSysRootLibSearchPaths() {
786786
path))
787787
searchPaths.push_back(saver().save(path));
788788
}
789+
790+
// Libraries specified by `/nodefaultlib:` may not be found in incomplete
791+
// search paths before lld infers a machine type from input files.
792+
std::set<std::string> noDefaultLibs;
793+
for (const std::string &path : ctx.config.noDefaultLibs)
794+
noDefaultLibs.insert(findLib(path).lower());
795+
ctx.config.noDefaultLibs = noDefaultLibs;
789796
}
790797

791798
// Parses LIB environment which contains a list of search paths.

0 commit comments

Comments
 (0)