build: Fixup .text section flags using objcopy and assert in pefixup.

This commit is contained in:
Rémi Bernon 2022-02-15 17:20:52 +01:00 committed by Arkadiusz Hiler
parent 47fe4a8063
commit 88064f86ee
2 changed files with 4 additions and 4 deletions

View file

@ -10,7 +10,7 @@ for path in sys.argv[1:]:
for section in pe.sections:
if section.Name.decode("utf-8")[0:5] == ".text":
section.Characteristics &= ~pefile.SECTION_CHARACTERISTICS['IMAGE_SCN_CNT_INITIALIZED_DATA']
assert not (section.Characteristics & pefile.SECTION_CHARACTERISTICS['IMAGE_SCN_CNT_INITIALIZED_DATA'])
assert not (section.Characteristics & pefile.SECTION_CHARACTERISTICS['IMAGE_SCN_ALIGN_MASK'])
pe.OPTIONAL_HEADER.CheckSum = pe.generate_checksum()