This commit causes gnu-config to recognize the *-*-uefi triples.

These triples describe binaries which use the PE object file format
and UEFI calling "convention" (which is actually a family of
completely unrelated calling conventions, one per CPU architecture):

- https://uefi.org/specs/UEFI/2.9_A/02_Overview.html#detailed-calling-convention
- 
https://uefi.org/specs/UEFI/2.9_A/02_Overview.html#detailed-calling-convention-1
- 
https://uefi.org/specs/UEFI/2.9_A/02_Overview.html#detailed-calling-convention-2
- https://wiki.osdev.org/UEFI#Calling_Conventions

This is in contrast to the *-w64-mingw32 triple of GNU-EFI, which
uses the ELF format and cdecl calling convention:

- https://wiki.osdev.org/UEFI#Calling_Conventions

Because *-*-uefi uses a different object file format (everywhere)
and calling convention (everywhere except x86_32) from
*-w64-mingw32, the resulting binaries cannot be linked against each
other.  This is the primary justification for introducing a new
triple.

Since gnu-config does not yet have triples for these builds, we
might as well use the same ones already selected by LLVM.  It
considers uefi to be an operating system:

- https://reviews.llvm.org/D131594

* config.sub (*-*-uefi): Recognize.
* testsuite/config-sub.data (i686-unknown-uefi, x86_64-unknown-uefi,
  aarch64-unknown-uefi): New entries.

Signed-off-by: Adam Joseph <a...@westernsemico.com>
X-Disclaimer: This commit shall not be construed as the author's approval of 
the UEFI boondoggle in any way, shape or form.
---
 config.sub                | 7 +++++++
 testsuite/config-sub.data | 3 +++
 2 files changed, 10 insertions(+)

diff --git a/config.sub b/config.sub
index defe52c..ad5ad81 100755
--- a/config.sub
+++ b/config.sub
@@ -1772,6 +1772,13 @@ case $os in
        sco3.2v2 | sco3.2v[4-9]* | sco5v6*)
                # Don't forget version if it is 3.2v4 or newer.
                ;;
+       # This refers to builds using the UEFI calling convention
+       # (which depends on the architecture) and PE file format.
+       # Note that this is both a different calling convention and
+       # different file format than that of GNU-EFI
+       # (x86_64-w64-mingw32).
+       uefi)
+               ;;
        none)
                ;;
        kernel* | msvc* )
diff --git a/testsuite/config-sub.data b/testsuite/config-sub.data
index f36bea2..6a2a3f9 100644
--- a/testsuite/config-sub.data
+++ b/testsuite/config-sub.data
@@ -22,6 +22,7 @@ aarch64-managarm-kernel                               
aarch64-unknown-managarm-kernel
 aarch64-managarm-mlibc                         aarch64-unknown-managarm-mlibc
 aarch64-unknown-elf                            aarch64-unknown-elf
 aarch64-unknown-linux                          aarch64-unknown-linux-gnu
+aarch64-unknown-uefi                           aarch64-unknown-uefi
 aarch64-wrs-vxworks                            aarch64-wrs-vxworks
 aarch64-zephyr                                 aarch64-unknown-zephyr
 aarch64_be                                     aarch64_be-unknown-none
@@ -328,6 +329,7 @@ i686-ericsson-dicos                         
i686-ericsson-dicos
 i686-haiku                                     i686-pc-haiku
 i686-kopensolaris5.11-gnu                      i686-pc-kopensolaris5.11-gnu
 i686-os2-emx                                   i686-pc-os2-emx
+i686-unknown-uefi                              i686-unknown-uefi
 i686-wrs-vxworks                               i686-wrs-vxworks
 i686-wrs-vxworks-simlinux                      i686-wrs-vxworks-simlinux
 i686-wrs-vxworks-simwindows                    i686-wrs-vxworks-simwindows
@@ -896,6 +898,7 @@ x86_64-secbsd                                       
x86_64-pc-secbsd
 x86_64-sortix                                  x86_64-pc-sortix
 x86_64-twizzler                                x86_64-pc-twizzler
 x86_64-unknown-ptx                             x86_64-sequent-ptx
+x86_64-unknown-uefi                            x86_64-unknown-uefi
 x86_64-windows                                 x86_64-pc-windows
 x86_64-windows-msvc                            x86_64-pc-windows-msvc
 x86_64-wrs-vxworks                             x86_64-wrs-vxworks
-- 
2.42.0


Reply via email to