Skip to content

Conversation

Prabhuk
Copy link
Contributor

@Prabhuk Prabhuk commented Oct 9, 2024

Add a __UEFI__ predefine for UEFI target.

Co-authored-by: RossComputerGuy

Prabhuk and others added 3 commits October 9, 2024 10:16
Remove PE_COFF
Updating the PE COFF generating windows code path to predefine the new __UEFI__ macro.
@Prabhuk Prabhuk requested a review from jhuber6 December 20, 2024 18:24
@jhuber6
Copy link
Contributor

jhuber6 commented Dec 20, 2024

Didn't know this existed, but we have #120632 tracking it now.

@petrhosek petrhosek marked this pull request as ready for review December 20, 2024 20:47
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Dec 20, 2024
@llvmbot
Copy link
Member

llvmbot commented Dec 20, 2024

@llvm/pr-subscribers-clang-driver

@llvm/pr-subscribers-clang

Author: Prabhuk (Prabhuk)

Changes

Add a __UEFI__ predefine for UEFI target.


Full diff: https://github.com/llvm/llvm-project/pull/111719.diff

1 Files Affected:

  • (modified) clang/lib/Basic/Targets/OSTargets.h (+3-1)
diff --git a/clang/lib/Basic/Targets/OSTargets.h b/clang/lib/Basic/Targets/OSTargets.h
index a83d6464e789d6..5a23eef0117294 100644
--- a/clang/lib/Basic/Targets/OSTargets.h
+++ b/clang/lib/Basic/Targets/OSTargets.h
@@ -783,7 +783,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__");
+  }
 
 public:
   UEFITargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)

@petrhosek
Copy link
Member

Can you include a test for this change?

@Prabhuk
Copy link
Contributor Author

Prabhuk commented Dec 20, 2024

Can you include a test for this change?

I'll add the test.

@llvmbot llvmbot added the clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' label Dec 21, 2024
@Prabhuk
Copy link
Contributor Author

Prabhuk commented Dec 21, 2024

Didn't know this existed, but we have #120632 tracking it now.

Thanks. I left another comment there for @RossComputerGuy to decide on whether to land this patch or not.

@Prabhuk Prabhuk requested a review from echristo December 22, 2024 01:59
@Prabhuk Prabhuk merged commit ac586fd into llvm:main Dec 23, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants