package bap-elf

  1. Overview
  2. Docs

ELF data structures.

type e_class =
  1. | ELFCLASS32
  2. | ELFCLASS64
include sig ... end
val e_class_of_sexp : Sexplib.Sexp.t -> e_class
val sexp_of_e_class : e_class -> Sexplib.Sexp.t
val compare_e_class : e_class -> e_class -> int
val bin_e_class : e_class Core_kernel.Std.Bin_prot.Type_class.t
val bin_read_e_class : e_class Core_kernel.Std.Bin_prot.Read.reader
val __bin_read_e_class__ : (int -> e_class) Core_kernel.Std.Bin_prot.Read.reader
val bin_reader_e_class : e_class Core_kernel.Std.Bin_prot.Type_class.reader
val bin_size_e_class : e_class Core_kernel.Std.Bin_prot.Size.sizer
val bin_write_e_class : e_class Core_kernel.Std.Bin_prot.Write.writer
val bin_writer_e_class : e_class Core_kernel.Std.Bin_prot.Type_class.writer
type e_data =
  1. | ELFDATA2LSB
  2. | ELFDATA2MSB
include sig ... end
val e_data_of_sexp : Sexplib.Sexp.t -> e_data
val sexp_of_e_data : e_data -> Sexplib.Sexp.t
val compare_e_data : e_data -> e_data -> int
val bin_e_data : e_data Core_kernel.Std.Bin_prot.Type_class.t
val bin_read_e_data : e_data Core_kernel.Std.Bin_prot.Read.reader
val __bin_read_e_data__ : (int -> e_data) Core_kernel.Std.Bin_prot.Read.reader
val bin_reader_e_data : e_data Core_kernel.Std.Bin_prot.Type_class.reader
val bin_size_e_data : e_data Core_kernel.Std.Bin_prot.Size.sizer
val bin_write_e_data : e_data Core_kernel.Std.Bin_prot.Write.writer
val bin_writer_e_data : e_data Core_kernel.Std.Bin_prot.Type_class.writer
type e_osabi =
  1. | ELFOSABI_SYSV
  2. | ELFOSABI_HPUX
  3. | ELFOSABI_NETBSD
  4. | ELFOSABI_LINUX
  5. | ELFOSABI_SOLARIS
  6. | ELFOSABI_AIX
  7. | ELFOSABI_IRIX
  8. | ELFOSABI_FREEBSD
  9. | ELFOSABI_TRU64
  10. | ELFOSABI_MODESTO
  11. | ELFOSABI_OPENBSD
  12. | ELFOSABI_ARM_AEABI
  13. | ELFOSABI_ARM
  14. | ELFOSABI_STANDALONE
  15. | ELFOSABI_EXT of int
include sig ... end
val e_osabi_of_sexp : Sexplib.Sexp.t -> e_osabi
val sexp_of_e_osabi : e_osabi -> Sexplib.Sexp.t
val compare_e_osabi : e_osabi -> e_osabi -> int
val bin_e_osabi : e_osabi Core_kernel.Std.Bin_prot.Type_class.t
val bin_read_e_osabi : e_osabi Core_kernel.Std.Bin_prot.Read.reader
val __bin_read_e_osabi__ : (int -> e_osabi) Core_kernel.Std.Bin_prot.Read.reader
val bin_reader_e_osabi : e_osabi Core_kernel.Std.Bin_prot.Type_class.reader
val bin_size_e_osabi : e_osabi Core_kernel.Std.Bin_prot.Size.sizer
val bin_write_e_osabi : e_osabi Core_kernel.Std.Bin_prot.Write.writer
val bin_writer_e_osabi : e_osabi Core_kernel.Std.Bin_prot.Type_class.writer
type e_type =
  1. | ET_NONE
  2. | ET_REL
  3. | ET_EXEC
  4. | ET_DYN
  5. | ET_CORE
  6. | ET_EXT of int
