public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/2] cleanup: Add missing feature/ XML files to Makefile
@ 2022-09-12 22:47 Keith Seitz
  2022-09-12 22:47 ` [PATCH 2/2] Constify target_desc declarations Keith Seitz
  2022-09-13 13:34 ` [PATCH 1/2] cleanup: Add missing feature/ XML files to Makefile Simon Marchi
  0 siblings, 2 replies; 11+ messages in thread
From: Keith Seitz @ 2022-09-12 22:47 UTC (permalink / raw)
  To: gdb-patches

This patch adds some missing .xml files to features/Makefile so that when the
directory's C files are regenerated, all files are appropriately remade.

This has demonstrated that there have been several "misses" in regenerating
files in this directory. Namely, arm-secext.c and sparc{32,64}-solaris.c. For
the former case, there was what essentially amounts to a typo regarding the
create feature function's name. In the later case, this file has missed at least
one important update in July, 2020, when allocate_target_description was
changed to return a unique pointer.

Those corrections are included.
---
 gdb/features/Makefile                |  4 ++++
 gdb/features/arm/arm-secext.c        |  2 +-
 gdb/features/sparc/sparc32-solaris.c | 16 ++++++++--------
 gdb/features/sparc/sparc64-solaris.c | 22 +++++++++++-----------
 4 files changed, 24 insertions(+), 20 deletions(-)

diff --git a/gdb/features/Makefile b/gdb/features/Makefile
index 061cb2ed032..bdd032f2c3c 100644
--- a/gdb/features/Makefile
+++ b/gdb/features/Makefile
@@ -108,6 +108,7 @@ XMLTOC = \
 	nds32.xml \
 	nios2.xml \
 	or1k.xml \
+	or1k-linux.xml \
 	rs6000/powerpc-32.xml \
 	rs6000/powerpc-32l.xml \
 	rs6000/powerpc-403.xml \
@@ -164,6 +165,8 @@ XMLTOC = \
 	s390x-vx-linux64.xml \
 	s390-gs-linux64.xml \
 	s390x-gs-linux64.xml \
+	sparc/sparc32-solaris.xml \
+	sparc/sparc64-solaris.xml \
 	z80.xml
 
 TDESC_CFILES = $(patsubst %.xml,%.c,$(XMLTOC))
@@ -209,6 +212,7 @@ FEATURE_XMLFILES = aarch64-core.xml \
 	arm/arm-m-profile-mve.xml \
 	arm/arm-m-system.xml \
 	arm/arm-m-profile-with-fpa.xml \
+	arm/arm-secext.xml \
 	arm/arm-tls.xml \
 	arm/arm-vfpv2.xml \
 	arm/arm-vfpv3.xml \
diff --git a/gdb/features/arm/arm-secext.c b/gdb/features/arm/arm-secext.c
index 39ef4afb05f..c71cffd2db6 100644
--- a/gdb/features/arm/arm-secext.c
+++ b/gdb/features/arm/arm-secext.c
@@ -4,7 +4,7 @@
 #include "gdbsupport/tdesc.h"
 
 static int
-create_feature_arm_arm_m_system (struct target_desc *result, long regnum)
+create_feature_arm_arm_secext (struct target_desc *result, long regnum)
 {
   struct tdesc_feature *feature;
 
diff --git a/gdb/features/sparc/sparc32-solaris.c b/gdb/features/sparc/sparc32-solaris.c
index 2f13292b72b..c2f16062fc1 100644
--- a/gdb/features/sparc/sparc32-solaris.c
+++ b/gdb/features/sparc/sparc32-solaris.c
@@ -9,14 +9,14 @@ struct target_desc *tdesc_sparc32_solaris;
 static void
 initialize_tdesc_sparc32_solaris (void)
 {
-  struct target_desc *result = allocate_target_description ();
-  struct tdesc_feature *feature;
+  target_desc_up result = allocate_target_description ();
+  set_tdesc_architecture (result.get (), bfd_scan_arch ("sparc"));
 
-  set_tdesc_architecture (result, bfd_scan_arch ("sparc"));
+  set_tdesc_osabi (result.get (), osabi_from_tdesc_string ("Solaris"));
 
-  set_tdesc_osabi (result, osabi_from_tdesc_string ("Solaris"));
+  struct tdesc_feature *feature;
 
-  feature = tdesc_create_feature (result, "org.gnu.gdb.sparc.cpu");
+  feature = tdesc_create_feature (result.get (), "org.gnu.gdb.sparc.cpu");
   tdesc_create_reg (feature, "g0", 0, 1, NULL, 32, "uint32");
   tdesc_create_reg (feature, "g1", 1, 1, NULL, 32, "uint32");
   tdesc_create_reg (feature, "g2", 2, 1, NULL, 32, "uint32");
@@ -50,7 +50,7 @@ initialize_tdesc_sparc32_solaris (void)
   tdesc_create_reg (feature, "fp", 30, 1, NULL, 32, "uint32");
   tdesc_create_reg (feature, "i7", 31, 1, NULL, 32, "uint32");
 
-  feature = tdesc_create_feature (result, "org.gnu.gdb.sparc.cp0");
+  feature = tdesc_create_feature (result.get (), "org.gnu.gdb.sparc.cp0");
   tdesc_create_reg (feature, "y", 64, 1, NULL, 32, "uint32");
   tdesc_create_reg (feature, "psr", 65, 1, NULL, 32, "uint32");
   tdesc_create_reg (feature, "wim", 66, 1, NULL, 32, "uint32");
@@ -60,7 +60,7 @@ initialize_tdesc_sparc32_solaris (void)
   tdesc_create_reg (feature, "fsr", 70, 1, NULL, 32, "uint32");
   tdesc_create_reg (feature, "csr", 71, 1, NULL, 32, "uint32");
 
-  feature = tdesc_create_feature (result, "org.gnu.gdb.sparc.fpu");
+  feature = tdesc_create_feature (result.get (), "org.gnu.gdb.sparc.fpu");
   tdesc_create_reg (feature, "f0", 32, 1, NULL, 32, "ieee_single");
   tdesc_create_reg (feature, "f1", 33, 1, NULL, 32, "ieee_single");
   tdesc_create_reg (feature, "f2", 34, 1, NULL, 32, "ieee_single");
@@ -94,5 +94,5 @@ initialize_tdesc_sparc32_solaris (void)
   tdesc_create_reg (feature, "f30", 62, 1, NULL, 32, "ieee_single");
   tdesc_create_reg (feature, "f31", 63, 1, NULL, 32, "ieee_single");
 
-  tdesc_sparc_solaris = result;
+  tdesc_sparc32_solaris = result.release ();
 }
diff --git a/gdb/features/sparc/sparc64-solaris.c b/gdb/features/sparc/sparc64-solaris.c
index ecc7b0fa58f..bb8f6853841 100644
--- a/gdb/features/sparc/sparc64-solaris.c
+++ b/gdb/features/sparc/sparc64-solaris.c
@@ -9,14 +9,14 @@ struct target_desc *tdesc_sparc64_solaris;
 static void
 initialize_tdesc_sparc64_solaris (void)
 {
-  struct target_desc *result = allocate_target_description ();
-  struct tdesc_feature *feature;
+  target_desc_up result = allocate_target_description ();
+  set_tdesc_architecture (result.get (), bfd_scan_arch ("sparc:v9"));
 
-  set_tdesc_architecture (result, bfd_scan_arch ("sparc"));
+  set_tdesc_osabi (result.get (), osabi_from_tdesc_string ("Solaris"));
 
-  set_tdesc_osabi (result, osabi_from_tdesc_string ("Solaris"));
+  struct tdesc_feature *feature;
 
-  feature = tdesc_create_feature (result, "org.gnu.gdb.sparc.cpu");
+  feature = tdesc_create_feature (result.get (), "org.gnu.gdb.sparc.cpu");
   tdesc_create_reg (feature, "g0", 0, 1, NULL, 64, "uint64");
   tdesc_create_reg (feature, "g1", 1, 1, NULL, 64, "uint64");
   tdesc_create_reg (feature, "g2", 2, 1, NULL, 64, "uint64");
@@ -47,18 +47,18 @@ initialize_tdesc_sparc64_solaris (void)
   tdesc_create_reg (feature, "i3", 27, 1, NULL, 64, "uint64");
   tdesc_create_reg (feature, "i4", 28, 1, NULL, 64, "uint64");
   tdesc_create_reg (feature, "i5", 29, 1, NULL, 64, "uint64");
-  tdesc_create_reg (feature, "fp", 30, 1, NULL, 32, "uint64");
+  tdesc_create_reg (feature, "fp", 30, 1, NULL, 64, "uint64");
   tdesc_create_reg (feature, "i7", 31, 1, NULL, 64, "uint64");
 
-  feature = tdesc_create_feature (result, "org.gnu.gdb.sparc.cp0");
+  feature = tdesc_create_feature (result.get (), "org.gnu.gdb.sparc.cp0");
   tdesc_create_reg (feature, "pc", 80, 1, NULL, 64, "code_ptr");
   tdesc_create_reg (feature, "npc", 81, 1, NULL, 64, "code_ptr");
   tdesc_create_reg (feature, "state", 82, 1, NULL, 64, "uint64");
-  tdesc_create_reg (feature, "fsr", 83, 1, NULL, 32, "ieee_single");
-  tdesc_create_reg (feature, "fprs", 84, 1, NULL, 32, "ieee_single");
+  tdesc_create_reg (feature, "fsr", 83, 1, NULL, 64, "uint64");
+  tdesc_create_reg (feature, "fprs", 84, 1, NULL, 64, "uint64");
   tdesc_create_reg (feature, "y", 85, 1, NULL, 64, "uint64");
 
-  feature = tdesc_create_feature (result, "org.gnu.gdb.sparc.fpu");
+  feature = tdesc_create_feature (result.get (), "org.gnu.gdb.sparc.fpu");
   tdesc_create_reg (feature, "f0", 32, 1, NULL, 32, "ieee_single");
   tdesc_create_reg (feature, "f1", 33, 1, NULL, 32, "ieee_single");
   tdesc_create_reg (feature, "f2", 34, 1, NULL, 32, "ieee_single");
@@ -108,5 +108,5 @@ initialize_tdesc_sparc64_solaris (void)
   tdesc_create_reg (feature, "f60", 78, 1, NULL, 64, "ieee_double");
   tdesc_create_reg (feature, "f62", 79, 1, NULL, 64, "ieee_double");
 
-  tdesc_sparc64_solaris = result;
+  tdesc_sparc64_solaris = result.release ();
 }
-- 
2.37.2


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 2/2] Constify target_desc declarations
  2022-09-12 22:47 [PATCH 1/2] cleanup: Add missing feature/ XML files to Makefile Keith Seitz
