* [Patch] BaseTools: Set section alignment as zero if its type is Auto
@ 2020-09-22 11:27 Bob Feng
2020-09-24 3:04 ` 回复: [edk2-devel] " gaoliming
2020-09-24 5:19 ` Yuwei Chen
0 siblings, 2 replies; 3+ messages in thread
From: Bob Feng @ 2020-09-22 11:27 UTC (permalink / raw)
To: devel; +Cc: Liming Gao, Yuwei Chen
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 <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
---
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* 回复: [edk2-devel] [Patch] BaseTools: Set section alignment as zero if its type is Auto
2020-09-22 11:27 [Patch] BaseTools: Set section alignment as zero if its type is Auto Bob Feng
@ 2020-09-24 3:04 ` gaoliming
2020-09-24 5:19 ` Yuwei Chen
1 sibling, 0 replies; 3+ messages in thread
From: gaoliming @ 2020-09-24 3:04 UTC (permalink / raw)
To: devel, bob.c.feng; +Cc: 'Yuwei Chen'
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
> -----邮件原件-----
> 发件人: bounce+27952+65441+4905953+8761045@groups.io
> <bounce+27952+65441+4905953+8761045@groups.io> 代表 Bob Feng
> 发送时间: 2020年9月22日 19:28
> 收件人: devel@edk2.groups.io
> 抄送: Liming Gao <gaoliming@byosoft.com.cn>; Yuwei Chen
> <yuwei.chen@intel.com>
> 主题: [edk2-devel] [Patch] BaseTools: Set section alignment as zero if its
type
> is Auto
>
> 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 <bob.c.feng@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Yuwei Chen <yuwei.chen@intel.com>
> ---
> 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
>
>
>
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Patch] BaseTools: Set section alignment as zero if its type is Auto
2020-09-22 11:27 [Patch] BaseTools: Set section alignment as zero if its type is Auto Bob Feng
2020-09-24 3:04 ` 回复: [edk2-devel] " gaoliming
@ 2020-09-24 5:19 ` Yuwei Chen
1 sibling, 0 replies; 3+ messages in thread
From: Yuwei Chen @ 2020-09-24 5:19 UTC (permalink / raw)
To: Feng, Bob C, devel@edk2.groups.io; +Cc: Liming Gao
Reviewed-by: Yuwei Chen<yuwei.chen@intel.com>
> -----Original Message-----
> From: Feng, Bob C <bob.c.feng@intel.com>
> Sent: Tuesday, September 22, 2020 7:28 PM
> To: devel@edk2.groups.io
> Cc: Liming Gao <gaoliming@byosoft.com.cn>; Chen, Christine
> <yuwei.chen@intel.com>
> Subject: [Patch] BaseTools: Set section alignment as zero if its type is Auto
>
> 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 <bob.c.feng@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Yuwei Chen <yuwei.chen@intel.com>
> ---
> 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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-09-24 5:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-22 11:27 [Patch] BaseTools: Set section alignment as zero if its type is Auto Bob Feng
2020-09-24 3:04 ` 回复: [edk2-devel] " gaoliming
2020-09-24 5:19 ` Yuwei Chen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox