-
- Downloads
[lld-macho][nfc] Give non-text ConcatOutputSections order-independent finalization
This diff is motivated by my work to add proper DWARF unwind support. As detailed in PR50956 functions that need DWARF unwind need to have compact unwind entries synthesized for them. These CU entries encode an offset within `__eh_frame` that points to the corresponding DWARF FDE. In order to encode this offset during `UnwindInfoSectionImpl::finalize()`, we need to first assign values to `InputSection::outSecOff` for each `__eh_frame` subsection. But `__eh_frame` is ordered after `__unwind_info` (according to ld64 at least), which puts us in a bit of a bind: `outSecOff` gets assigned during finalization, but `__eh_frame` is being finalized after `__unwind_info`. But it occurred to me that there's no real need for most ConcatOutputSections to be finalized sequentially. It's only necessary for text-containing ConcatOutputSections that may contain branch relocs which may need thunks. ConcatOutputSections containing other types of data can be finalized in any order. This diff moves the finalization logic for non-text sections into a separate `finalizeContents()` method. This method is called before section address assignment & unwind info finalization takes place. In theory we could call these `finalizeContents()` methods in parallel, but in practice it seems to be faster to do it all on the main thread. Reviewed By: #lld-macho, oontvoo Differential Revision: https://reviews.llvm.org/D123279
Loading
Please register or sign in to comment