jon.recoil.org

Module Dissector

Dissector pass for analyzing ELF object files.

The dissector analyzes all object files involved in a link to compute the total size of allocated ELF sections. This information is used to partition object files to prevent relocation overflow when linking very large executables with the small code model.

type error =
  1. | Measure_error of Measure_object_files.error
  2. | Partition_error of Partition_object_files.error

Errors that can occur during the dissector pass.

exception Error of Dissector.error

Exception wrapper for dissector errors.

val report_error : Stdlib.Format.formatter -> Dissector.error -> unit

Pretty-print a dissector error.

module Result : sig ... end

Result of running the dissector. After the dissector runs, OCaml object files (ml_objfiles, startup_obj) are baked into the partition files. Passthrough files (ccobjs, runtime_libs) bypass partial linking and are passed directly to the final linker. Use Build_linker_args.build to convert this result into linker arguments.

val run : unix:(module Compiler_owee.Unix_intf.S) -> temp_dir:string -> ml_objfiles:string list -> startup_obj:string -> ccobjs:string list -> runtime_libs:string list -> cached_genfns:string option -> Dissector.Result.t

Run the dissector pass.

Analyzes all object files that will be involved in a link, computes the total size of allocated ELF sections, partitions files to stay under the threshold, partially links each partition, and extracts relocations that need conversion to use an intermediate PLT or GOT.

The startup_obj is analyzed like all other .o files but may need to be handled specially during partitioning.

  • parameter unix

    First-class Unix module for file operations

  • parameter temp_dir

    Directory for temporary and output files

  • parameter ml_objfiles

    The OCaml object files (.o, .a derived from .cmx, .cmxa)

  • parameter startup_obj

    The startup object file

  • parameter ccobjs

    Extra C object files from -cclib (Clflags.ccobjs)

  • parameter runtime_libs

    Runtime libraries (from runtime_lib ())

  • parameter cached_genfns

    Optional path to cached generic functions

Raises Error (Partition_error (File_exceeds_partition_size _)) if any single file exceeds the partition threshold.

Raises Error (Partial_link_error _) if partial linking fails.

Raises an error if Target_system is not Linux.