@ 2022-09-12 22:47 ` Keith Seitz
  2022-09-13 13:38   ` Simon Marchi
  2022-09-13 13:34 ` [PATCH 1/2] cleanup: Add missing feature/ XML files to Makefile Simon Marchi
  1 sibling, 1 reply; 11+ messages in thread
From: Keith Seitz @ 2022-09-12 22:47 UTC (permalink / raw)
  To: gdb-patches

This patch changes various global target_desc declarations to const, thereby
correcting a prominent source of ODR violations in PowerPC-related target code.
The majority of files/changes are mechanical const-ifications accomplished by
regenerating the C files in features/.

This also required manually updating mips-linux-tdep.h,  s390-linux-tdep.h,
nios2-tdep.h, s390-tdep.h, arch/ppc-linux-tdesc.h, arch/ppc-linux-common.c,
and rs6000-tdep.c.

Patch tested against the sourceware trybot, and fully regression tested against
our (Red Hat's) internal  test infrastructure on Rawhide aarch64, s390x, x86_64,
and powerpcle.

With this patch, I can finally enable LTO in our GDB package builds. [Tested
with a rawhide scratch build containing this patch.]

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=22395
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=24835
---
 gdb/arch/ppc-linux-common.c                   |  2 +-
 gdb/arch/ppc-linux-tdesc.h                    | 40 +++++++++----------
 gdb/features/microblaze-with-stack-protect.c  |  2 +-
 gdb/features/microblaze.c                     |  2 +-
 gdb/features/mips-dsp-linux.c                 |  2 +-
 gdb/features/mips-linux.c                     |  2 +-
 gdb/features/mips64-dsp-linux.c               |  2 +-
 gdb/features/mips64-linux.c                   |  2 +-
 gdb/features/nds32.c                          |  2 +-
 gdb/features/nios2.c                          |  2 +-
 gdb/features/or1k-linux.c                     |  2 +-
 gdb/features/or1k.c                           |  2 +-
 gdb/features/rs6000/powerpc-32.c              |  2 +-
 gdb/features/rs6000/powerpc-32l.c             |  2 +-
 gdb/features/rs6000/powerpc-403.c             |  2 +-
 gdb/features/rs6000/powerpc-403gc.c           |  2 +-
 gdb/features/rs6000/powerpc-405.c             |  2 +-
 gdb/features/rs6000/powerpc-505.c             |  2 +-
 gdb/features/rs6000/powerpc-601.c             |  2 +-
 gdb/features/rs6000/powerpc-602.c             |  2 +-
 gdb/features/rs6000/powerpc-603.c             |  2 +-
 gdb/features/rs6000/powerpc-604.c             |  2 +-
 gdb/features/rs6000/powerpc-64.c              |  2 +-
 gdb/features/rs6000/powerpc-64l.c             |  2 +-
 gdb/features/rs6000/powerpc-7400.c            |  2 +-
 gdb/features/rs6000/powerpc-750.c             |  2 +-
 gdb/features/rs6000/powerpc-860.c             |  2 +-
 gdb/features/rs6000/powerpc-altivec32.c       |  2 +-
 gdb/features/rs6000/powerpc-altivec32l.c      |  2 +-
 gdb/features/rs6000/powerpc-altivec64.c       |  2 +-
 gdb/features/rs6000/powerpc-altivec64l.c      |  2 +-
 gdb/features/rs6000/powerpc-e500.c            |  2 +-
 gdb/features/rs6000/powerpc-e500l.c           |  2 +-
 gdb/features/rs6000/powerpc-isa205-32l.c      |  2 +-
 gdb/features/rs6000/powerpc-isa205-64l.c      |  2 +-
 .../rs6000/powerpc-isa205-altivec32l.c        |  2 +-
 .../rs6000/powerpc-isa205-altivec64l.c        |  2 +-
 .../rs6000/powerpc-isa205-ppr-dscr-vsx32l.c   |  2 +-
 .../rs6000/powerpc-isa205-ppr-dscr-vsx64l.c   |  2 +-
 gdb/features/rs6000/powerpc-isa205-vsx32l.c   |  2 +-
 gdb/features/rs6000/powerpc-isa205-vsx64l.c   |  2 +-
 .../rs6000/powerpc-isa207-htm-vsx32l.c        |  2 +-
 .../rs6000/powerpc-isa207-htm-vsx64l.c        |  2 +-
 gdb/features/rs6000/powerpc-isa207-vsx32l.c   |  2 +-
 gdb/features/rs6000/powerpc-isa207-vsx64l.c   |  2 +-
 gdb/features/rs6000/powerpc-vsx32.c           |  2 +-
 gdb/features/rs6000/powerpc-vsx32l.c          |  2 +-
 gdb/features/rs6000/powerpc-vsx64.c           |  2 +-
 gdb/features/rs6000/powerpc-vsx64l.c          |  2 +-
 gdb/features/rs6000/rs6000.c                  |  2 +-
 gdb/features/rx.c                             |  2 +-
 gdb/features/s390-gs-linux64.c                |  2 +-
 gdb/features/s390-linux32.c                   |  2 +-
 gdb/features/s390-linux32v1.c                 |  2 +-
 gdb/features/s390-linux32v2.c                 |  2 +-
 gdb/features/s390-linux64.c                   |  2 +-
 gdb/features/s390-linux64v1.c                 |  2 +-
 gdb/features/s390-linux64v2.c                 |  2 +-
 gdb/features/s390-te-linux64.c                |  2 +-
 gdb/features/s390-tevx-linux64.c              |  2 +-
 gdb/features/s390-vx-linux64.c                |  2 +-
 gdb/features/s390x-gs-linux64.c               |  2 +-
 gdb/features/s390x-linux64.c                  |  2 +-
 gdb/features/s390x-linux64v1.c                |  2 +-
 gdb/features/s390x-linux64v2.c                |  2 +-
 gdb/features/s390x-te-linux64.c               |  2 +-
 gdb/features/s390x-tevx-linux64.c             |  2 +-
 gdb/features/s390x-vx-linux64.c               |  2 +-
 gdb/features/sparc/sparc32-solaris.c          |  2 +-
 gdb/features/sparc/sparc64-solaris.c          |  2 +-
 gdb/features/z80.c                            |  2 +-
 gdb/mips-linux-tdep.h                         |  8 ++--
 gdb/nios2-tdep.h                              |  4 +-
 gdb/rs6000-tdep.c                             |  2 +-
 gdb/s390-linux-tdep.h                         | 30 +++++++-------
 gdb/s390-tdep.h                               |  4 +-
 gdb/target-descriptions.c                     |  2 +-
 77 files changed, 115 insertions(+), 115 deletions(-)

diff --git a/gdb/arch/ppc-linux-common.c b/gdb/arch/ppc-linux-common.c
index 02523840070..a0c38f5aa4a 100644
--- a/gdb/arch/ppc-linux-common.c
+++ b/gdb/arch/ppc-linux-common.c
@@ -46,7 +46,7 @@ ppc_linux_has_isa205 (CORE_ADDR hwcap)
 const struct target_desc *
 ppc_linux_match_description (struct ppc_linux_features features)
 {
-  struct target_desc *tdesc = NULL;
+  const struct target_desc *tdesc = NULL;
 
   if (features.wordsize == 8)
     {
diff --git a/gdb/arch/ppc-linux-tdesc.h b/gdb/arch/ppc-linux-tdesc.h
index 6bda06467e3..b17e03361d6 100644
--- a/gdb/arch/ppc-linux-tdesc.h
+++ b/gdb/arch/ppc-linux-tdesc.h
@@ -22,25 +22,25 @@
 
 struct target_desc;
 
-extern struct target_desc *tdesc_powerpc_32l;
-extern struct target_desc *tdesc_powerpc_altivec32l;
-extern struct target_desc *tdesc_powerpc_vsx32l;
-extern struct target_desc *tdesc_powerpc_isa205_32l;
-extern struct target_desc *tdesc_powerpc_isa205_altivec32l;
-extern struct target_desc *tdesc_powerpc_isa205_vsx32l;
-extern struct target_desc *tdesc_powerpc_isa205_ppr_dscr_vsx32l;
-extern struct target_desc *tdesc_powerpc_isa207_vsx32l;
-extern struct target_desc *tdesc_powerpc_isa207_htm_vsx32l;
-extern struct target_desc *tdesc_powerpc_e500l;
-
-extern struct target_desc *tdesc_powerpc_64l;
-extern struct target_desc *tdesc_powerpc_altivec64l;
-extern struct target_desc *tdesc_powerpc_vsx64l;
-extern struct target_desc *tdesc_powerpc_isa205_64l;
-extern struct target_desc *tdesc_powerpc_isa205_altivec64l;
-extern struct target_desc *tdesc_powerpc_isa205_vsx64l;
-extern struct target_desc *tdesc_powerpc_isa205_ppr_dscr_vsx64l;
-extern struct target_desc *tdesc_powerpc_isa207_vsx64l;
-extern struct target_desc *tdesc_powerpc_isa207_htm_vsx64l;
+extern const struct target_desc *tdesc_powerpc_32l;
+extern const struct target_desc *tdesc_powerpc_altivec32l;
+extern const struct target_desc *tdesc_powerpc_vsx32l;
+extern const struct target_desc *tdesc_powerpc_isa205_32l;
+extern const struct target_desc *tdesc_powerpc_isa205_altivec32l;
+extern const struct target_desc *tdesc_powerpc_isa205_vsx32l;
+extern const struct target_desc *tdesc_powerpc_isa205_ppr_dscr_vsx32l;
+extern const struct target_desc *tdesc_powerpc_isa207_vsx32l;
+extern const struct target_desc *tdesc_powerpc_isa207_htm_vsx32l;
+extern const struct target_desc *tdesc_powerpc_e500l;
+
+extern const struct target_desc *tdesc_powerpc_64l;
+extern const struct target_desc *tdesc_powerpc_altivec64l;
+extern const struct target_desc *tdesc_powerpc_vsx64l;
+extern const struct target_desc *tdesc_powerpc_isa205_64l;
+extern const struct target_desc *tdesc_powerpc_isa205_altivec64l;
+extern const struct target_desc *tdesc_powerpc_isa205_vsx64l;
+extern const struct target_desc *tdesc_powerpc_isa205_ppr_dscr_vsx64l;
+extern const struct target_desc *tdesc_powerpc_isa207_vsx64l;
+extern const struct target_desc *tdesc_powerpc_isa207_htm_vsx64l;
 
 #endif /* ARCH_PPC_LINUX_TDESC_H */
diff --git a/gdb/features/microblaze-with-stack-protect.c b/gdb/features/microblaze-with-stack-protect.c
index aa180bf35d5..574dc02db67 100644
--- a/gdb/features/microblaze-with-stack-protect.c
+++ b/gdb/features/microblaze-with-stack-protect.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_microblaze_with_stack_protect;
+const struct target_desc *tdesc_microblaze_with_stack_protect;
 static void
 initialize_tdesc_microblaze_with_stack_protect (void)
 {
diff --git a/gdb/features/microblaze.c b/gdb/features/microblaze.c
index ef2c64c720e..8f1fb0a142f 100644
--- a/gdb/features/microblaze.c
+++ b/gdb/features/microblaze.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_microblaze;
+const struct target_desc *tdesc_microblaze;
 static void
 initialize_tdesc_microblaze (void)
 {
diff --git a/gdb/features/mips-dsp-linux.c b/gdb/features/mips-dsp-linux.c
index 76a91775e26..d9d928c8012 100644
--- a/gdb/features/mips-dsp-linux.c
+++ b/gdb/features/mips-dsp-linux.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_mips_dsp_linux;
+const struct target_desc *tdesc_mips_dsp_linux;
 static void
 initialize_tdesc_mips_dsp_linux (void)
 {
diff --git a/gdb/features/mips-linux.c b/gdb/features/mips-linux.c
index f97232c8a75..8557bc8357d 100644
--- a/gdb/features/mips-linux.c
+++ b/gdb/features/mips-linux.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_mips_linux;
+const struct target_desc *tdesc_mips_linux;
 static void
 initialize_tdesc_mips_linux (void)
 {
diff --git a/gdb/features/mips64-dsp-linux.c b/gdb/features/mips64-dsp-linux.c
index 48d212ad907..80bbbcbd152 100644
--- a/gdb/features/mips64-dsp-linux.c
+++ b/gdb/features/mips64-dsp-linux.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_mips64_dsp_linux;
+const struct target_desc *tdesc_mips64_dsp_linux;
 static void
 initialize_tdesc_mips64_dsp_linux (void)
 {
diff --git a/gdb/features/mips64-linux.c b/gdb/features/mips64-linux.c
index 4b37d3ddb12..21e8c37b933 100644
--- a/gdb/features/mips64-linux.c
+++ b/gdb/features/mips64-linux.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_mips64_linux;
+const struct target_desc *tdesc_mips64_linux;
 static void
 initialize_tdesc_mips64_linux (void)
 {
diff --git a/gdb/features/nds32.c b/gdb/features/nds32.c
index 4e520163931..7a08d2c85bb 100644
--- a/gdb/features/nds32.c
+++ b/gdb/features/nds32.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_nds32;
+const struct target_desc *tdesc_nds32;
 static void
 initialize_tdesc_nds32 (void)
 {
diff --git a/gdb/features/nios2.c b/gdb/features/nios2.c
index 6872aaea02d..648f7ed57ab 100644
--- a/gdb/features/nios2.c
+++ b/gdb/features/nios2.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_nios2;
+const struct target_desc *tdesc_nios2;
 static void
 initialize_tdesc_nios2 (void)
 {
diff --git a/gdb/features/or1k-linux.c b/gdb/features/or1k-linux.c
index e718d317990..3eb65489383 100644
--- a/gdb/features/or1k-linux.c
+++ b/gdb/features/or1k-linux.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_or1k_linux;
+const struct target_desc *tdesc_or1k_linux;
 static void
 initialize_tdesc_or1k_linux (void)
 {
diff --git a/gdb/features/or1k.c b/gdb/features/or1k.c
index c1fd26ce8d6..67040965bd5 100644
--- a/gdb/features/or1k.c
+++ b/gdb/features/or1k.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_or1k;
+const struct target_desc *tdesc_or1k;
 static void
 initialize_tdesc_or1k (void)
 {
diff --git a/gdb/features/rs6000/powerpc-32.c b/gdb/features/rs6000/powerpc-32.c
index 4c766b7bf0e..a4f4bed180f 100644
--- a/gdb/features/rs6000/powerpc-32.c
+++ b/gdb/features/rs6000/powerpc-32.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_powerpc_32;
+const struct target_desc *tdesc_powerpc_32;
 static void
 initialize_tdesc_powerpc_32 (void)
 {
diff --git a/gdb/features/rs6000/powerpc-32l.c b/gdb/features/rs6000/powerpc-32l.c
index 34cba5d8a82..f5893bff01b 100644
--- a/gdb/features/rs6000/powerpc-32l.c
+++ b/gdb/features/rs6000/powerpc-32l.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_powerpc_32l;
+const struct target_desc *tdesc_powerpc_32l;
 static void
 initialize_tdesc_powerpc_32l (void)
 {
diff --git a/gdb/features/rs6000/powerpc-403.c b/gdb/features/rs6000/powerpc-403.c
index 1b16e081c61..2783287b981 100644
--- a/gdb/features/rs6000/powerpc-403.c
+++ b/gdb/features/rs6000/powerpc-403.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_powerpc_403;
+const struct target_desc *tdesc_powerpc_403;
 static void
 initialize_tdesc_powerpc_403 (void)
 {
diff --git a/gdb/features/rs6000/powerpc-403gc.c b/gdb/features/rs6000/powerpc-403gc.c
index 4ff844dcd73..c69a1342773 100644
--- a/gdb/features/rs6000/powerpc-403gc.c
+++ b/gdb/features/rs6000/powerpc-403gc.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_powerpc_403gc;
+const struct target_desc *tdesc_powerpc_403gc;
 static void
 initialize_tdesc_powerpc_403gc (void)
 {
diff --git a/gdb/features/rs6000/powerpc-405.c b/gdb/features/rs6000/powerpc-405.c
index 4c97aa5ef62..1146d6601bd 100644
--- a/gdb/features/rs6000/powerpc-405.c
+++ b/gdb/features/rs6000/powerpc-405.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_powerpc_405;
+const struct target_desc *tdesc_powerpc_405;
 static void
 initialize_tdesc_powerpc_405 (void)
 {
diff --git a/gdb/features/rs6000/powerpc-505.c b/gdb/features/rs6000/powerpc-505.c
index b9cae668aac..a36157f6c74 100644
--- a/gdb/features/rs6000/powerpc-505.c
+++ b/gdb/features/rs6000/powerpc-505.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_powerpc_505;
+const struct target_desc *tdesc_powerpc_505;
 static void
 initialize_tdesc_powerpc_505 (void)
 {
diff --git a/gdb/features/rs6000/powerpc-601.c b/gdb/features/rs6000/powerpc-601.c
index ba35dc97bf2..ceaf789f3d7 100644
--- a/gdb/features/rs6000/powerpc-601.c
+++ b/gdb/features/rs6000/powerpc-601.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_powerpc_601;
+const struct target_desc *tdesc_powerpc_601;
 static void
 initialize_tdesc_powerpc_601 (void)
 {
diff --git a/gdb/features/rs6000/powerpc-602.c b/gdb/features/rs6000/powerpc-602.c
index 7f69f44ca34..eb85e69d6a0 100644
--- a/gdb/features/rs6000/powerpc-602.c
+++ b/gdb/features/rs6000/powerpc-602.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_powerpc_602;
+const struct target_desc *tdesc_powerpc_602;
 static void
 initialize_tdesc_powerpc_602 (void)
 {
diff --git a/gdb/features/rs6000/powerpc-603.c b/gdb/features/rs6000/powerpc-603.c
index 28c3628dbf5..223919ca2d7 100644
--- a/gdb/features/rs6000/powerpc-603.c
+++ b/gdb/features/rs6000/powerpc-603.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_powerpc_603;
+const struct target_desc *tdesc_powerpc_603;
 static void
 initialize_tdesc_powerpc_603 (void)
 {
diff --git a/gdb/features/rs6000/powerpc-604.c b/gdb/features/rs6000/powerpc-604.c
index fe0fe2fc7e4..09cbb50129f 100644
--- a/gdb/features/rs6000/powerpc-604.c
+++ b/gdb/features/rs6000/powerpc-604.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_powerpc_604;
+const struct target_desc *tdesc_powerpc_604;
 static void
 initialize_tdesc_powerpc_604 (void)
 {
diff --git a/gdb/features/rs6000/powerpc-64.c b/gdb/features/rs6000/powerpc-64.c
index d0688ee28eb..43dee105954 100644
--- a/gdb/features/rs6000/powerpc-64.c
+++ b/gdb/features/rs6000/powerpc-64.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_powerpc_64;
+const struct target_desc *tdesc_powerpc_64;
 static void
 initialize_tdesc_powerpc_64 (void)
 {
diff --git a/gdb/features/rs6000/powerpc-64l.c b/gdb/features/rs6000/powerpc-64l.c
index 465c023696a..83a6a159048 100644
--- a/gdb/features/rs6000/powerpc-64l.c
+++ b/gdb/features/rs6000/powerpc-64l.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_powerpc_64l;
+const struct target_desc *tdesc_powerpc_64l;
 static void
 initialize_tdesc_powerpc_64l (void)
 {
diff --git a/gdb/features/rs6000/powerpc-7400.c b/gdb/features/rs6000/powerpc-7400.c
index 0e71dd7c2bb..d5fbf4bd3d7 100644
--- a/gdb/features/rs6000/powerpc-7400.c
+++ b/gdb/features/rs6000/powerpc-7400.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_powerpc_7400;
+const struct target_desc *tdesc_powerpc_7400;
 static void
 initialize_tdesc_powerpc_7400 (void)
 {
diff --git a/gdb/features/rs6000/powerpc-750.c b/gdb/features/rs6000/powerpc-750.c
index 396ec456651..60a7b412070 100644
--- a/gdb/features/rs6000/powerpc-750.c
+++ b/gdb/features/rs6000/powerpc-750.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_powerpc_750;
+const struct target_desc *tdesc_powerpc_750;
 static void
 initialize_tdesc_powerpc_750 (void)
 {
diff --git a/gdb/features/rs6000/powerpc-860.c b/gdb/features/rs6000/powerpc-860.c
index 328ad195772..3e9a25f8e97 100644
--- a/gdb/features/rs6000/powerpc-860.c
+++ b/gdb/features/rs6000/powerpc-860.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_powerpc_860;
+const struct target_desc *tdesc_powerpc_860;
 static void
 initialize_tdesc_powerpc_860 (void)
 {
diff --git a/gdb/features/rs6000/powerpc-altivec32.c b/gdb/features/rs6000/powerpc-altivec32.c
index 743ca06fdd1..41cca727be8 100644
--- a/gdb/features/rs6000/powerpc-altivec32.c
+++ b/gdb/features/rs6000/powerpc-altivec32.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_powerpc_altivec32;
+const struct target_desc *tdesc_powerpc_altivec32;
 static void
 initialize_tdesc_powerpc_altivec32 (void)
 {
diff --git a/gdb/features/rs6000/powerpc-altivec32l.c b/gdb/features/rs6000/powerpc-altivec32l.c
index a19016bbac4..9cd935551db 100644
--- a/gdb/features/rs6000/powerpc-altivec32l.c
+++ b/gdb/features/rs6000/powerpc-altivec32l.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_powerpc_altivec32l;
+const struct target_desc *tdesc_powerpc_altivec32l;
 static void
 initialize_tdesc_powerpc_altivec32l (void)
 {
diff --git a/gdb/features/rs6000/powerpc-altivec64.c b/gdb/features/rs6000/powerpc-altivec64.c
index b8a157bb98e..8422708ec7f 100644
--- a/gdb/features/rs6000/powerpc-altivec64.c
+++ b/gdb/features/rs6000/powerpc-altivec64.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_powerpc_altivec64;
+const struct target_desc *tdesc_powerpc_altivec64;
 static void
 initialize_tdesc_powerpc_altivec64 (void)
 {
diff --git a/gdb/features/rs6000/powerpc-altivec64l.c b/gdb/features/rs6000/powerpc-altivec64l.c
index 1846d067330..977af8c941f 100644
--- a/gdb/features/rs6000/powerpc-altivec64l.c
+++ b/gdb/features/rs6000/powerpc-altivec64l.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_powerpc_altivec64l;
+const struct target_desc *tdesc_powerpc_altivec64l;
 static void
 initialize_tdesc_powerpc_altivec64l (void)
 {
diff --git a/gdb/features/rs6000/powerpc-e500.c b/gdb/features/rs6000/powerpc-e500.c
index bf6240561d0..84f721d948f 100644
--- a/gdb/features/rs6000/powerpc-e500.c
+++ b/gdb/features/rs6000/powerpc-e500.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_powerpc_e500;
+const struct target_desc *tdesc_powerpc_e500;
 static void
 initialize_tdesc_powerpc_e500 (void)
 {
diff --git a/gdb/features/rs6000/powerpc-e500l.c b/gdb/features/rs6000/powerpc-e500l.c
index 8199989d3a1..a1e133d1c73 100644
--- a/gdb/features/rs6000/powerpc-e500l.c
+++ b/gdb/features/rs6000/powerpc-e500l.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_powerpc_e500l;
+const struct target_desc *tdesc_powerpc_e500l;
 static void
 initialize_tdesc_powerpc_e500l (void)
 {
diff --git a/gdb/features/rs6000/powerpc-isa205-32l.c b/gdb/features/rs6000/powerpc-isa205-32l.c
index 7791fa7e029..57fb20a4b12 100644
--- a/gdb/features/rs6000/powerpc-isa205-32l.c
+++ b/gdb/features/rs6000/powerpc-isa205-32l.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_powerpc_isa205_32l;
+const struct target_desc *tdesc_powerpc_isa205_32l;
 static void
 initialize_tdesc_powerpc_isa205_32l (void)
 {
diff --git a/gdb/features/rs6000/powerpc-isa205-64l.c b/gdb/features/rs6000/powerpc-isa205-64l.c
index fb05df7911b..b9ce8e604fb 100644
--- a/gdb/features/rs6000/powerpc-isa205-64l.c
+++ b/gdb/features/rs6000/powerpc-isa205-64l.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_powerpc_isa205_64l;
+const struct target_desc *tdesc_powerpc_isa205_64l;
 static void
 initialize_tdesc_powerpc_isa205_64l (void)
 {
diff --git a/gdb/features/rs6000/powerpc-isa205-altivec32l.c b/gdb/features/rs6000/powerpc-isa205-altivec32l.c
index a510931ea3c..54b914c3714 100644
--- a/gdb/features/rs6000/powerpc-isa205-altivec32l.c
+++ b/gdb/features/rs6000/powerpc-isa205-altivec32l.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_powerpc_isa205_altivec32l;
+const struct target_desc *tdesc_powerpc_isa205_altivec32l;
 static void
 initialize_tdesc_powerpc_isa205_altivec32l (void)
 {
diff --git a/gdb/features/rs6000/powerpc-isa205-altivec64l.c b/gdb/features/rs6000/powerpc-isa205-altivec64l.c
index f91c2e84518..42e6f03e93c 100644
--- a/gdb/features/rs6000/powerpc-isa205-altivec64l.c
+++ b/gdb/features/rs6000/powerpc-isa205-altivec64l.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_powerpc_isa205_altivec64l;
+const struct target_desc *tdesc_powerpc_isa205_altivec64l;
 static void
 initialize_tdesc_powerpc_isa205_altivec64l (void)
 {
diff --git a/gdb/features/rs6000/powerpc-isa205-ppr-dscr-vsx32l.c b/gdb/features/rs6000/powerpc-isa205-ppr-dscr-vsx32l.c
index 28a7c3b2c4f..a2c6172c6d2 100644
--- a/gdb/features/rs6000/powerpc-isa205-ppr-dscr-vsx32l.c
+++ b/gdb/features/rs6000/powerpc-isa205-ppr-dscr-vsx32l.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_powerpc_isa205_ppr_dscr_vsx32l;
+const struct target_desc *tdesc_powerpc_isa205_ppr_dscr_vsx32l;
 static void
 initialize_tdesc_powerpc_isa205_ppr_dscr_vsx32l (void)
 {
diff --git a/gdb/features/rs6000/powerpc-isa205-ppr-dscr-vsx64l.c b/gdb/features/rs6000/powerpc-isa205-ppr-dscr-vsx64l.c
index d34a197b4f5..3e7915a0619 100644
--- a/gdb/features/rs6000/powerpc-isa205-ppr-dscr-vsx64l.c
+++ b/gdb/features/rs6000/powerpc-isa205-ppr-dscr-vsx64l.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_powerpc_isa205_ppr_dscr_vsx64l;
+const struct target_desc *tdesc_powerpc_isa205_ppr_dscr_vsx64l;
 static void
 initialize_tdesc_powerpc_isa205_ppr_dscr_vsx64l (void)
 {
diff --git a/gdb/features/rs6000/powerpc-isa205-vsx32l.c b/gdb/features/rs6000/powerpc-isa205-vsx32l.c
index 763915502c0..4cefcc36de5 100644
--- a/gdb/features/rs6000/powerpc-isa205-vsx32l.c
+++ b/gdb/features/rs6000/powerpc-isa205-vsx32l.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_powerpc_isa205_vsx32l;
+const struct target_desc *tdesc_powerpc_isa205_vsx32l;
 static void
 initialize_tdesc_powerpc_isa205_vsx32l (void)
 {
diff --git a/gdb/features/rs6000/powerpc-isa205-vsx64l.c b/gdb/features/rs6000/powerpc-isa205-vsx64l.c
index fad4227b095..2fb151d12c5 100644
--- a/gdb/features/rs6000/powerpc-isa205-vsx64l.c
+++ b/gdb/features/rs6000/powerpc-isa205-vsx64l.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_powerpc_isa205_vsx64l;
+const struct target_desc *tdesc_powerpc_isa205_vsx64l;
 static void
 initialize_tdesc_powerpc_isa205_vsx64l (void)
 {
diff --git a/gdb/features/rs6000/powerpc-isa207-htm-vsx32l.c b/gdb/features/rs6000/powerpc-isa207-htm-vsx32l.c
index 78f2047272a..b945039ca28 100644
--- a/gdb/features/rs6000/powerpc-isa207-htm-vsx32l.c
+++ b/gdb/features/rs6000/powerpc-isa207-htm-vsx32l.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_powerpc_isa207_htm_vsx32l;
+const struct target_desc *tdesc_powerpc_isa207_htm_vsx32l;
 static void
 initialize_tdesc_powerpc_isa207_htm_vsx32l (void)
 {
diff --git a/gdb/features/rs6000/powerpc-isa207-htm-vsx64l.c b/gdb/features/rs6000/powerpc-isa207-htm-vsx64l.c
index 5517201043f..3aa579fd5f9 100644
--- a/gdb/features/rs6000/powerpc-isa207-htm-vsx64l.c
+++ b/gdb/features/rs6000/powerpc-isa207-htm-vsx64l.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_powerpc_isa207_htm_vsx64l;
+const struct target_desc *tdesc_powerpc_isa207_htm_vsx64l;
 static void
 initialize_tdesc_powerpc_isa207_htm_vsx64l (void)
 {
diff --git a/gdb/features/rs6000/powerpc-isa207-vsx32l.c b/gdb/features/rs6000/powerpc-isa207-vsx32l.c
index 7fc15bfbfbd..e5ce7f956cf 100644
--- a/gdb/features/rs6000/powerpc-isa207-vsx32l.c
+++ b/gdb/features/rs6000/powerpc-isa207-vsx32l.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_powerpc_isa207_vsx32l;
+const struct target_desc *tdesc_powerpc_isa207_vsx32l;
 static void
 initialize_tdesc_powerpc_isa207_vsx32l (void)
 {
diff --git a/gdb/features/rs6000/powerpc-isa207-vsx64l.c b/gdb/features/rs6000/powerpc-isa207-vsx64l.c
index 3ad55f75658..adf6d3eec7f 100644
--- a/gdb/features/rs6000/powerpc-isa207-vsx64l.c
+++ b/gdb/features/rs6000/powerpc-isa207-vsx64l.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_powerpc_isa207_vsx64l;
+const struct target_desc *tdesc_powerpc_isa207_vsx64l;
 static void
 initialize_tdesc_powerpc_isa207_vsx64l (void)
 {
diff --git a/gdb/features/rs6000/powerpc-vsx32.c b/gdb/features/rs6000/powerpc-vsx32.c
index d7278d9a52b..6fccdb374fb 100644
--- a/gdb/features/rs6000/powerpc-vsx32.c
+++ b/gdb/features/rs6000/powerpc-vsx32.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_powerpc_vsx32;
+const struct target_desc *tdesc_powerpc_vsx32;
 static void
 initialize_tdesc_powerpc_vsx32 (void)
 {
diff --git a/gdb/features/rs6000/powerpc-vsx32l.c b/gdb/features/rs6000/powerpc-vsx32l.c
index 7097ffac8c6..1efe880d379 100644
--- a/gdb/features/rs6000/powerpc-vsx32l.c
+++ b/gdb/features/rs6000/powerpc-vsx32l.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_powerpc_vsx32l;
+const struct target_desc *tdesc_powerpc_vsx32l;
 static void
 initialize_tdesc_powerpc_vsx32l (void)
 {
diff --git a/gdb/features/rs6000/powerpc-vsx64.c b/gdb/features/rs6000/powerpc-vsx64.c
index 7e9055991e2..df6d0f4bef9 100644
--- a/gdb/features/rs6000/powerpc-vsx64.c
+++ b/gdb/features/rs6000/powerpc-vsx64.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_powerpc_vsx64;
+const struct target_desc *tdesc_powerpc_vsx64;
 static void
 initialize_tdesc_powerpc_vsx64 (void)
 {
diff --git a/gdb/features/rs6000/powerpc-vsx64l.c b/gdb/features/rs6000/powerpc-vsx64l.c
index 4affa35d0cc..89aa13de662 100644
--- a/gdb/features/rs6000/powerpc-vsx64l.c
+++ b/gdb/features/rs6000/powerpc-vsx64l.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_powerpc_vsx64l;
+const struct target_desc *tdesc_powerpc_vsx64l;
 static void
 initialize_tdesc_powerpc_vsx64l (void)
 {
diff --git a/gdb/features/rs6000/rs6000.c b/gdb/features/rs6000/rs6000.c
index 826d9ad7582..4aa5a8764a0 100644
--- a/gdb/features/rs6000/rs6000.c
+++ b/gdb/features/rs6000/rs6000.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_rs6000;
+const struct target_desc *tdesc_rs6000;
 static void
 initialize_tdesc_rs6000 (void)
 {
diff --git a/gdb/features/rx.c b/gdb/features/rx.c
index dd765c2c63a..825a4ac4538 100644
--- a/gdb/features/rx.c
+++ b/gdb/features/rx.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_rx;
+const struct target_desc *tdesc_rx;
 static void
 initialize_tdesc_rx (void)
 {
diff --git a/gdb/features/s390-gs-linux64.c b/gdb/features/s390-gs-linux64.c
index 331b6e27e8c..d48f8312f20 100644
--- a/gdb/features/s390-gs-linux64.c
+++ b/gdb/features/s390-gs-linux64.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_s390_gs_linux64;
+const struct target_desc *tdesc_s390_gs_linux64;
 static void
 initialize_tdesc_s390_gs_linux64 (void)
 {
diff --git a/gdb/features/s390-linux32.c b/gdb/features/s390-linux32.c
index 18b0d0f37be..03ec11a26b3 100644
--- a/gdb/features/s390-linux32.c
+++ b/gdb/features/s390-linux32.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_s390_linux32;
+const struct target_desc *tdesc_s390_linux32;
 static void
 initialize_tdesc_s390_linux32 (void)
 {
diff --git a/gdb/features/s390-linux32v1.c b/gdb/features/s390-linux32v1.c
index d1180f98b28..65de6f254f7 100644
--- a/gdb/features/s390-linux32v1.c
+++ b/gdb/features/s390-linux32v1.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_s390_linux32v1;
+const struct target_desc *tdesc_s390_linux32v1;
 static void
 initialize_tdesc_s390_linux32v1 (void)
 {
diff --git a/gdb/features/s390-linux32v2.c b/gdb/features/s390-linux32v2.c
index d1da31a7c9a..0e3e04dfd43 100644
--- a/gdb/features/s390-linux32v2.c
+++ b/gdb/features/s390-linux32v2.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_s390_linux32v2;
+const struct target_desc *tdesc_s390_linux32v2;
 static void
 initialize_tdesc_s390_linux32v2 (void)
 {
diff --git a/gdb/features/s390-linux64.c b/gdb/features/s390-linux64.c
index 235da0f63c2..f0ec91992f9 100644
--- a/gdb/features/s390-linux64.c
+++ b/gdb/features/s390-linux64.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_s390_linux64;
+const struct target_desc *tdesc_s390_linux64;
 static void
 initialize_tdesc_s390_linux64 (void)
 {
diff --git a/gdb/features/s390-linux64v1.c b/gdb/features/s390-linux64v1.c
index 108c0ef404f..9a360c7e267 100644
--- a/gdb/features/s390-linux64v1.c
+++ b/gdb/features/s390-linux64v1.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_s390_linux64v1;
+const struct target_desc *tdesc_s390_linux64v1;
 static void
 initialize_tdesc_s390_linux64v1 (void)
 {
diff --git a/gdb/features/s390-linux64v2.c b/gdb/features/s390-linux64v2.c
index 057a12978a7..18bc6ed4f9c 100644
--- a/gdb/features/s390-linux64v2.c
+++ b/gdb/features/s390-linux64v2.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_s390_linux64v2;
+const struct target_desc *tdesc_s390_linux64v2;
 static void
 initialize_tdesc_s390_linux64v2 (void)
 {
diff --git a/gdb/features/s390-te-linux64.c b/gdb/features/s390-te-linux64.c
index f8f2217c69b..a8909b36bbf 100644
--- a/gdb/features/s390-te-linux64.c
+++ b/gdb/features/s390-te-linux64.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_s390_te_linux64;
+const struct target_desc *tdesc_s390_te_linux64;
 static void
 initialize_tdesc_s390_te_linux64 (void)
 {
diff --git a/gdb/features/s390-tevx-linux64.c b/gdb/features/s390-tevx-linux64.c
index cbc20775cc6..8f8aec61a49 100644
--- a/gdb/features/s390-tevx-linux64.c
+++ b/gdb/features/s390-tevx-linux64.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_s390_tevx_linux64;
+const struct target_desc *tdesc_s390_tevx_linux64;
 static void
 initialize_tdesc_s390_tevx_linux64 (void)
 {
diff --git a/gdb/features/s390-vx-linux64.c b/gdb/features/s390-vx-linux64.c
index 779332ca5e4..0bcc14d7d08 100644
--- a/gdb/features/s390-vx-linux64.c
+++ b/gdb/features/s390-vx-linux64.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_s390_vx_linux64;
+const struct target_desc *tdesc_s390_vx_linux64;
 static void
 initialize_tdesc_s390_vx_linux64 (void)
 {
diff --git a/gdb/features/s390x-gs-linux64.c b/gdb/features/s390x-gs-linux64.c
index a779dafe6c3..074c38d668c 100644
--- a/gdb/features/s390x-gs-linux64.c
+++ b/gdb/features/s390x-gs-linux64.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_s390x_gs_linux64;
+const struct target_desc *tdesc_s390x_gs_linux64;
 static void
 initialize_tdesc_s390x_gs_linux64 (void)
 {
diff --git a/gdb/features/s390x-linux64.c b/gdb/features/s390x-linux64.c
index f8097e94d5b..af5ba23dc38 100644
--- a/gdb/features/s390x-linux64.c
+++ b/gdb/features/s390x-linux64.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_s390x_linux64;
+const struct target_desc *tdesc_s390x_linux64;
 static void
 initialize_tdesc_s390x_linux64 (void)
 {
diff --git a/gdb/features/s390x-linux64v1.c b/gdb/features/s390x-linux64v1.c
index c79ee40efb9..a33bdc1672f 100644
--- a/gdb/features/s390x-linux64v1.c
+++ b/gdb/features/s390x-linux64v1.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_s390x_linux64v1;
+const struct target_desc *tdesc_s390x_linux64v1;
 static void
 initialize_tdesc_s390x_linux64v1 (void)
 {
diff --git a/gdb/features/s390x-linux64v2.c b/gdb/features/s390x-linux64v2.c
index 95009170fe8..8b906a47e44 100644
--- a/gdb/features/s390x-linux64v2.c
+++ b/gdb/features/s390x-linux64v2.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_s390x_linux64v2;
+const struct target_desc *tdesc_s390x_linux64v2;
 static void
 initialize_tdesc_s390x_linux64v2 (void)
 {
diff --git a/gdb/features/s390x-te-linux64.c b/gdb/features/s390x-te-linux64.c
index 64a0fe599df..de8bf610470 100644
--- a/gdb/features/s390x-te-linux64.c
+++ b/gdb/features/s390x-te-linux64.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_s390x_te_linux64;
+const struct target_desc *tdesc_s390x_te_linux64;
 static void
 initialize_tdesc_s390x_te_linux64 (void)
 {
diff --git a/gdb/features/s390x-tevx-linux64.c b/gdb/features/s390x-tevx-linux64.c
index ec68e702f7c..8bd5cc6c439 100644
--- a/gdb/features/s390x-tevx-linux64.c
+++ b/gdb/features/s390x-tevx-linux64.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_s390x_tevx_linux64;
+const struct target_desc *tdesc_s390x_tevx_linux64;
 static void
 initialize_tdesc_s390x_tevx_linux64 (void)
 {
diff --git a/gdb/features/s390x-vx-linux64.c b/gdb/features/s390x-vx-linux64.c
index 4362e53ad3f..f450c45144d 100644
--- a/gdb/features/s390x-vx-linux64.c
+++ b/gdb/features/s390x-vx-linux64.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_s390x_vx_linux64;
+const struct target_desc *tdesc_s390x_vx_linux64;
 static void
 initialize_tdesc_s390x_vx_linux64 (void)
 {
diff --git a/gdb/features/sparc/sparc32-solaris.c b/gdb/features/sparc/sparc32-solaris.c
index c2f16062fc1..3353d4f44f7 100644
--- a/gdb/features/sparc/sparc32-solaris.c
+++ b/gdb/features/sparc/sparc32-solaris.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_sparc32_solaris;
+const struct target_desc *tdesc_sparc32_solaris;
 static void
 initialize_tdesc_sparc32_solaris (void)
 {
diff --git a/gdb/features/sparc/sparc64-solaris.c b/gdb/features/sparc/sparc64-solaris.c
index bb8f6853841..1150c884b44 100644
--- a/gdb/features/sparc/sparc64-solaris.c
+++ b/gdb/features/sparc/sparc64-solaris.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_sparc64_solaris;
+const struct target_desc *tdesc_sparc64_solaris;
 static void
 initialize_tdesc_sparc64_solaris (void)
 {
diff --git a/gdb/features/z80.c b/gdb/features/z80.c
index 944b563aca4..f8e2a1988d0 100644
--- a/gdb/features/z80.c
+++ b/gdb/features/z80.c
@@ -5,7 +5,7 @@
 #include "osabi.h"
 #include "target-descriptions.h"
 
-struct target_desc *tdesc_z80;
+const struct target_desc *tdesc_z80;
 static void
 initialize_tdesc_z80 (void)
 {
diff --git a/gdb/mips-linux-tdep.h b/gdb/mips-linux-tdep.h
index 4b9940c0485..1b79302a3a5 100644
--- a/gdb/mips-linux-tdep.h
+++ b/gdb/mips-linux-tdep.h
@@ -108,9 +108,9 @@ enum {
 int mips_linux_restart_reg_p (struct gdbarch *gdbarch);
 
 /* Target descriptions.  */
-extern struct target_desc *tdesc_mips_linux;
-extern struct target_desc *tdesc_mips64_linux;
-extern struct target_desc *tdesc_mips_dsp_linux;
-extern struct target_desc *tdesc_mips64_dsp_linux;
+extern const struct target_desc *tdesc_mips_linux;
+extern const struct target_desc *tdesc_mips64_linux;
+extern const struct target_desc *tdesc_mips_dsp_linux;
+extern const struct target_desc *tdesc_mips64_dsp_linux;
 
 #endif /* MIPS_LINUX_TDEP_H */
diff --git a/gdb/nios2-tdep.h b/gdb/nios2-tdep.h
index cbf2599f5c0..78d5d8e0c97 100644
--- a/gdb/nios2-tdep.h
+++ b/gdb/nios2-tdep.h
@@ -84,7 +84,7 @@ struct nios2_gdbarch_tdep : gdbarch_tdep_base
   int jb_pc = 0;
 };
 
-extern struct target_desc *tdesc_nios2_linux;
-extern struct target_desc *tdesc_nios2;
+extern const  struct target_desc *tdesc_nios2_linux;
+extern const struct target_desc *tdesc_nios2;
 
 #endif /* NIOS2_TDEP_H */
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index cccc8872da9..0620bf30148 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -3466,7 +3466,7 @@ struct ppc_variant
     unsigned long mach;
 
     /* Target description for this variant.  */
-    struct target_desc **tdesc;
+    const struct target_desc **tdesc;
   };
 
 static struct ppc_variant variants[] =
diff --git a/gdb/s390-linux-tdep.h b/gdb/s390-linux-tdep.h
index acc57ab9291..a73c20f3560 100644
--- a/gdb/s390-linux-tdep.h
+++ b/gdb/s390-linux-tdep.h
@@ -48,20 +48,20 @@ extern const struct regset s390_gs_regset;
 extern const struct regset s390_gsbc_regset;
 
 /* GNU/Linux target descriptions.  */
-extern struct target_desc *tdesc_s390_linux32v1;
-extern struct target_desc *tdesc_s390_linux32v2;
-extern struct target_desc *tdesc_s390_linux64;
-extern struct target_desc *tdesc_s390_linux64v1;
-extern struct target_desc *tdesc_s390_linux64v2;
-extern struct target_desc *tdesc_s390_te_linux64;
-extern struct target_desc *tdesc_s390_vx_linux64;
-extern struct target_desc *tdesc_s390_tevx_linux64;
-extern struct target_desc *tdesc_s390_gs_linux64;
-extern struct target_desc *tdesc_s390x_linux64v1;
-extern struct target_desc *tdesc_s390x_linux64v2;
-extern struct target_desc *tdesc_s390x_te_linux64;
-extern struct target_desc *tdesc_s390x_vx_linux64;
-extern struct target_desc *tdesc_s390x_tevx_linux64;
-extern struct target_desc *tdesc_s390x_gs_linux64;
+extern const struct target_desc *tdesc_s390_linux32v1;
+extern const struct target_desc *tdesc_s390_linux32v2;
+extern const struct target_desc *tdesc_s390_linux64;
+extern const struct target_desc *tdesc_s390_linux64v1;
+extern const struct target_desc *tdesc_s390_linux64v2;
+extern const struct target_desc *tdesc_s390_te_linux64;
+extern const struct target_desc *tdesc_s390_vx_linux64;
+extern const struct target_desc *tdesc_s390_tevx_linux64;
+extern const struct target_desc *tdesc_s390_gs_linux64;
+extern const struct target_desc *tdesc_s390x_linux64v1;
+extern const struct target_desc *tdesc_s390x_linux64v2;
+extern const struct target_desc *tdesc_s390x_te_linux64;
+extern const struct target_desc *tdesc_s390x_vx_linux64;
+extern const struct target_desc *tdesc_s390x_tevx_linux64;
+extern const struct target_desc *tdesc_s390x_gs_linux64;
 
 #endif /* S390_LINUX_TDEP_H */
diff --git a/gdb/s390-tdep.h b/gdb/s390-tdep.h
index f51423cb018..bfee9a80dd5 100644
--- a/gdb/s390-tdep.h
+++ b/gdb/s390-tdep.h
@@ -317,7 +317,7 @@ extern struct value *s390_trad_frame_prev_register
     (struct frame_info *this_frame, struct trad_frame_saved_reg saved_regs[],
      int regnum);
 
-extern struct target_desc *tdesc_s390_linux32;
-extern struct target_desc *tdesc_s390x_linux64;
+extern const struct target_desc *tdesc_s390_linux32;
+extern const struct target_desc *tdesc_s390x_linux64;
 
 #endif /* S390_TDEP_H */
diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c
index 044b171ecd2..2bd0b166d18 100644
--- a/gdb/target-descriptions.c
+++ b/gdb/target-descriptions.c
@@ -1370,7 +1370,7 @@ class print_c_tdesc : public tdesc_element_visitor
     gdb_printf ("#include \"target-descriptions.h\"\n");
     gdb_printf ("\n");
 
-    gdb_printf ("struct target_desc *tdesc_%s;\n", m_function);
+    gdb_printf ("const struct target_desc *tdesc_%s;\n", m_function);
     gdb_printf ("static void\n");
     gdb_printf ("initialize_tdesc_%s (void)\n", m_function);
     gdb_printf ("{\n");
-- 
2.37.2


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/2] cleanup: Add missing feature/ XML files to Makefile
  2022-09-12 22:47 [PATCH 1/2] cleanup: Add missing feature/ XML files to Makefile Keith Seitz
  2022-09-12 22:47 ` [PATCH 2/2] Constify target_desc declarations Keith Seitz
