r200666 - Use a switch for the emulation handling.

Joerg Sonnenberger joerg at bec.de
Sun Feb 2 14:50:35 PST 2014


Author: joerg
Date: Sun Feb  2 16:50:34 2014
New Revision: 200666

URL: http://llvm.org/viewvc/llvm-project?rev=200666&view=rev
Log:
Use a switch for the emulation handling.

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

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=200666&r1=200665&r2=200666&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Sun Feb  2 16:50:34 2014
@@ -6110,16 +6110,15 @@ void netbsd::Link::ConstructJob(Compilat
     }
   }
 
-  // When building 32-bit code on NetBSD/amd64, we have to explicitly
-  // instruct ld in the base system to link 32-bit code.
-  if (getToolChain().getArch() == llvm::Triple::x86) {
+  // Many NetBSD architectures support more than one ABI.
+  // Determine the correct emulation for ld.
+  switch (getToolChain().getArch()) {
+  case llvm::Triple::x86:
     CmdArgs.push_back("-m");
     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) {
+    break;
+  case llvm::Triple::arm:
+  case llvm::Triple::thumb:
     CmdArgs.push_back("-m");
     switch (getToolChain().getTriple().getEnvironment()) {
     case llvm::Triple::EABI:
@@ -6132,6 +6131,9 @@ void netbsd::Link::ConstructJob(Compilat
       CmdArgs.push_back("armelf_nbsd");
       break;
     }
+    break;
+  default:
+    break;
   }
 
   if (Output.isFilename()) {





More information about the cfe-commits mailing list