[clang] d9258a2 - Fix the data layout mangling specification for 'arm64-pc-win32-macho'

Akira Hatanaka via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 10 18:52:55 PST 2020


Author: Akira Hatanaka
Date: 2020-11-10T18:52:12-08:00
New Revision: d9258a21f03811a9e231c2ec338822de84d55eef

URL: https://github.com/llvm/llvm-project/commit/d9258a21f03811a9e231c2ec338822de84d55eef
DIFF: https://github.com/llvm/llvm-project/commit/d9258a21f03811a9e231c2ec338822de84d55eef.diff

LOG: Fix the data layout mangling specification for 'arm64-pc-win32-macho'

rdar://problem/70410504

Added: 
    

Modified: 
    clang/lib/Basic/Targets/AArch64.cpp
    clang/test/CodeGen/target-data.c

Removed: 
    


################################################################################
diff  --git a/clang/lib/Basic/Targets/AArch64.cpp b/clang/lib/Basic/Targets/AArch64.cpp
index e25a783cfa66..8e0fc5fa621e 100644
--- a/clang/lib/Basic/Targets/AArch64.cpp
+++ b/clang/lib/Basic/Targets/AArch64.cpp
@@ -759,7 +759,9 @@ WindowsARM64TargetInfo::WindowsARM64TargetInfo(const llvm::Triple &Triple,
 }
 
 void WindowsARM64TargetInfo::setDataLayout() {
-  resetDataLayout("e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128");
+  resetDataLayout(Triple.isOSBinFormatMachO()
+                      ? "e-m:o-i64:64-i128:128-n32:64-S128"
+                      : "e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128");
 }
 
 TargetInfo::BuiltinVaListKind

diff  --git a/clang/test/CodeGen/target-data.c b/clang/test/CodeGen/target-data.c
index a8e995d2963a..75282846381f 100644
--- a/clang/test/CodeGen/target-data.c
+++ b/clang/test/CodeGen/target-data.c
@@ -191,6 +191,10 @@
 // RUN: FileCheck %s -check-prefix=AARCH64-ILP32
 // AARCH64-ILP32: target datalayout = "e-m:o-p:32:32-i64:64-i128:128-n32:64-S128"
 
+// RUN: %clang_cc1 -triple arm64-pc-win32-macho -o - -emit-llvm %s | \
+// RUN: FileCheck %s -check-prefix=AARCH64-WIN32-MACHO
+// AARCH64-WIN32-MACHO: target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
+
 // RUN: %clang_cc1 -triple thumb-unknown-gnueabi -o - -emit-llvm %s | \
 // RUN: FileCheck %s -check-prefix=THUMB
 // THUMB: target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"


        


More information about the cfe-commits mailing list