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

Commit 4db8831

Browse files
committed
[LDC] PGO: Avoid COMDATs with private linkage (fixing PGO for Windows)
1 parent 050ecc2 commit 4db8831

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/ProfileData/InstrProf.cpp

+5
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)