[llvm] [Clang][OHOS] Keep ARM ABI selection logic in sync between Clang and LLVM (PR #68656)

Brad Smith via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 9 19:49:40 PDT 2023


https://github.com/brad0 created https://github.com/llvm/llvm-project/pull/68656

None

>From d95c16f82bbdcc58c36b8191632b07b6857d7908 Mon Sep 17 00:00:00 2001
From: Brad Smith <brad at comstyle.com>
Date: Mon, 9 Oct 2023 22:41:36 -0400
Subject: [PATCH] [Clang][OHOS] Keep ARM ABI selection logic in sync between
 Clang and LLVM

---
 clang/lib/Basic/Targets/ARM.cpp           | 3 ++-
 llvm/lib/TargetParser/ARMTargetParser.cpp | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Basic/Targets/ARM.cpp b/clang/lib/Basic/Targets/ARM.cpp
index 1e809283748b66c..ce7e4d4639ceacb 100644
--- a/clang/lib/Basic/Targets/ARM.cpp
+++ b/clang/lib/Basic/Targets/ARM.cpp
@@ -258,6 +258,7 @@ ARMTargetInfo::ARMTargetInfo(const llvm::Triple &Triple,
   bool IsOpenBSD = Triple.isOSOpenBSD();
   bool IsNetBSD = Triple.isOSNetBSD();
   bool IsHaiku = Triple.isOSHaiku();
+  bool IsOHOS = Triple.isOHOSFamily();
 
   // FIXME: the isOSBinFormatMachO is a workaround for identifying a Darwin-like
   // environment where size_t is `unsigned long` rather than `unsigned int`
@@ -324,7 +325,7 @@ ARMTargetInfo::ARMTargetInfo(const llvm::Triple &Triple,
     default:
       if (IsNetBSD)
         setABI("apcs-gnu");
-      else if (IsFreeBSD || IsOpenBSD || IsHaiku)
+      else if (IsFreeBSD || IsOpenBSD || IsHaiku || IsOHOS)
         setABI("aapcs-linux");
       else
         setABI("aapcs");
diff --git a/llvm/lib/TargetParser/ARMTargetParser.cpp b/llvm/lib/TargetParser/ARMTargetParser.cpp
index 20225232b3cccb7..e903350e41687d4 100644
--- a/llvm/lib/TargetParser/ARMTargetParser.cpp
+++ b/llvm/lib/TargetParser/ARMTargetParser.cpp
@@ -519,6 +519,7 @@ StringRef ARM::computeDefaultTargetABI(const Triple &TT, StringRef CPU) {
   case Triple::GNUEABIHF:
   case Triple::MuslEABI:
   case Triple::MuslEABIHF:
+  case llvm::Triple::OpenHOS:
     return "aapcs-linux";
   case Triple::EABIHF:
   case Triple::EABI:



More information about the llvm-commits mailing list