Skip to main content

link

Function link 

Source
pub fn link(program: &Program) -> Result<LinkedProgram, LinkError>
Expand description

Link a content-addressed Program into a flat LinkedProgram.

The linker:

  1. Topologically sorts function blobs by dependencies.
  2. Pass 1 (sequential): Computes cumulative base offsets for each blob and builds the hash_to_id reverse index.
  3. Pass 2 (parallel for >50 functions): Each blob independently remaps its instructions/constants/strings into pre-allocated output arrays at non-overlapping offsets.
  4. Builds a LinkedFunction table and merged debug info.