[lld] [ELF] Orphan placement: remove hasInputSections condition (PR #93761)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 10 18:01:03 PDT 2024
MaskRay wrote:
> > OK, your argument is that .other (`hasInputSection==false`) might be A or AX and you would prefer that an orphan is not placed after it.
>
> Not exactly. The output section '.other' could be `AX` (`hasInputSection==true`) or `A` (`hasInputSection==false`), which could trigger different placement of orphans, which in turn could surprise a developer. I wouldn't mind if its flags were the same regardless of whether it has input sections.
>
> I prefer to follow [the principle of least astonishment](https://en.wikipedia.org/wiki/Principle_of_least_astonishment) here.
`readelf -S` output shows A and AX differences, which justifies different orphan section placement.
`hasInputSection` making behaviors different actually surprised me.
>From the output, a `hasInputSection==false` output section using `. += xxx` is not really distinguishable from an output section that contains an input section. It is odd to me that the orphan section placement is different (without this patch) when the section flags are not distinguishable.
https://github.com/llvm/llvm-project/pull/93761
More information about the llvm-commits
mailing list