Blame SOURCES/0022-Use-EFI-canonical-names-everywhere-the-compiler-does.patch

4c0d37
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
4c0d37
From: Peter Jones <pjones@redhat.com>
4c0d37
Date: Tue, 1 May 2018 14:12:01 -0400
4c0d37
Subject: [PATCH] Use EFI canonical names everywhere the compiler doesn't care.
4c0d37
4c0d37
Always use x64/X64 and aa64/AA64 unless the toolchain cares about
4c0d37
"x86_64" or whatnot.
4c0d37
4c0d37
Note that we still have mips64el as an arch name, which is not actually
4c0d37
defined in the UEFI specs.
4c0d37
4c0d37
Signed-off-by: Peter Jones <pjones@redhat.com>
4c0d37
---
4c0d37
 Make.defaults                                      | 39 +++++++++++++++-------
4c0d37
 README.gnuefi                                      |  6 ++--
4c0d37
 apps/Makefile                                      |  6 ++--
4c0d37
 gnuefi/Makefile                                    |  6 ++--
4c0d37
 gnuefi/{crt0-efi-aarch64.S => crt0-efi-aa64.S}     |  2 +-
4c0d37
 gnuefi/{crt0-efi-x86_64.S => crt0-efi-x64.S}       |  2 +-
4c0d37
 gnuefi/{elf_aarch64_efi.lds => elf_aa64_efi.lds}   |  0
4c0d37
 gnuefi/{elf_x86_64_efi.lds => elf_x64_efi.lds}     |  2 +-
4c0d37
 ...lf_x86_64_fbsd_efi.lds => elf_x64_fbsd_efi.lds} |  2 +-
4c0d37
 gnuefi/{reloc_aarch64.c => reloc_aa64.c}           |  2 +-
4c0d37
 gnuefi/{reloc_x86_64.c => reloc_x64.c}             |  2 +-
4c0d37
 inc/{aarch64 => aa64}/efibind.h                    |  3 ++
4c0d37
 inc/{aarch64 => aa64}/efilibplat.h                 |  0
4c0d37
 inc/{aarch64 => aa64}/efisetjmp_arch.h             |  6 ++--
4c0d37
 inc/efiapi.h                                       |  5 ++-
4c0d37
 inc/efidebug.h                                     |  2 +-
4c0d37
 inc/{x86_64 => x64}/efibind.h                      |  4 +--
4c0d37
 inc/{x86_64 => x64}/efilibplat.h                   |  0
4c0d37
 inc/{x86_64 => x64}/efisetjmp_arch.h               |  6 ++--
4c0d37
 inc/{x86_64 => x64}/pe.h                           |  0
4c0d37
 lib/Makefile                                       |  4 +--
4c0d37
 lib/{aarch64 => aa64}/efi_stub.S                   |  0
4c0d37
 lib/{aarch64 => aa64}/initplat.c                   |  0
4c0d37
 lib/{aarch64 => aa64}/math.c                       |  0
4c0d37
 lib/{aarch64 => aa64}/setjmp.S                     |  0
4c0d37
 lib/{x86_64 => x64}/callwrap.c                     |  0
4c0d37
 lib/{x86_64 => x64}/efi_stub.S                     |  0
4c0d37
 lib/{x86_64 => x64}/initplat.c                     |  0
4c0d37
 lib/{x86_64 => x64}/math.c                         |  0
4c0d37
 lib/{x86_64 => x64}/setjmp.S                       |  0
4c0d37
 30 files changed, 60 insertions(+), 39 deletions(-)
4c0d37
 rename gnuefi/{crt0-efi-aarch64.S => crt0-efi-aa64.S} (98%)
4c0d37
 rename gnuefi/{crt0-efi-x86_64.S => crt0-efi-x64.S} (97%)
4c0d37
 rename gnuefi/{elf_aarch64_efi.lds => elf_aa64_efi.lds} (100%)
4c0d37
 rename gnuefi/{elf_x86_64_efi.lds => elf_x64_efi.lds} (93%)
4c0d37
 rename gnuefi/{elf_x86_64_fbsd_efi.lds => elf_x64_fbsd_efi.lds} (93%)
4c0d37
 rename gnuefi/{reloc_aarch64.c => reloc_aa64.c} (97%)
