From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.65; helo=mga03.intel.com; envelope-from=liming.gao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 2E31F2034D8C5 for ; Sun, 25 Feb 2018 21:45:54 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Feb 2018 21:51:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,396,1515484800"; d="scan'208";a="20285541" Received: from shwde7172.ccr.corp.intel.com ([10.239.9.15]) by orsmga007.jf.intel.com with ESMTP; 25 Feb 2018 21:51:58 -0800 From: Liming Gao To: edk2-devel@lists.01.org Date: Mon, 26 Feb 2018 13:51:44 +0800 Message-Id: <1519624304-1544-1-git-send-email-liming.gao@intel.com> X-Mailer: git-send-email 2.8.0.windows.1 Subject: [Patch] BaseTools: Update GenFw to correct DebugEntry Offset when convert XIP image X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Feb 2018 05:45:55 -0000 DebugEntry FileOffset is required to be updated to the virtual address if the input image is converted to XIP image. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao --- BaseTools/Source/C/GenFw/GenFw.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/BaseTools/Source/C/GenFw/GenFw.c b/BaseTools/Source/C/GenFw/GenFw.c index 33ba917..00c9ff3 100644 --- a/BaseTools/Source/C/GenFw/GenFw.c +++ b/BaseTools/Source/C/GenFw/GenFw.c @@ -92,6 +92,7 @@ CHAR8 *mInImageName; UINT32 mImageTimeStamp = 0; UINT32 mImageSize = 0; UINT32 mOutImageType = FW_DUMMY_IMAGE; +BOOLEAN mIsConvertXip = FALSE; STATIC @@ -665,6 +666,8 @@ PeCoffConvertImageToXip ( free (*FileBuffer); *FileLength = XipLength; *FileBuffer = XipFile; + + mIsConvertXip = TRUE; } UINT8 * @@ -2897,6 +2900,9 @@ Returns: Index = 0; for (Index=0; Index < DebugDirectoryEntrySize / sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY); Index ++, DebugEntry ++) { DebugEntry->TimeDateStamp = 0; + if (mIsConvertXip) { + DebugEntry->FileOffset = DebugEntry->RVA; + } if (ZeroDebugFlag || DebugEntry->Type != EFI_IMAGE_DEBUG_TYPE_CODEVIEW) { memset (FileBuffer + DebugEntry->FileOffset, 0, DebugEntry->SizeOfData); memset (DebugEntry, 0, sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY)); -- 2.8.0.windows.1