[clang] [clang] Fix UEFI Target info (PR #127290)
Petr Hosek via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 19 20:07:47 PDT 2025
================
@@ -835,8 +835,24 @@ class LLVM_LIBRARY_VISIBILITY UEFIX86_64TargetInfo
public:
UEFIX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
: UEFITargetInfo<X86_64TargetInfo>(Triple, Opts) {
+ // The UEFI spec does not mandate specific C++ ABI, integer widths, or
+ // alignment. We are setting these defaults to match the Windows target as
+ // it is the only way to build EFI applications with Clang/LLVM today. We
+ // intend to offer flexibility by supporting choices that are not default in
+ // Windows target in the future.
+
+ // Set C++ ABI.
this->TheCXXABI.set(TargetCXXABI::Microsoft);
- this->MaxTLSAlign = 8192u * this->getCharWidth();
+ // Set Integer types and alignment.
+ IntMaxType = SignedLongLong;
+ Int64Type = SignedLongLong;
+ SizeType = UnsignedLongLong;
+ PtrDiffType = SignedLongLong;
+ IntPtrType = SignedLongLong;
+ WCharType = UnsignedShort;
+ WIntType = UnsignedShort;
+ LongWidth = LongAlign = 32;
----------------
petrhosek wrote:
Looks like UEFI supports float so we should include it here.
```suggestion
LongWidth = LongAlign = 32;
DoubleAlign = LongLongAlign = 64;
LongDoubleWidth = LongDoubleAlign = 64;
LongDoubleFormat = &llvm::APFloat::IEEEdouble();
IntMaxType = SignedLongLong;
Int64Type = SignedLongLong;
SizeType = UnsignedLongLong;
PtrDiffType = SignedLongLong;
IntPtrType = SignedLongLong;
WCharType = UnsignedShort;
WIntType = UnsignedShort;
```
https://github.com/llvm/llvm-project/pull/127290
More information about the cfe-commits
mailing list