]> granicus.if.org Git - clang/commitdiff
[Xray] Darwin - Enable in the driver side
authorDavid Carlier <devnexen@gmail.com>
Mon, 27 Aug 2018 05:16:09 +0000 (05:16 +0000)
committerDavid Carlier <devnexen@gmail.com>
Mon, 27 Aug 2018 05:16:09 +0000 (05:16 +0000)
Reviewers: dberris

Reviered By: dberris

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@340712 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/ToolChains/Darwin.cpp
lib/Driver/ToolChains/Darwin.h
lib/Driver/XRayArgs.cpp
test/Driver/XRay/lit.local.cfg
test/Driver/XRay/xray-instrument-os.c

index 5971a0ae4472659a5935d1e625ea52932f7fe393..1fded3cd1bbd30f71f009048090c21fc29d86c97 100644 (file)
@@ -1105,6 +1105,13 @@ void DarwinClang::AddLinkRuntimeLibArgs(const ArgList &Args,
   if (Sanitize.needsEsanRt())
     AddLinkSanitizerLibArgs(Args, CmdArgs, "esan");
 
+  const XRayArgs &XRay = getXRayArgs();
+  if (XRay.needsXRayRt()) {
+    AddLinkRuntimeLib(Args, CmdArgs, "xray");
+    AddLinkRuntimeLib(Args, CmdArgs, "xray-basic");
+    AddLinkRuntimeLib(Args, CmdArgs, "xray-fdr");
+  }
+
   // Otherwise link libSystem, then the dynamic runtime library, and finally any
   // target specific static runtime library.
   CmdArgs.push_back("-lSystem");
index 73c4ac6aecaa42e3a64ba1c155ee8657561cf86c..7a0f74e67a6c87f36502a1d8e69100a05b37089b 100644 (file)
@@ -11,6 +11,7 @@
 #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_DARWIN_H
 
 #include "Cuda.h"
+#include "clang/Driver/XRayArgs.h"
 #include "clang/Driver/Tool.h"
 #include "clang/Driver/ToolChain.h"
 
index 30b0e72760c95a757ffb46fb8e8237a9bc20d112..527fc3c95584adc9dc57b0ecd0c38518bbcf3c8e 100644 (file)
@@ -52,7 +52,8 @@ XRayArgs::XRayArgs(const ToolChain &TC, const ArgList &Args) {
       }
     } else if (Triple.getOS() == llvm::Triple::FreeBSD ||
                Triple.getOS() == llvm::Triple::OpenBSD ||
-               Triple.getOS() == llvm::Triple::NetBSD) {
+               Triple.getOS() == llvm::Triple::NetBSD ||
+               Triple.getOS() == llvm::Triple::Darwin) {
       if (Triple.getArch() != llvm::Triple::x86_64) {
         D.Diag(diag::err_drv_clang_unsupported)
             << (std::string(XRayInstrumentOption) + " on " + Triple.str());
index 41bd41395f7b29d21822818d1f202cb609fd32e7..70f9792ba3db5f0d6cf4e25295d2da471c1c6b47 100644 (file)
@@ -10,7 +10,7 @@ supported_targets = [
 
 # Only on platforms we support.
 supported_oses = [
-    'Linux', 'FreeBSD'
+    'Linux', 'FreeBSD', 'Darwin'
 ]
 
 triple_set = set(target_triple_components)
index 7e221365d6114dd8ec88cb18f134513fcd627057..1008d0aff6f8b957b432dc9ea84680a03cb1c004 100644 (file)
@@ -1,4 +1,4 @@
 // RUN: not %clang -o /dev/null -v -fxray-instrument -c %s
-// XFAIL: -linux-, -freebsd
+// XFAIL: -linux-, -freebsd, -darwin
 // REQUIRES-ANY: amd64, x86_64, x86_64h, arm, aarch64, arm64
 typedef int a;