Ver Fonte

[Xray] Darwin - Enable in the driver side

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
David Carlier há 7 anos atrás
pai
commit
37975d5918

+ 7 - 0
lib/Driver/ToolChains/Darwin.cpp

@@ -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");

+ 1 - 0
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"
 

+ 2 - 1
lib/Driver/XRayArgs.cpp

@@ -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());

+ 1 - 1
test/Driver/XRay/lit.local.cfg

@@ -10,7 +10,7 @@ supported_targets = [
 
 # Only on platforms we support.
 supported_oses = [
-    'Linux', 'FreeBSD'
+    'Linux', 'FreeBSD', 'Darwin'
 ]
 
 triple_set = set(target_triple_components)

+ 1 - 1
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;