[clang] [clang] fix uefi target for aarch64 & x86_64 (PR #120632)

Petr Hosek via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 20 12:47:06 PST 2024


================
@@ -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 {
+    Builder.defineMacro("__UEFI__");
----------------
petrhosek wrote:

`DefineStd` will define `uefi` (in the GNU mode), `__uefi` and `__uefi__`. I don't think we should be defining any new symbols in the user's namespace, even in the GNU mode. I also don't think we should have more then one define, we do it in other targets for backwards compatibility, but there is no backwards compatibility for UEFI. Regarding upper case vs lower case, I have mild preference for the upper case since it's more consistent with Windows and UEFI is essentially a flavor of Windows, not UNIX or GNU. TL;DR I'd prefer using `Builder.defineMacro("__UEFI__");` as you had originally.

https://github.com/llvm/llvm-project/pull/120632


More information about the cfe-commits mailing list