NAME

ELF::Writer::Section - Object representing the fields of one section in an ELF file.

VERSION

version 0.011

ATTRIBUTES (header fields)

The following are elf section header fields:

name

Pointer to name of this section within the Strings table. (.shstrtab)

TODO: auto-generate the string table if this is set to anything other than a number.

type, type_sym

Type of this section. A 32-bit number, or one of: "null" (or undef), "progbits", "symtab", "strtab", "rela", "hash", "dynamic", "note", "nobits", "rel", "shlib", "dynsym", "num".

flags

32-bit flags. Use the attributes below to access known flag bits.

flag_write

Read/write accessor for write bit of flags

flag_alloc

Read/write accesor for alloc bit of flags

flag_execinstr

Read/write accessor for execinstr bit of flags

addr

The address in the process's memory where this section gets loaded, or zero if it doesn't.

offset

Location within the ELF file where this section is located.

size

Size (in bytes) of the section within the ELF file. If the type of the section is 'nobits' then this field is ignored and the section does not occupy bytes of the ELF file.

Reference to another section, as an index into the section table. Meaning depends on section type.

info

Extra info, depending on section type.

addralign

Required alignment for the "addr" field. Addr must be a multiple of this value. Values 0 and 1 both mean no alignment is required.

entsize

If the section holds a table of fixed-size entries, this is the size of each entry. Set to 0 otherwise.

ATTRIBUTES (user)

data

The data bytes of this section

data_start

Use this attribute to introduce padding between the start of the section and the offset where your 'data' should be written. This is mainly of use for segments, but provided on sections for symmetry.

data_offset

Read-only sum of "offset" and "data_start". This is the file offset at which your data scalar (if provided) will be written to the file.

METHODS

new

standard Moo constructor. Pass any attributes, *including* the flag aliases.

coerce

$class->coerce($thing)

Returns $thing if it is an instance of $class, or passes $thing to the constructor otherwise.

clone

Clone this instance.

AUTHOR

Michael Conrad <mike@nrdvana.net>

COPYRIGHT AND LICENSE

This software is copyright (c) 2017 by Michael Conrad.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.