https://github.com/RossComputerGuy updated https://github.com/llvm/llvm-project/pull/120632
>From 2ee88359c3be20f3b6697bf75466fa44e7b10ab5 Mon Sep 17 00:00:00 2001 From: Tristan Ross <tristan.r...@midstall.com> Date: Thu, 19 Dec 2024 10:54:58 -0800 Subject: [PATCH 1/2] [clang] fix uefi data layout on x86 & aarch64 --- clang/lib/Basic/Targets/AArch64.cpp | 3 +++ clang/lib/Basic/Targets/X86.h | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/clang/lib/Basic/Targets/AArch64.cpp b/clang/lib/Basic/Targets/AArch64.cpp index 53e102bbe44687..dd5d033afd8763 100644 --- a/clang/lib/Basic/Targets/AArch64.cpp +++ b/clang/lib/Basic/Targets/AArch64.cpp @@ -1537,6 +1537,9 @@ void AArch64leTargetInfo::setDataLayout() { resetDataLayout("e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-" "n32:64-S128-Fn32", "_"); + } else if (getTriple().isUEFI() && getTriple().isOSBinFormatCOFF()) { + resetDataLayout("e-m:w-p270:32:32-p271:32:32-p272:64:64-p:64:64-i32:32-" + "i64:64-i128:128-n32:64-S128-Fn32"); } else resetDataLayout("e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-" "i64:64-i128:128-n32:64-S128-Fn32"); diff --git a/clang/lib/Basic/Targets/X86.h b/clang/lib/Basic/Targets/X86.h index 3ed36c8fa724b5..1d6fe468af3be1 100644 --- a/clang/lib/Basic/Targets/X86.h +++ b/clang/lib/Basic/Targets/X86.h @@ -713,8 +713,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; >From 71eb5ea788558ce31984715edc14106c44fe7a8c Mon Sep 17 00:00:00 2001 From: Tristan Ross <tristan.r...@midstall.com> Date: Thu, 19 Dec 2024 08:37:46 -0800 Subject: [PATCH 2/2] [clang] add __uefi__ define --- clang/lib/Basic/Targets/OSTargets.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/clang/lib/Basic/Targets/OSTargets.h b/clang/lib/Basic/Targets/OSTargets.h index cd9b3760ca5874..24ffd542d664c7 100644 --- a/clang/lib/Basic/Targets/OSTargets.h +++ b/clang/lib/Basic/Targets/OSTargets.h @@ -790,7 +790,9 @@ template <typename Target> class LLVM_LIBRARY_VISIBILITY UEFITargetInfo : public OSTargetInfo<Target> { protected: void getOSDefines(const LangOptions &Opts, const llvm::Triple &Triple, - MacroBuilder &Builder) const override {} + MacroBuilder &Builder) const override { + DefineStd(Builder, "uefi", Opts); + } public: UEFITargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts) _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits