]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/C/Common/BasePeCoff.c
Sync EDKII BaseTools to BaseTools project r1988
[mirror_edk2.git] / BaseTools / Source / C / Common / BasePeCoff.c
index 5ffb5d45032468dffdcfa96c73e928d5784bd6c5..4a3f92fb159d0ea7be97cd3d5fa1afba5408215c 100644 (file)
@@ -2,8 +2,8 @@
 \r
   Functions to get info and load PE/COFF image.\r
 \r
-Copyright (c) 2004 - 2008, Intel Corporation                                                         \r
-All rights reserved. This program and the accompanying materials                          \r
+Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.<BR>\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
@@ -71,6 +71,14 @@ PeCoffLoaderRelocateIpfImage (
   IN UINT64      Adjust\r
   );\r
 \r
+RETURN_STATUS\r
+PeCoffLoaderRelocateArmImage (\r
+  IN UINT16      **Reloc,\r
+  IN OUT CHAR8   *Fixup,\r
+  IN OUT CHAR8   **FixupData,\r
+  IN UINT64      Adjust\r
+  );\r
+\r
 STATIC\r
 RETURN_STATUS\r
 PeCoffLoaderGetPeHeader (\r
@@ -621,15 +629,10 @@ Returns:
   }\r
 \r
   //\r
-  // If the destination address is not 0, use that rather than the\r
-  // image address as the relocation target.\r
+  // Use DestinationAddress field of ImageContext as the relocation address even if it is 0.\r
   //\r
-  if (ImageContext->DestinationAddress) {\r
-    BaseAddress = ImageContext->DestinationAddress;\r
-  } else {\r
-    BaseAddress = ImageContext->ImageAddress;\r
-  }\r
-\r
+  BaseAddress = ImageContext->DestinationAddress;\r
+  \r
   if (!(ImageContext->IsTeImage)) {\r
     PeHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)((UINTN)ImageContext->ImageAddress + \r
                                             ImageContext->PeCoffHeaderOffset);\r
@@ -777,9 +780,11 @@ Returns:
       default:\r
         switch (MachineType) {\r
         case EFI_IMAGE_MACHINE_IA32:\r
-        case EFI_IMAGE_MACHINE_ARMT:\r
           Status = PeCoffLoaderRelocateIa32Image (Reloc, Fixup, &FixupData, Adjust);\r
           break;\r
+        case EFI_IMAGE_MACHINE_ARMT:\r
+          Status = PeCoffLoaderRelocateArmImage (&Reloc, Fixup, &FixupData, Adjust);\r
+          break;\r
         case EFI_IMAGE_MACHINE_X64:\r
           Status = PeCoffLoaderRelocateX64Image (Reloc, Fixup, &FixupData, Adjust);\r
           break;\r