[lld] [ELF] Orphan placement: remove hasInputSections condition (PR #93761)

Igor Kudrin via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 10 15:18:26 PDT 2024


igorkudrin wrote:

> What's the problem? `.other` has a rank of read-only sections. `.orphan` has the same rank and is placed after `.other` with the simplified condition.

Oh, I see, I was too concise. I meant that input sections `.other` if they exist, would also be executable. But, under certain conditions, there might be no `.other` sections in any input files, so the corresponding output section would just be 'A', not 'AX', which would result in the unexpected placement of orphan sections.

Our usage scenario is not a dedicated linker script carefully prepared for a particular application. It is rather a platform/SDK that provides a set of predefined linker scripts, and all developers should use one of them for their applications; it is generally not possible for a developer to tune the linker scripts they use. Also, it doesn't seem feasible to specify all possible input sections in the linker scripts, so we rely on a predictable placement of orphan sections. Thus, I would prefer not to fix what is not broken, unless there is a clear benefit to doing so.

https://github.com/llvm/llvm-project/pull/93761


More information about the llvm-commits mailing list