0x0LearnReferenceLibraries0x0.jmp0x1b.com

Post-Link Layout Optimization

Post-link layout optimization is an explicit release optimization path. It is

not part of the default developer build loop. The goal is to improve final

binary layout after ordinary PGO and Thin summary optimization while preserving

determinism, relocation safety, binary-size budgets, and clear fail-closed

diagnostics.

Run:


make post-link-layout-check
make native-post-link-check

make native-post-link-check depends on both make pgo-thin-summary-check and

make post-link-layout-check. Profile evidence must be valid before layout

evidence can pass.

Evidence Files

where the object format supports it.

and block order files.

explicit function-order fallback behavior.

size, startup, and runtime counters.

diagnostics.

evidence.

wiring.

Strategy Selection

Each target must select a supported strategy or fail closed:

when object block sections are available;

relocation and unwind coverage are complete;

sections are unavailable;

WASM lowering milestone.

Every strategy row is explicit-only and must not run on the default developer

path.

Order Files And Metrics

The gate records both function-order and block-order files when the target can

emit block sections. Order files are consumed only when their input hash,

output hash, profile hash, and relocation evidence are current.

The release metrics report records:

A layout decision fails when any required metric regresses beyond its budget or

when binary size grows beyond the recorded release budget.

Diagnostics

The gate rejects unsupported or unsafe layout decisions with stable

diagnostics:


POST_LINK_LAYOUT_UNSUPPORTED_TARGET
POST_LINK_LAYOUT_BLOCK_METADATA
POST_LINK_LAYOUT_ORDER_HASH
POST_LINK_LAYOUT_COUNTER_REGRESSION
POST_LINK_LAYOUT_PROFILE
POST_LINK_LAYOUT_RELOCATION
POST_LINK_LAYOUT_DEFAULT_PATH

Unsupported targets, missing block metadata, stale or missing profiles, missing

relocation evidence, order hash drift, metric regressions, and accidental

default-path enablement all fail closed.

Documentation Impact

Compiler, linker, object format, profile, or native toolchain changes that

alter post-link layout strategy, block metadata, order files, metrics,

fallbacks, or diagnostics must update this page, the evidence TSV files,

release notes, and public reference index in the same change.