NAME
ELF::Writer::Segment - Object representing the fields of one program segment in an ELF file.
VERSION
version 0.011
ATTRIBUTES (header fields)
The following are elf program header fields:
type, type_sym
Type of segment: "null"
(or undef
), "load"
, "dynamic"
, "interp"
, "note"
, "shlib"
, or "phdr"
. Defaults to "load"
.
offset
Offset of this segment within the elf file
virt_addr
Address where this segment should be memory-mapped
phys_addr
Address where this segment should be loaded
filesize, size
Size of the segment within the elf file
memsize
Size of the segment after loaded into memory
flags
32-bit flags. Use the accessors below to access the defined bits. Defaults to readable and executable.
flag_readable
Read/write the readable
bit of flags
flag_writable
Read/write the writable
bit of flags
flag_executable
Read/write the executable
bit of flags.
align
Page size, for both the file and when loaded into memory (I think?)
ATTRIBUTES (user)
data
The payload of this segment (machine code, or etc)
data_start
Used for auto-aligning segments within the elf file. This is the number of bytes in the file which should come between "offset" and your data. Typical use of this feature is to have the first segment start at offset 0 and include the elf header, with data starting somehwere beyond it. If this is zero (or just less than the size of your elf header) then nearly a whole page will be wasted within the file as it aligns the start of the data to a page boundary.
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 bit 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.