[PATCH] D63775: [LLD][COFF] Case insensitive compares for /nodefaultlib

Alexandre Ganea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 26 08:40:41 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL364438: [LLD][COFF] Case insensitive compares for /nodefaultlib (authored by aganea, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D63775?vs=206536&id=206687#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63775/new/

https://reviews.llvm.org/D63775

Files:
  lld/trunk/COFF/Config.h
  lld/trunk/COFF/Driver.cpp
  lld/trunk/test/COFF/nodefaultlib.test


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<Symbol *> GCRoot;
 
-  std::set<StringRef> NoDefaultLibs;
+  std::set<std::string> 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<sys::fs::UniqueID> ID = getUniqueID(Path))
@@ -1240,7 +1240,7 @@
 
   // 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))
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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63775.206687.patch
Type: text/x-patch
Size: 2275 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190626/c0cf9568/attachment.bin>


More information about the llvm-commits mailing list