]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Conditionally define user_morello_state and user_cap structs
authorLuis Machado <luis.machado@arm.com>
Tue, 21 Jun 2022 08:44:00 +0000 (09:44 +0100)
committerJohn Baldwin <jhb@FreeBSD.org>
Thu, 1 Sep 2022 23:06:27 +0000 (16:06 -0700)
If we don't have the Morello kernel headers, we need to define our own
structures to read capability registers and capabilities.

gdb/nat/aarch64-cap-linux.h

index 3dc582a4c94d53fd049fde664ad508420e9ae865..ff38bccaf6e01148d16e49f15cfaaaa329e64c8a 100644 (file)
 #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.