Skip to content

Commit e0d525f

Browse files
[clang] fix uefi data layout on x86 & aarch64
1 parent bb69499 commit e0d525f

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
@@ -1626,6 +1626,9 @@ void AArch64leTargetInfo::setDataLayout() {
16261626
resetDataLayout("e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-"
16271627
"n32:64-S128-Fn32",
16281628
"_");
1629+
} else if (getTriple().isUEFI() && getTriple().isOSBinFormatCOFF()) {
1630+
resetDataLayout("e-m:w-p270:32:32-p271:32:32-p272:64:64-p:64:64-i32:32-"
1631+
"i64:64-i128:128-n32:64-S128-Fn32");
16291632
} else
16301633
resetDataLayout("e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-"
16311634
"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
@@ -722,8 +722,8 @@ class LLVM_LIBRARY_VISIBILITY X86_64TargetInfo : public X86TargetInfo {
722722
X86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
723723
: X86TargetInfo(Triple, Opts) {
724724
const bool IsX32 = getTriple().isX32();
725-
bool IsWinCOFF =
726-
getTriple().isOSWindows() && getTriple().isOSBinFormatCOFF();
725+
bool IsWinCOFF = (getTriple().isOSWindows() || getTriple().isUEFI()) &&
726+
getTriple().isOSBinFormatCOFF();
727727
LongWidth = LongAlign = PointerWidth = PointerAlign = IsX32 ? 32 : 64;
728728
LongDoubleWidth = 128;
729729
LongDoubleAlign = 128;

0 commit comments

Comments
 (0)