llvm-project
25d130fc - [lld-macho] Include ICF safe thunks in balanced partitioning (#212096)

Commit
13 days ago
[lld-macho] Include ICF safe thunks in balanced partitioning (#212096) Mach-O balanced partitioning currently discovers candidate sections by walking the input-file section graph. In `--icf=safe_thunks` mode, address-significant functions can instead be emitted as linker-created thunk sections after that graph has been built. A temporal-profile name then resolves to the dead folded input while the callable section present in the final binary is never eligible for BP ordering. Factor candidate collection into a helper, then inspect the final `inputSections` set for sections containing a `Defined` symbol marked `ICFFoldKind::Thunk`. This makes emitted ICF safe thunks visible while keeping unrelated synthetic metadata outside BP. The new arm64 regression folds a profiled address-significant function into a 4-byte safe thunk and verifies both the BP startup count and final symbol order. Without the change, BP orders zero startup sections for that profile; with the change it orders the emitted thunk first.
Parents
Loading