Python

AssemblerConfig

class lief.assembly.AssemblerConfig(self)

Bases: object

This class exposes the different elements that can be configured to assemble code.

class DIALECT(value)

Bases: Enum

The different supported dialects

DEFAULT_DIALECT = 0
X86_ATT = 2
X86_INTEL = 1
default_config lief.assembly.AssemblerConfig = <nanobind.nb_func object>
property dialect lief.assembly.AssemblerConfig.DIALECT

The dialect of the input assembly code

resolve_symbol(self, name: str) int | None

This function aims to be overloaded in order to resolve symbols used in the assembly listing.

For instance, given this assembly code:

0x1000: mov rdi, rbx
0x1003: call _my_function

The function _my_function will remain undefined unless we return its address in resolve_symbol():

class MyConfig(lief.assembly.AssemblerConfig):
    def __init__(self):
        super().__init__() # This is important

    @override
    def resolve_symbol(self, name: str) -> int | None:
        if name == '_my_function':
            return 0x4000
        return None # Or super().resolve_symbol(name)