Allow all environments for NetBSD.

> Is the trailing - in the triple intentional?

Yes, the triple has four parts (the environment comes after the last "-") and 
I'm not trying to test the triple parser here.

http://reviews.llvm.org/D5100

Files:
  lib/Driver/Tools.cpp
  test/Driver/arm-abi.c
Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -755,9 +755,14 @@
       break;
     case llvm::Triple::EABIHF:
     case llvm::Triple::EABI:
-    default:
       ABIName = "aapcs";
       break;
+    default:
+      if (Triple.getOS() == llvm::Triple::NetBSD)
+        ABIName = "apcs-gnu";
+      else
+        ABIName = "aapcs";
+      break;
     }
   }
   CmdArgs.push_back("-target-abi");
Index: test/Driver/arm-abi.c
===================================================================
--- test/Driver/arm-abi.c
+++ test/Driver/arm-abi.c
@@ -20,6 +20,14 @@
 // RUN: %clang -target arm--windows-gnueabi %s -### -o %t.o 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHECK-AAPCS %s
 
+// NetBSD defaults to apcs-gnu, but can also use aapcs
+// RUN: %clang -target arm--netbsd- %s -### -o %t.o 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-APCS-GNU %s
+// RUN: %clang -target arm--netbsd-eabi %s -### -o %t.o 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-AAPCS %s
+// RUN: %clang -target arm--netbsd-eabihf %s -### -o %t.o 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-AAPCS %s
+
 // Otherwise, ABI is celected based on environment
 // RUN: %clang -target arm---android %s -### -o %t.o 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHECK-AAPCS-LINUX %s
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to