OpenBSD add C++ runtime in a driver's standpoint
authorDean Michael Berris <dberris@google.com>
Thu, 19 Apr 2018 06:55:30 +0000 (06:55 +0000)
committerDean Michael Berris <dberris@google.com>
Thu, 19 Apr 2018 06:55:30 +0000 (06:55 +0000)
Summary: - Since 6.2 release, on supporters platforms clang is shipped with both libcxx and libcxxabi.

Reviewers: dberris, alekseyshl, EricWF

Reviewed By: dberris

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D45662

llvm-svn: 330310

clang/lib/Driver/ToolChains/OpenBSD.cpp
clang/lib/Driver/ToolChains/OpenBSD.h

index 72888b4..a12d83d 100644 (file)
@@ -259,6 +259,14 @@ OpenBSD::OpenBSD(const Driver &D, const llvm::Triple &Triple,
   getFilePaths().push_back("/usr/lib");
 }
 
+void OpenBSD::AddCXXStdlibLibArgs(const ArgList &Args,
+                                  ArgStringList &CmdArgs) const {
+  bool Profiling = Args.hasArg(options::OPT_pg);
+
+  CmdArgs.push_back(Profiling ? "-lc++_p" : "-lc++");
+  CmdArgs.push_back(Profiling ? "-lc++abi_p" : "-lc++abi");
+}
+
 Tool *OpenBSD::buildAssembler() const {
   return new tools::openbsd::Assembler(*this);
 }
index 5277609..bf8dfa4 100644 (file)
@@ -58,6 +58,8 @@ public:
   bool IsMathErrnoDefault() const override { return false; }
   bool IsObjCNonFragileABIDefault() const override { return true; }
   bool isPIEDefault() const override { return true; }
+  void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
+                           llvm::opt::ArgStringList &CmdArgs) const override;
 
   unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const override {
     return 2;