This revision was automatically updated to reflect the committed changes.
Closed by commit rL340712: [Xray] Darwin - Enable in the driver side (authored 
by devnexen, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D51269?vs=162583&id=162610#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D51269

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


Index: cfe/trunk/lib/Driver/XRayArgs.cpp
===================================================================
--- cfe/trunk/lib/Driver/XRayArgs.cpp
+++ cfe/trunk/lib/Driver/XRayArgs.cpp
@@ -52,7 +52,8 @@
       }
     } 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: cfe/trunk/lib/Driver/ToolChains/Darwin.cpp
===================================================================
--- cfe/trunk/lib/Driver/ToolChains/Darwin.cpp
+++ cfe/trunk/lib/Driver/ToolChains/Darwin.cpp
@@ -1105,6 +1105,13 @@
   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: cfe/trunk/lib/Driver/ToolChains/Darwin.h
===================================================================
--- cfe/trunk/lib/Driver/ToolChains/Darwin.h
+++ cfe/trunk/lib/Driver/ToolChains/Darwin.h
@@ -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: cfe/trunk/test/Driver/XRay/xray-instrument-os.c
===================================================================
--- cfe/trunk/test/Driver/XRay/xray-instrument-os.c
+++ cfe/trunk/test/Driver/XRay/xray-instrument-os.c
@@ -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;
Index: cfe/trunk/test/Driver/XRay/lit.local.cfg
===================================================================
--- cfe/trunk/test/Driver/XRay/lit.local.cfg
+++ cfe/trunk/test/Driver/XRay/lit.local.cfg
@@ -10,7 +10,7 @@
 
 # Only on platforms we support.
 supported_oses = [
-    'Linux', 'FreeBSD'
+    'Linux', 'FreeBSD', 'Darwin'
 ]
 
 triple_set = set(target_triple_components)


Index: cfe/trunk/lib/Driver/XRayArgs.cpp
===================================================================
--- cfe/trunk/lib/Driver/XRayArgs.cpp
+++ cfe/trunk/lib/Driver/XRayArgs.cpp
@@ -52,7 +52,8 @@
       }
     } 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: cfe/trunk/lib/Driver/ToolChains/Darwin.cpp
===================================================================
--- cfe/trunk/lib/Driver/ToolChains/Darwin.cpp
+++ cfe/trunk/lib/Driver/ToolChains/Darwin.cpp
@@ -1105,6 +1105,13 @@
   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: cfe/trunk/lib/Driver/ToolChains/Darwin.h
===================================================================
--- cfe/trunk/lib/Driver/ToolChains/Darwin.h
+++ cfe/trunk/lib/Driver/ToolChains/Darwin.h
@@ -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: cfe/trunk/test/Driver/XRay/xray-instrument-os.c
===================================================================
--- cfe/trunk/test/Driver/XRay/xray-instrument-os.c
+++ cfe/trunk/test/Driver/XRay/xray-instrument-os.c
@@ -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;
Index: cfe/trunk/test/Driver/XRay/lit.local.cfg
===================================================================
--- cfe/trunk/test/Driver/XRay/lit.local.cfg
+++ cfe/trunk/test/Driver/XRay/lit.local.cfg
@@ -10,7 +10,7 @@
 
 # Only on platforms we support.
 supported_oses = [
-    'Linux', 'FreeBSD'
+    'Linux', 'FreeBSD', 'Darwin'
 ]
 
 triple_set = set(target_triple_components)
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to