[PATCH] D53017: [LLD] [COFF] Look for libfoo.a if foo.lib is specified, for MinGW

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 9 14:22:55 PDT 2018


rnk added inline comments.


================
Comment at: COFF/Driver.cpp:377
   // Add ".lib" to Filename if that has no file extension.
   bool HasExt = Filename.contains('.');
   if (!HasExt)
----------------
I guess this could be `has_extension`, probably with `Style::windows`, as well.


================
Comment at: COFF/Driver.cpp:383-385
+    std::string LibName = "lib";
+    LibName += Filename.substr(0, Filename.rfind('.'));
+    LibName += ".dll.a";
----------------
How about `llvm::sys::path::replace_extension`?


================
Comment at: COFF/Driver.cpp:386
+    LibName += ".dll.a";
+    StringRef LibNameRef = Saver.save(LibName);
+    StringRef Ret2 = doFindFile(LibNameRef);
----------------
Eh, saving a library name for every -defaultlib: we find in an object file is kind of a waste of memory. They're everywhere. But, this is a pre-existing problem that needs fixing, so I won't push to fix it now.


https://reviews.llvm.org/D53017





More information about the llvm-commits mailing list