class ELF
- ELF
- Reference
- Object
Overview
ELF (Executable and Linkable Format) is a standard file format for object files.
This code was adapted from Crystal's internal ELF reader.
References:
- http://www.sco.com/developers/gabi/latest/contents.html
- https://lwn.net/Articles/631631/
- https://linuxhint.com/understanding_elf_file_format/
- https://www.conradk.com/codebase/2017/05/28/elf-from-scratch/
- http://www.skyfree.org/linux/references/ELF_Format.pdf
Defined in:
codegen/obj/elf.crConstant Summary
-
MAGIC =
UInt8.slice(127, 'E'.ord, 'L'.ord, 'F'.ord)
Constructors
Instance Method Summary
- #ehsize : UInt16
- #ehsize=(ehsize : UInt16)
- #ehsize? : UInt16 | Nil
- #entry : UInt32 | UInt64
- #entry=(entry : UInt32 | UInt64)
- #entry? : UInt32 | UInt64 | Nil
- #flags : UInt32
- #flags=(flags : UInt32)
- #flags? : UInt32 | Nil
- #ident : Ident
- #ident? : Ident | Nil
- #machine : Machine
- #machine=(machine : Machine)
- #machine? : Machine | Nil
- #phentsize : UInt16
- #phentsize=(phentsize : UInt16)
- #phentsize? : UInt16 | Nil
- #phnum : UInt16
- #phnum=(phnum : UInt16)
- #phnum? : UInt16 | Nil
- #phoff : UInt32 | UInt64
- #phoff=(phoff : UInt32 | UInt64)
- #phoff? : UInt32 | UInt64 | Nil
-
#read_section?(name : String, &)
Searches for a section then yield the
SectionHeader
and the IO object ready for parsing if the section was found. -
#section_headers
Parses and returns an Array of
SectionHeader
. -
#sh_name(index)
Returns the name of a section, using the
SectionHeader#name
index. - #shentsize : UInt16
- #shentsize=(shentsize : UInt16)
- #shentsize? : UInt16 | Nil
- #shnum : UInt16
- #shnum=(shnum : UInt16)
- #shnum? : UInt16 | Nil
- #shoff : UInt32 | UInt64
- #shoff=(shoff : UInt32 | UInt64)
- #shoff? : UInt32 | UInt64 | Nil
- #shstrndx : UInt16
- #shstrndx=(shstrndx : UInt16)
- #shstrndx? : UInt16 | Nil
- #to_s(io)
- #type : Type
- #type=(type : Type)
- #type? : Type | Nil
- #version : UInt32
- #version=(version : UInt32)
- #version? : UInt32 | Nil
Constructor Detail
Instance Method Detail
def read_section?(name : String, &)
#
Searches for a section then yield the SectionHeader
and the IO object
ready for parsing if the section was found. Returns the value returned by
the block or nil if the section wasn't found.