From: Luis Machado Date: Tue, 21 Jun 2022 08:44:00 +0000 (+0100) Subject: Conditionally define user_morello_state and user_cap structs X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=58969269b95669bb05d386ae8456cdbb5478033f;p=thirdparty%2Fbinutils-gdb.git Conditionally define user_morello_state and user_cap structs If we don't have the Morello kernel headers, we need to define our own structures to read capability registers and capabilities. --- diff --git a/gdb/nat/aarch64-cap-linux.h b/gdb/nat/aarch64-cap-linux.h index 3dc582a4c94..ff38bccaf6e 100644 --- a/gdb/nat/aarch64-cap-linux.h +++ b/gdb/nat/aarch64-cap-linux.h @@ -18,15 +18,10 @@ #ifndef NAT_AARCH64_CAP_LINUX_H #define NAT_AARCH64_CAP_LINUX_H -/* Morello-specific requests. */ -#ifndef PTRACE_PEEKCAP -#define PTRACE_PEEKCAP 12 -#endif - -#ifndef PTRACE_POKECAP -#define PTRACE_POKECAP 13 -#endif - +/* If we don't find PTRACE_POKECAP and PTRACE_PEEKCAP, we need to define + our own structures for reading capability registers and capabilities, as we + may be building GDB without the Morello kernel headers. */ +#if !defined(PTRACE_POKECAP) && !defined(PTRACE_PEEKCAP) /* Struct defining the layout of the capability register set. */ struct user_morello_state { /* General capability registers. */ @@ -58,6 +53,11 @@ struct user_cap { uint8_t __reserved[15]; }; +/* Morello-specific requests. */ +#define PTRACE_PEEKCAP 12 +#define PTRACE_POKECAP 13 +#endif + /* From thread TID, read a capability from memory at ADDRESS and store it into CAP.