[lld] [lld][MachO] Add N_COLD_FUNC support (PR #183909)
Zhaoxuan Jiang via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 3 01:38:38 PST 2026
nocchijiang wrote:
Ideally, I think we'd want:
- ICF should try to pick non-cold sections as the master so we don't accidentally merge hot code into a cold area.
- If a section has an explicit priority, we honor that and ignore the cold flag.
- Group cold sections at the very end of the output section just like Apple linkers.
- Run BP in three distinct buckets: startup, cold, and everything else.
The main blocker is that `PriorityBuilder::buildInputSectionPriorities()` happens after ICF, and I'm not sure there's an easy way around that right now. If an `N_COLD_FUNC` actually ends up being hot, we just have to accept some slightly suboptimal ICF merging for it.
What do you guys think? Does this direction make sense, or am I missing a cleaner way to handle the pass ordering?
https://github.com/llvm/llvm-project/pull/183909
More information about the llvm-commits
mailing list