COFF/ELF: Place llvm.global_ctors elements in llvm.used if comdat is used
On ELF, an SHT_INIT_ARRAY outside a section group is a GC root. The current codegen abuses SHT_INIT_ARRAY in a section group to mean a GC root. On PE/COFF, the dynamic initialization for `__declspec(selectany)` in a comdat can be garbage collected by `-opt:ref`. Call `addUsedGlobal` for the two cases to fix the abuse/bug. Reviewed By: rnk Differential Revision: https://reviews.llvm.org/D106925 (cherry picked from commit 828767f3)
Loading
Please register or sign in to comment