[PATCH] D80421: [Mips] use correct ld.so for musl soft float

Joe Holden via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 21 19:30:14 PDT 2020


joewholden created this revision.
Herald added subscribers: cfe-commits, atanasyan, arichardson, sdardis.
Herald added a project: clang.

This patch attempts to fix the dynamic linker path for mips64-sf, I'm not entirely familiar with the llvm structure so I am unsure if this is the best way but I'd appreciate some feedback if not


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D80421

Files:
  clang/lib/Driver/ToolChains/Linux.cpp


Index: clang/lib/Driver/ToolChains/Linux.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Linux.cpp
+++ clang/lib/Driver/ToolChains/Linux.cpp
@@ -519,6 +519,7 @@
   if (Triple.isMusl()) {
     std::string ArchName;
     bool IsArm = false;
+    bool IsMips = false;

     switch (Arch) {
     case llvm::Triple::arm:
@@ -531,6 +532,16 @@
       ArchName = "armeb";
       IsArm = true;
       break;
+    case llvm::Triple::mips:
+    case llvm::Triple::mipsel:
+      ArchName = "mips";
+      IsMips = true;
+      break;
+    case llvm::Triple::mips64:
+    case llvm::Triple::mips64el:
+      ArchName = "mips64";
+      IsMips = true;
+      break;
     default:
       ArchName = Triple.getArchName().str();
     }
@@ -538,6 +549,8 @@
         (Triple.getEnvironment() == llvm::Triple::MuslEABIHF ||
          tools::arm::getARMFloatABI(*this, Args) == tools::arm::FloatABI::Hard))
       ArchName += "hf";
+    if (IsMips && tools::mips::getMipsFloatABI(getDriver(), Args, getTriple()) == tools::mips::FloatABI::Soft)
+      ArchName += "-sf";

     return "/lib/ld-musl-" + ArchName + ".so.1";
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80421.265662.patch
Type: text/x-patch
Size: 1162 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200522/bf536e63/attachment.bin>


More information about the cfe-commits mailing list