@ 2022-09-13 13:34 ` Simon Marchi
  2022-09-13 13:55   ` Keith Seitz
  1 sibling, 1 reply; 11+ messages in thread
From: Simon Marchi @ 2022-09-13 13:34 UTC (permalink / raw)
  To: Keith Seitz, gdb-patches



On 2022-09-12 18:47, Keith Seitz via Gdb-patches wrote:
> This patch adds some missing .xml files to features/Makefile so that when the
> directory's C files are regenerated, all files are appropriately remade.
> 
> This has demonstrated that there have been several "misses" in regenerating
> files in this directory. Namely, arm-secext.c and sparc{32,64}-solaris.c. For
> the former case, there was what essentially amounts to a typo regarding the
> create feature function's name. In the later case, this file has missed at least
> one important update in July, 2020, when allocate_target_description was
> changed to return a unique pointer.
> 
> Those corrections are included.

With your patch applied, I tried re-generating everything:

$ cd features
$ rm *.c */*.c
$ make cfiles GDB="/home/simark/build/binutils-gdb-all-targets/gdb/gdb --data-directory=/home/simark/build/binutils-gdb-all-targets/gdb/data-directory"

And then git shows these files as missing:

        deleted:    aarch64-sve.c
        deleted:    cskyv2-linux.c

aarch64-sve.c is not generate, so it's actually fine.  cskyv2-linux.c is
generated, but we are missing the XML for it, I sent a reply to the
patch thread that added it to ask the author to upload it.

> ---
>  gdb/features/Makefile                |  4 ++++
>  gdb/features/arm/arm-secext.c        |  2 +-
>  gdb/features/sparc/sparc32-solaris.c | 16 ++++++++--------
>  gdb/features/sparc/sparc64-solaris.c | 22 +++++++++++-----------
>  4 files changed, 24 insertions(+), 20 deletions(-)
> 
> diff --git a/gdb/features/Makefile b/gdb/features/Makefile
> index 061cb2ed032..bdd032f2c3c 100644
> --- a/gdb/features/Makefile
> +++ b/gdb/features/Makefile
> @@ -108,6 +108,7 @@ XMLTOC = \
>  	nds32.xml \
>  	nios2.xml \
>  	or1k.xml \
> +	or1k-linux.xml \

When typing just "make" in features/, I get this diff:

diff --git a/gdb/regformats/or1k-linux.dat b/gdb/regformats/or1k-linux.dat
index 7b64646fc65a..9a9f8a640188 100644
--- a/gdb/regformats/or1k-linux.dat
+++ b/gdb/regformats/or1k-linux.dat
@@ -2,7 +2,7 @@
 # Generated from: or1k-linux.xml
 name:or1k_linux
 xmltarget:or1k-linux.xml
-expedite:r1,npc
+expedite:
 32:r0
 32:r1
 32:r2

Probably a separate fix, but I think we need

  or1k-expedite = r1,npc

in features/Makefile

>  	rs6000/powerpc-32.xml \
>  	rs6000/powerpc-32l.xml \
>  	rs6000/powerpc-403.xml \
> @@ -164,6 +165,8 @@ XMLTOC = \
>  	s390x-vx-linux64.xml \
>  	s390-gs-linux64.xml \
>  	s390x-gs-linux64.xml \
> +	sparc/sparc32-solaris.xml \
> +	sparc/sparc64-solaris.xml \
>  	z80.xml
>  
>  TDESC_CFILES = $(patsubst %.xml,%.c,$(XMLTOC))
> @@ -209,6 +212,7 @@ FEATURE_XMLFILES = aarch64-core.xml \
>  	arm/arm-m-profile-mve.xml \
>  	arm/arm-m-system.xml \
>  	arm/arm-m-profile-with-fpa.xml \
> +	arm/arm-secext.xml \
>  	arm/arm-tls.xml \
>  	arm/arm-vfpv2.xml \
>  	arm/arm-vfpv3.xml \
> diff --git a/gdb/features/arm/arm-secext.c b/gdb/features/arm/arm-secext.c
> index 39ef4afb05f..c71cffd2db6 100644
> --- a/gdb/features/arm/arm-secext.c
> +++ b/gdb/features/arm/arm-secext.c
> @@ -4,7 +4,7 @@
>  #include "gdbsupport/tdesc.h"
>  
>  static int
> -create_feature_arm_arm_m_system (struct target_desc *result, long regnum)
> +create_feature_arm_arm_secext (struct target_desc *result, long regnum)

This change looks good, it was obviously wrong before.  But I don't see
any call to create_feature_arm_arm_secext in the code base, so what is
the point of this file?  Should the arm tdep code use it?  It might be
worth asking in the thread that added this file.

Simon

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/2] Constify target_desc declarations
  2022-09-12 22:47 ` [PATCH 2/2] Constify target_desc declarations Keith Seitz
@ 2022-09-13 13:38   ` Simon Marchi
  0 siblings, 0 replies; 11+ messages in thread
From: Simon Marchi @ 2022-09-13 13:38 UTC (permalink / raw)
  To: Keith Seitz, gdb-patches

Thanks for doing this, this looks good to me.

> diff --git a/gdb/nios2-tdep.h b/gdb/nios2-tdep.h
> index cbf2599f5c0..78d5d8e0c97 100644
> --- a/gdb/nios2-tdep.h
> +++ b/gdb/nios2-tdep.h
> @@ -84,7 +84,7 @@ struct nios2_gdbarch_tdep : gdbarch_tdep_base
>    int jb_pc = 0;
>  };
>  
> -extern struct target_desc *tdesc_nios2_linux;
> -extern struct target_desc *tdesc_nios2;
> +extern const  struct target_desc *tdesc_nios2_linux;

Double space.

Simon

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/2] cleanup: Add missing feature/ XML files to Makefile
  2022-09-13 13:34 ` [PATCH 1/2] cleanup: Add missing feature/ XML files to Makefile Simon Marchi
@ 2022-09-13 13:55   ` Keith Seitz
  2022-09-13 13:57     ` Simon Marchi
                       ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Keith Seitz @ 2022-09-13 13:55 UTC (permalink / raw)
  To: Simon Marchi, gdb-patches

On 9/13/22 06:34, Simon Marchi wrote:
> With your patch applied, I tried re-generating everything:
> 
> $ cd features
> $ rm *.c */*.c
> $ make cfiles GDB="/home/simark/build/binutils-gdb-all-targets/gdb/gdb --data-directory=/home/simark/build/binutils-gdb-all-targets/gdb/data-directory"
> 
> And then git shows these files as missing:
> 
>          deleted:    aarch64-sve.c
>          deleted:    cskyv2-linux.c
> 
> aarch64-sve.c is not generate, so it's actually fine.  cskyv2-linux.c is
> generated, but we are missing the XML for it, I sent a reply to the
> patch thread that added it to ask the author to upload it.

