-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[clang] fix uefi target for aarch64 & x86_64 #120632
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
e0d525f
6d242b0
dfcd456
3177fc8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -722,8 +722,8 @@ class LLVM_LIBRARY_VISIBILITY X86_64TargetInfo : public X86TargetInfo { | |
X86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts) | ||
: X86TargetInfo(Triple, Opts) { | ||
const bool IsX32 = getTriple().isX32(); | ||
bool IsWinCOFF = | ||
getTriple().isOSWindows() && getTriple().isOSBinFormatCOFF(); | ||
bool IsWinCOFF = (getTriple().isOSWindows() || getTriple().isUEFI()) && | ||
getTriple().isOSBinFormatCOFF(); | ||
LongWidth = LongAlign = PointerWidth = PointerAlign = IsX32 ? 32 : 64; | ||
|
||
LongDoubleWidth = 128; | ||
LongDoubleAlign = 128; | ||
|
@@ -829,38 +829,6 @@ class LLVM_LIBRARY_VISIBILITY X86_64TargetInfo : public X86TargetInfo { | |
} | ||
}; | ||
|
||
// x86-64 UEFI target | ||
class LLVM_LIBRARY_VISIBILITY UEFIX86_64TargetInfo | ||
: public UEFITargetInfo<X86_64TargetInfo> { | ||
public: | ||
UEFIX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts) | ||
: UEFITargetInfo<X86_64TargetInfo>(Triple, Opts) { | ||
this->TheCXXABI.set(TargetCXXABI::Microsoft); | ||
|
||
this->MaxTLSAlign = 8192u * this->getCharWidth(); | ||
this->resetDataLayout("e-m:w-p270:32:32-p271:32:32-p272:64:64-" | ||
"i64:64-i128:128-f80:128-n8:16:32:64-S128"); | ||
} | ||
|
||
BuiltinVaListKind getBuiltinVaListKind() const override { | ||
return TargetInfo::CharPtrBuiltinVaList; | ||
} | ||
|
||
CallingConvCheckResult checkCallingConvention(CallingConv CC) const override { | ||
switch (CC) { | ||
case CC_C: | ||
case CC_Win64: | ||
return CCCR_OK; | ||
default: | ||
return CCCR_Warning; | ||
} | ||
} | ||
|
||
TargetInfo::CallingConvKind | ||
getCallingConvKind(bool ClangABICompat4) const override { | ||
return CCK_MicrosoftWin64; | ||
} | ||
}; | ||
|
||
// x86-64 Windows target | ||
class LLVM_LIBRARY_VISIBILITY WindowsX86_64TargetInfo | ||
: public WindowsTargetInfo<X86_64TargetInfo> { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: This could simply be
getTriple().isUEFI() || (getTriple().isOSWindows() && getTriple().isOSBinFormatCOFF()) as isOSBinFormatCOFF will always be true for UEFI.