From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mx.groups.io with SMTP id smtpd.web11.6077.1600774078344557922 for ; Tue, 22 Sep 2020 04:27:58 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.24, mailfrom: bob.c.feng@intel.com) IronPort-SDR: VcGW3PpkLU3zLJ/J3fpXIZCNnuXSDVuPgIVb+0vLt4OyewPehSMvAWA6aYwNXyyaevV4A0xXZ5 0ToLnCwhdIsA== X-IronPort-AV: E=McAfee;i="6000,8403,9751"; a="161508102" X-IronPort-AV: E=Sophos;i="5.77,290,1596524400"; d="scan'208";a="161508102" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Sep 2020 04:27:57 -0700 IronPort-SDR: fdZvmL0DUS0eYaL0QRQq/9aLkc0f6OB0tuOAZjcI3DmHWZTkWWJcFw1nP61/aCgt2VClIHQGBj KQDu6HeZcT3Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,290,1596524400"; d="scan'208";a="334969086" Received: from shwdepsi1121.ccr.corp.intel.com ([10.239.158.66]) by fmsmga004.fm.intel.com with ESMTP; 22 Sep 2020 04:27:56 -0700 From: "Bob Feng" To: devel@edk2.groups.io Cc: Liming Gao , Yuwei Chen Subject: [Patch] BaseTools: Set section alignment as zero if its type is Auto Date: Tue, 22 Sep 2020 19:27:54 +0800 Message-Id: <20200922112754.36396-1-bob.c.feng@intel.com> X-Mailer: git-send-email 2.20.1.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2881 Currently, the build tool try to read the section alignment from efi file if the section alignment type is Auto. If there is no efi generated, the section alignment will be set to zero. This behavior causes the Makefile to be different between the full build and the incremental build. Since the Genffs can auto get the section alignment from efi file during Genffs procedure, the build tool can just set section alignment as zero. This change can make the autogen makefile consistent for the full build and the incremental build. Signed-off-by: Bob Feng Cc: Liming Gao Cc: Yuwei Chen --- BaseTools/Source/Python/GenFds/DataSection.py | 9 +-------- BaseTools/Source/Python/GenFds/EfiSection.py | 9 +-------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/BaseTools/Source/Python/GenFds/DataSection.py b/BaseTools/Source/Python/GenFds/DataSection.py index f20fd70225..5af3ee7b7f 100644 --- a/BaseTools/Source/Python/GenFds/DataSection.py +++ b/BaseTools/Source/Python/GenFds/DataSection.py @@ -78,18 +78,11 @@ class DataSection (DataSectionClassObject): if not os.path.exists(CopyMapFile) or (os.path.getmtime(MapFile) > os.path.getmtime(CopyMapFile)): CopyLongFilePath(MapFile, CopyMapFile) #Get PE Section alignment when align is set to AUTO if self.Alignment == 'Auto' and self.SecType in (BINARY_FILE_TYPE_TE, BINARY_FILE_TYPE_PE32): - ImageObj = PeImageClass (Filename) - if ImageObj.SectionAlignment < 0x400: - self.Alignment = str (ImageObj.SectionAlignment) - elif ImageObj.SectionAlignment < 0x100000: - self.Alignment = str (ImageObj.SectionAlignment // 0x400) + 'K' - else: - self.Alignment = str (ImageObj.SectionAlignment // 0x100000) + 'M' - + self.Alignment = "0" NoStrip = True if self.SecType in (BINARY_FILE_TYPE_TE, BINARY_FILE_TYPE_PE32): if self.KeepReloc is not None: NoStrip = self.KeepReloc diff --git a/BaseTools/Source/Python/GenFds/EfiSection.py b/BaseTools/Source/Python/GenFds/EfiSection.py index e7d4639041..fd58391dac 100644 --- a/BaseTools/Source/Python/GenFds/EfiSection.py +++ b/BaseTools/Source/Python/GenFds/EfiSection.py @@ -258,18 +258,11 @@ class EfiSection (EfiSectionClassObject): OutputFile = os.path.join( OutputPath, ModuleName + SUP_MODULE_SEC + Num + SectionSuffix.get(SectionType)) File = GenFdsGlobalVariable.MacroExtend(File, Dict) #Get PE Section alignment when align is set to AUTO if self.Alignment == 'Auto' and (SectionType == BINARY_FILE_TYPE_PE32 or SectionType == BINARY_FILE_TYPE_TE): - ImageObj = PeImageClass (File) - if ImageObj.SectionAlignment < 0x400: - Align = str (ImageObj.SectionAlignment) - elif ImageObj.SectionAlignment < 0x100000: - Align = str (ImageObj.SectionAlignment // 0x400) + 'K' - else: - Align = str (ImageObj.SectionAlignment // 0x100000) + 'M' - + Align = "0" if File[(len(File)-4):] == '.efi' and FfsInf.InfModule.BaseName == os.path.basename(File)[:-4]: MapFile = File.replace('.efi', '.map') CopyMapFile = os.path.join(OutputPath, ModuleName + '.map') if IsMakefile: if GenFdsGlobalVariable.CopyList == []: -- 2.20.1.windows.1