Bah. I caught aarch64-sve.c, but not the other. Thank you for catching that.
I will keep my eye out for it and update when cskyv2-linux.xml reappears.

> 
> When typing just "make" in features/, I get this diff:
> 
> diff --git a/gdb/regformats/or1k-linux.dat b/gdb/regformats/or1k-linux.dat
> index 7b64646fc65a..9a9f8a640188 100644
> --- a/gdb/regformats/or1k-linux.dat
> +++ b/gdb/regformats/or1k-linux.dat
> @@ -2,7 +2,7 @@
>   # Generated from: or1k-linux.xml
>   name:or1k_linux
>   xmltarget:or1k-linux.xml
> -expedite:r1,npc
> +expedite:
>   32:r0
>   32:r1
>   32:r2
> 
> Probably a separate fix, but I think we need
> 
>    or1k-expedite = r1,npc
> 
> in features/Makefile

Just typing "make" in features does nothing here. Am I neglecting to do
something?

>>   	rs6000/powerpc-32.xml \
>>   	rs6000/powerpc-32l.xml \
>>   	rs6000/powerpc-403.xml \
>> diff --git a/gdb/features/arm/arm-secext.c b/gdb/features/arm/arm-secext.c
>> index 39ef4afb05f..c71cffd2db6 100644
>> --- a/gdb/features/arm/arm-secext.c
>> +++ b/gdb/features/arm/arm-secext.c
>> @@ -4,7 +4,7 @@
>>   #include "gdbsupport/tdesc.h"
>>   
>>   static int
>> -create_feature_arm_arm_m_system (struct target_desc *result, long regnum)
>> +create_feature_arm_arm_secext (struct target_desc *result, long regnum)
> 
> This change looks good, it was obviously wrong before.  But I don't see
> any call to create_feature_arm_arm_secext in the code base, so what is
> the point of this file?  Should the arm tdep code use it?  It might be
> worth asking in the thread that added this file.

