diff --git a/clang/lib/Driver/XRayArgs.cpp b/clang/lib/Driver/XRayArgs.cpp --- a/clang/lib/Driver/XRayArgs.cpp +++ b/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: diff --git a/clang/test/Driver/XRay/xray-instrument-macos.c b/clang/test/Driver/XRay/xray-instrument-macos.c --- a/clang/test/Driver/XRay/xray-instrument-macos.c +++ b/clang/test/Driver/XRay/xray-instrument-macos.c @@ -1,4 +1,5 @@ +// 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 -// REQUIRES: x86_64 || x86_64h +// REQUIRES: aarch64 || x86_64 || x86_64h typedef int a; diff --git a/clang/test/Driver/XRay/xray-instrument-os.c b/clang/test/Driver/XRay/xray-instrument-os.c --- a/clang/test/Driver/XRay/xray-instrument-os.c +++ b/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;