[lld] [ELF] Make start/stop symbols retain associated discardable output sections (PR #96343)

Andrew Ng via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 24 09:40:41 PDT 2024


nga888 wrote:

I can see the benefit of the simplification and reducing the amount of code but I still feel a bit uneasy with keeping the empty sections. The actual somewhat unusual use case that showed up this issue was with `ASAN` and an empty `asan_globals` section which produced `__start_asan_globals` and `__stop_asan_globals` with invalid section indices which then caused an error in `llvm-objcopy`.

This patch fixes the invalid section indices but also introduces another minor issue in that the value of the `__start_asan_globals` symbol is no longer aligned according to `ASAN`'s requirements and can cause a run-time `ASAN` assertion. Normally, the alignment would be correct because of the input section alignment. This can be addressed in the linker script or perhaps the `ASAN` runtime shouldn't validate the start alignment if the size is `0`. It's also highly unlikely that `asan_globals` would be empty, but it does show that there could be side-effects due to this change in behaviour.

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


More information about the llvm-commits mailing list