[PATCH] D108689: [Linker] Support weak symbols in nodeduplicate COMDAT group

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 27 09:41:35 PDT 2021


MaskRay added a comment.

If you mean zero flag groups for export linkage functions and GRP_COMDAT groups for weak linkage functions.
If the symbol resolution says the strong symbol overrides the weak one, no rule says that the GRP_COMDAT group should be discarded because it is unclear it is a non-prevailing group.
For local linkage functions, we'd still use a zero flag group.

Symbol resolution is orthogonal to GRP_COMDAT selection.
Switching to GRP_COMDAT does not imply that the weak leader symbol makes the group discarded.
Therefore, I think switching the group flag doesn't help.
The fundamental issue is that LLVM IR is symbol oriented. It cannot encode the section oriented ELF group semantics.

Since GRP_COMDAT doesn't help, I think accepting the deficiency and using `comdat any` like semantics for regular LTO is fine.
We just need to be careful not to request too much from `comdat nodeduplicate`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108689/new/

https://reviews.llvm.org/D108689



More information about the llvm-commits mailing list