[PATCH] D145849: [Driver][xray] Allow XRay on Apple Silicon

Oleksii Lozovskyi via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jun 11 00:32:02 PDT 2023


ilammy updated this revision to Diff 530285.
ilammy added a comment.

Addressing feedback by  @MaskRay:

- Moved `// REQUIRES:` directive to the top of the test file
- Replaced legacy `-target` option with proper `--target` in tests
- Also rebased on updated trunk


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D145849/new/

https://reviews.llvm.org/D145849

Files:
  clang/lib/Driver/XRayArgs.cpp
  clang/test/Driver/XRay/xray-instrument-macos.c
  clang/test/Driver/XRay/xray-instrument-os.c


Index: clang/test/Driver/XRay/xray-instrument-os.c
===================================================================
--- clang/test/Driver/XRay/xray-instrument-os.c
+++ clang/test/Driver/XRay/xray-instrument-os.c
@@ -1,4 +1,4 @@
 // RUN: not %clang -o /dev/null -v -fxray-instrument -c %s
-// XFAIL: target={{.*-(linux|freebsd).*}}, target=x86_64-apple-{{(darwin|macos).*}}
+// XFAIL: target={{.*-(linux|freebsd).*}}, target={{(aarch64|x86_64)-apple-(darwin|macos).*}}
 // REQUIRES: target={{(amd64|x86_64|x86_64h|arm|aarch64|arm64)-.*}}
 typedef int a;
Index: clang/test/Driver/XRay/xray-instrument-macos.c
===================================================================
--- clang/test/Driver/XRay/xray-instrument-macos.c
+++ clang/test/Driver/XRay/xray-instrument-macos.c
@@ -1,4 +1,5 @@
-// RUN: %clang -o /dev/null -v -fxray-instrument -target x86_64-apple-macos10.11 -c %s
-// RUN: %clang -o /dev/null -v -fxray-instrument -target x86_64-apple-darwin15 -c %s
-// REQUIRES: x86_64 || x86_64h
+// REQUIRES: aarch64 || x86_64 || x86_64h
+// RUN: %clang -o /dev/null -v -fxray-instrument --target aarch64-apple-darwin20 -c %s
+// RUN: %clang -o /dev/null -v -fxray-instrument --target x86_64-apple-macos10.11 -c %s
+// RUN: %clang -o /dev/null -v -fxray-instrument --target x86_64-apple-darwin15 -c %s
 typedef int a;
Index: clang/lib/Driver/XRayArgs.cpp
===================================================================
--- clang/lib/Driver/XRayArgs.cpp
+++ clang/lib/Driver/XRayArgs.cpp
@@ -52,11 +52,20 @@
           << (std::string(XRayInstrumentOption) + " on " + Triple.str());
     }
   } else if (Triple.isOSFreeBSD() || Triple.isOSOpenBSD() ||
-             Triple.isOSNetBSD() || Triple.isMacOSX()) {
+             Triple.isOSNetBSD()) {
     if (Triple.getArch() != llvm::Triple::x86_64) {
       D.Diag(diag::err_drv_clang_unsupported)
           << (std::string(XRayInstrumentOption) + " on " + Triple.str());
     }
+  } else if (Triple.isMacOSX()) {
+    switch (Triple.getArch()) {
+    case llvm::Triple::x86_64:
+    case llvm::Triple::aarch64:
+      break;
+    default:
+      D.Diag(diag::err_drv_clang_unsupported)
+          << (std::string(XRayInstrumentOption) + " on " + Triple.str());
+    }
   } else if (Triple.getOS() == llvm::Triple::Fuchsia) {
     switch (Triple.getArch()) {
     case llvm::Triple::x86_64:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145849.530285.patch
Type: text/x-patch
Size: 2351 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230611/2af98966/attachment-0001.bin>


More information about the cfe-commits mailing list