================
@@ -0,0 +1,124 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: target={{aarch64.*}}
+// UNSUPPORTED: target={{.*-windows.*}}
+
+#undef NDEBUG
+#include "support/func_bounds.h"
+#include <assert.h>
+#include <inttypes.h>
+#include <libunwind.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <unwind.h>
+
+#if defined(__APPLE__)
+#include <sys/sysctl.h>
+#endif
+
+// Note: This test requires FEAT_PAuth (and is setup to pass on other targets).
+
+#if defined(__APPLE__)
+static bool checkHasPAuth() {
+  int has_pauth = 0;
+  size_t size = sizeof(has_pauth);
+  if (sysctlbyname("hw.optional.arm.FEAT_PAuth", &has_pauth, &size, NULL, 0))
+    return false;
+  return has_pauth != 0;
+}
+#else
+static bool checkHasPAuth() {
+  // TODO: Support other platforms.
----------------
brad0 wrote:

> [bf97dc7](https://github.com/llvm/llvm-project/commit/bf97dc7d7d95e55e3fa4f7efabf235ff8bfc024a)
> 
> @brad0, mind double-checking this on OpenBSD / FreeBSD?

Although both OpenBSD / FreeBSD define and set HWCAP_PACA and this builds Ok 
the test fails. OpenBSD has PAC support by default but I don't know enough 
about this subject matter to understand the relation.

https://github.com/llvm/llvm-project/pull/205188
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to