Skip to content

Commit 3e61227

Browse files
committed
[clang] Fix UEFI Target info
For X64 UEFI targets, making the integer size and va_list kind fixes.
1 parent f719d8a commit 3e61227

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

clang/include/clang/Basic/TargetOSMacros.def

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,7 @@ TARGET_OS(TARGET_OS_NANO, Triple.isWatchOS())
5353
TARGET_OS(TARGET_IPHONE_SIMULATOR, Triple.isSimulatorEnvironment())
5454
TARGET_OS(TARGET_OS_UIKITFORMAC, Triple.isMacCatalystEnvironment())
5555

56+
// UEFI target.
57+
TARGET_OS(TARGET_OS_UEFI, Triple.isUEFI())
58+
5659
#undef TARGET_OS

clang/lib/Basic/Targets/X86.h

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -835,16 +835,22 @@ class LLVM_LIBRARY_VISIBILITY UEFIX86_64TargetInfo
835835
public:
836836
UEFIX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
837837
: UEFITargetInfo<X86_64TargetInfo>(Triple, Opts) {
838+
LongWidth = LongAlign = 32;
839+
DoubleAlign = LongLongAlign = 64;
840+
IntMaxType = SignedLongLong;
841+
Int64Type = SignedLongLong;
842+
SizeType = UnsignedLongLong;
843+
PtrDiffType = SignedLongLong;
844+
IntPtrType = SignedLongLong;
845+
LongDoubleWidth = LongDoubleAlign = 64;
846+
LongDoubleFormat = &llvm::APFloat::IEEEdouble();
847+
WCharType = UnsignedShort;
848+
WIntType = UnsignedShort;
838849
this->TheCXXABI.set(TargetCXXABI::Microsoft);
839-
this->MaxTLSAlign = 8192u * this->getCharWidth();
840850
this->resetDataLayout("e-m:w-p270:32:32-p271:32:32-p272:64:64-"
841851
"i64:64-i128:128-f80:128-n8:16:32:64-S128");
842852
}
843853

844-
BuiltinVaListKind getBuiltinVaListKind() const override {
845-
return TargetInfo::CharPtrBuiltinVaList;
846-
}
847-
848854
CallingConvCheckResult checkCallingConvention(CallingConv CC) const override {
849855
switch (CC) {
850856
case CC_C:

0 commit comments

Comments
 (0)