jon.recoil.org

Module Partial_link

Partial linking of object files.

This module partially links groups of object files into single relocatable object files, to work around relocation overflow issues when linking very large executables with the small code model.

type error =
  1. | Linker_error of {
    1. partition_index : int;
    2. exit_code : int;
    3. files : string list;
    }

Errors that can occur during partial linking.

exception Error of Partial_link.error

Exception wrapper for partial linking errors.

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

Pretty-print a partial linking error.

link_partitions ~temp_dir partitions partially links each partition into a single relocatable object file.

For each partition, creates a response file listing the input files, then invokes the linker with: ld --whole-archive @<response_file> --relocatable -o <output.o>

Returns the list of linked partitions with paths to the output .o files.

  • parameter temp_dir

    Directory for temporary and output files