4c0d37
 rename gnuefi/{reloc_x86_64.c => reloc_x64.c} (97%)
4c0d37
 rename inc/{aarch64 => aa64}/efibind.h (98%)
4c0d37
 rename inc/{aarch64 => aa64}/efilibplat.h (100%)
4c0d37
 rename inc/{aarch64 => aa64}/efisetjmp_arch.h (78%)
4c0d37
 rename inc/{x86_64 => x64}/efibind.h (99%)
4c0d37
 rename inc/{x86_64 => x64}/efilibplat.h (100%)
4c0d37
 rename inc/{x86_64 => x64}/efisetjmp_arch.h (72%)
4c0d37
 rename inc/{x86_64 => x64}/pe.h (100%)
4c0d37
 rename lib/{aarch64 => aa64}/efi_stub.S (100%)
4c0d37
 rename lib/{aarch64 => aa64}/initplat.c (100%)
4c0d37
 rename lib/{aarch64 => aa64}/math.c (100%)
4c0d37
 rename lib/{aarch64 => aa64}/setjmp.S (100%)
4c0d37
 rename lib/{x86_64 => x64}/callwrap.c (100%)
4c0d37
 rename lib/{x86_64 => x64}/efi_stub.S (100%)
4c0d37
 rename lib/{x86_64 => x64}/initplat.c (100%)
4c0d37
 rename lib/{x86_64 => x64}/math.c (100%)
4c0d37
 rename lib/{x86_64 => x64}/setjmp.S (100%)
4c0d37
4c0d37
diff --git a/Make.defaults b/Make.defaults
4c0d37
index 5d34ff47157..585f3a00aa5 100755
4c0d37
--- a/Make.defaults
4c0d37
+++ b/Make.defaults
4c0d37
@@ -62,17 +62,32 @@ OBJCOPY      := $(prefix)$(CROSS_COMPILE)objcopy
4c0d37
 
4c0d37
 # Host/target identification
4c0d37
 OS           := $(shell uname -s)
4c0d37
-HOSTARCH     ?= $(shell $(HOSTCC) -dumpmachine | cut -f1 -d- | sed -e s,i[3456789]86,ia32, -e 's,armv[67].*,arm,' )
4c0d37
-ARCH         ?= $(shell $(HOSTCC) -dumpmachine | cut -f1 -d- | sed -e s,i[3456789]86,ia32, -e 's,armv[67].*,arm,' )
4c0d37
+HOSTARCH     ?= $(shell $(HOSTCC) -dumpmachine | cut -f1 -d- | sed \
4c0d37
+			-e s,i[3456789]86,ia32, \
4c0d37
+			-e s,amd64,x64, -e s,x86_64,x64, \
4c0d37
+			-e s,aarch64,aa64, \
4c0d37
+			-e 's,armv[[:digit:]].*,arm,' \
4c0d37
+			)
4c0d37
+ARCH         ?= $(shell $(HOSTCC) -dumpmachine | cut -f1 -d- | sed \
4c0d37
+			-e s,i[3456789]86,ia32, \
4c0d37
+			-e s,amd64,x64, -e s,x86_64,x64, \
4c0d37
+			-e s,aarch64,aa64, \
4c0d37
+			-e 's,armv[[:digit:]].*,arm,' \
4c0d37
+			)
4c0d37
+BFD_ARCH     ?= $(shell $(HOSTCC) -dumpmachine | cut -f1 -d- | sed \
4c0d37
+			-e s,i[3456789]86,ia32, \
4c0d37
+			-e s,amd64,x86_64, \
4c0d37
+			-e 's,armv[[:digit:]].*,arm,' \
4c0d37
+			)
4c0d37
 
4c0d37
 # Get ARCH from the compiler if cross compiling
4c0d37
 ifneq ($(CROSS_COMPILE),)
4c0d37
-  override ARCH := $(shell $(CC) -dumpmachine | cut -f1 -d-| sed -e s,i[3456789]86,ia32, -e 's,armv[67].*,arm,' )
4c0d37
-endif
4c0d37
-
4c0d37
-# FreeBSD (and possibly others) reports amd64 instead of x86_64
4c0d37
-ifeq ($(ARCH),amd64)
4c0d37
-  override ARCH := x86_64
4c0d37
+  override ARCH := $(shell $(CC) -dumpmachine | cut -f1 -d- | sed \
4c0d37
+			-e s,i[3456789]86,ia32, \
4c0d37
+			-e s,amd64,x64, -e s,x86_64,x64, \
4c0d37
+			-e s,aarch64,aa64, \
4c0d37
+			-e 's,armv[[:digit:]].*,arm,' \
4c0d37
+			)
4c0d37
 endif