include sig ... end
val e_type_of_sexp : Sexplib.Sexp.t -> e_type
val sexp_of_e_type : e_type -> Sexplib.Sexp.t
val compare_e_type : e_type -> e_type -> int
val bin_e_type : e_type Core_kernel.Std.Bin_prot.Type_class.t
val bin_read_e_type : e_type Core_kernel.Std.Bin_prot.Read.reader
val __bin_read_e_type__ : (int -> e_type) Core_kernel.Std.Bin_prot.Read.reader
val bin_reader_e_type : e_type Core_kernel.Std.Bin_prot.Type_class.reader
val bin_size_e_type : e_type Core_kernel.Std.Bin_prot.Size.sizer
val bin_write_e_type : e_type Core_kernel.Std.Bin_prot.Write.writer
val bin_writer_e_type : e_type Core_kernel.Std.Bin_prot.Type_class.writer
type e_machine =
  1. | EM_NONE
  2. | EM_M32
  3. | EM_SPARC
  4. | EM_386
  5. | EM_68K
  6. | EM_88K
  7. | EM_860
  8. | EM_MIPS
  9. | EM_S370
  10. | EM_MIPS_RS3_LE
  11. | EM_PARISC
  12. | EM_VPP500
  13. | EM_SPARC32PLUS
  14. | EM_960
  15. | EM_PPC
  16. | EM_PPC64
  17. | EM_S390
  18. | EM_V800
  19. | EM_FR20
  20. | EM_RH32
  21. | EM_RCE
  22. | EM_ARM
  23. | EM_ALPHA
  24. | EM_SH
  25. | EM_SPARCV9
  26. | EM_TRICORE
  27. | EM_ARC
  28. | EM_H8_300
  29. | EM_H8_300H
  30. | EM_H8S
  31. | EM_H8_500
  32. | EM_IA_64
  33. | EM_MIPS_X
  34. | EM_COLDFIRE
  35. | EM_68HC12
  36. | EM_MMA
  37. | EM_PCP
  38. | EM_NCPU
  39. | EM_NDR1
  40. | EM_STARCORE
  41. | EM_ME16
  42. | EM_ST100
  43. | EM_TINYJ
  44. | EM_X86_64
  45. | EM_PDSP
  46. | EM_FX66
  47. | EM_ST9PLUS
  48. | EM_ST7
  49. | EM_68HC16
  50. | EM_68HC11
  51. | EM_68HC08
  52. | EM_68HC05
  53. | EM_SVX
  54. | EM_ST19
  55. | EM_VAX
  56. | EM_CRIS
  57. | EM_JAVELIN
  58. | EM_FIREPATH
  59. | EM_ZSP
  60. | EM_MMIX
  61. | EM_HUANY
  62. | EM_PRISM
  63. | EM_AVR
  64. | EM_FR30
  65. | EM_D10V
  66. | EM_D30V
  67. | EM_V850
  68. | EM_M32R
  69. | EM_MN10300
  70. | EM_MN10200
  71. | EM_PJ
  72. | EM_OPENRISC
  73. | EM_ARC_A5
  74. | EM_XTENSA
  75. | EM_AARCH64
  76. | EM_TILEPRO
  77. | EM_MICROBLAZE
  78. | EM_TILEGX
  79. | EM_EXT of int
include sig ... end
val e_machine_of_sexp : Sexplib.Sexp.t -> e_machine
val sexp_of_e_machine : e_machine -> Sexplib.Sexp.t
val compare_e_machine : e_machine -> e_machine -> int
val bin_e_machine : e_machine Core_kernel.Std.Bin_prot.Type_class.t
val bin_read_e_machine : e_machine Core_kernel.Std.Bin_prot.Read.reader
val __bin_read_e_machine__ : (int -> e_machine) Core_kernel.Std.Bin_prot.Read.reader
val bin_reader_e_machine : e_machine Core_kernel.Std.Bin_prot.Type_class.reader
val bin_size_e_machine : e_machine Core_kernel.Std.Bin_prot.Size.sizer
val bin_write_e_machine : e_machine Core_kernel.Std.Bin_prot.Write.writer
val bin_writer_e_machine : e_machine Core_kernel.Std.Bin_prot.Type_class.writer
type p_type =
  1. | PT_NULL
  2. | PT_LOAD
  3. | PT_DYNAMIC
  4. | PT_INTERP
  5. | PT_NOTE
  6. | PT_SHLIB
  7. | PT_PHDR
  8. | PT_OTHER of int32
include sig ... end
val p_type_of_sexp : Sexplib.Sexp.t -> p_type
val sexp_of_p_type : p_type -> Sexplib.Sexp.t
val compare_p_type : p_type -> p_type -> int
val bin_p_type : p_type Core_kernel.Std.Bin_prot.Type_class.t
val bin_read_p_type : p_type Core_kernel.Std.Bin_prot.Read.reader
val __bin_read_p_type__ : (int -> p_type) Core_kernel.Std.Bin_prot.Read.reader
val bin_reader_p_type : p_type Core_kernel.Std.Bin_prot.Type_class.reader
val bin_size_p_type : p_type Core_kernel.Std.Bin_prot.Size.sizer
val bin_write_p_type : p_type Core_kernel.Std.Bin_prot.Write.writer
val bin_writer_p_type : p_type Core_kernel.Std.Bin_prot.Type_class.writer
type p_flag =
  1. | PF_X
  2. | PF_W
  3. | PF_R
  4. | PF_EXT of int
