asmjit::Section Class Reference

Section entry.

Public Members

Public Types

Member Functions

Accessors

Member Enumeration Documentation

Section::Flags : uint32_tenum

Section flags.

ConstantDescription
kFlagExec 

Executable (.text sections).

kFlagConst 

Read-only (.text and .data sections).

kFlagZero 

Zero initialized by the loader (BSS).

kFlagInfo 

Info / comment flag.

kFlagImplicit 

Section created implicitly and can be deleted by Target.

Member Function Documentation

uint32_t Section::id() constnoexcept

Returns the section id.

const char* Section::name() constnoexcept

Returns the section name, as a null terminated string.

uint8_t* Section::data()noexcept[1/2]

Returns the section data.

const uint8_t* Section::data() constnoexcept[2/2]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

uint32_t Section::flags() constnoexcept

Returns the section flags, see Flags.

bool Section::hasFlag(uint32_t flag) constnoexcept

Tests whether the section has the given flag.

void Section::addFlags(uint32_t flags)noexcept

Adds flags to the section flags.

void Section::clearFlags(uint32_t flags)noexcept

Removes flags from the section flags.

uint32_t Section::alignment() constnoexcept

Returns the minimum section alignment.

void Section::setAlignment(uint32_t alignment)noexcept

Sets the minimum section alignment.

int32_t Section::order() constnoexcept

Returns the section order, which has a higher priority than section id.

uint64_t Section::offset() constnoexcept

Returns the section offset, relative to base.

void Section::setOffset(uint64_t offset)noexcept

Set the section offset.

uint64_t Section::virtualSize() constnoexcept

Returns the virtual size of the section.

Virtual size is initially zero and is never changed by AsmJit. It's normal if virtual size is smaller than size returned by bufferSize() as the buffer stores real data emitted by assemblers or appended by users.

Use realSize() to get the real and final size of this section.

void Section::setVirtualSize(uint64_t virtualSize)noexcept

Sets the virtual size of the section.

size_t Section::bufferSize() constnoexcept

Returns the buffer size of the section.

uint64_t Section::realSize() constnoexcept

Returns the real size of the section calculated from virtual and buffer sizes.

CodeBuffer& Section::buffer()noexcept[1/2]

Returns the CodeBuffer used by this section.

const CodeBuffer& Section::buffer() constnoexcept[2/2]

Returns the CodeBuffer used by this section (const).

Member Data Documentation

uint32_t Section::_id

Section id.

uint32_t Section::_flags

Section flags.

uint32_t Section::_alignment

Section alignment requirements (0 if no requirements).

int32_t Section::_order

Order (lower value means higher priority).

uint64_t Section::_offset

Offset of this section from base-address.

uint64_t Section::_virtualSize

Virtual size of the section (zero initialized sections).

FixedString<Globals::kMaxSectionNameSize + 1>Section::_name

Section name (max 35 characters, PE allows max 8).

CodeBuffer Section::_buffer

Code or data buffer.