phosek created this revision. phosek added reviewers: dexonsmith, compnerd. Herald added a reviewer: EricWF. Herald added a subscriber: cfe-commits.
Darwin driver currently uses libc++ headers that are part of Clang toolchain when available (by default ../include/c++/v1 relative to executable), but it completely ignores the libc++ library itself because it doesn't pass the location of libc++ library that's part of Clang (by default ../lib relative to the exceutable) to the linker always using the system copy of libc++. This may lead to subtle issues when the compilation fails because the headers that are part of Clang toolchain are incompatible with the system library. Either the driver should ignore both headers as well as the library, or it should always try to use both when available. This patch changes the driver behavior to do the latter which seems more reasonable, it makes it easy to test and use custom libc++ build on Darwin while still allowing the use of system version. This also matches the Clang driver behavior on other systems. Repository: rC Clang https://reviews.llvm.org/D45639 Files: clang/lib/Driver/ToolChains/Darwin.cpp Index: clang/lib/Driver/ToolChains/Darwin.cpp =================================================================== --- clang/lib/Driver/ToolChains/Darwin.cpp +++ clang/lib/Driver/ToolChains/Darwin.cpp @@ -508,6 +508,8 @@ Args.AddAllArgs(CmdArgs, options::OPT_L); + getToolChain().AddFilePathLibArgs(Args, CmdArgs); + AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs, JA); // Build the input file for -filelist (list of linker input files) in case we // need it later @@ -668,6 +670,7 @@ getProgramPaths().push_back(getDriver().getInstalledDir()); if (getDriver().getInstalledDir() != getDriver().Dir) getProgramPaths().push_back(getDriver().Dir); + getFilePaths().push_back(getDriver().Dir + "/../lib"); } /// Darwin - Darwin tool chain for i386 and x86_64.
Index: clang/lib/Driver/ToolChains/Darwin.cpp =================================================================== --- clang/lib/Driver/ToolChains/Darwin.cpp +++ clang/lib/Driver/ToolChains/Darwin.cpp @@ -508,6 +508,8 @@ Args.AddAllArgs(CmdArgs, options::OPT_L); + getToolChain().AddFilePathLibArgs(Args, CmdArgs); + AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs, JA); // Build the input file for -filelist (list of linker input files) in case we // need it later @@ -668,6 +670,7 @@ getProgramPaths().push_back(getDriver().getInstalledDir()); if (getDriver().getInstalledDir() != getDriver().Dir) getProgramPaths().push_back(getDriver().Dir); + getFilePaths().push_back(getDriver().Dir + "/../lib"); } /// Darwin - Darwin tool chain for i386 and x86_64.
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits