summaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorMarkus Mayer <[email protected]>2025-02-21 11:19:34 -0800
committerMark Wielaard <[email protected]>2025-02-23 14:18:36 +0100
commit52a747a316042e70a22acb489df9e51bfc6bf2d5 (patch)
tree5f0f4b53d890b0778e95ffff69f44eded95789e2 /configure.ac
parente543c7f5c2b28ac2bce1e9f09fad30caebb579d5 (diff)
aarch64: define struct user_pac_mask if needed
On Aarch64, Linux is using Pointer Authentication Code (PAC) for pointer authentication.[1] The struct "user_pac_mask" has been part of the Linux kernel since version 5.0 as part of this feature. However, older kernels do not define it. Therefore, we want to check if the definition is present in the kernel headers and provide one if it isn't. This ensures two things: * elfutils will continue to compile against kernel headers from 4.x * binaries built against older kernel headers will still be fully functional if used on a newer system For reference, the build error that is being avoided looks like this: [...] CC aarch64_initreg.o aarch64_initreg.c: In function 'aarch64_set_initial_registers_tid': aarch64_initreg.c:61:24: error: storage size of 'pac_mask' isn't known struct user_pac_mask pac_mask; ^~~~~~~~ aarch64_initreg.c:61:24: warning: unused variable 'pac_mask' [-Wunused-variable] make[4]: *** [Makefile:831: aarch64_initreg.o] Error 1 make[3]: *** [Makefile:547: all-recursive] Error 1 make[2]: *** [Makefile:463: all] Error 2 [1] https://docs.kernel.org/arch/arm64/pointer-authentication.html https://sourceware.org/bugzilla/show_bug.cgi?id=32684 Fixes: 64e3b451ad2c ("aarch64: extend dwfl_thread_state_registers to handle PAC") Signed-off-by: Markus Mayer <[email protected]>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac8
1 files changed, 8 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index e57d3927..3298f7fc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -777,6 +777,14 @@ if test "$sys_user_has_user_regs" = "yes"; then
[Define to 1 if <sys/user.h> defines struct user_regs_struct])
fi
+AC_CHECK_TYPE([struct user_pac_mask],
+ [has_user_pac_mask=yes], [has_user_pac_mask=no],
+ [[#include <asm/ptrace.h>]])
+if test "$has_user_pac_mask" = "yes"; then
+ AC_DEFINE(HAVE_USER_PACK_MASK, 1,
+ [Defined if struct user_pac_mask exists.])
+fi
+
# On a 64-bit host where can can use $CC -m32, we'll run two sets of tests.
utrace_BIARCH
CC_BIARCH="$CC $utrace_biarch"