4c0d37
 
4c0d37
 #
4c0d37
@@ -95,12 +110,12 @@ endif
4c0d37
 
4c0d37
 ifeq ($(ARCH),ia32)
4c0d37
   CFLAGS += -mno-mmx -mno-sse
4c0d37
-  ifeq ($(HOSTARCH),x86_64)
4c0d37
+  ifeq ($(HOSTARCH),x64)
4c0d37
     ARCH3264 = -m32
4c0d37
   endif
4c0d37
 endif
4c0d37
 
4c0d37
-ifeq ($(ARCH),x86_64)
4c0d37
+ifeq ($(ARCH),x64)
4c0d37
   GCCVERSION   := $(shell $(CC) -dumpversion | cut -f1 -d.)
4c0d37
   GCCMINOR     := $(shell $(CC) -dumpversion | cut -f2 -d.)
4c0d37
   USING_CLANG  := $(shell $(CC) -v 2>&1 | grep -q 'clang version' && echo clang)
4c0d37
@@ -122,7 +137,7 @@ ifeq ($(ARCH),x86_64)
4c0d37
   endif
4c0d37
 endif
4c0d37
 
4c0d37
-ifneq (,$(filter $(ARCH),ia32 x86_64))
4c0d37
+ifneq (,$(filter $(ARCH),ia32 x64))
4c0d37
   # Disable AVX, if the compiler supports that.
4c0d37
   CC_CAN_DISABLE_AVX=$(shell $(CC) -Werror -c -o /dev/null -xc -mno-avx - </dev/null >/dev/null 2>&1 && echo 1)
4c0d37
   ifeq ($(CC_CAN_DISABLE_AVX), 1)
4c0d37
@@ -139,7 +154,7 @@ endif
4c0d37
 # Set HAVE_EFI_OBJCOPY if objcopy understands --target efi-[app|bsdrv|rtdrv],
4c0d37
 # otherwise we need to compose the PE/COFF header using the assembler
4c0d37
 #
4c0d37
-ifneq ($(ARCH),aarch64)
4c0d37
+ifneq ($(ARCH),aa64)
4c0d37
 ifneq ($(ARCH),arm)
4c0d37
 ifneq ($(ARCH),mips64el)
4c0d37
 export HAVE_EFI_OBJCOPY=y
4c0d37
diff --git a/README.gnuefi b/README.gnuefi
4c0d37
index a65e5f9042a..dd714de116d 100644
4c0d37
--- a/README.gnuefi
4c0d37
+++ b/README.gnuefi
4c0d37
@@ -100,7 +100,7 @@ the appropriate compiler, assembler, linker, ar, and ranlib binaries,
4c0d37
 respectively.
4c0d37
 
4c0d37
 If you're working in a cross-development environment, be sure to set