include sig ... end
val p_flag_of_sexp : Sexplib.Sexp.t -> p_flag
val sexp_of_p_flag : p_flag -> Sexplib.Sexp.t
val compare_p_flag : p_flag -> p_flag -> int
val bin_p_flag : p_flag Core_kernel.Std.Bin_prot.Type_class.t
val bin_read_p_flag : p_flag Core_kernel.Std.Bin_prot.Read.reader
val __bin_read_p_flag__ : (int -> p_flag) Core_kernel.Std.Bin_prot.Read.reader
val bin_reader_p_flag : p_flag Core_kernel.Std.Bin_prot.Type_class.reader
val bin_size_p_flag : p_flag Core_kernel.Std.Bin_prot.Size.sizer
val bin_write_p_flag : p_flag Core_kernel.Std.Bin_prot.Write.writer
val bin_writer_p_flag : p_flag Core_kernel.Std.Bin_prot.Type_class.writer
type sh_type =
  1. | SHT_NULL
  2. | SHT_PROGBITS
  3. | SHT_SYMTAB
  4. | SHT_STRTAB
  5. | SHT_RELA
  6. | SHT_HASH
  7. | SHT_DYNAMIC
  8. | SHT_NOTE
  9. | SHT_NOBITS
  10. | SHT_REL
  11. | SHT_SHLIB
  12. | SHT_DYNSYM
  13. | SHT_EXT of int32
include sig ... end
val sh_type_of_sexp : Sexplib.Sexp.t -> sh_type
val sexp_of_sh_type : sh_type -> Sexplib.Sexp.t
val compare_sh_type : sh_type -> sh_type -> int
val bin_sh_type : sh_type Core_kernel.Std.Bin_prot.Type_class.t
val bin_read_sh_type : sh_type Core_kernel.Std.Bin_prot.Read.reader
val __bin_read_sh_type__ : (int -> sh_type) Core_kernel.Std.Bin_prot.Read.reader
val bin_reader_sh_type : sh_type Core_kernel.Std.Bin_prot.Type_class.reader
val bin_size_sh_type : sh_type Core_kernel.Std.Bin_prot.Size.sizer
val bin_write_sh_type : sh_type Core_kernel.Std.Bin_prot.Write.writer
val bin_writer_sh_type : sh_type Core_kernel.Std.Bin_prot.Type_class.writer
type sh_flag =
  1. | SHF_WRITE
  2. | SHF_ALLOC
  3. | SHF_EXECINSTR
  4. | SHF_EXT of int
