Skip to content
This repository was archived by the owner on Dec 20, 2019. It is now read-only.

Commit 0cbb0b2

Browse files
committed
[LDC] PGO: Avoid COMDATs with private linkage (fixing PGO for Windows)
1 parent 7f88194 commit 0cbb0b2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/ProfileData/InstrProf.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,9 +311,14 @@ GlobalVariable *createPGOFuncNameVar(Module &M,
311311
Linkage = GlobalValue::LinkOnceAnyLinkage;
312312
else if (Linkage == GlobalValue::AvailableExternallyLinkage)
313313
Linkage = GlobalValue::LinkOnceODRLinkage;
314+
/* LDC: use `internal` instead of `private` linkage (still local, but allows
315+
for COMDATs, and is required for Windows)
314316
else if (Linkage == GlobalValue::InternalLinkage ||
315317
Linkage == GlobalValue::ExternalLinkage)
316318
Linkage = GlobalValue::PrivateLinkage;
319+
*/
320+
else if (Linkage == GlobalValue::ExternalLinkage)
321+
Linkage = GlobalValue::InternalLinkage;
317322

318323
auto *Value =
319324
ConstantDataArray::getString(M.getContext(), PGOFuncName, false);

0 commit comments

Comments
 (0)