Skip to content

Commit b6fdb93

Browse files
Merge pull request #9285 from aschwaighofer/swift-4.0-branch_fix_linkage_private_decls_wmo
[swift-4.0-branch] IRGen: Use link_once instead of external for private decls
2 parents a85a08c + 5ff0707 commit b6fdb93

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/IRGen/GenDecl.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1393,8 +1393,12 @@ getIRLinkage(const UniversalLinkageInfo &info, SILLinkage linkage,
13931393
case SILLinkage::Private:
13941394
// In case of multiple llvm modules (in multi-threaded compilation) all
13951395
// private decls must be visible from other files.
1396+
// We use LinkOnceODR instead of External here because private lazy protocol
1397+
// witness table accessors could be emitted by two different IGMs during
1398+
// IRGen into different object files and the linker would complain about
1399+
// duplicate symbols.
13961400
if (info.HasMultipleIGMs)
1397-
return RESULT(External, Hidden, Default);
1401+
return RESULT(LinkOnceODR, Hidden, Default);
13981402
return RESULT(Internal, Default, Default);
13991403

14001404
case SILLinkage::PublicExternal: {

0 commit comments

Comments
 (0)