Skip to content

Commit 73bc23f

Browse files
committed
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
1 parent 923cf89 commit 73bc23f

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

clang/lib/Basic/Targets/X86.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,10 @@ class LLVM_LIBRARY_VISIBILITY X86_32TargetInfo : public X86TargetInfo {
358358
LongDoubleWidth = 96;
359359
LongDoubleAlign = 32;
360360
SuitableAlign = 128;
361-
resetDataLayout("e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-"
361+
resetDataLayout(Triple.isOSBinFormatMachO() ?
362+
"e-m:o-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-"
363+
"f80:32-n8:16:32-S128" :
364+
"e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-"
362365
"f80:32-n8:16:32-S128");
363366
SizeType = UnsignedInt;
364367
PtrDiffType = SignedInt;

clang/test/CodeGen/target-data.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
// RUN: FileCheck --check-prefix=I686-CYGWIN %s
1515
// 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"
1616

17+
// RUN: %clang_cc1 -triple i686-pc-macho -emit-llvm -o - %s | \
18+
// RUN: FileCheck --check-prefix=I686-MACHO %s
19+
// 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"
20+
1721
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s | \
1822
// RUN: FileCheck --check-prefix=X86_64 %s
1923
// 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"

0 commit comments

Comments
 (0)