Common Lisp Package: ELF

README:

FUNCTION

Public

ELF-P (FILE)

Return t if file is an ELF file (using the magic number test).

GENERIC-COPY (OBJ &OPTIONAL TRACE)

A generic copy method, may run way too long on partially circular elements.

MAPSLOTS (FUNC OBJ)

Map func over the slots of the clos object OBJ.

NAMED-SECTION (ELF NAME)

Return the section in ELF named NAME.

NAMED-SYMBOL (ELF NAME)

Return the symbol in ELF named NAME.

OBJDUMP-PARSE (OUTPUT)

Parse the output of `objdump' returning the disassembly by symbol.

PARSE-ADDRESSES (LINES)

Parse addresses from lines of objdump output.

REL-INFO (SYM TYPE)

Convert a symbol and type back into the info field of an elf-rel.

SHOW-DYNAMIC (ELF)

Show the dynamic symbols of ELF in a manner similar to readelf.

SHOW-FILE-LAYOUT (ELF)

Show the layout of the elements of an elf file with binary offset.

SHOW-MEMORY-LAYOUT (ELF)

Show the layout of the elements of an elf file with binary offset.

SHOW-SYMBOLS (ELF)

Show all symbols in ELF in a manner similar to readelf.

Undocumented

BYTES-TO-INT (BYTES &OPTIONAL SIGNED-P &AUX STEPS)

COPY-ELF (ELF)

INT-TO-BYTES (INT SIZE &OPTIONAL SIGNED-P &AUX STEPS)

READ-ELF (FILE)

WRITE-ELF (ELF FILE)

Private

DYNAMIC-ENTRY (SEC)

Return the entry in .dynamic associated with SEC.

ELF-DYN-TYPE

Return the appropriate type of dynamic symbol given the value of *CLASS*.

ELF-REL-TYPE

Return the appropriate type of elf relocation given the value of *CLASS*.

ELF-RELA-TYPE

Return type of elf relocation (w/addend) given the value of *CLASS*.

ELF-SYM-TYPE

Return the appropriate type of elf symbol given the value of *CLASS*.

EQUAL-IT (OBJ1 OBJ2 &OPTIONAL TRACE)

Equal over objects and lists.

NAME-SYMBOLS (SEC)

Assign names to the symbols contained in SEC.

PROGRAM-HEADER-FOR-SECTION (PT SEC)

Return the program header in PT associated with SEC. Note: a section may be included in multiple program headers, but for now lets just select the one with the tightest bounds on the section (in the file).

PROGRAM-HEADER-TYPE

Return the appropriate type of program header given the value of *CLASS*.

SHOW-IT (HD &KEY (OUT T))

Print the fields of a elf, section or program header. Optional argument OUT specifies an output stream.

SHOW-REL (ELF)

Print information on the symbols stored in a relocatable section. Note: the output should resemble the output of readelf -r.

Undocumented

BYTES-FROM (IN BYTES &OPTIONAL SIGNED-P)

BYTES-TO (OUT BYTES VALUE &OPTIONAL SIGNED-P)

DIFFERENT-IT (OBJ1 OBJ2 &OPTIONAL TRACE)

ELF-HEADER-SIZE

INDEXED (SEQUENCE)

MY-CLASS-SLOTS (EL)

MY-SLOT-DEFINITION-NAME (EL)

SHELL (COMMAND)

TEMP-FILE-NAME

TEMPNAM (DIR PREFIX)

TRIM (STR &KEY (CHARS '( )))

MACRO

Private

WITH-TEMP-FILE (FILE &REST BODY)

SPEC is the variable used to reference the file w/optional extension. After BODY is executed the temporary file is removed.

Undocumented

DEFINE-ELF-DICTIONARY (NAME NUM DICTIONARY &KEY (SIGNED NIL) (CLASS-DEPENDENT NIL))

GENERIC-FUNCTION

Public

READ-VALUE (TYPE STREAM &KEY CHARACTER-TYPE LENGTH BYTES SWAP TERMINATOR BYTES BITS-PER-BYTE)

Read a value of the given type from the stream.

WRITE-VALUE (TYPE STREAM VALUE &KEY CHARACTER-TYPE LENGTH BYTES SWAP TERMINATOR BYTES BITS-PER-BYTE)

Write a value as the given type to the stream.

Undocumented

ALIGNMENT (SEC)

SETFALIGNMENT (NEW SEC)

BINDING (SYM)

SETFDATA (NEW SEC)

OBJDUMP (SEC)

PTR (DYN)

SETFPTR (NEW DYN)

REL-SYM (REL)

REL-TYPE (REL HEADER)

SYMBOLS (ELF)

UN-TYPE (DYN)

VAL (DYN)

SETFVAL (NEW DYN)

VMA (SEC)

SETFVMA (NEW SEC)

Private

Undocumented

CLASS (CONDITION)

WORD-SIZE (DYN)

SLOT-ACCESSOR

Public

Undocumented

ADDRALIGN (OBJECT)

SETFADDRALIGN (NEW-VALUE OBJECT)

ADDRESS (OBJECT)

SETFADDRESS (NEW-VALUE OBJECT)

ALIGN (OBJECT)

SETFALIGN (NEW-VALUE OBJECT)

DATA (OBJECT)

ELF (OBJECT)

SETFELF (NEW-VALUE OBJECT)

ENTSIZE (OBJECT)

SETFENTSIZE (NEW-VALUE OBJECT)

FILESZ (OBJECT)

SETFFILESZ (NEW-VALUE OBJECT)

FLAGS (OBJECT)

SETFFLAGS (NEW-VALUE OBJECT)

SETFHEADER (NEW-VALUE OBJECT)

INFO (OBJECT)

SETFINFO (NEW-VALUE OBJECT)

MAGIC-NUMBER (OBJECT)

SETFMAGIC-NUMBER (NEW-VALUE OBJECT)

MEMSZ (OBJECT)

SETFMEMSZ (NEW-VALUE OBJECT)

NAME (OBJECT)

SETFNAME (NEW-VALUE OBJECT)

OFFSET (OBJECT)

SETFOFFSET (NEW-VALUE OBJECT)

ORDERING (OBJECT)

SETFORDERING (NEW-VALUE OBJECT)

OTHER (OBJECT)

SETFOTHER (NEW-VALUE OBJECT)

PADDR (OBJECT)

SETFPADDR (NEW-VALUE OBJECT)

PH (OBJECT)

SETFPH (NEW-VALUE OBJECT)

PROGRAM-TABLE (OBJECT)

SETFPROGRAM-TABLE (NEW-VALUE OBJECT)

SECTION-TABLE (OBJECT)

SETFSECTION-TABLE (NEW-VALUE OBJECT)

SECTIONS (OBJECT)

SETFSECTIONS (NEW-VALUE OBJECT)

SH (OBJECT)

SETFSH (NEW-VALUE OBJECT)

SHNDX (OBJECT)

SETFSHNDX (NEW-VALUE OBJECT)

SIZE (OBJECT)

SETFSIZE (NEW-VALUE OBJECT)

SYM-NAME (OBJECT)

SETFSYM-NAME (NEW-VALUE OBJECT)

TYPE (OBJECT)

SETFTYPE (NEW-VALUE OBJECT)

VADDR (OBJECT)

SETFVADDR (NEW-VALUE OBJECT)

VALUE (OBJECT)

SETFVALUE (NEW-VALUE OBJECT)

Private

Undocumented

ADDEND (OBJECT)

SETFADDEND (NEW-VALUE OBJECT)

DATA-ENCODING (OBJECT)

SETFDATA-ENCODING (NEW-VALUE OBJECT)

EH-SIZE (OBJECT)

SETFEH-SIZE (NEW-VALUE OBJECT)

EI-SIZE (OBJECT)

SETFEI-SIZE (NEW-VALUE OBJECT)

ENTRY (OBJECT)

SETFENTRY (NEW-VALUE OBJECT)

FILE-CLASS (OBJECT)

SETFFILE-CLASS (NEW-VALUE OBJECT)

IDENT-VERSION (OBJECT)

SETFIDENT-VERSION (NEW-VALUE OBJECT)

MACHINE (OBJECT)

SETFMACHINE (NEW-VALUE OBJECT)

PADDING (OBJECT)

SETFPADDING (NEW-VALUE OBJECT)

PH-ENT-SIZE (OBJECT)

SETFPH-ENT-SIZE (NEW-VALUE OBJECT)

PH-NUM (OBJECT)

SETFPH-NUM (NEW-VALUE OBJECT)

PHOFF (OBJECT)

SETFPHOFF (NEW-VALUE OBJECT)

SET-DATA (NEW-VALUE OBJECT)

SH-ENT-SIZE (OBJECT)

SETFSH-ENT-SIZE (NEW-VALUE OBJECT)

SH-NUM (OBJECT)

SETFSH-NUM (NEW-VALUE OBJECT)

SH-STR-IND (OBJECT)

SETFSH-STR-IND (NEW-VALUE OBJECT)

SHOFF (OBJECT)

SETFSHOFF (NEW-VALUE OBJECT)

TAG (OBJECT)

SETFTAG (NEW-VALUE OBJECT)

UN (OBJECT)

SETFUN (NEW-VALUE OBJECT)

VERSION (OBJECT)

SETFVERSION (NEW-VALUE OBJECT)

VARIABLE

Public

*CLASS*

Word size of the machine, (e.g. :32-bit or :64-bit).

*ENDIAN*

Controls the endianness of how bytes are read.

Private

REL-TYPES

Association list of type meaning by machine type.

CLASS

Public

Undocumented

ELF (OBJECT)

Private

Undocumented

ELF-DYN

ELF-DYN-32

ELF-DYN-64

ELF-HEADER

ELF-REL

ELF-REL-32

ELF-REL-64

ELF-RELA-32

ELF-RELA-64

ELF-SYM

ELF-SYM-32

ELF-SYM-64

PROGRAM-HEADER-32

PROGRAM-HEADER-64

SECTION

SECTION-HEADER

CONDITION

Private

Undocumented

BAD-ELF-CLASS