diff --git a/meson.build b/meson.build index f8af69911b9..395eca1943c 100644 --- a/meson.build +++ b/meson.build @@ -2143,8 +2143,8 @@ if efi_arch == 'x64' and cc.links(''' endif have_pyelftools = pymod.find_installation('python3', required : false, modules : ['elftools']).found() -if get_option('bootloader') == 'true' and (not python_39 or not have_pyelftools) - error('EFI bootloader support requires Python >= 3.9 and pyelftools.') +if get_option('bootloader') == 'true' and not have_pyelftools + error('EFI bootloader support requires pyelftools.') endif conf.set10( @@ -2152,7 +2152,6 @@ conf.set10( get_option('efi') and get_option('bootloader') in ['auto', 'true'] and efi_arch != '' and - python_39 and have_pyelftools, ) diff --git a/tools/elf2efi.py b/tools/elf2efi.py index 20d25321c4d..e233c8e3aba 100755 --- a/tools/elf2efi.py +++ b/tools/elf2efi.py @@ -80,7 +80,7 @@ class PeRelocationBlock(LittleEndianStructure): def __init__(self, PageRVA: int): super().__init__(PageRVA) - self.entries: list[PeRelocationEntry] = [] + self.entries: typing.List[PeRelocationEntry] = [] class PeRelocationEntry(LittleEndianStructure): @@ -281,7 +281,7 @@ def convert_elf_section(elf_s: ELFSection) -> PeSection: return pe_s -def copy_sections(elf: ELFFile, opt: PeOptionalHeader) -> list[PeSection]: +def copy_sections(elf: ELFFile, opt: PeOptionalHeader) -> typing.List[PeSection]: sections = [] for elf_s in elf.iter_sections(): @@ -304,7 +304,7 @@ def copy_sections(elf: ELFFile, opt: PeOptionalHeader) -> list[PeSection]: def apply_elf_relative_relocation( - reloc: ElfRelocation, image_base: int, sections: list[PeSection], addend_size: int + reloc: ElfRelocation, image_base: int, sections: typing.List[PeSection], addend_size: int ): # fmt: off [target] = [ @@ -330,8 +330,8 @@ def convert_elf_reloc_table( elf: ELFFile, elf_reloc_table: ElfRelocationTable, image_base: int, - sections: list[PeSection], - pe_reloc_blocks: dict[int, PeRelocationBlock], + sections: typing.List[PeSection], + pe_reloc_blocks: typing.Dict[int, PeRelocationBlock], ): NONE_RELOC = { "EM_386": ENUM_RELOC_TYPE_i386["R_386_NONE"], @@ -377,7 +377,7 @@ def convert_elf_reloc_table( def convert_elf_relocations( - elf: ELFFile, opt: PeOptionalHeader, sections: list[PeSection] + elf: ELFFile, opt: PeOptionalHeader, sections: typing.List[PeSection] ) -> typing.Optional[PeSection]: dynamic = elf.get_section_by_name(".dynamic") if dynamic is None: @@ -387,7 +387,7 @@ def convert_elf_relocations( if not flags_tag["d_val"] & ENUM_DT_FLAGS_1["DF_1_PIE"]: raise RuntimeError("ELF file is not a PIE.") - pe_reloc_blocks: dict[int, PeRelocationBlock] = {} + pe_reloc_blocks: typing.Dict[int, PeRelocationBlock] = {} for reloc_type, reloc_table in dynamic.get_relocation_tables().items(): if reloc_type not in ["REL", "RELA"]: raise RuntimeError("Unsupported relocation type {elf_reloc_type}.") @@ -433,7 +433,7 @@ def convert_elf_relocations( def write_pe( - file, coff: PeCoffHeader, opt: PeOptionalHeader, sections: list[PeSection] + file, coff: PeCoffHeader, opt: PeOptionalHeader, sections: typing.List[PeSection] ): file.write(b"MZ") file.seek(0x3C, io.SEEK_SET)