class ELF

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:

Defined in:

codegen/obj/elf.cr

Constant Summary

MAGIC = UInt8.slice(127, 'E'.ord, 'L'.ord, 'F'.ord)

Constructors

Instance Method Summary

Constructor Detail

def self.new(io : IO) #

[View source]

Instance Method Detail

def ehsize : UInt16 #

def ehsize=(ehsize : UInt16) #

[View source]
def ehsize? : UInt16 | Nil #

def entry : UInt32 | UInt64 #

def entry=(entry : UInt32 | UInt64) #

[View source]
def entry? : UInt32 | UInt64 | Nil #

def flags : UInt32 #

def flags=(flags : UInt32) #

[View source]
def flags? : UInt32 | Nil #

def ident : Ident #

[View source]
def ident? : Ident | Nil #

[View source]
def machine : Machine #

def machine=(machine : Machine) #

[View source]
def machine? : Machine | Nil #

def phentsize : UInt16 #

def phentsize=(phentsize : UInt16) #

[View source]
def phentsize? : UInt16 | Nil #

def phnum : UInt16 #

def phnum=(phnum : UInt16) #

[View source]
def phnum? : UInt16 | Nil #

def phoff : UInt32 | UInt64 #

def phoff=(phoff : UInt32 | UInt64) #

[View source]
def phoff? : UInt32 | UInt64 | Nil #

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.


[View source]
def section_headers #

Parses and returns an Array of SectionHeader.


[View source]
def sh_name(index) #

Returns the name of a section, using the SectionHeader#name index.


[View source]
def shentsize : UInt16 #

def shentsize=(shentsize : UInt16) #

[View source]
def shentsize? : UInt16 | Nil #

def shnum : UInt16 #

def shnum=(shnum : UInt16) #

[View source]
def shnum? : UInt16 | Nil #

def shoff : UInt32 | UInt64 #

def shoff=(shoff : UInt32 | UInt64) #

[View source]
def shoff? : UInt32 | UInt64 | Nil #

def shstrndx : UInt16 #

def shstrndx=(shstrndx : UInt16) #

[View source]
def shstrndx? : UInt16 | Nil #

def to_s(io) #

[View source]
def type : Type #

def type=(type : Type) #

[View source]
def type? : Type | Nil #

def version : UInt32 #

def version=(version : UInt32) #

[View source]
def version? : UInt32 | Nil #