[lld] r364438 - [LLD][COFF] Case insensitive compares for /nodefaultlib
Alexandre Ganea via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 26 08:40:17 PDT 2019
Author: aganea
Date: Wed Jun 26 08:40:17 2019
New Revision: 364438
URL: http://llvm.org/viewvc/llvm-project?rev=364438&view=rev
Log:
[LLD][COFF] Case insensitive compares for /nodefaultlib
Differential Revision: https://reviews.llvm.org/D63775
Modified:
lld/trunk/COFF/Config.h
lld/trunk/COFF/Driver.cpp
lld/trunk/test/COFF/nodefaultlib.test
Modified: lld/trunk/COFF/Config.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Config.h?rev=364438&r1=364437&r2=364438&view=diff
==============================================================================
--- lld/trunk/COFF/Config.h (original)
+++ lld/trunk/COFF/Config.h Wed Jun 26 08:40:17 2019
@@ -115,7 +115,7 @@ struct Configuration {
// Symbols in this set are considered as live by the garbage collector.
std::vector<Symbol *> GCRoot;
- std::set<StringRef> NoDefaultLibs;
+ std::set<std::string> NoDefaultLibs;
bool NoDefaultLibAll = false;
// True if we are creating a DLL.
Modified: lld/trunk/COFF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Driver.cpp?rev=364438&r1=364437&r2=364438&view=diff
==============================================================================
--- lld/trunk/COFF/Driver.cpp (original)
+++ lld/trunk/COFF/Driver.cpp Wed Jun 26 08:40:17 2019
@@ -356,7 +356,7 @@ void LinkerDriver::parseDirectives(Input
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 @@ Optional<StringRef> LinkerDriver::findLi
return None;
StringRef Path = doFindLib(Filename);
- if (Config->NoDefaultLibs.count(Path))
+ if (Config->NoDefaultLibs.count(Path.lower()))
return None;
if (Optional<sys::fs::UniqueID> ID = getUniqueID(Path))
@@ -1240,7 +1240,7 @@ void LinkerDriver::link(ArrayRef<const c
// Handle /nodefaultlib:<filename>
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))
Modified: lld/trunk/test/COFF/nodefaultlib.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/nodefaultlib.test?rev=364438&r1=364437&r2=364438&view=diff
==============================================================================
--- lld/trunk/test/COFF/nodefaultlib.test (original)
+++ lld/trunk/test/COFF/nodefaultlib.test Wed Jun 26 08:40:17 2019
@@ -29,3 +29,10 @@ CHECK3-NEXT: >>> referenced by {{.*}}hel
# 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
More information about the llvm-commits
mailing list