From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (using TLSv1 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 3EE5C1A1DF8 for ; Mon, 22 Aug 2016 00:43:15 -0700 (PDT) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 22 Aug 2016 00:43:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,558,1464678000"; d="scan'208";a="1045220429" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga002.fm.intel.com with ESMTP; 22 Aug 2016 00:43:15 -0700 Received: from fmsmsx156.amr.corp.intel.com (10.18.116.74) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 22 Aug 2016 00:43:14 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by fmsmsx156.amr.corp.intel.com (10.18.116.74) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 22 Aug 2016 00:43:14 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.181]) by shsmsx102.ccr.corp.intel.com ([169.254.2.147]) with mapi id 14.03.0248.002; Mon, 22 Aug 2016 15:43:12 +0800 From: "Zhu, Yonghong" To: "Gao, Liming" , "edk2-devel@lists.01.org" CC: Ard Biesheuvel , "Zhu, Yonghong" Thread-Topic: [Patch] BaseTools PeCoffLib: Fix the issue to get RelocationsStripped from TE image Thread-Index: AQHR/CKVvUKRuVs9p0mrfUr8PawcqKBUmU4A Date: Mon, 22 Aug 2016 07:43:12 +0000 Message-ID: References: <1471835341-25516-1-git-send-email-liming.gao@intel.com> In-Reply-To: <1471835341-25516-1-git-send-email-liming.gao@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch] BaseTools PeCoffLib: Fix the issue to get RelocationsStripped from TE image X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Aug 2016 07:43:15 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Yonghong Zhu =20 Best Regards, Zhu Yonghong -----Original Message----- From: Gao, Liming=20 Sent: Monday, August 22, 2016 11:09 AM To: edk2-devel@lists.01.org Cc: Ard Biesheuvel ; Zhu, Yonghong Subject: [Patch] BaseTools PeCoffLib: Fix the issue to get RelocationsStrip= ped from TE image If PE image has no relocation section, and has not set RELOCS_STRIPPED, aft= er it is converted to TE image, GenFw will set its relocation section Virtu= alAddress to non-zero address, and keep Size value as Zero. MdePkg BasePeCo= ffLib applied this rule to get RelocationsStripped attribute. But, it is mi= ssing in BaseTools BasePeCoffLib. Cc: Ard Biesheuvel Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Liming Gao --- BaseTools/Source/C/Common/BasePeCoff.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BaseTools/Source/C/Common/BasePeCoff.c b/BaseTools/Source/C/Co= mmon/BasePeCoff.c index 9652557..d0cc1af 100644 --- a/BaseTools/Source/C/Common/BasePeCoff.c +++ b/BaseTools/Source/C/Common/BasePeCoff.c @@ -2,7 +2,7 @@ =20 Functions to get info and load PE/COFF image. =20 -Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.
Portions Copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.
This program and the accompanying materials =20 are licensed and made available under the terms and conditions of the BSD = License =20 @@ -336,7 +336,7 @@ Returns: // if ((!(ImageContext->IsTeImage)) && ((PeHdr->Pe32.FileHeader.Characteris= tics & EFI_IMAGE_FILE_RELOCS_STRIPPED) !=3D 0)) { ImageContext->RelocationsStripped =3D TRUE; - } else if ((ImageContext->IsTeImage) && (TeHdr->DataDirectory[0].Size = =3D=3D 0)) { + } else if ((ImageContext->IsTeImage) && (TeHdr->DataDirectory[0].Size=20 + =3D=3D 0) && (TeHdr->DataDirectory[0].VirtualAddress =3D=3D 0)) { ImageContext->RelocationsStripped =3D TRUE; } else { ImageContext->RelocationsStripped =3D FALSE; -- 2.8.0.windows.1