Skip to main content

thin_rebuild_obj

Function thin_rebuild_obj 

Source
pub async fn thin_rebuild_obj(
    captured_rustc: &CapturedRustcInvocation,
    captured_linker_args: &[String],
    output_dir: &Path,
    output_dylib: &Path,
    rustc_path: &Path,
    linker_path: &Path,
    cwd: &Path,
    target_os: LinkerOs,
    aslr_stub: Option<&Path>,
) -> Result<PathBuf>
Expand description

Compose run_obj_plan and run_link_plan into the full hot-patch rebuild.

Inputs are the captured rustc + linker calls from the fat build, plus where the patch should land and which OS the patch is going to run on. Returns the final .so/.dylib path that can be packaged into a JumpTable and sent to the device.

This function is the “happy path” — the production code (Patcher, I4g-X3) calls this directly when neither captured call is missing and the target is supported.

aslr_stub is an optional pre-built jump-stub object (crate::hotpatch::create_undefined_symbol_stub). When Some, it gets linked into the patch dylib alongside the freshly rebuilt .o, supplying every host symbol the patch references as a hardcoded runtime-address trampoline. When None, the patch is linked with --unresolved-symbols=ignore-all only — fine for host-only fixtures where the test process satisfies the patch via dynamic_lookup.