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