[binutils-gdb] GDB: aarch64-linux: Reorganize SME-related definitions

Thiago Bauermann via Gdb-cvs <[email protected]>
Newsgroups gmane.comp.gdb.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=59dd01bfe9cbc33a6fb18c5a474024da0276f3e2

commit 59dd01bfe9cbc33a6fb18c5a474024da0276f3e2
Author: Thiago Jung Bauermann <[email protected]>
Date:   Sat Feb 28 17:13:59 2026 -0300

    GDB: aarch64-linux: Reorganize SME-related definitions
    
    The HWCAP2_SME, HWCAP2_SME2 and HWCAP2_SME2P1 definitions should be in a
    file under gdb/nat/, so move them to aarch64-scalable-linux-ptrace.h.
    
    Also, I noticed that gdb/aarch64-linux-nat.c and
    gdbserver/linux-aarch64-low.cc don't need anything from the
    arch/aarch64-scalable-linux.h header, so make them not include it.
    
    Approved-By: Luis Machado <[email protected]>

Diff:
---
 gdb/aarch64-linux-nat.c                 |  1 -
 gdb/arch/aarch64-scalable-linux.h       | 11 -----------
 gdb/nat/aarch64-scalable-linux-ptrace.h | 12 ++++++++++++
 gdbserver/linux-aarch64-low.cc          |  1 -
 4 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c
index d12e2ddcfb2..4b86ae9ebe1 100644
--- a/gdb/aarch64-linux-nat.c
+++ b/gdb/aarch64-linux-nat.c
@@ -55,7 +55,6 @@
 #include "arch-utils.h"
 
 #include "arch/aarch64-gcs-linux.h"
-#include "arch/aarch64-scalable-linux.h"
 
 #include <string.h>
 
diff --git a/gdb/arch/aarch64-scalable-linux.h b/gdb/arch/aarch64-scalable-linux.h
index 813d0656205..e20d094e79d 100644
--- a/gdb/arch/aarch64-scalable-linux.h
+++ b/gdb/arch/aarch64-scalable-linux.h
@@ -23,17 +23,6 @@
 
 #include "gdbsupport/common-regcache.h"
 
-/* Feature check for Scalable Matrix Extension.  */
-#ifndef HWCAP2_SME
-#define HWCAP2_SME (1 << 23)
-#endif
-
-/* Feature check for Scalable Matrix Extension 2.  */
-#ifndef HWCAP2_SME2
-#define HWCAP2_SME2   (1UL << 37)
-#define HWCAP2_SME2P1 (1UL << 38)
-#endif
-
 /* Streaming mode enabled/disabled bit.  */
 #define SVCR_SM_BIT (1 << 0)
 /* ZA enabled/disabled bit.  */
diff --git a/gdb/nat/aarch64-scalable-linux-ptrace.h b/gdb/nat/aarch64-scalable-linux-ptrace.h
index 453f19dfe8d..35715475150 100644
--- a/gdb/nat/aarch64-scalable-linux-ptrace.h
+++ b/gdb/nat/aarch64-scalable-linux-ptrace.h
@@ -30,10 +30,22 @@
    these very same symbols.  When that's the case, build errors will
    result when <asm/ptrace.h> is included before <sys/ptrace.h>.  */
 #include <sys/ptrace.h>
+#include <asm/hwcap.h>
 #include <asm/ptrace.h>
 #include <stdarg.h>
 #include "aarch64-scalable-linux-sigcontext.h"
 
+/* Feature check for Scalable Matrix Extension.  */
+#ifndef HWCAP2_SME
+#define HWCAP2_SME (1 << 23)
+#endif
+
+/* Feature check for Scalable Matrix Extension 2.  */
+#ifndef HWCAP2_SME2
+#define HWCAP2_SME2   (1UL << 37)
+#define HWCAP2_SME2P1 (1UL << 38)
+#endif
+
 /* Indicates whether a SVE ptrace header is followed by SVE registers or a
    fpsimd structure.  */
 #define HAS_SVE_STATE(header) ((header).flags & SVE_PT_REGS_SVE)
diff --git a/gdbserver/linux-aarch64-low.cc b/gdbserver/linux-aarch64-low.cc
index a00ee1556c8..c44f7516714 100644
--- a/gdbserver/linux-aarch64-low.cc
+++ b/gdbserver/linux-aarch64-low.cc
@@ -43,7 +43,6 @@
 #include "arch/aarch64-gcs-linux.h"
 #include "arch/aarch64-mte-linux.h"
 #include "arch/aarch64-pauth-linux.h"
-#include "arch/aarch64-scalable-linux.h"
 #include "linux-aarch32-tdesc.h"
 #include "linux-aarch64-tdesc.h"
 #include "nat/aarch64-fpmr-linux.h"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.