summaryrefslogtreecommitdiff
path: root/BaseTools/Source/C/Common/PeCoffLoaderEx.c
diff options
context:
space:
mode:
authorLiming Gao <liming.gao@intel.com>2013-08-23 02:18:16 +0000
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2013-08-23 02:18:16 +0000
commit4afd3d042215afe68d00b9ab8c32f063a3a1c03f (patch)
treeb5190bd11547ac22fe35eeceee85ef42bfe6eea5 /BaseTools/Source/C/Common/PeCoffLoaderEx.c
parenta365eed476687881ce0ed49af7d483fd3cb0c491 (diff)
downloadedk2-platforms-4afd3d042215afe68d00b9ab8c32f063a3a1c03f.tar.xz
Sync BaseTool trunk (version r2599) into EDKII BaseTools.
Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Heshen Chen <chen.heshen@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14591 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools/Source/C/Common/PeCoffLoaderEx.c')
-rw-r--r--BaseTools/Source/C/Common/PeCoffLoaderEx.c44
1 files changed, 43 insertions, 1 deletions
diff --git a/BaseTools/Source/C/Common/PeCoffLoaderEx.c b/BaseTools/Source/C/Common/PeCoffLoaderEx.c
index 2afd441845..8d6b3961f5 100644
--- a/BaseTools/Source/C/Common/PeCoffLoaderEx.c
+++ b/BaseTools/Source/C/Common/PeCoffLoaderEx.c
@@ -1,6 +1,7 @@
/** @file
Copyright (c) 2004 - 2008, Intel Corporation. All rights reserved.<BR>
+Portions Copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -15,7 +16,7 @@ Module Name:
Abstract:
- IA32, X64 and IPF Specific relocation fixups
+ IA32, X64, IPF, ARM and AArch64 Specific relocation fixups
Revision History
@@ -25,6 +26,7 @@ Revision History
#include <IndustryStandard/PeImage.h>
#include "PeCoffLib.h"
#include "CommonLib.h"
+#include "EfiUtilityMsgs.h"
#define EXT_IMM64(Value, Address, Size, InstPos, ValPos) \
@@ -472,3 +474,43 @@ PeCoffLoaderRelocateArmImage (
return RETURN_SUCCESS;
}
+
+RETURN_STATUS
+PeCoffLoaderRelocateAArch64Image (
+ IN UINT16 *Reloc,
+ IN OUT CHAR8 *Fixup,
+ IN OUT CHAR8 **FixupData,
+ IN UINT64 Adjust
+ )
+/**
+ Performs an AArch64 specific relocation fixup
+
+ @param Reloc Pointer to the relocation record
+ @param Fixup Pointer to the address to fix up
+ @param FixupData Pointer to a buffer to log the fixups
+ @param Adjust The offset to adjust the fixup
+
+ @retval RETURN_SUCCESS Success to perform relocation
+ @retval RETURN_UNSUPPORTED Unsupported.
+**/
+{
+ UINT64 *F64;
+
+ switch ((*Reloc) >> 12) {
+
+ case EFI_IMAGE_REL_BASED_DIR64:
+ F64 = (UINT64 *) Fixup;
+ *F64 = *F64 + (UINT64) Adjust;
+ if (*FixupData != NULL) {
+ *FixupData = ALIGN_POINTER(*FixupData, sizeof(UINT64));
+ *(UINT64 *)(*FixupData) = *F64;
+ *FixupData = *FixupData + sizeof(UINT64);
+ }
+ break;
+
+ default:
+ return RETURN_UNSUPPORTED;
+ }
+
+ return RETURN_SUCCESS;
+}