File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -469,10 +469,14 @@ void IRGenModule::emitSourceFile(SourceFile &SF) {
469469 if (ObjCInterop)
470470 this ->addLinkLibrary (LinkLibrary (" objc" , LibraryKind::Library));
471471
472- // Automatically with libc++ when possible.
473- if (Context.LangOpts .EnableCXXInterop && Context.LangOpts .Target .isOSDarwin ())
474- this ->addLinkLibrary (LinkLibrary (" c++" , LibraryKind::Library));
475-
472+ // If C++ interop is enabled, add -lc++ on Darwin and -lstdc++ on linux.
473+ if (Context.LangOpts .EnableCXXInterop ) {
474+ if (Context.LangOpts .Target .isOSDarwin ())
475+ this ->addLinkLibrary (LinkLibrary (" c++" , LibraryKind::Library));
476+ else if (Context.LangOpts .Target .isOSLinux ())
477+ this ->addLinkLibrary (LinkLibrary (" stdc++" , LibraryKind::Library));
478+ }
479+
476480 // FIXME: It'd be better to have the driver invocation or build system that
477481 // executes the linker introduce these compatibility libraries, since at
478482 // that point we know whether we're building an executable, which is the only
You can’t perform that action at this time.
0 commit comments