r200665 - Handle compat support for EABI/old APCS compatibility on NetBSD/ARM.

Joerg Sonnenberger joerg at bec.de
Sun Feb 2 14:47:38 PST 2014


Author: joerg
Date: Sun Feb  2 16:47:37 2014
New Revision: 200665

URL: http://llvm.org/viewvc/llvm-project?rev=200665&view=rev
Log:
Handle compat support for EABI/old APCS compatibility on NetBSD/ARM.

Modified:
    cfe/trunk/lib/Driver/ToolChains.cpp
    cfe/trunk/lib/Driver/Tools.cpp

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=200665&r1=200664&r2=200665&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Sun Feb  2 16:47:37 2014
@@ -2230,8 +2230,27 @@ NetBSD::NetBSD(const Driver &D, const ll
     // doesn't work.
     // FIXME: It'd be nicer to test if this directory exists, but I'm not sure
     // what all logic is needed to emulate the '=' prefix here.
-    if (Triple.getArch() == llvm::Triple::x86)
+    switch (Triple.getArch()) {
+    case llvm::Triple::x86:
       getFilePaths().push_back("=/usr/lib/i386");
+      break;
+    case llvm::Triple::arm:
+    case llvm::Triple::thumb:
+      switch (Triple.getEnvironment()) {
+      case llvm::Triple::EABI:
+      case llvm::Triple::EABIHF:
+      case llvm::Triple::GNUEABI:
+      case llvm::Triple::GNUEABIHF:
+        getFilePaths().push_back("=/usr/lib/eabi");
+        break;
+      default:
+        getFilePaths().push_back("=/usr/lib/oabi");
+        break;
+      }
+      break;
+    default:
+      break;
+    }
 
     getFilePaths().push_back("=/usr/lib");
   }

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=200665&r1=200664&r2=200665&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Sun Feb  2 16:47:37 2014
@@ -6117,6 +6117,23 @@ void netbsd::Link::ConstructJob(Compilat
     CmdArgs.push_back("elf_i386");
   }
 
+  // On ARM, the linker can generate either EABI or the older APCS.
+  // Instruct it to use the correct emulation.
+  if (getToolChain().getArch() == llvm::Triple::arm) {
+    CmdArgs.push_back("-m");
+    switch (getToolChain().getTriple().getEnvironment()) {
+    case llvm::Triple::EABI:
+    case llvm::Triple::EABIHF:
+    case llvm::Triple::GNUEABI:
+    case llvm::Triple::GNUEABIHF:
+      CmdArgs.push_back("armelf_nbsd_eabi");
+      break;
+    default:
+      CmdArgs.push_back("armelf_nbsd");
+      break;
+    }
+  }
+
   if (Output.isFilename()) {
     CmdArgs.push_back("-o");
     CmdArgs.push_back(Output.getFilename());





More information about the cfe-commits mailing list