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(
get_option('efi') and
get_option('bootloader') in ['auto', 'true'] and
efi_arch != '' and
- python_39 and
have_pyelftools,
)
def __init__(self, PageRVA: int):
super().__init__(PageRVA)
- self.entries: list[PeRelocationEntry] = []
+ self.entries: typing.List[PeRelocationEntry] = []
class PeRelocationEntry(LittleEndianStructure):
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():
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] = [
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"],
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:
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}.")
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)