[PATCH] kselftest/arm64: Enable build of PAC tests with LLVM=1

Mark Brown posted 1 patch 1 week, 4 days ago
tools/testing/selftests/arm64/pauth/Makefile | 6 ++++++
1 file changed, 6 insertions(+)
[PATCH] kselftest/arm64: Enable build of PAC tests with LLVM=1
Posted by Mark Brown 1 week, 4 days ago
Currently we don't build the PAC selftests when building with LLVM=1 since
we attempt to test for PAC support in the toolchain before we've set up the
build system to point at LLVM in lib.mk, which has to be one of the last
things in the Makefile.

Since all versions of LLVM supported for use with the kernel have PAC
support we can just sidestep the issue by just assuming PAC is there when
doing a LLVM=1 build.

Signed-off-by: Mark Brown <broonie@kernel.org>
---
 tools/testing/selftests/arm64/pauth/Makefile | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tools/testing/selftests/arm64/pauth/Makefile b/tools/testing/selftests/arm64/pauth/Makefile
index 72e290b0b10c1ea5bf1b84232f70844a601b8129..b5a1c80e0ead6932d2441a192b9758a049e3b3f8 100644
--- a/tools/testing/selftests/arm64/pauth/Makefile
+++ b/tools/testing/selftests/arm64/pauth/Makefile
@@ -7,8 +7,14 @@ CC := $(CROSS_COMPILE)gcc
 endif
 
 CFLAGS += -mbranch-protection=pac-ret
+
+# All supported LLVMs have PAC, test for GCC
+ifeq ($(LLVM),1)
+pauth_cc_support := 1
+else
 # check if the compiler supports ARMv8.3 and branch protection with PAuth
 pauth_cc_support := $(shell if ($(CC) $(CFLAGS) -march=armv8.3-a -E -x c /dev/null -o /dev/null 2>&1) then echo "1"; fi)
+endif
 
 ifeq ($(pauth_cc_support),1)
 TEST_GEN_PROGS := pac

---
base-commit: 8e929cb546ee42c9a61d24fae60605e9e3192354
change-id: 20241111-arm64-selftest-pac-clang-cb80de079169

Best regards,
-- 
Mark Brown <broonie@kernel.org>
Re: [PATCH] kselftest/arm64: Enable build of PAC tests with LLVM=1
Posted by Catalin Marinas 1 week, 3 days ago
On Mon, 11 Nov 2024 18:32:58 +0000, Mark Brown wrote:
> Currently we don't build the PAC selftests when building with LLVM=1 since
> we attempt to test for PAC support in the toolchain before we've set up the
> build system to point at LLVM in lib.mk, which has to be one of the last
> things in the Makefile.
> 
> Since all versions of LLVM supported for use with the kernel have PAC
> support we can just sidestep the issue by just assuming PAC is there when
> doing a LLVM=1 build.
> 
> [...]

Applied to arm64 (for-next/kselftest), thanks!

[1/1] kselftest/arm64: Enable build of PAC tests with LLVM=1
      https://git.kernel.org/arm64/c/c297aa7d3fb6

-- 
Catalin