Legend:
Library
Module
Module type
Parameter
Class
Class type
elf_program_header_table contains type, functions and other definitions * for working with program header tables and their entries and ELF segments. * Related files are elf_interpreted_segments which extracts information * derived from PHTs presented in this file and converts it into a more usable * format for processing. * * FIXME: * Bug in Lem as Lem codebase uses int type throughout where BigInt.t * is really needed, hence chokes on huge constants below, which is why they are * written in the way that they are.
string_of_elf_segment_type os proc st produces a string representation of * the coding of an ELF segment type st using os and proc to render OS- * and processor-specific codings.
exact_permission_of_permission m: ELF has two interpretations of a RWX-style * permission bit m, an exact permission and an allowable permission. These * permissions allow us to interpret a flag as an upper bound for behaviour and * an ABI-compliant implementation can choose to interpret the flag m as either. * * In the exact interpretation, the upper bound is exactly the natural interpretation * of the flag. This is encoded in exact_permission_of_permission, which is * a glorified identity function, though included for completeness.
allowable_permission_of_permission m: ELF has two interpretations of a RWX-style * permission bit m, an exact permission and an allowable permission. These * permissions allow us to interpret a flag as an upper bound for behaviour and * an ABI-compliant implementation can choose to interpret the flag m as either. * * In the allowable interpretation, the upper bound is more lax than the natural * interpretation of the flag.
val parse_elf_segment_permissions : Nat_big_num.num-> bool * bool * bool
elf64_interpreted_program_header_flags w extracts a boolean triple of flags * from the flags field of an interpreted segment.
val string_of_elf_segment_permissions : Nat_big_num.num-> string
string_of_elf_segment_permissions m produces a string-based representation * of an ELF segment's permission field. * TODO: expand this as is needed by the validation tests.
Type elf32_program_header_table_entry encodes a program header table entry * for 32-bit platforms. Each entry describes a segment in an executable or * shared object file.
compare_elf32_program_header_table_entry ent1 ent2 is an ordering-comparison * function on program header table entries suitable for constructing sets, * finite maps, and other ordered data types with.
Type elf64_program_header_table_entry encodes a program header table entry * for 64-bit platforms. Each entry describes a segment in an executable or * shared object file.
compare_elf64_program_header_table_entry ent1 ent2 is an ordering-comparison * function on program header table entries suitable for constructing sets, * finite maps, and other ordered data types with.
string_of_elf32_program_header_table_entry os proc et produces a string * representation of a 32-bit program header table entry using os and proc * to render OS- and processor-specific entries.
string_of_elf64_program_header_table_entry os proc et produces a string * representation of a 64-bit program header table entry using os and proc * to render OS- and processor-specific entries.
string_of_elf32_program_header_table_entry_default et produces a string representation * of table entry et where OS- and processor-specific entries are replaced with * default strings.
string_of_elf64_program_header_table_entry_default et produces a string representation * of table entry et where OS- and processor-specific entries are replaced with * default strings.
read_elf32_program_header_table_entry endian bs0 reads an ELF32 program header table * entry from byte sequence bs0 assuming endianness endian. If bs0 is larger * than necessary, the excess is returned from the function, too. * Fails if the entry cannot be read.
read_elf64_program_header_table_entry endian bs0 reads an ELF64 program header table * entry from byte sequence bs0 assuming endianness endian. If bs0 is larger * than necessary, the excess is returned from the function, too. * Fails if the entry cannot be read.
Type elf32_program_header_table represents a program header table for 32-bit * ELF files. A program header table is an array (implemented as a list, here) * of program header table entries.
Type elf64_program_header_table represents a program header table for 64-bit * ELF files. A program header table is an array (implemented as a list, here) * of program header table entries.
read_elf32_program_header_table' endian bs0 reads an ELF32 program header table from * byte_sequence bs0 assuming endianness endian. The byte_sequence bs0 is assumed * to have exactly the correct size for the table. For internal use, only. Use * read_elf32_program_header_table below instead.
read_elf64_program_header_table' endian bs0 reads an ELF64 program header table from * byte_sequence bs0 assuming endianness endian. The byte_sequence bs0 is assumed * to have exactly the correct size for the table. For internal use, only. Use * read_elf32_program_header_table below instead.
read_elf32_program_header_table table_size endian bs0 reads an ELF32 program header * table from byte_sequence bs0 assuming endianness endian based on the size (in bytes) passed in via table_size. * This table_size argument should be equal to the number of entries in the * table multiplied by the fixed entry size. Bitstring bs0 may be larger than * necessary, in which case the excess is returned.
read_elf64_program_header_table table_size endian bs0 reads an ELF64 program header * table from byte_sequence bs0 assuming endianness endian based on the size (in bytes) passed in via table_size. * This table_size argument should be equal to the number of entries in the * table multiplied by the fixed entry size. Bitstring bs0 may be larger than * necessary, in which case the excess is returned.
The pht_print_bundle type is used to tidy up other type signatures. Some of the * top-level string_of_ functions require six or more functions passed to them, * which quickly gets out of hand. This type is used to reduce that complexity. * The first component of the type is an OS specific print function, the second is * a processor specific print function.
string_of_elf32_program_header_table os proc tbl produces a string representation * of program header table tbl using os and proc to render OS- and processor- * specific entries.
string_of_elf64_program_header_table os proc tbl produces a string representation * of program header table tbl using os and proc to render OS- and processor- * specific entries.
get_elf32_dynamic_linked pht tests whether an ELF32 file is a dynamically * linked object by traversing the program header table and attempting to find * a header describing a segment with the name of an associated interpreter. * Returns true if any such header is found, false --- indicating static * linkage --- otherwise.
get_elf64_dynamic_linked pht tests whether an ELF64 file is a dynamically * linked object by traversing the program header table and attempting to find * a header describing a segment with the name of an associated interpreter. * Returns true if any such header is found, false --- indicating static * linkage --- otherwise.
get_elf32_requested_interpreter ent bs0 extracts the requested interpreter * of a dynamically linkable ELF file from that file's program header table * entry of type PT_INTERP, ent. Interpreter string is extracted from byte * sequence bs0. * Fails if ent is not of type PT_INTERP, or if transcription otherwise fails.
get_elf64_requested_interpreter ent bs0 extracts the requested interpreter * of a dynamically linkable ELF file from that file's program header table * entry of type PT_INTERP, ent. Interpreter string is extracted from byte * sequence bs0. * Fails if ent is not of type PT_INTERP, or if transcription otherwise fails.