[PATCH] D129944: [JITLink][COFF] Consider lib/dll files in llvm-jitlink.

Sunho Kim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 25 21:00:55 PDT 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG85c6629d8555: [JITLink][COFF] Consider lib/dll files in llvm-jitlink. (authored by sunho).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129944

Files:
  llvm/tools/llvm-jitlink/llvm-jitlink.cpp


Index: llvm/tools/llvm-jitlink/llvm-jitlink.cpp
===================================================================
--- llvm/tools/llvm-jitlink/llvm-jitlink.cpp
+++ llvm/tools/llvm-jitlink/llvm-jitlink.cpp
@@ -1486,7 +1486,8 @@
     unsigned InputFileArgIdx =
         InputFiles.getPosition(InputFileItr - InputFiles.begin());
     const std::string &InputFile = *InputFileItr;
-    if (StringRef(InputFile).endswith(".a"))
+    if (StringRef(InputFile).endswith(".a") ||
+        StringRef(InputFile).endswith(".lib"))
       continue;
     auto &JD = *std::prev(IdxToJD.lower_bound(InputFileArgIdx))->second;
     LLVM_DEBUG(dbgs() << "  " << InputFileArgIdx << ": \"" << InputFile
@@ -1572,7 +1573,7 @@
   for (auto InputFileItr = InputFiles.begin(), InputFileEnd = InputFiles.end();
        InputFileItr != InputFileEnd; ++InputFileItr) {
     StringRef InputFile = *InputFileItr;
-    if (!InputFile.endswith(".a"))
+    if (!InputFile.endswith(".a") && !InputFile.endswith(".lib"))
       continue;
     LibraryLoad LL;
     LL.LibName = InputFile;
@@ -1594,8 +1595,8 @@
     LL.Modifier = LibraryLoad::Hidden;
     LibraryLoads.push_back(std::move(LL));
   }
-  StringRef StandardExtensions[] = {".so", ".dylib", ".a"};
-  StringRef ArchiveExtensionsOnly[] = {".a"};
+  StringRef StandardExtensions[] = {".so", ".dylib", ".dll", ".a", ".lib"};
+  StringRef ArchiveExtensionsOnly[] = {".a", ".lib"};
 
   // Add -lx arguments to LibraryLoads.
   for (auto LibItr = Libraries.begin(), LibEnd = Libraries.end();
@@ -1676,13 +1677,16 @@
     auto JDSearchPathsItr = JDSearchPaths.find(&JD);
     if (JDSearchPathsItr != JDSearchPaths.end()) {
       for (StringRef SearchPath : JDSearchPathsItr->second) {
-        for (const char *LibExt : {".dylib", ".so", ".a"}) {
+        for (const char *LibExt : {".dylib", ".so", ".dll", ".a", ".lib"}) {
           SmallVector<char, 256> LibPath;
           LibPath.reserve(SearchPath.size() + strlen("lib") +
                           LL.LibName.size() + strlen(LibExt) +
                           2); // +2 for pathsep, null term.
           llvm::copy(SearchPath, std::back_inserter(LibPath));
-          sys::path::append(LibPath, "lib" + LL.LibName + LibExt);
+          if (StringRef(LibExt) != ".lib" && StringRef(LibExt) != ".dll")
+            sys::path::append(LibPath, "lib" + LL.LibName + LibExt);
+          else
+            sys::path::append(LibPath, LL.LibName + LibExt);
           LibPath.push_back('\0');
 
           // Skip missing or non-regular paths.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129944.447550.patch
Type: text/x-patch
Size: 2523 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220726/39158c7c/attachment.bin>


More information about the llvm-commits mailing list