Before submitting, I did email the original author, who CC'd Luis. I've added
him (Luis) to CC so that he can answer here more definitively than any
paraphrase in which I might introduce confusion.

Keith


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/2] cleanup: Add missing feature/ XML files to Makefile
  2022-09-13 13:55   ` Keith Seitz
@ 2022-09-13 13:57     ` Simon Marchi
  2022-09-13 14:44       ` Keith Seitz
  2022-09-13 14:10     ` Luis Machado
       [not found]     ` <2e6adda3-3cdf-7520-eee9-d58f179537ab@redhat.com>
  2 siblings, 1 reply; 11+ messages in thread
From: Simon Marchi @ 2022-09-13 13:57 UTC (permalink / raw)
  To: Keith Seitz, gdb-patches

>> When typing just "make" in features/, I get this diff:
>>
>> diff --git a/gdb/regformats/or1k-linux.dat b/gdb/regformats/or1k-linux.dat
>> index 7b64646fc65a..9a9f8a640188 100644
>> --- a/gdb/regformats/or1k-linux.dat
>> +++ b/gdb/regformats/or1k-linux.dat
>> @@ -2,7 +2,7 @@
>>   # Generated from: or1k-linux.xml
>>   name:or1k_linux
>>   xmltarget:or1k-linux.xml
>> -expedite:r1,npc
>> +expedite:
>>   32:r0
>>   32:r1
>>   32:r2
>>
>> Probably a separate fix, but I think we need
>>
>>    or1k-expedite = r1,npc
>>
>> in features/Makefile
> 
> Just typing "make" in features does nothing here. Am I neglecting to do
> something?

Oh, probably because the date of the .dat files is >= the date of the
.xml files.  If you do

  $ touch *.xml */*.xml

in features and then "make", it will re-generate them.

Simon


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/2] cleanup: Add missing feature/ XML files to Makefile
  2022-09-13 13:55   ` Keith Seitz
  2022-09-13 13:57     ` Simon Marchi
@ 2022-09-13 14:10     ` Luis Machado
  2022-09-13 15:11       ` Simon Marchi
       [not found]     ` <2e6adda3-3cdf-7520-eee9-d58f179537ab@redhat.com>
  2 siblings, 1 reply; 11+ messages in thread
