[lld] [LLD][ELF] Do not emit __start/__stop for empty sections (PR #96213)

Andrew Ng via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 21 06:58:47 PDT 2024


nga888 wrote:

> Behaviors of different visibilities are unified, even if the behavior differs from GNU ld.

Your suggested alternative causes the test `ELF/linkerscript/sections-gc2.s` to fail. How important this is, I'm not sure. Also the emission of the empty section in this test case doesn't feel quite right either.

If the concern is the performance impact of the addition of `if (sym->isLocal() && sym->isUndefined())` to the `.symtab` loop, then perhaps that can be dropped? However, doing so would leave behind the `LOCAL HIDDEN UND` `__start/__stop` symbols, but that's still better than symbols with invalid section indices.


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


More information about the llvm-commits mailing list