r296430 - Set ABIs correctly for OpenBSD/arm; soft float and aapcs-linux.

Brad Smith via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 27 19:20:26 PST 2017


Author: brad
Date: Mon Feb 27 21:20:26 2017
New Revision: 296430

URL: http://llvm.org/viewvc/llvm-project?rev=296430&view=rev
Log:
Set ABIs correctly for OpenBSD/arm; soft float and aapcs-linux.

Modified:
    cfe/trunk/lib/Basic/Targets.cpp
    cfe/trunk/lib/Driver/Arch/ARM.cpp
    cfe/trunk/lib/Driver/Tools.cpp
    cfe/trunk/test/Driver/arm-abi.c
    cfe/trunk/test/Driver/openbsd.c

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=296430&r1=296429&r2=296430&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Mon Feb 27 21:20:26 2017
@@ -5166,6 +5166,8 @@ public:
       default:
         if (Triple.getOS() == llvm::Triple::NetBSD)
           setABI("apcs-gnu");
+        else if (Triple.getOS() == llvm::Triple::OpenBSD)
+          setABI("aapcs-linux");
         else
           setABI("aapcs");
         break;

Modified: cfe/trunk/lib/Driver/Arch/ARM.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Arch/ARM.cpp?rev=296430&r1=296429&r2=296430&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Arch/ARM.cpp (original)
+++ cfe/trunk/lib/Driver/Arch/ARM.cpp Mon Feb 27 21:20:26 2017
@@ -191,6 +191,10 @@ arm::FloatABI arm::getARMFloatABI(const
       }
       break;
 
+    case llvm::Triple::OpenBSD:
+      ABI = FloatABI::Soft;
+      break;
+
     default:
       switch (Triple.getEnvironment()) {
       case llvm::Triple::GNUEABIHF:

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=296430&r1=296429&r2=296430&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Mon Feb 27 21:20:26 2017
@@ -787,6 +787,8 @@ void Clang::AddARMTargetArgs(const llvm:
     default:
       if (Triple.getOS() == llvm::Triple::NetBSD)
         ABIName = "apcs-gnu";
+      else if (Triple.getOS() == llvm::Triple::OpenBSD)
+        ABIName = "aapcs-linux";
       else
         ABIName = "aapcs";
       break;

Modified: cfe/trunk/test/Driver/arm-abi.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/arm-abi.c?rev=296430&r1=296429&r2=296430&view=diff
==============================================================================
--- cfe/trunk/test/Driver/arm-abi.c (original)
+++ cfe/trunk/test/Driver/arm-abi.c Mon Feb 27 21:20:26 2017
@@ -28,6 +28,10 @@
 // RUN: %clang -target arm--netbsd-eabihf %s -### -o %t.o 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHECK-AAPCS %s
 
+// OpenBSD defaults to aapcs-linux
+// RUN: %clang -target arm--openbsd- %s -### -o %t.o 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-AAPCS-LINUX %s
+
 // Otherwise, ABI is selected based on environment
 // RUN: %clang -target arm---android %s -### -o %t.o 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHECK-AAPCS-LINUX %s

Modified: cfe/trunk/test/Driver/openbsd.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/openbsd.c?rev=296430&r1=296429&r2=296430&view=diff
==============================================================================
--- cfe/trunk/test/Driver/openbsd.c (original)
+++ cfe/trunk/test/Driver/openbsd.c Mon Feb 27 21:20:26 2017
@@ -96,3 +96,8 @@
 // CHECK-STATIC-PIE: "{{.*}}rcrt0.o"
 // CHECK-STATIC-PIE-NOT: "-nopie"
 // CHECK-NOPIE: "-nopie" "{{.*}}crt0.o"
+
+// Check ARM float ABI
+// RUN: %clang -target arm-unknown-openbsd -### -c %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-ARM-FLOAT-ABI %s
+// CHECK-ARM-FLOAT-ABI: "-mfloat-abi" "soft"




More information about the cfe-commits mailing list