[clang] 73bc23f - Fix the data layout mangling specification for 'i686-pc-macho'
Akira Hatanaka via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 21 12:58:29 PDT 2020
Author: Akira Hatanaka
Date: 2020-07-21T12:58:17-07:00
New Revision: 73bc23ff86655b4e041ce14a991a8bd5cce985e0
URL: https://github.com/llvm/llvm-project/commit/73bc23ff86655b4e041ce14a991a8bd5cce985e0
DIFF: https://github.com/llvm/llvm-project/commit/73bc23ff86655b4e041ce14a991a8bd5cce985e0.diff
LOG: Fix the data layout mangling specification for 'i686-pc-macho'
Use 'o' for the mangling specification instead of 'e'. This fixes an
error in the backend caused by a mismatch between the data layouts
generated by the backend and the frontend.
rdar://problem/64168540
Added:
Modified:
clang/lib/Basic/Targets/X86.h
clang/test/CodeGen/target-data.c
Removed:
################################################################################
diff --git a/clang/lib/Basic/Targets/X86.h b/clang/lib/Basic/Targets/X86.h
index 72a01d2514c2..50e77937febd 100644
--- a/clang/lib/Basic/Targets/X86.h
+++ b/clang/lib/Basic/Targets/X86.h
@@ -358,7 +358,10 @@ class LLVM_LIBRARY_VISIBILITY X86_32TargetInfo : public X86TargetInfo {
LongDoubleWidth = 96;
LongDoubleAlign = 32;
SuitableAlign = 128;
- resetDataLayout("e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-"
+ resetDataLayout(Triple.isOSBinFormatMachO() ?
+ "e-m:o-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-"
+ "f80:32-n8:16:32-S128" :
+ "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-"
"f80:32-n8:16:32-S128");
SizeType = UnsignedInt;
PtrDiffType = SignedInt;
diff --git a/clang/test/CodeGen/target-data.c b/clang/test/CodeGen/target-data.c
index 8c740119cd1b..4f2dbe7c8e10 100644
--- a/clang/test/CodeGen/target-data.c
+++ b/clang/test/CodeGen/target-data.c
@@ -14,6 +14,10 @@
// RUN: FileCheck --check-prefix=I686-CYGWIN %s
// I686-CYGWIN: target datalayout = "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:32-n8:16:32-a:0:32-S32"
+// RUN: %clang_cc1 -triple i686-pc-macho -emit-llvm -o - %s | \
+// RUN: FileCheck --check-prefix=I686-MACHO %s
+// I686-MACHO: target datalayout = "e-m:o-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-f80:32-n8:16:32-S128"
+
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s | \
// RUN: FileCheck --check-prefix=X86_64 %s
// X86_64: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
More information about the cfe-commits
mailing list