Page MenuHomePhabricator

WORK IN PROGRESS Add Clang UEFI target to support "x86_64-unknown-uefi" triple
Needs ReviewPublic

Authored by Prabhuk on Aug 10 2022, 9:48 AM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None

Diff Detail

Event Timeline

Prabhuk created this revision.Aug 10 2022, 9:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 10 2022, 9:48 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
Prabhuk requested review of this revision.Aug 10 2022, 9:48 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptAug 10 2022, 9:48 AM
phosek added a subscriber: phosek.Aug 15 2022, 3:02 PM
phosek added inline comments.
clang/lib/Basic/Targets.cpp
579

What does this comment refer to?

clang/lib/Basic/Targets/OSTargets.h
945

I'd start with only necessary minimum and add more later if needed. Initially we probably only need a define to identify this target, likely __UEFI__.

Prabhuk updated this revision to Diff 468370.Oct 17 2022, 4:53 PM

Added changes to the Driver.cpp.
This version uses underlying MSVC toolchain to compile UEFI target introduced here.

Prabhuk updated this revision to Diff 468595.Oct 18 2022, 9:45 AM

Introducing UEFIX86_64TargetInfo.

Prabhuk updated this revision to Diff 468600.Oct 18 2022, 9:50 AM

Add UEFI macro.

phosek added inline comments.Oct 18 2022, 3:10 PM
clang/lib/Basic/Targets/X86.h
812–828

According to https://wiki.osdev.org/UEFI#Calling_Conventions, only cdecl, Microsoft's 64-bit calling convention and ARM SMC are supported for UEFI. This would translate to CC_C and CC_Win64 (I'm not sure if SMC is supported by Clang, it doesn't appear to be).

Prabhuk updated this revision to Diff 477622.Wed, Nov 23, 3:09 PM
Prabhuk marked an inline comment as done.

Introducing a new toolchain for UEFI COFF.

Prabhuk updated this revision to Diff 477634.Wed, Nov 23, 3:37 PM
Prabhuk marked an inline comment as done.

Added tests to the new UEFI target.

Prabhuk marked an inline comment as done.Wed, Nov 23, 3:40 PM