Skip to content

Commit 61899cf

Browse files
committed
FreeBSD: Autolink C++ runtime
This hooks up the autolink mechanism to link the C++ runtime when C++ interop is enabled on FreeBSD. (cherry picked from commit 91aa7b8)
1 parent d6635f7 commit 61899cf

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lib/AST/ModuleDependencies.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,8 @@ void swift::dependencies::registerCxxInteropLibraries(
600600
return mainModuleName == Name;
601601
})) {
602602
// Only link with CxxStdlib on platforms where the overlay is available.
603-
if (Target.isOSDarwin() || Target.isOSLinux() || Target.isOSWindows())
603+
if (Target.isOSDarwin() || Target.isOSLinux() || Target.isOSWindows() ||
604+
Target.isOSFreeBSD())
604605
RegistrationCallback(LinkLibrary{"swiftCxxStdlib", LibraryKind::Library,
605606
hasStaticCxxStdlib});
606607
}

lib/Frontend/CompilerInvocation.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,8 @@ void CompilerInvocation::computeCXXStdlibOptions() {
390390
// (see https://reviews.llvm.org/D101479).
391391
LangOpts.CXXStdlib = CXXStdlibKind::Msvcprt;
392392
LangOpts.PlatformDefaultCXXStdlib = CXXStdlibKind::Msvcprt;
393-
} else if (LangOpts.Target.isOSLinux() || LangOpts.Target.isOSDarwin()) {
393+
} else if (LangOpts.Target.isOSLinux() || LangOpts.Target.isOSDarwin() ||
394+
LangOpts.Target.isOSFreeBSD()) {
394395
auto [clangDriver, clangDiagEngine] =
395396
ClangImporter::createClangDriver(LangOpts, ClangImporterOpts);
396397
auto clangDriverArgs = ClangImporter::createClangArgs(

0 commit comments

Comments
 (0)