From c6cf918f448bd3ba1f8f0feff9f97a1fc4e3b7ef Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Thu, 26 Jul 2018 22:59:17 +0000 Subject: [InstrProf] Use comdats on COFF for available_externally functions Summary: r262157 added ELF-specific logic to put a comdat on the __profc_* globals created for available_externally functions. We should be able to generalize that logic to all object file formats that support comdats, i.e. everything other than MachO. This fixes duplicate symbol errors, since on COFF, linkonce_odr doesn't make the symbol weak. Fixes PR38251. Reviewers: davidxl, xur Subscribers: hiraditya, dmajor, llvm-commits, aheejin Differential Revision: https://reviews.llvm.org/D49882 llvm-svn: 338082 --- llvm/lib/ProfileData/InstrProf.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'llvm/lib/ProfileData') diff --git a/llvm/lib/ProfileData/InstrProf.cpp b/llvm/lib/ProfileData/InstrProf.cpp index bae293aa75f..544a77ec20a 100644 --- a/llvm/lib/ProfileData/InstrProf.cpp +++ b/llvm/lib/ProfileData/InstrProf.cpp @@ -926,8 +926,7 @@ bool needsComdatForCounter(const Function &F, const Module &M) { if (F.hasComdat()) return true; - Triple TT(M.getTargetTriple()); - if (!TT.isOSBinFormatELF() && !TT.isOSBinFormatWasm()) + if (!Triple(M.getTargetTriple()).supportsCOMDAT()) return false; // See createPGOFuncNameVar for more details. To avoid link errors, profile -- cgit v1.2.3