From: Luis Machado @ 2022-09-13 14:10 UTC (permalink / raw)
  To: Keith Seitz, Simon Marchi, gdb-patches

On 9/13/22 14:55, Keith Seitz wrote:
> On 9/13/22 06:34, Simon Marchi wrote:
>> With your patch applied, I tried re-generating everything:
>>
>> $ cd features
>> $ rm *.c */*.c
>> $ make cfiles GDB="/home/simark/build/binutils-gdb-all-targets/gdb/gdb --data-directory=/home/simark/build/binutils-gdb-all-targets/gdb/data-directory"
>>
>> And then git shows these files as missing:
>>
>>          deleted:    aarch64-sve.c
>>          deleted:    cskyv2-linux.c
>>
>> aarch64-sve.c is not generate, so it's actually fine.  cskyv2-linux.c is
>> generated, but we are missing the XML for it, I sent a reply to the
>> patch thread that added it to ask the author to upload it.
> 
> Bah. I caught aarch64-sve.c, but not the other. Thank you for catching that.
> I will keep my eye out for it and update when cskyv2-linux.xml reappears.
> 
>>
>> When typing just "make" in features/, I get this diff:
>>
>> diff --git a/gdb/regformats/or1k-linux.dat b/gdb/regformats/or1k-linux.dat
>> index 7b64646fc65a..9a9f8a640188 100644
>> --- a/gdb/regformats/or1k-linux.dat
>> +++ b/gdb/regformats/or1k-linux.dat
>> @@ -2,7 +2,7 @@
>>   # Generated from: or1k-linux.xml
>>   name:or1k_linux
>>   xmltarget:or1k-linux.xml
>> -expedite:r1,npc
>> +expedite:
>>   32:r0
>>   32:r1
>>   32:r2
>>
>> Probably a separate fix, but I think we need
>>
>>    or1k-expedite = r1,npc
>>
>> in features/Makefile
> 
> Just typing "make" in features does nothing here. Am I neglecting to do
> something?
> 
>>>       rs6000/powerpc-32.xml \
>>>       rs6000/powerpc-32l.xml \
>>>       rs6000/powerpc-403.xml \
>>> diff --git a/gdb/features/arm/arm-secext.c b/gdb/features/arm/arm-secext.c
>>> index 39ef4afb05f..c71cffd2db6 100644
>>> --- a/gdb/features/arm/arm-secext.c
>>> +++ b/gdb/features/arm/arm-secext.c
>>> @@ -4,7 +4,7 @@
>>>   #include "gdbsupport/tdesc.h"
>>>   static int
>>> -create_feature_arm_arm_m_system (struct target_desc *result, long regnum)
>>> +create_feature_arm_arm_secext (struct target_desc *result, long regnum)
>>
>> This change looks good, it was obviously wrong before.  But I don't see
>> any call to create_feature_arm_arm_secext in the code base, so what is
>> the point of this file?  Should the arm tdep code use it?  It might be
>> worth asking in the thread that added this file.
> 
> Before submitting, I did email the original author, who CC'd Luis. I've added
> him (Luis) to CC so that he can answer here more definitively than any
> paraphrase in which I might introduce confusion.
> 
> Keith
> 

Right. So the org.gnu.gdb.arm.secext feature + registers are only reported by remote targets. We don't actually use this C file or its functions in
GDB/GDBserver.

I think it should be OK to remove these files (Linux doesn't support m-profiles, so it is unlikely this will get
used in the near future). We should add documentation about the feature, its registers and its purpose somewhere,
either in the code or in the manual. I can do that.

Otherwise the changes look OK to me. Watch out for the dynamically-generated descriptions (like aarch64-sve.c). I plan
to submit a patch to remove aarch64-tls.xml and make aarch64-tls.c generate the feature dynamically.

Is there something we should be aware of when adding such files that don't have corresponding .xml ones?

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/2] cleanup: Add missing feature/ XML files to Makefile
  2022-09-13 13:57     ` Simon Marchi
@ 2022-09-13 14:44       ` Keith Seitz
  0 siblings, 0 replies; 11+ messages in thread
From: Keith Seitz @ 2022-09-13 14:44 UTC (permalink / raw)
  To: Simon Marchi, gdb-patches

On 9/13/22 06:57, Simon Marchi wrote:
> Oh, probably because the date of the .dat files is >= the date of the
> .xml files.  If you do
> 
>    $ touch *.xml */*.xml
> 
> in features and then "make", it will re-generate them.

