summaryrefslogtreecommitdiffstats
path: root/lib/Driver/ToolChains/Darwin.cpp
diff options
context:
space:
mode:
authorDean Michael Berris <dberris@google.com>2017-11-10 05:50:13 +0000
committerDean Michael Berris <dberris@google.com>2017-11-10 05:50:13 +0000
commit6d2e3c60e65e302d47594038d19135211ce182e1 (patch)
tree4b75a94d567048be681bf70b75b6d192fe0e1c66 /lib/Driver/ToolChains/Darwin.cpp
parent41ea3d5b6cc3bdb5a44b1e9bc292f635471d44c3 (diff)
[XRay][darwin] Initial XRay in Darwin Support
Summary: This change implements the changes required in both clang and compiler-rt to allow building XRay-instrumented binaries in Darwin. For now we limit this to x86_64. We also start building the XRay runtime library in compiler-rt for osx. A caveat to this is that we don't have the tests set up and running yet, which we'll do in a set of follow-on changes. This patch uses the monorepo layout for the coordinated change across multiple projects. Reviewers: kubamracek Subscribers: mgorny, cfe-commits, llvm-commits Differential Revision: https://reviews.llvm.org/D39114 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@317875 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/ToolChains/Darwin.cpp')
-rw-r--r--lib/Driver/ToolChains/Darwin.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Driver/ToolChains/Darwin.cpp b/lib/Driver/ToolChains/Darwin.cpp
index 39c4525f84..e689d4fa44 100644
--- a/lib/Driver/ToolChains/Darwin.cpp
+++ b/lib/Driver/ToolChains/Darwin.cpp
@@ -18,6 +18,7 @@
#include "clang/Driver/DriverDiagnostic.h"
#include "clang/Driver/Options.h"
#include "clang/Driver/SanitizerArgs.h"
+#include "clang/Driver/XRayArgs.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/Option/ArgList.h"
#include "llvm/Support/Path.h"
@@ -1098,6 +1099,11 @@ void DarwinClang::AddLinkRuntimeLibArgs(const ArgList &Args,
if (Sanitize.needsEsanRt())
AddLinkSanitizerLibArgs(Args, CmdArgs, "esan");
+ const XRayArgs& XRay = getXRayArgs();
+ if (XRay.needsXRayRt() && isTargetMacOS()) {
+ AddLinkRuntimeLib(Args, CmdArgs, "libclang_rt.xray_osx.a", RLO_AlwaysLink);
+ }
+
// Otherwise link libSystem, then the dynamic runtime library, and finally any
// target specific static runtime library.
CmdArgs.push_back("-lSystem");