Index: lld/trunk/COFF/Config.h =================================================================== --- lld/trunk/COFF/Config.h +++ lld/trunk/COFF/Config.h @@ -115,7 +115,7 @@ // Symbols in this set are considered as live by the garbage collector. std::vector GCRoot; - std::set NoDefaultLibs; + std::set NoDefaultLibs; bool NoDefaultLibAll = false; // True if we are creating a DLL. Index: lld/trunk/COFF/Driver.cpp =================================================================== --- lld/trunk/COFF/Driver.cpp +++ lld/trunk/COFF/Driver.cpp @@ -356,7 +356,7 @@ parseMerge(Arg->getValue()); break; case OPT_nodefaultlib: - Config->NoDefaultLibs.insert(doFindLib(Arg->getValue())); + Config->NoDefaultLibs.insert(doFindLib(Arg->getValue()).lower()); break; case OPT_section: parseSection(Arg->getValue()); @@ -457,7 +457,7 @@ return None; StringRef Path = doFindLib(Filename); - if (Config->NoDefaultLibs.count(Path)) + if (Config->NoDefaultLibs.count(Path.lower())) return None; if (Optional ID = getUniqueID(Path)) @@ -1240,7 +1240,7 @@ // Handle /nodefaultlib: for (auto *Arg : Args.filtered(OPT_nodefaultlib)) - Config->NoDefaultLibs.insert(doFindLib(Arg->getValue())); + Config->NoDefaultLibs.insert(doFindLib(Arg->getValue()).lower()); // Handle /nodefaultlib if (Args.hasArg(OPT_nodefaultlib_all)) Index: lld/trunk/test/COFF/nodefaultlib.test =================================================================== --- lld/trunk/test/COFF/nodefaultlib.test +++ lld/trunk/test/COFF/nodefaultlib.test @@ -29,3 +29,10 @@ # RUN: env LIB=%T lld-link /out:%t.exe /entry:main \ # RUN: /subsystem:console hello64.obj /defaultlib:std64.lib + +MSVC stamps uppercase references in OBJ directives, thus ensure that passing lowercase 'libcmt' and 'oldnames' to /nodefaultlib works. +# RUN: lld-link %S/Inputs/precomp.obj %S/Inputs/precomp-a.obj %S/Inputs/precomp-b.obj /nodefaultlib:libcmt /nodefaultlib:oldnames /entry:main /debug /pdb:%t.pdb /out:%t.exe /opt:ref /opt:icf +# RUN: llvm-pdbutil dump -modules %t.pdb | FileCheck %s -check-prefix UPPERCASE + +UPPERCASE-NOT: OLDNAMES +UPPERCASE-NOT: LIBCMT