mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
69094d3a4d
Many optimizers (e.g. GlobalOpt/ConstantMerge) do not respect linker semantics for comdat and may not discard the sections as a unit. The interconnected `__llvm_prf_{cnts,data}` sections (in comdat for ELF) are similar to D97432: `__profd_` is not directly referenced, so `__profd_` may be discarded while `__profc_` is retained, breaking the interconnection. We currently conservatively add all such sections to `llvm.used` and let the linker do GC for ELF. In D97448, we will change GlobalObject's in the llvm.used list to use SHF_GNU_RETAIN, causing the metadata sections to be unnecessarily retained (some `check-profile` tests check for GC). Use `llvm.compiler.used` to retain the current GC behavior. Differential Revision: https://reviews.llvm.org/D97585