jon.recoil.org

Module Binary_emitter_verify

Verification of binary emitter output against system assembler output.

This module compares the section contents produced by the binary emitter (saved in .binary-sections/ directories) against the corresponding sections extracted from object files produced by the system assembler.

type section_mismatch = {
  1. section_name : string;
  2. byte_offset : int;
    (*

    For .text, aligned to instruction boundary

    *)
  3. instruction_offset : int option;
  4. expected : string;
    (*

    from binary emitter, hex dump

    *)
  5. actual : string;
    (*

    from assembler, hex dump

    *)
  6. expected_size : int;
  7. actual_size : int;
}
type relocation_mismatch = {
  1. section_name : string;
  2. offset : int;
  3. expected : string;
  4. actual : string;
}
type mismatch =
  1. | Section_content of section_mismatch
  2. | Section_size of {
    1. section_name : string;
    2. expected : int;
    3. actual : int;
    }
  3. | Relocation of relocation_mismatch
  4. | Missing_section of string
  5. | Missing_binary_sections_dir of string
type result =
  1. | Match of {
    1. text_size : int;
    2. data_size : int;
    }
  2. | Mismatch of mismatch
  3. | Object_file_error of string
val compare : (module Compiler_owee.Unix_intf.S) -> obj_file:string -> binary_sections_dir:string -> result

Compare binary emitter output against assembled object file.

  • parameter unix

    The Unix module (as first-class module)

  • parameter obj_file

    Path to the .o file produced by the system assembler

  • parameter binary_sections_dir

    Path to the .binary-sections/ directory

  • returns

    Comparison result

val print_result : Format.formatter -> result -> unit

Print a comparison result to a formatter.

module For_testing : sig ... end

Functions for testing the verification logic itself.