]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdePkg: remove redundant handling of EFI_IMAGE_REL_BASED_DIR64 relocations
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Fri, 25 Sep 2015 21:49:09 +0000 (21:49 +0000)
committerabiesheuvel <abiesheuvel@Edk2>
Fri, 25 Sep 2015 21:49:09 +0000 (21:49 +0000)
There is AARCH64 specific code in the PE/COFF loader to handle relocations
of type EFI_IMAGE_REL_BASED_DIR64 which is dead code since this type is
handled by generic code and never handed to the AARCH64 specific routine.
So remove it.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18556 6f19259b-4bc3-4df7-8a09-765794883524

MdePkg/Library/BasePeCoffLib/AArch64/PeCoffLoaderEx.c [deleted file]
MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
MdePkg/Library/BasePeCoffLib/PeCoffLoaderEx.c

diff --git a/MdePkg/Library/BasePeCoffLib/AArch64/PeCoffLoaderEx.c b/MdePkg/Library/BasePeCoffLib/AArch64/PeCoffLoaderEx.c
deleted file mode 100644 (file)
index 7e4b4db..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-/** @file\r
-  Specific relocation fixups for ARM architecture.\r
-\r
-  Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>\r
-  Portions copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>\r
-  Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>\r
-\r
-  This program and the accompanying materials\r
-  are licensed and made available under the terms and conditions of the BSD License\r
-  which accompanies this distribution.  The full text of the license may be found at\r
-  http://opensource.org/licenses/bsd-license.php.\r
-\r
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#include "BasePeCoffLibInternals.h"\r
-#include <Library/BaseLib.h>\r
-\r
-// Note: Currently only large memory model is supported by UEFI relocation code.\r
-\r
-/**\r
-  Performs an AARCH64-based specific relocation fixup and is a no-op on other\r
-  instruction sets.\r
-\r
-  @param  Reloc       The pointer to the relocation record.\r
-  @param  Fixup       The pointer to the address to fix up.\r
-  @param  FixupData   The pointer to a buffer to log the fixups.\r
-  @param  Adjust      The offset to adjust the fixup.\r
-\r
-  @return Status code.\r
-\r
-**/\r
-RETURN_STATUS\r
-PeCoffLoaderRelocateImageEx (\r
-  IN UINT16      *Reloc,\r
-  IN OUT CHAR8   *Fixup,\r
-  IN OUT CHAR8   **FixupData,\r
-  IN UINT64      Adjust\r
-  )\r
-{\r
-  UINT64      *Fixup64;\r
-\r
-  switch ((*Reloc) >> 12) {\r
-\r
-    case EFI_IMAGE_REL_BASED_DIR64:\r
-      Fixup64 = (UINT64 *) Fixup;\r
-      *Fixup64 = *Fixup64 + (UINT64) Adjust;\r
-      if (*FixupData != NULL) {\r
-        *FixupData = ALIGN_POINTER(*FixupData, sizeof(UINT64));\r
-        *(UINT64 *)(*FixupData) = *Fixup64;\r
-        *FixupData = *FixupData + sizeof(UINT64);\r
-      }\r
-      break;\r
-\r
-    default:\r
-      return RETURN_UNSUPPORTED;\r
-  }\r
-\r
-  return RETURN_SUCCESS;\r
-}\r
-\r
-/**\r
-  Returns TRUE if the machine type of PE/COFF image is supported. Supported\r
-  does not mean the image can be executed it means the PE/COFF loader supports\r
-  loading and relocating of the image type. It's up to the caller to support\r
-  the entry point.\r
-\r
-  @param  Machine   Machine type from the PE Header.\r
-\r
-  @return TRUE if this PE/COFF loader can load the image\r
-\r
-**/\r
-BOOLEAN\r
-PeCoffLoaderImageFormatSupported (\r
-  IN  UINT16  Machine\r
-  )\r
-{\r
-  if ((Machine == IMAGE_FILE_MACHINE_ARM64) || (Machine ==  IMAGE_FILE_MACHINE_EBC)) {\r
-    return TRUE;\r
-  }\r
-\r
-  return FALSE;\r
-}\r
-\r
-/**\r
-  Performs an ARM-based specific re-relocation fixup and is a no-op on other\r
-  instruction sets. This is used to re-relocated the image into the EFI virtual\r
-  space for runtime calls.\r
-\r
-  @param  Reloc       The pointer to the relocation record.\r
-  @param  Fixup       The pointer to the address to fix up.\r
-  @param  FixupData   The pointer to a buffer to log the fixups.\r
-  @param  Adjust      The offset to adjust the fixup.\r
-\r
-  @return Status code.\r
-\r
-**/\r
-RETURN_STATUS\r
-PeHotRelocateImageEx (\r
-  IN UINT16      *Reloc,\r
-  IN OUT CHAR8   *Fixup,\r
-  IN OUT CHAR8   **FixupData,\r
-  IN UINT64      Adjust\r
-  )\r
-{\r
-  UINT64  *Fixup64;\r
-\r
-  switch ((*Reloc) >> 12) {\r
-  case EFI_IMAGE_REL_BASED_DIR64:\r
-    Fixup64     = (UINT64 *) Fixup;\r
-    *FixupData  = ALIGN_POINTER (*FixupData, sizeof (UINT64));\r
-    if (*(UINT64 *) (*FixupData) == *Fixup64) {\r
-      *Fixup64 = *Fixup64 + (UINT64) Adjust;\r
-    }\r
-\r
-    *FixupData = *FixupData + sizeof (UINT64);\r
-    break;\r
-\r
-  default:\r
-    DEBUG ((EFI_D_ERROR, "PeHotRelocateEx:unknown fixed type\n"));\r
-    return RETURN_UNSUPPORTED;\r
-  }\r
-\r
-  return RETURN_SUCCESS;\r
-}\r
index 576d72826c329a60e056b8963ae54629d4c2100f..ff0580fbdf568e765fd61945fe230025440c26ff 100644 (file)
@@ -40,7 +40,7 @@
   BasePeCoffLibInternals.h\r
   BasePeCoff.c\r
 \r
-[Sources.IA32, Sources.X64, Sources.EBC]\r
+[Sources.IA32, Sources.X64, Sources.EBC, Sources.AARCH64]\r
   PeCoffLoaderEx.c\r
 \r
 [Sources.IPF]\r
@@ -49,9 +49,6 @@
 [Sources.ARM]\r
   Arm/PeCoffLoaderEx.c\r
 \r
-[Sources.AARCH64]\r
-  AArch64/PeCoffLoaderEx.c\r
-\r
 [Packages]\r
   MdePkg/MdePkg.dec\r
 \r
index 2ed58844d5d4a3b40830a86563b5f956a1a72720..9eda4cf39deb58edf194d1cf8c3de8b4dfd05c79 100644 (file)
@@ -57,7 +57,7 @@ PeCoffLoaderImageFormatSupported (
   )\r
 {\r
   if ((Machine == IMAGE_FILE_MACHINE_I386) || (Machine == IMAGE_FILE_MACHINE_X64) || \r
-      (Machine ==  IMAGE_FILE_MACHINE_EBC)) {\r
+      (Machine == IMAGE_FILE_MACHINE_EBC) || (Machine == IMAGE_FILE_MACHINE_ARM64)) {\r
     return TRUE; \r
   }\r
 \r