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

Igor Kudrin via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 8 22:21:04 PDT 2024


igorkudrin wrote:

> Since output sections with `hasInputSections==false` always have A or WA flags. The "similar section's rank <= orphan's rank" condition almost always kicks in, with a few exceptions: ambiguous cases that we don't particularly care about. These test updates are documented in the description.

Maybe I'm missing something, but the latest revision of this patch with my example still places synthetic sections in an executable segment. Prioritizing the last section of the same similarity (#94099) does little to address the core problem I was trying to demonstrate: output sections without input sections have no reliable flags, and thus when used as potential anchors for orphan sections, the output can be unexpected; another example can easily be conjured up where such sections occur in the last segment, attracting orphans there. So for me, this patch favors simplification over correctness, and I would stick with the latter, especially since the proposed simplification does not seem critical.

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


More information about the llvm-commits mailing list