Skip to content

Commit 505d8c2

Browse files
authored
Merge pull request swiftlang#63193 from apple/egorzhdan/std-to-cxxstdlib-irgen
[cxx-interop] Link with `CxxStdlib` binary if it is available
2 parents ae0f156 + 5008730 commit 505d8c2

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/IRGen/GenDecl.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,8 +494,15 @@ void IRGenModule::emitSourceFile(SourceFile &SF) {
494494
// Do not try to link std with itself.
495495
if ((target.isOSDarwin() || target.isOSLinux()) &&
496496
!getSwiftModule()->getName().is("Cxx") &&
497-
!getSwiftModule()->getName().is("std"))
497+
!getSwiftModule()->getName().is("CxxStdlib") &&
498+
!getSwiftModule()->getName().is("std")) {
499+
// TODO: link with swiftCxxStdlib unconditionally once the overlay module
500+
// is renamed in CMake
501+
if (target.isOSDarwin())
502+
this->addLinkLibrary(
503+
LinkLibrary("swiftCxxStdlib", LibraryKind::Library));
498504
this->addLinkLibrary(LinkLibrary("swiftstd", LibraryKind::Library));
505+
}
499506
}
500507

501508
// FIXME: It'd be better to have the driver invocation or build system that

0 commit comments

Comments
 (0)