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

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