[LangRef] Clarify comdat
authorFangrui Song <i@maskray.me>
Fri, 23 Jul 2021 23:33:06 +0000 (16:33 -0700)
committerFangrui Song <i@maskray.me>
Fri, 23 Jul 2021 23:33:06 +0000 (16:33 -0700)
commitd5401315cd29b67607b5914997c99d34427ac354
tree8109aab9a0f80ed2bf14150d7eb5087e8698abaf
parent0cd964ff254888d563659f4f8f39c934732aa487
[LangRef] Clarify comdat

* ELF supports `nodeduplicate`.
* ELF calls the concept "section group". `GRP_COMDAT` emulates the PE COMDAT deduplication feature.
* "COMDAT group" is an ELF term. Avoid it for PE/COFF.
* WebAssembly supports comdat but only supports the `any` selection kind. https://bugs.llvm.org/show_bug.cgi?id=50531
* A comdat must be included or omitted as a unit. Both the compiler and the linker must obey this rule.
* A global object can be a member of at most one comdat.
* COFF requires a non-local linkage for non-`nodeduplicate` selection kinds.
* llvm.global_ctors/.llvm.global_dtors: if the third field is used on ELF, it must reference a global variable or function in a comdat

Reviewed By: rnk

Differential Revision: https://reviews.llvm.org/D106300
llvm/docs/LangRef.rst