LIEF: Library to Instrument Executable Formats Version 0.17.0
Loading...
Searching...
No Matches
LIEF::assembly::AssemblerConfig Class Reference

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

#include <AssemblerConfig.hpp>

Public Types

enum class  DIALECT { DEFAULT_DIALECT = 0 , X86_INTEL , X86_ATT }
 The different supported dialects. More...
 

Public Member Functions

 AssemblerConfig ()=default
 
 AssemblerConfig (const AssemblerConfig &)=default
 
AssemblerConfigoperator= (const AssemblerConfig &)=default
 
 AssemblerConfig (AssemblerConfig &&)=default
 
AssemblerConfigoperator= (AssemblerConfig &&)=default
 
virtual optional< uint64_t > resolve_symbol (const std::string &)
 This function aims to be overloaded in order to resolve symbols used in the assembly listing.
 
virtual ~AssemblerConfig ()=default
 

Static Public Member Functions

static AssemblerConfigdefault_config ()
 Default configuration.
 

Public Attributes

DIALECT dialect = DIALECT::DEFAULT_DIALECT
 The dialect of the input assembly code.
 

Detailed Description

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

Member Enumeration Documentation

◆ DIALECT

The different supported dialects.

Enumerator
DEFAULT_DIALECT 
X86_INTEL 

Intel syntax.

X86_ATT 

AT&T syntax.

Constructor & Destructor Documentation

◆ AssemblerConfig() [1/3]

LIEF::assembly::AssemblerConfig::AssemblerConfig ( )
default

◆ AssemblerConfig() [2/3]

LIEF::assembly::AssemblerConfig::AssemblerConfig ( const AssemblerConfig & )
default

◆ AssemblerConfig() [3/3]

LIEF::assembly::AssemblerConfig::AssemblerConfig ( AssemblerConfig && )
default

◆ ~AssemblerConfig()

virtual LIEF::assembly::AssemblerConfig::~AssemblerConfig ( )
virtualdefault

Member Function Documentation

◆ default_config()

static AssemblerConfig & LIEF::assembly::AssemblerConfig::default_config ( )
inlinestatic

Default configuration.

◆ operator=() [1/2]

AssemblerConfig & LIEF::assembly::AssemblerConfig::operator= ( AssemblerConfig && )
default

◆ operator=() [2/2]

AssemblerConfig & LIEF::assembly::AssemblerConfig::operator= ( const AssemblerConfig & )
default

◆ resolve_symbol()

virtual optional< uint64_t > LIEF::assembly::AssemblerConfig::resolve_symbol ( const std::string & )
inlinevirtual

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 : public AssemblerConfig {
public:
optional<uint64_t> resolve_symbol(const std::string& name) {
if (name == "_my_function") {
return 0x4000;
}
return nullopt(); // or AssemblerConfig::resolve_symbol(name)
}
};
virtual optional< uint64_t > resolve_symbol(const std::string &)
This function aims to be overloaded in order to resolve symbols used in the assembly listing.
Definition AssemblerConfig.hpp:82
tl::unexpected< lief_errors > nullopt()
Definition optional.hpp:36

References LIEF::nullopt().

Member Data Documentation

◆ dialect

DIALECT LIEF::assembly::AssemblerConfig::dialect = DIALECT::DEFAULT_DIALECT

The dialect of the input assembly code.


The documentation for this class was generated from the following file: