model.py
ofrak_patch_maker.toolchain.model
BinFileType (Enum)
Enums for file types
CStandardVersion (Enum)
An enumeration.
CompilerOptimizationLevel (Enum)
Some compilers implement different optimization options. This Enum
enables us to handle
those distinctly.
LinkerOptimizationLevel (Enum)
Todo
Experiment with this
Segment
dataclass
Describes a program segment.
Attributes:
Name | Type | Description |
---|---|---|
segment_name |
str |
e.g. |
vm_address |
int |
where the segment is located |
offset |
int |
offset from |
is_entry |
bool |
If the |
length |
int |
size of the segment in bytes |
access_perms |
MemoryPermissions |
|
ToolchainConfig
dataclass
A dataclass
that describes all of the parameters toolchains may be configured with.
As further Toolchain support is added, not all of these may be relevant to all toolchains.
It is expected the functionality described by the parameter will be achieved to the best effort.
Attributes:
Name | Type | Description |
---|---|---|
file_format |
BinFileType |
Usually ELF |
force_inlines |
bool |
forces inlines when specified in the function signature |
relocatable |
bool |
Enables PC-relative data references, branches, etc. (via |
no_std_lib |
bool |
Excludes the host system root from include paths |
no_jump_tables |
bool |
Prevents the generation of jump tables |
no_bss_section |
bool |
Forces usage of |
compiler_optimization_level |
CompilerOptimizationLevel |
|
compiler_target |
Optional[str] |
Forces specific triple (CPU/ARCH) target-- should match |
assembler_target |
Optional[str] |
Forces specific assembler CPU/ARCH target |
create_map_files |
bool |
Creates |
debug_info |
bool |
Should most closely mirror GNU |
check_overlap |
bool |
Enables the Toolchain Linker to assert memory boundaries (Default: |
userspace_dynamic_linker |
Optional[str] |
Signals compilation for userspace and libc usage. |
isysroot |
Optional[str] |
Specifies the root directory for header files |
c_standard |
Optional[ofrak_patch_maker.toolchain.model.CStandardVersion] |
Specifies the version of C to use, e.g. C89, C99, etc |
separate_data_sections |
bool |
Whether to put each data object in a separate section in .o file |
include_subsections |
bool |
In addition to normal keep sections, keep "sub"-sections sharing name prefix e.g. .text.foo (this flag is treated as True if separate_data_sections is True) |
hard_float |
bool |
Compile with support for hardware floating point operations (Default: |