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

Commit afa3920

Browse files
committed
[LDC] PGO: Avoid COMDATs with private linkage (fixing PGO for Windows)
1 parent b562fb7 commit afa3920

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
@@ -312,9 +312,14 @@ GlobalVariable *createPGOFuncNameVar(Module &M,
312312
Linkage = GlobalValue::LinkOnceAnyLinkage;
313313
else if (Linkage == GlobalValue::AvailableExternallyLinkage)
314314
Linkage = GlobalValue::LinkOnceODRLinkage;
315+
/* LDC: use `internal` instead of `private` linkage (still local, but allows
316+
for COMDATs, and is required for Windows)
315317
else if (Linkage == GlobalValue::InternalLinkage ||
316318
Linkage == GlobalValue::ExternalLinkage)
317319
Linkage = GlobalValue::PrivateLinkage;
320+
*/
321+
else if (Linkage == GlobalValue::ExternalLinkage)
322+
Linkage = GlobalValue::InternalLinkage;
318323

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

0 commit comments

Comments
 (0)