gnu_aarch64.py
ofrak_patch_maker.toolchain.gnu_aarch64
GNU_AARCH64_LINUX_10_Toolchain (GNU_10_Toolchain)
name: str
property
readonly
Returns:
Type | Description |
---|---|
str |
name property that matches the value used in |
segment_alignment: int
property
readonly
For example, x86 returns 16. This will most often be used when programmatically allocating memory for code/data.
Returns:
Type | Description |
---|---|
int |
required alignment factor for the toolchain/ISA |
ld_generate_placeholder_reloc_sections(self)
GCC generates these sections for relocatable binaries even if they are completely unnecessary.
They don't seem to make it into the final executable, so there should be no risk of injecting them inadvertently.
Todo
No clear way to get size, so way overestimate.
Source code in ofrak_patch_maker/toolchain/gnu_aarch64.py
def ld_generate_placeholder_reloc_sections(self):
regions, sections = super().ld_generate_placeholder_reloc_sections()
(
got_region,
got_name,
) = self._ld_generate_got_region(0xDEADBEEF + 0x30000, 0x1000)
regions.append(got_region)
sections.append(self._ld_generate_got_section(got_name))
return regions, sections
_get_assembler_target(self, processor)
private
Red Balloon Security strongly recommends all users provide their specific hardware target for best results.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
processor |
ArchInfo |
required |
Returns:
Type | Description |
---|---|
a default assembler target for the provided processor unless one is provided in |
Exceptions:
Type | Description |
---|---|
PatchMakerException |
if no target provided and program attributes do not correspond to a default value. |
Source code in ofrak_patch_maker/toolchain/gnu_aarch64.py
def _get_assembler_target(self, processor: ArchInfo):
if processor.isa is not InstructionSet.AARCH64:
raise ValueError(
f"The GNU AARCH64 toolchain does not support ISAs which are not AARCH64; "
f"given ISA {processor.isa.name}"
)
if processor.sub_isa is not None:
return processor.sub_isa.value.lower()
return SubInstructionSet.ARMv8A.value.lower()