4c0d37
-macro ARCH to the desired target architecture ("ia32" for x86, "x86_64" for
4c0d37
+macro ARCH to the desired target architecture ("ia32" for x86, "x64" for
4c0d37
 x86_64 and "ia64" for IA-64).  For convenience, this can also be done from
4c0d37
 the make command line (e.g., "make ARCH=ia64").
4c0d37
 
4c0d37
@@ -225,7 +225,7 @@ environment addresses each of these issues.
4c0d37
 In order to satisfy the COFF constraint of page-sized and page-aligned
4c0d37
 sections, the GNU EFI build environment uses the special linker script
4c0d37
 in gnuefi/elf_$(ARCH)_efi.lds where $(ARCH) is the target architecture
4c0d37
-("ia32" for x86, "x86_64" for x86_64 and "ia64" for IA-64).
4c0d37
+("ia32" for x86, "x64" for x86_64 and "ia64" for IA-64).
4c0d37
 This script is set up to create only eight COFF section, each page aligned
4c0d37
 and page sized.These eight sections are used to group together the much
4c0d37
 greater number of sections that are typically present in ELF object files.
4c0d37
@@ -319,7 +319,7 @@ environment is to:
4c0d37
 
4c0d37
 The self-relocator is of course architecture dependent.  The x86
4c0d37
 version can be found in gnuefi/reloc_ia32.c, the x86_64 version
4c0d37
-can be found in gnuefi/reloc_x86_64.c and the IA-64 version can be
4c0d37
+can be found in gnuefi/reloc_x64.c and the IA-64 version can be
4c0d37
 found in gnuefi/reloc_ia64.S.
4c0d37
 
4c0d37
 The self-relocator operates as follows: the startup code invokes it
4c0d37
diff --git a/apps/Makefile b/apps/Makefile
4c0d37
index 310c6fdb5fc..a95620cba2d 100644
4c0d37
--- a/apps/Makefile
4c0d37
+++ b/apps/Makefile
4c0d37
@@ -68,9 +68,9 @@ TARGET_RTDRIVERS =
4c0d37
 
4c0d37
 ifneq ($(HAVE_EFI_OBJCOPY),)
4c0d37
 
4c0d37
-FORMAT		:= --target efi-app-$(ARCH)
4c0d37
-$(TARGET_BSDRIVERS): FORMAT=--target efi-bsdrv-$(ARCH)
4c0d37
-$(TARGET_RTDRIVERS): FORMAT=--target efi-rtdrv-$(ARCH)
4c0d37
+FORMAT		:= --target efi-app-$(BFD_ARCH)
4c0d37
+$(TARGET_BSDRIVERS): FORMAT=--target efi-bsdrv-$(BFD_ARCH)
4c0d37
+$(TARGET_RTDRIVERS): FORMAT=--target efi-rtdrv-$(BFD_ARCH)
4c0d37
 
4c0d37
 else
4c0d37
 
4c0d37
diff --git a/gnuefi/Makefile b/gnuefi/Makefile
4c0d37
index 10d4e7addd0..df67ee83911 100644
4c0d37
--- a/gnuefi/Makefile
4c0d37
+++ b/gnuefi/Makefile
4c0d37
@@ -47,8 +47,8 @@ FILES	= reloc_$(ARCH)
4c0d37
 
4c0d37
 OBJS	= $(FILES:%=%.o)
4c0d37
 
4c0d37
-# on aarch64, avoid jump tables before all relocations have been processed
4c0d37
-reloc_aarch64.o: CFLAGS += -fno-jump-tables
4c0d37
+# on aa64, avoid jump tables before all relocations have been processed
4c0d37
+reloc_aa64.o: CFLAGS += -fno-jump-tables
4c0d37
 
4c0d37
 TARGETS	= crt0-efi-$(ARCH).o libgnuefi.a
4c0d37
 
4c0d37
@@ -65,7 +65,7 @@ install:
4c0d37
 	mkdir -p $(INSTALLROOT)$(LIBDIR)
4c0d37
 	$(INSTALL) -m 644 $(TARGETS) $(INSTALLROOT)$(LIBDIR)
4c0d37
 ifneq (,$(findstring FreeBSD,$(OS)))
4c0d37
- ifeq ($(ARCH),x86_64)
4c0d37
+ ifeq ($(ARCH),x64)
4c0d37
 	$(INSTALL) -m 644 $(SRCDIR)/elf_$(ARCH)_fbsd_efi.lds $(INSTALLROOT)$(LIBDIR)
4c0d37
  else
4c0d37
 	$(INSTALL) -m 644 $(SRCDIR)/elf_$(ARCH)_efi.lds $(INSTALLROOT)$(LIBDIR)
4c0d37
diff --git a/gnuefi/crt0-efi-aarch64.S b/gnuefi/crt0-efi-aa64.S
4c0d37
similarity index 98%
4c0d37
rename from gnuefi/crt0-efi-aarch64.S
4c0d37
rename to gnuefi/crt0-efi-aa64.S
4c0d37
index c300d89bdfd..d6e610b8c79 100644
4c0d37
--- a/gnuefi/crt0-efi-aarch64.S
4c0d37
+++ b/gnuefi/crt0-efi-aa64.S
4c0d37
@@ -1,5 +1,5 @@
4c0d37
 /*
4c0d37
- * crt0-efi-aarch64.S - PE/COFF header for AArch64 EFI applications
4c0d37
+ * crt0-efi-aa64.S - PE/COFF header for AArch64 EFI applications
4c0d37
  *
4c0d37
  * Copright (C) 2014 Linaro Ltd. <ard.biesheuvel@linaro.org>
4c0d37
  *
4c0d37
diff --git a/gnuefi/crt0-efi-x86_64.S b/gnuefi/crt0-efi-x64.S
4c0d37
similarity index 97%
4c0d37
rename from gnuefi/crt0-efi-x86_64.S
4c0d37
rename to gnuefi/crt0-efi-x64.S
4c0d37
index 6839150a72e..6533af7461f 100644
4c0d37
--- a/gnuefi/crt0-efi-x86_64.S
4c0d37
+++ b/gnuefi/crt0-efi-x64.S
4c0d37
@@ -1,4 +1,4 @@
4c0d37
-/* crt0-efi-x86_64.S - x86_64 EFI startup code.
4c0d37
+/* crt0-efi-x64.S - x86_64 EFI startup code.
4c0d37
    Copyright (C) 1999 Hewlett-Packard Co.
4c0d37
 	Contributed by David Mosberger <davidm@hpl.hp.com>.
4c0d37
    Copyright (C) 2005 Intel Co.
4c0d37
diff --git a/gnuefi/elf_aarch64_efi.lds b/gnuefi/elf_aa64_efi.lds
4c0d37
similarity index 100%
4c0d37
rename from gnuefi/elf_aarch64_efi.lds
4c0d37
rename to gnuefi/elf_aa64_efi.lds
4c0d37
diff --git a/gnuefi/elf_x86_64_efi.lds b/gnuefi/elf_x64_efi.lds
4c0d37
similarity index 93%
4c0d37
rename from gnuefi/elf_x86_64_efi.lds
4c0d37
rename to gnuefi/elf_x64_efi.lds
4c0d37
index 7be59023510..c7a105898c8 100644
4c0d37
--- a/gnuefi/elf_x86_64_efi.lds
4c0d37
+++ b/gnuefi/elf_x64_efi.lds
4c0d37
@@ -1,4 +1,4 @@
4c0d37
-/* Same as elf_x86_64_fbsd_efi.lds, except for OUTPUT_FORMAT below - KEEP IN SYNC */
4c0d37
+/* Same as elf_x64_fbsd_efi.lds, except for OUTPUT_FORMAT below - KEEP IN SYNC */
4c0d37
 OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")
4c0d37
 OUTPUT_ARCH(i386:x86-64)
4c0d37
 ENTRY(_start)
4c0d37
diff --git a/gnuefi/elf_x86_64_fbsd_efi.lds b/gnuefi/elf_x64_fbsd_efi.lds
4c0d37
similarity index 93%
4c0d37
rename from gnuefi/elf_x86_64_fbsd_efi.lds
4c0d37
rename to gnuefi/elf_x64_fbsd_efi.lds
4c0d37
index fe1f3342cae..705719bf68b 100644
4c0d37
--- a/gnuefi/elf_x86_64_fbsd_efi.lds
4c0d37
+++ b/gnuefi/elf_x64_fbsd_efi.lds
4c0d37
@@ -1,4 +1,4 @@
4c0d37
-/* Same as elf_x86_64_efi.lds, except for OUTPUT_FORMAT below - KEEP IN SYNC */
4c0d37
+/* Same as elf_x64_efi.lds, except for OUTPUT_FORMAT below - KEEP IN SYNC */
4c0d37
 OUTPUT_FORMAT("elf64-x86-64-freebsd", "elf64-x86-64-freebsd", "elf64-x86-64-freebsd")
4c0d37
 OUTPUT_ARCH(i386:x86-64)
4c0d37
 ENTRY(_start)
4c0d37
diff --git a/gnuefi/reloc_aarch64.c b/gnuefi/reloc_aa64.c
4c0d37
similarity index 97%
4c0d37
rename from gnuefi/reloc_aarch64.c
4c0d37
rename to gnuefi/reloc_aa64.c
4c0d37
index 086727961c2..f2ac52b1269 100644
4c0d37
--- a/gnuefi/reloc_aarch64.c
4c0d37
+++ b/gnuefi/reloc_aa64.c
4c0d37
@@ -1,4 +1,4 @@
4c0d37
-/* reloc_aarch64.c - position independent x86 ELF shared object relocator
4c0d37
+/* reloc_aa64.c - position independent ARM Aarch64 ELF shared object relocator
4c0d37
    Copyright (C) 2014 Linaro Ltd. <ard.biesheuvel@linaro.org>
4c0d37
    Copyright (C) 1999 Hewlett-Packard Co.
4c0d37
 	Contributed by David Mosberger <davidm@hpl.hp.com>.
4c0d37
diff --git a/gnuefi/reloc_x86_64.c b/gnuefi/reloc_x64.c
4c0d37
similarity index 97%
4c0d37
rename from gnuefi/reloc_x86_64.c
4c0d37
rename to gnuefi/reloc_x64.c
4c0d37
index 04b75b29fda..09493227a7b 100644
4c0d37
--- a/gnuefi/reloc_x86_64.c
4c0d37
+++ b/gnuefi/reloc_x64.c
4c0d37
@@ -1,4 +1,4 @@
4c0d37
-/* reloc_x86_64.c - position independent x86_64 ELF shared object relocator
4c0d37
+/* reloc_x64.c - position independent x86_64 ELF shared object relocator
4c0d37
    Copyright (C) 1999 Hewlett-Packard Co.
4c0d37
 	Contributed by David Mosberger <davidm@hpl.hp.com>.
4c0d37
    Copyright (C) 2005 Intel Co.
4c0d37
diff --git a/inc/aarch64/efibind.h b/inc/aa64/efibind.h
4c0d37
similarity index 98%
4c0d37
rename from inc/aarch64/efibind.h
4c0d37
rename to inc/aa64/efibind.h
4c0d37
index c2c546b892a..c4eafa0d8a8 100644
4c0d37
--- a/inc/aarch64/efibind.h
4c0d37
+++ b/inc/aa64/efibind.h
4c0d37
@@ -15,6 +15,8 @@
4c0d37
  * either version 2 of the License, or (at your option) any later version.
4c0d37
  */
4c0d37
 
4c0d37
+#ifndef GNU_EFI_AA64_EFI_BIND_H
4c0d37
+#define GNU_EFI_AA64_EFI_BIND_H
4c0d37
 #if !defined(_MSC_VER) && (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L )) && !defined(__cplusplus)
4c0d37
 
4c0d37
 // ANSI C 1999/2000 stdint.h integer width declarations
4c0d37
@@ -156,3 +158,4 @@ typedef uint64_t   UINTN;
4c0d37
 
4c0d37
 #define uefi_call_wrapper(func, va_num, ...) func(__VA_ARGS__)
4c0d37
 #define EFI_FUNCTION
4c0d37
+#endif /* GNU_EFI_AA64_EFI_BIND_H */
4c0d37
diff --git a/inc/aarch64/efilibplat.h b/inc/aa64/efilibplat.h
4c0d37
similarity index 100%
4c0d37
rename from inc/aarch64/efilibplat.h
4c0d37
rename to inc/aa64/efilibplat.h
4c0d37
diff --git a/inc/aarch64/efisetjmp_arch.h b/inc/aa64/efisetjmp_arch.h
4c0d37
similarity index 78%
4c0d37
rename from inc/aarch64/efisetjmp_arch.h
4c0d37
rename to inc/aa64/efisetjmp_arch.h
4c0d37
index 8dbce07821f..8ec3eeb9a47 100644
4c0d37
--- a/inc/aarch64/efisetjmp_arch.h
4c0d37
+++ b/inc/aa64/efisetjmp_arch.h
4c0d37
@@ -1,5 +1,5 @@
4c0d37
-#ifndef GNU_EFI_AARCH64_SETJMP_H
4c0d37
-#define GNU_EFI_AARCH64_SETJMP_H
4c0d37
+#ifndef GNU_EFI_AA64_SETJMP_H
4c0d37
+#define GNU_EFI_AA64_SETJMP_H
4c0d37
 
4c0d37
 #define JMPBUF_ALIGN 8
4c0d37
 
4c0d37
@@ -30,4 +30,4 @@ typedef struct {
4c0d37
 	UINT64	D15;
4c0d37
 } ALIGN(JMPBUF_ALIGN) jmp_buf[1];
4c0d37
 
4c0d37
-#endif /* GNU_EFI_AARCH64_SETJMP_H */
4c0d37
+#endif /* GNU_EFI_AA64_SETJMP_H */
4c0d37
diff --git a/inc/efiapi.h b/inc/efiapi.h
4c0d37
index bdf5de26a3f..2f6ff582252 100644
4c0d37
--- a/inc/efiapi.h
4c0d37
+++ b/inc/efiapi.h
4c0d37
@@ -338,8 +338,11 @@ EFI_STATUS
4c0d37
 #define EFI_IMAGE_MACHINE_ARMTHUMB_MIXED 0x01C2
4c0d37
 #endif
4c0d37
 
4c0d37
+#if !defined(EFI_IMAGE_MACHINE_AA64)
4c0d37
+#define EFI_IMAGE_MACHINE_AA64   0xAA64
4c0d37
+#endif
4c0d37
 #if !defined(EFI_IMAGE_MACHINE_AARCH64)
4c0d37
-#define EFI_IMAGE_MACHINE_AARCH64   0xAA64
4c0d37
+#define EFI_IMAGE_MACHINE_AARCH64   EFI_IMAGE_MACHINE_AA64
4c0d37
 #endif
4c0d37
 
4c0d37
 // Image Entry prototype
4c0d37
diff --git a/inc/efidebug.h b/inc/efidebug.h
4c0d37
index 8e54dcda842..3649edf26d1 100644
4c0d37
--- a/inc/efidebug.h
4c0d37
+++ b/inc/efidebug.h
4c0d37
@@ -533,7 +533,7 @@ typedef enum {
4c0d37
     IsaIpf = EFI_IMAGE_MACHINE_IA64,
4c0d37
     IsaEbc = EFI_IMAGE_MACHINE_EBC,
4c0d37
     IsaArm = EFI_IMAGE_MACHINE_ARMTHUMB_MIXED,
4c0d37
-//	IsaArm64 = EFI_IMAGE_MACHINE_AARCH64
4c0d37
+//	IsaArm64 = EFI_IMAGE_MACHINE_AA64
4c0d37
 } EFI_INSTRUCTION_SET_ARCHITECTURE;
4c0d37
 
4c0d37
 //
4c0d37
diff --git a/inc/x86_64/efibind.h b/inc/x64/efibind.h
4c0d37
similarity index 99%
4c0d37
rename from inc/x86_64/efibind.h
4c0d37
rename to inc/x64/efibind.h
4c0d37
index 31e9e119d74..2750ab9be7d 100644
4c0d37
--- a/inc/x86_64/efibind.h
4c0d37
+++ b/inc/x64/efibind.h
4c0d37
@@ -16,8 +16,8 @@ Abstract:
4c0d37
 Revision History
4c0d37
 
4c0d37
 --*/
4c0d37
-#ifndef X86_64_EFI_BIND
4c0d37
-#define X86_64_EFI_BIND
4c0d37
+#ifndef X64_EFI_BIND
4c0d37
+#define X64_EFI_BIND
4c0d37
 #ifndef __GNUC__
4c0d37
 #pragma pack()
4c0d37
 #endif
4c0d37
diff --git a/inc/x86_64/efilibplat.h b/inc/x64/efilibplat.h
4c0d37
similarity index 100%
4c0d37
rename from inc/x86_64/efilibplat.h
4c0d37
rename to inc/x64/efilibplat.h
4c0d37
diff --git a/inc/x86_64/efisetjmp_arch.h b/inc/x64/efisetjmp_arch.h
4c0d37
similarity index 72%
4c0d37
rename from inc/x86_64/efisetjmp_arch.h
4c0d37
rename to inc/x64/efisetjmp_arch.h
4c0d37
index b1ad1fe3087..cc8fd350517 100644
4c0d37
--- a/inc/x86_64/efisetjmp_arch.h
4c0d37
+++ b/inc/x64/efisetjmp_arch.h
4c0d37
@@ -1,5 +1,5 @@
4c0d37
-#ifndef GNU_EFI_X86_64_SETJMP_H
4c0d37
-#define GNU_EFI_X86_64_SETJMP_H
4c0d37
+#ifndef GNU_EFI_X64_SETJMP_H
4c0d37
+#define GNU_EFI_X64_SETJMP_H
4c0d37
 
4c0d37
 #define JMPBUF_ALIGN 8
4c0d37
 
4c0d37
@@ -19,4 +19,4 @@ typedef struct {
4c0d37
 	UINT8	XmmBuffer[160]; // XMM6 - XMM15
4c0d37
 } ALIGN(JMPBUF_ALIGN) jmp_buf[1];
4c0d37
 
4c0d37
-#endif /* GNU_EFI_X86_64_SETJMP_H */
4c0d37
+#endif /* GNU_EFI_X64_SETJMP_H */
4c0d37
diff --git a/inc/x86_64/pe.h b/inc/x64/pe.h
4c0d37
similarity index 100%
4c0d37
rename from inc/x86_64/pe.h
4c0d37
rename to inc/x64/pe.h
4c0d37
diff --git a/lib/Makefile b/lib/Makefile
4c0d37
index 0e6410dac55..8bf94000e33 100644
4c0d37
--- a/lib/Makefile
4c0d37
+++ b/lib/Makefile
4c0d37
@@ -53,7 +53,7 @@ ifeq ($(ARCH),ia64)
4c0d37
 FILES += $(ARCH)/salpal $(ARCH)/palproc
4c0d37
 endif
4c0d37
 
4c0d37
-ifeq ($(ARCH),x86_64)
4c0d37
+ifeq ($(ARCH),x64)
4c0d37
 FILES += $(ARCH)/callwrap $(ARCH)/efi_stub
4c0d37
 endif
4c0d37
 
4c0d37
@@ -64,7 +64,7 @@ endif
4c0d37
 
4c0d37
 OBJS  = $(FILES:%=%.o)
4c0d37
 
4c0d37
-SUBDIRS = ia32 x86_64 ia64 aarch64 arm mips64el runtime
4c0d37
+SUBDIRS = ia32 x64 ia64 aa64 arm mips64el runtime
4c0d37
 
4c0d37
 LIBDIRINSTALL = $(INSTALLROOT)$(LIBDIR)
4c0d37
 
4c0d37
diff --git a/lib/aarch64/efi_stub.S b/lib/aa64/efi_stub.S
4c0d37
similarity index 100%
4c0d37
rename from lib/aarch64/efi_stub.S
4c0d37
rename to lib/aa64/efi_stub.S
4c0d37
diff --git a/lib/aarch64/initplat.c b/lib/aa64/initplat.c
4c0d37
similarity index 100%
4c0d37
rename from lib/aarch64/initplat.c
4c0d37
rename to lib/aa64/initplat.c
4c0d37
diff --git a/lib/aarch64/math.c b/lib/aa64/math.c
4c0d37
similarity index 100%
4c0d37
rename from lib/aarch64/math.c
4c0d37
rename to lib/aa64/math.c
4c0d37
diff --git a/lib/aarch64/setjmp.S b/lib/aa64/setjmp.S
4c0d37
similarity index 100%
4c0d37
rename from lib/aarch64/setjmp.S
4c0d37
rename to lib/aa64/setjmp.S
4c0d37
diff --git a/lib/x86_64/callwrap.c b/lib/x64/callwrap.c
4c0d37
similarity index 100%
4c0d37
rename from lib/x86_64/callwrap.c
4c0d37
rename to lib/x64/callwrap.c
4c0d37
diff --git a/lib/x86_64/efi_stub.S b/lib/x64/efi_stub.S
4c0d37
similarity index 100%
4c0d37
rename from lib/x86_64/efi_stub.S
4c0d37
rename to lib/x64/efi_stub.S
4c0d37
diff --git a/lib/x86_64/initplat.c b/lib/x64/initplat.c
4c0d37
similarity index 100%
4c0d37
rename from lib/x86_64/initplat.c
4c0d37
rename to lib/x64/initplat.c
4c0d37
diff --git a/lib/x86_64/math.c b/lib/x64/math.c
4c0d37
similarity index 100%
4c0d37
rename from lib/x86_64/math.c
4c0d37
rename to lib/x64/math.c
4c0d37
diff --git a/lib/x86_64/setjmp.S b/lib/x64/setjmp.S
4c0d37
similarity index 100%
4c0d37
rename from lib/x86_64/setjmp.S
4c0d37
rename to lib/x64/setjmp.S