Skip to content

[clang] UEFI handle unsupported triples. #124824

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

Merged
merged 7 commits into from
Jan 29, 2025
Merged

Conversation

Prabhuk
Copy link
Contributor

@Prabhuk Prabhuk commented Jan 28, 2025

The only architecture currently being supported (still a WIP) is
x86_64. Other UEFI triples targeting other architectures will now
report an unknown target triple error.

The only architecture currently being supported (still a WIP) is
x86_64. Other UEFI triples targeting other architectures will now
report an error.
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' labels Jan 28, 2025
@llvmbot
Copy link
Member

llvmbot commented Jan 28, 2025

@llvm/pr-subscribers-clang-driver

@llvm/pr-subscribers-clang

Author: Prabhuk (Prabhuk)

Changes

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

1 Files Affected:

  • (modified) clang/lib/Driver/Driver.cpp (+2)
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 87855fdb799710..f1cd6353234a90 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -6677,6 +6677,8 @@ const ToolChain &Driver::getToolChain(const ArgList &Args,
       TC = std::make_unique<toolchains::AMDGPUToolChain>(*this, Target, Args);
       break;
     case llvm::Triple::UEFI:
+      if(Target.getArch() != llvm::Triple::x86_64)        
+        llvm::report_fatal_error("Currently the only architecture supported by *-uefi triples are x86_64.");
       TC = std::make_unique<toolchains::UEFI>(*this, Target, Args);
       break;
     case llvm::Triple::Win32:

@Prabhuk Prabhuk requested review from rnk and ilovepi January 28, 2025 19:24
Copy link
Contributor

@ilovepi ilovepi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This patch needs a test for the new driver logic. I'd also suggest adding some error handling in LLVM, so that it isn't possible to try an generate wrong code if this triple is supplied somewhere else (e.g. by another frontend or through opt).

Copy link

github-actions bot commented Jan 28, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

@Prabhuk Prabhuk changed the title [clang] Abort on unsupported uefi triples. [clang] UEFI handle unsupported triples. Jan 28, 2025
@rnk
Copy link
Collaborator

rnk commented Jan 28, 2025

+1 for a test

Copy link
Contributor

@ilovepi ilovepi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Lets try to follow up w/ something on the llvm side too though.

@Prabhuk Prabhuk merged commit fdd4e9f into llvm:main Jan 29, 2025
8 checks passed
@Prabhuk Prabhuk deleted the uefi_driver branch January 29, 2025 22:42
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 Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants