]> granicus.if.org Git - clang/commitdiff
[XRay] Support AArch64 in Clang
authorDean Michael Berris <dberris@google.com>
Mon, 21 Nov 2016 03:24:59 +0000 (03:24 +0000)
committerDean Michael Berris <dberris@google.com>
Mon, 21 Nov 2016 03:24:59 +0000 (03:24 +0000)
This patch adds XRay support in Clang for AArch64 target.
This patch is one of a series:

LLVM: https://reviews.llvm.org/D26412
compiler-rt: https://reviews.llvm.org/D26413

Author: rSerge

Reviewers: rengolin, dberris

Subscribers: aemerson, cfe-commits, iid_iunknown

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

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

lib/Driver/Tools.cpp
test/Driver/XRay/xray-instrument-cpu.c
test/Driver/XRay/xray-instrument-os.c

index 8fc34ab05a0f7f4b61909094aa906aab844cd700..18c917c55a41e686b6b9b09b7103f91be9acdebd 100644 (file)
@@ -4900,14 +4900,20 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
   if (Args.hasFlag(options::OPT_fxray_instrument,
                    options::OPT_fnoxray_instrument, false)) {
     const char *const XRayInstrumentOption = "-fxray-instrument";
-    if (Triple.getOS() == llvm::Triple::Linux &&
-        (Triple.getArch() == llvm::Triple::arm ||
-         Triple.getArch() == llvm::Triple::x86_64)) {
-      // Supported.
-    } else {
+    if (Triple.getOS() == llvm::Triple::Linux)
+      switch (Triple.getArch()) {
+      case llvm::Triple::x86_64:
+      case llvm::Triple::arm:
+      case llvm::Triple::aarch64:
+        // Supported.
+        break;
+      default:
+        D.Diag(diag::err_drv_clang_unsupported)
+            << (std::string(XRayInstrumentOption) + " on " + Triple.str());
+      }
+    else
       D.Diag(diag::err_drv_clang_unsupported)
-          << (std::string(XRayInstrumentOption) + " on " + Triple.str());
-    }
+          << (std::string(XRayInstrumentOption) + " on non-Linux target OS");
     CmdArgs.push_back(XRayInstrumentOption);
     if (const Arg *A =
             Args.getLastArg(options::OPT_fxray_instruction_threshold_,
index a686377d287c71eb88221ce76e532b0bc5adf889..613342063a40a52622d2de6c14c5843763a778d6 100644 (file)
@@ -1,4 +1,4 @@
 // RUN: not %clang -o /dev/null -v -fxray-instrument -c %s
-// XFAIL: amd64-, x86_64-, x86_64h-, arm
+// XFAIL: amd64-, x86_64-, x86_64h-, arm, aarch64, arm64
 // REQUIRES: linux
 typedef int a;
index 3b9920309041b220f26b990b018e2592e320b3c6..86b109b6dbfe7e5b6e340469a5d92c96197a139c 100644 (file)
@@ -1,4 +1,4 @@
 // RUN: not %clang -o /dev/null -v -fxray-instrument -c %s
 // XFAIL: -linux-
-// REQUIRES-ANY: amd64, x86_64, x86_64h, arm
+// REQUIRES-ANY: amd64, x86_64, x86_64h, arm, aarch64, arm64
 typedef int a;