Skip to content

Commit 2ee8835

Browse files
[clang] fix uefi data layout on x86 & aarch64
1 parent f0dcf32 commit 2ee8835

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

clang/lib/Basic/Targets/AArch64.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1537,6 +1537,9 @@ void AArch64leTargetInfo::setDataLayout() {
15371537
resetDataLayout("e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-"
15381538
"n32:64-S128-Fn32",
15391539
"_");
1540+
} else if (getTriple().isUEFI() && getTriple().isOSBinFormatCOFF()) {
1541+
resetDataLayout("e-m:w-p270:32:32-p271:32:32-p272:64:64-p:64:64-i32:32-"
1542+
"i64:64-i128:128-n32:64-S128-Fn32");
15401543
} else
15411544
resetDataLayout("e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-"
15421545
"i64:64-i128:128-n32:64-S128-Fn32");

clang/lib/Basic/Targets/X86.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -713,8 +713,8 @@ class LLVM_LIBRARY_VISIBILITY X86_64TargetInfo : public X86TargetInfo {
713713
X86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
714714
: X86TargetInfo(Triple, Opts) {
715715
const bool IsX32 = getTriple().isX32();
716-
bool IsWinCOFF =
717-
getTriple().isOSWindows() && getTriple().isOSBinFormatCOFF();
716+
bool IsWinCOFF = (getTriple().isOSWindows() || getTriple().isUEFI()) &&
717+
getTriple().isOSBinFormatCOFF();
718718
LongWidth = LongAlign = PointerWidth = PointerAlign = IsX32 ? 32 : 64;
719719
LongDoubleWidth = 128;
720720
LongDoubleAlign = 128;

0 commit comments

Comments
 (0)