Haha. That was indeed the problem. I will update my patch to
include that.

Thank you,
Keith


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/2] cleanup: Add missing feature/ XML files to Makefile
  2022-09-13 14:10     ` Luis Machado
@ 2022-09-13 15:11       ` Simon Marchi
  2022-09-13 15:19         ` Luis Machado
  0 siblings, 1 reply; 11+ messages in thread
From: Simon Marchi @ 2022-09-13 15:11 UTC (permalink / raw)
  To: Luis Machado, Keith Seitz, gdb-patches

> I think it should be OK to remove these files (Linux doesn't support m-profiles, so it is unlikely this will get
> used in the near future). We should add documentation about the feature, its registers and its purpose somewhere,
> either in the code or in the manual. I can do that.
This would be the right page, I suppose:

https://sourceware.org/gdb/current/onlinedocs/gdb/ARM-Features.html#ARM-Features

> Otherwise the changes look OK to me. Watch out for the dynamically-generated descriptions (like aarch64-sve.c). I plan
> to submit a patch to remove aarch64-tls.xml and make aarch64-tls.c generate the feature dynamically.
> 
> Is there something we should be aware of when adding such files that don't have corresponding .xml ones?

I don't think so.

I wish that the generated and non-generated ones were separated (perhaps
put the generated ones in a "generated" directory), so it's easier to
remove them, to force-regenerate them.  And maybe "make clean" in
features/ could remove them too.  But that's not a prerequisite for what
you want to do.

Simno


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/2] cleanup: Add missing feature/ XML files to Makefile
  2022-09-13 15:11       ` Simon Marchi
