<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, May 1, 2014 at 1:46 PM, Patrick Wildt <span dir="ltr"><<a href="mailto:mail@patrick-wildt.de" target="_blank">mail@patrick-wildt.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
Bitrig's standard C++ standard library changed from libstdc++ to libc++.<br>
Also, it uses libc++abi and needs pthread. While there, fix the libc++<br>
include path.<br>
<br>
\Patrick<br>
<br>
diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp<br>
index 9465be8..d8ed34f 100644<br>
--- a/lib/Driver/ToolChains.cpp<br>
+++ b/lib/Driver/ToolChains.cpp<br>
@@ -2407,6 +2407,21 @@ Tool *Bitrig::buildLinker() const {<br>
return new tools::bitrig::Link(*this);<br>
}<br>
<br>
+ToolChain::CXXStdlibType<br>
+Bitrig::GetCXXStdlibType(const ArgList &Args) const {<br>
+ if (Arg *A = Args.getLastArg(options::OPT_stdlib_EQ)) {<br>
+ StringRef Value = A->getValue();<br>
+ if (Value == "libstdc++")<br>
+ return ToolChain::CST_Libstdcxx;<br>
+ if (Value == "libc++")<br>
+ return ToolChain::CST_Libcxx;<br>
+<br>
+ getDriver().Diag(diag::err_drv_invalid_stdlib_name)<br>
+ << A->getAsString(Args);<br>
+ }<br>
+ return ToolChain::CST_Libcxx;<br>
+}<br>
+<br>
void Bitrig::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs,<br>
ArgStringList &CC1Args) const {<br>
if (DriverArgs.hasArg(options::OPT_nostdlibinc) ||<br>
@@ -2416,7 +2431,7 @@ void Bitrig::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs,<br>
switch (GetCXXStdlibType(DriverArgs)) {<br>
case ToolChain::CST_Libcxx:<br>
addSystemInclude(DriverArgs, CC1Args,<br>
- getDriver().SysRoot + "/usr/include/c++/");<br>
+ getDriver().SysRoot + "/usr/include/c++/v1");<br>
break;<br>
case ToolChain::CST_Libstdcxx:<br>
addSystemInclude(DriverArgs, CC1Args,<br>
@@ -2442,9 +2457,8 @@ void Bitrig::AddCXXStdlibLibArgs(const ArgList &Args,<br>
switch (GetCXXStdlibType(Args)) {<br>
case ToolChain::CST_Libcxx:<br>
CmdArgs.push_back("-lc++");<br>
- CmdArgs.push_back("-lcxxrt");<br>
- // Include supc++ to provide Unwind until provided by libcxx.<br>
- CmdArgs.push_back("-lgcc");<br>
+ CmdArgs.push_back("-lc++abi");<br>
+ CmdArgs.push_back("-lpthread");<br></blockquote><div><br></div><div>Should this be controlled by the -pthread switch, or do you need it for all C++ builds for some reason?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
break;<br>
case ToolChain::CST_Libstdcxx:<br>
CmdArgs.push_back("-lstdc++");<br>
diff --git a/lib/Driver/ToolChains.h b/lib/Driver/ToolChains.h<br>
index ad4d4c1..b1a0627 100644<br>
--- a/lib/Driver/ToolChains.h<br>
+++ b/lib/Driver/ToolChains.h<br>
@@ -557,6 +557,7 @@ public:<br>
bool IsMathErrnoDefault() const override { return false; }<br>
bool IsObjCNonFragileABIDefault() const override { return true; }<br>
<br>
+ CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const override;<br>
void<br>
AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs,<br>
llvm::opt::ArgStringList &CC1Args) const override;<br>
diff --git a/test/Driver/bitrig.c b/test/Driver/bitrig.c<br>
index 876a9cd..d36d204 100644<br>
--- a/test/Driver/bitrig.c<br>
+++ b/test/Driver/bitrig.c<br>
@@ -4,15 +4,15 @@<br>
// CHECK-LD-C: ld{{.*}}" {{.*}} "-lc" "-lclang_rt.amd64"<br>
<br>
// RUN: %clangxx -no-canonical-prefixes -target amd64-pc-bitrig %s -### 2>&1 \<br>
+// RUN: | FileCheck --check-prefix=CHECK-LD-CXX-STDLIB %s<br>
+// CHECK-LD-CXX-STDLIB: clang{{.*}}" "-cc1" "-triple" "amd64-pc-bitrig"<br>
+// CHECK-LD-CXX-STDLIB: ld{{.*}}" {{.*}} "-lc++" "-lc++abi" "-lpthread" "-lm" "-lc" "-lclang_rt.amd64"<br>
+<br>
+// RUN: %clangxx -stdlib=libstdc++ -no-canonical-prefixes -target amd64-pc-bitrig %s -### 2>&1 \<br>
// RUN: | FileCheck --check-prefix=CHECK-LD-CXX %s<br>
// CHECK-LD-CXX: clang{{.*}}" "-cc1" "-triple" "amd64-pc-bitrig"<br>
// CHECK-LD-CXX: ld{{.*}}" {{.*}} "-lstdc++" "-lm" "-lc" "-lclang_rt.amd64"<br>
<br>
-// RUN: %clangxx -stdlib=libc++ -no-canonical-prefixes -target amd64-pc-bitrig %s -### 2>&1 \<br>
-// RUN: | FileCheck --check-prefix=CHECK-LD-CXX-STDLIB %s<br>
-// CHECK-LD-CXX-STDLIB: clang{{.*}}" "-cc1" "-triple" "amd64-pc-bitrig"<br>
-// CHECK-LD-CXX-STDLIB: ld{{.*}}" {{.*}} "-lc++" "-lcxxrt" "-lgcc" "-lm" "-lc" "-lclang_rt.amd64"<br>
-<br>
// RUN: %clang -no-canonical-prefixes -target amd64-pc-bitrig -pthread %s -### 2>&1 \<br>
// RUN: | FileCheck --check-prefix=CHECK-PTHREAD %s<br>
// CHECK-PTHREAD: clang{{.*}}" "-cc1" "-triple" "amd64-pc-bitrig"<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div></div>