include sig ... end
val sh_flag_of_sexp : Sexplib.Sexp.t -> sh_flag
val sexp_of_sh_flag : sh_flag -> Sexplib.Sexp.t
val compare_sh_flag : sh_flag -> sh_flag -> int
val bin_sh_flag : sh_flag Core_kernel.Std.Bin_prot.Type_class.t
val bin_read_sh_flag : sh_flag Core_kernel.Std.Bin_prot.Read.reader
val __bin_read_sh_flag__ : (int -> sh_flag) Core_kernel.Std.Bin_prot.Read.reader
val bin_reader_sh_flag : sh_flag Core_kernel.Std.Bin_prot.Type_class.reader
val bin_size_sh_flag : sh_flag Core_kernel.Std.Bin_prot.Size.sizer
val bin_write_sh_flag : sh_flag Core_kernel.Std.Bin_prot.Write.writer
val bin_writer_sh_flag : sh_flag Core_kernel.Std.Bin_prot.Type_class.writer
type segment = {
  1. p_type : p_type;
  2. p_flags : p_flag list;
  3. p_vaddr : int64;
  4. p_paddr : int64;
  5. p_align : int64;
  6. p_memsz : int64;
  7. p_filesz : int64;
  8. p_offset : int64;
}
include sig ... end
val segment_of_sexp : Sexplib.Sexp.t -> segment
val sexp_of_segment : segment -> Sexplib.Sexp.t
val p_offset : segment -> int64
val p_filesz : segment -> int64
val p_memsz : segment -> int64
val p_align : segment -> int64
val p_paddr : segment -> int64
val p_vaddr : segment -> int64
val p_flags : segment -> p_flag list
val p_type : segment -> p_type
module Fields_of_segment : sig ... end
val compare_segment : segment -> segment -> int
val bin_segment : segment Core_kernel.Std.Bin_prot.Type_class.t
val bin_read_segment : segment Core_kernel.Std.Bin_prot.Read.reader
val __bin_read_segment__ : (int -> segment) Core_kernel.Std.Bin_prot.Read.reader
val bin_reader_segment : segment Core_kernel.Std.Bin_prot.Type_class.reader
val bin_size_segment : segment Core_kernel.Std.Bin_prot.Size.sizer
val bin_write_segment : segment Core_kernel.Std.Bin_prot.Write.writer
val bin_writer_segment : segment Core_kernel.Std.Bin_prot.Type_class.writer
type section = {
  1. sh_name : int;
  2. sh_type : sh_type;
  3. sh_flags : sh_flag list;
  4. sh_addr : int64;
  5. sh_size : int64;
  6. sh_info : int32;
  7. sh_addralign : int64;
  8. sh_entsize : int64;
  9. sh_offset : int64;
}
include sig ... end
val section_of_sexp : Sexplib.Sexp.t -> section
val sexp_of_section : section -> Sexplib.Sexp.t
val sh_offset : section -> int64
val sh_entsize : section -> int64
val sh_addralign : section -> int64
val sh_info : section -> int32
val sh_size : section -> int64
val sh_addr : section -> int64
val sh_flags : section -> sh_flag list
val sh_type : section -> sh_type
val sh_name : section -> int
module Fields_of_section : sig ... end
val compare_section : section -> section -> int
val bin_section : section Core_kernel.Std.Bin_prot.Type_class.t
val bin_read_section : section Core_kernel.Std.Bin_prot.Read.reader
val __bin_read_section__ : (int -> section) Core_kernel.Std.Bin_prot.Read.reader
val bin_reader_section : section Core_kernel.Std.Bin_prot.Type_class.reader
val bin_size_section : section Core_kernel.Std.Bin_prot.Size.sizer
val bin_write_section : section Core_kernel.Std.Bin_prot.Write.writer
val bin_writer_section : section Core_kernel.Std.Bin_prot.Type_class.writer
type elf = {
  1. e_class : e_class;
  2. e_data : e_data;
  3. e_version : int;
  4. e_osabi : e_osabi;
  5. e_abiver : int;
  6. e_type : e_type;
  7. e_machine : e_machine;
  8. e_entry : int64;
  9. e_shstrndx : int;
  10. e_sections : section Bap.Std.seq;
  11. e_segments : segment Bap.Std.seq;
}
include sig ... end
val elf_of_sexp : Sexplib.Sexp.t -> elf
val sexp_of_elf : elf -> Sexplib.Sexp.t
val e_segments : elf -> segment Bap.Std.seq
val e_sections : elf -> section Bap.Std.seq
val e_shstrndx : elf -> int
val e_entry : elf -> int64
val e_machine : elf -> e_machine
val e_type : elf -> e_type
val e_abiver : elf -> int
val e_osabi : elf -> e_osabi
val e_version : elf -> int
val e_data : elf -> e_data
val e_class : elf -> e_class
module Fields_of_elf : sig ... end
val compare_elf : elf -> elf -> int
val bin_elf : elf Core_kernel.Std.Bin_prot.Type_class.t
val bin_read_elf : elf Core_kernel.Std.Bin_prot.Read.reader
val __bin_read_elf__ : (int -> elf) Core_kernel.Std.Bin_prot.Read.reader
val bin_reader_elf : elf Core_kernel.Std.Bin_prot.Type_class.reader
val bin_size_elf : elf Core_kernel.Std.Bin_prot.Size.sizer
val bin_write_elf : elf Core_kernel.Std.Bin_prot.Write.writer
val bin_writer_elf : elf Core_kernel.Std.Bin_prot.Type_class.writer
type table_info = {
  1. table_offset : int64;
  2. entry_size : int;
  3. entry_num : int;
}
include sig ... end
val table_info_of_sexp : Sexplib.Sexp.t -> table_info
val sexp_of_table_info : table_info -> Sexplib.Sexp.t
val entry_num : table_info -> int
val entry_size : table_info -> int
val table_offset : table_info -> int64
module Fields_of_table_info : sig ... end
val compare_table_info : table_info -> table_info -> int
val bin_table_info : table_info Core_kernel.Std.Bin_prot.Type_class.t
val bin_read_table_info : table_info Core_kernel.Std.Bin_prot.Read.reader
val __bin_read_table_info__ : (int -> table_info) Core_kernel.Std.Bin_prot.Read.reader
val bin_reader_table_info : table_info Core_kernel.Std.Bin_prot.Type_class.reader
val bin_size_table_info : table_info Core_kernel.Std.Bin_prot.Size.sizer
val bin_write_table_info : table_info Core_kernel.Std.Bin_prot.Write.writer
val bin_writer_table_info : table_info Core_kernel.Std.Bin_prot.Type_class.writer
type t = elf
val from_bigstring : ?pos:int -> ?len:int -> Core_kernel.Std.Bigstring.t -> t Core_kernel.Std.Or_error.t

from_bigstring data parses data with optional offset provided as pos and length as len

val section_name : Core_kernel.Std.Bigstring.t -> t -> section -> string Core_kernel.Std.Or_error.t

section_name data elf section retrieves name of section from data

val string_of_section : Core_kernel.Std.Bigstring.t -> section -> string Core_kernel.Std.Or_error.t

string_of_section data section extracts the section data as string from the provided data

OCaml

Innovation. Community. Security.