@ 2022-09-13 15:19         ` Luis Machado
  0 siblings, 0 replies; 11+ messages in thread
From: Luis Machado @ 2022-09-13 15:19 UTC (permalink / raw)
  To: Simon Marchi, Keith Seitz, gdb-patches

On 9/13/22 16:11, Simon Marchi wrote:
>> I think it should be OK to remove these files (Linux doesn't support m-profiles, so it is unlikely this will get
>> used in the near future). We should add documentation about the feature, its registers and its purpose somewhere,
>> either in the code or in the manual. I can do that.
> This would be the right page, I suppose:
> 
> https://sourceware.org/gdb/current/onlinedocs/gdb/ARM-Features.html#ARM-Features
> 
>> Otherwise the changes look OK to me. Watch out for the dynamically-generated descriptions (like aarch64-sve.c). I plan
>> to submit a patch to remove aarch64-tls.xml and make aarch64-tls.c generate the feature dynamically.
>>
>> Is there something we should be aware of when adding such files that don't have corresponding .xml ones?
> 
> I don't think so.
> 
> I wish that the generated and non-generated ones were separated (perhaps
> put the generated ones in a "generated" directory), so it's easier to
> remove them, to force-regenerate them.  And maybe "make clean" in
> features/ could remove them too.  But that's not a prerequisite for what
> you want to do.

Sounds reasonable to me. I'll put on my list to do it.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/2] cleanup: Add missing feature/ XML files to Makefile
       [not found]       ` <3b7b0389-3cfe-ea44-7a22-9cb496debd4c@simark.ca>
@ 2022-09-29 17:08         ` Keith Seitz
  0 siblings, 0 replies; 11+ messages in thread
From: Keith Seitz @ 2022-09-29 17:08 UTC (permalink / raw)
  To: gdb-patches@sourceware.org ml

On 9/27/22 17:37, Simon Marchi wrote:
> 
> On 2022-09-27 13:57, Keith Seitz wrote:
>> On 9/13/22 06:55, Keith Seitz via Gdb-patches wrote:
>>> On 9/13/22 06:34, Simon Marchi wrote:
>>>> aarch64-sve.c is not generate, so it's actually fine.  cskyv2-linux.c is
>>>> generated, but we are missing the XML for it, I sent a reply to the
>>>> patch thread that added it to ask the author to upload it.
>>>
>>> Bah. I caught aarch64-sve.c, but not the other. Thank you for catching that.
>>> I will keep my eye out for it and update when cskyv2-linux.xml reappears.
>>
>> cskyv2-linux.xml has landed. Is there anything else I need to address before
>> pushing this?
> 
> Not sure if you intended to omit gdb-patches on this, but in any case I think the patch
> is good to go.

I did not intend to omit the list, but it happened anyway. :-)

I've now pushed this. Thank you for the review.

Keith


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-09-29 17:08 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-12 22:47 [PATCH 1/2] cleanup: Add missing feature/ XML files to Makefile Keith Seitz
2022-09-12 22:47 ` [PATCH 2/2] Constify target_desc declarations Keith Seitz
2022-09-13 13:38   ` Simon Marchi
2022-09-13 13:34 ` [PATCH 1/2] cleanup: Add missing feature/ XML files to Makefile Simon Marchi
2022-09-13 13:55   ` Keith Seitz
2022-09-13 13:57     ` Simon Marchi
2022-09-13 14:44       ` Keith Seitz
2022-09-13 14:10     ` Luis Machado
2022-09-13 15:11       ` Simon Marchi
2022-09-13 15:19         ` Luis Machado
     [not found]     ` <2e6adda3-3cdf-7520-eee9-d58f179537ab@redhat.com>
     [not found]       ` <3b7b0389-3cfe-ea44-7a22-9cb496debd4c@simark.ca>
2022-09-29 17:08         ` Keith Seitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).