[PATCH] D16264: For FreeBSD, use _p variants of libraries for linking C++ programs
Dimitry Andric via cfe-commits
cfe-commits at lists.llvm.org
Sat Feb 13 08:34:59 PST 2016
dim updated this revision to Diff 47913.
dim added a comment.
Add checks for -lm and -lm_p, when profiling is on.
http://reviews.llvm.org/D16264
Files:
lib/Driver/ToolChains.cpp
lib/Driver/ToolChains.h
test/Driver/freebsd.cpp
Index: test/Driver/freebsd.cpp
===================================================================
--- test/Driver/freebsd.cpp
+++ test/Driver/freebsd.cpp
@@ -2,5 +2,12 @@
// RUN: | FileCheck --check-prefix=CHECK-TEN %s
// RUN: %clangxx %s -### -o %t.o -target amd64-unknown-freebsd9.2 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-NINE %s
-// CHECK-TEN: -lc++
-// CHECK-NINE: -lstdc++
+// CHECK-TEN: "-lc++" "-lm"
+// CHECK-NINE: "-lstdc++" "-lm"
+
+// RUN: %clangxx %s -### -pg -o %t.o -target amd64-unknown-freebsd10.0 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-PG-TEN %s
+// RUN: %clangxx %s -### -pg -o %t.o -target amd64-unknown-freebsd9.2 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-PG-NINE %s
+// CHECK-PG-TEN: "-lc++_p" "-lm_p"
+// CHECK-PG-NINE: "-lstdc++_p" "-lm_p"
Index: lib/Driver/ToolChains.h
===================================================================
--- lib/Driver/ToolChains.h
+++ lib/Driver/ToolChains.h
@@ -728,6 +728,8 @@
void AddClangCXXStdlibIncludeArgs(
const llvm::opt::ArgList &DriverArgs,
llvm::opt::ArgStringList &CC1Args) const override;
+ void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
+ llvm::opt::ArgStringList &CmdArgs) const override;
bool UseSjLjExceptions(const llvm::opt::ArgList &Args) const override;
bool isPIEDefault() const override;
Index: lib/Driver/ToolChains.cpp
===================================================================
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -3128,6 +3128,22 @@
}
}
+void FreeBSD::AddCXXStdlibLibArgs(const ArgList &Args,
+ ArgStringList &CmdArgs) const {
+ CXXStdlibType Type = GetCXXStdlibType(Args);
+ bool Profiling = Args.hasArg(options::OPT_pg);
+
+ switch (Type) {
+ case ToolChain::CST_Libcxx:
+ CmdArgs.push_back(Profiling ? "-lc++_p" : "-lc++");
+ break;
+
+ case ToolChain::CST_Libstdcxx:
+ CmdArgs.push_back(Profiling ? "-lstdc++_p" : "-lstdc++");
+ break;
+ }
+}
+
Tool *FreeBSD::buildAssembler() const {
return new tools::freebsd::Assembler(*this);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16264.47913.patch
Type: text/x-patch
Size: 2120 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160213/e640a3ed/attachment.bin>
More information about the cfe-commits
mailing list