[lld][MachO] Stream FunctionStartsSection from laid-out code sections (#247021)
Currently, `FunctionStartsSection::finalizeContents()` scans every
`ObjFile`'s full symbol table, resolves `defined->getVA()` for each live
code symbol, and sorts all addresses with `llvm::sort`.
By the time `FunctionStartsSection::finalizeContents()` runs, output
segments, their sections, and each `ConcatOutputSection`'s inputs are
already laid out in ascending virtual address order, and each input
section's `symbols` list is kept sorted by offset. This PR walks those
laid-out code sections directly.
To avoid calling `isCodeSection()` on every subsection, we add an
`isCodeSection(const Section &)` overload and cache its result across
consecutive inputs sharing the same originating `Section`. This targets
the common case where most subsections remain in their original input
order (even under an order file, non-code sections and unprioritized
code sections stay grouped by `Section`).
Linker-synthesized symbols and symbols left behind in a coalesced
section after being replaced in-place by an absolute or bitcode override
are skipped so the emitted entries stay identical to the input-file
walk.
One small unrelated optimization is included in this PR: The current
implementation encodes ULEB128 deltas byte-by-byte through the
[unbuffered](https://github.com/llvm/llvm-project/blob/4bfe5ade4fcd9b975dbbcf1f33badc124067299e/llvm/include/llvm/Support/raw_ostream.h#L715)
`raw_svector_ostream`, meaning every streamed byte incurs the cost of a
virtual call to `write_impl`, which in turn does an out-of-line call to
`OS.append`. This PR instead streams ULEB128 deltas straight into a
pre-sized 16-byte buffer instead.
Assisted by Gemini / Claude.