summaryrefslogtreecommitdiff
path: root/gdb/arch
diff options
context:
space:
mode:
authorKeith Seitz <keiths@redhat.com>2022-09-09 08:44:50 -0700
committerKeith Seitz <keiths@redhat.com>2022-09-29 10:00:13 -0700
commitac9b8c676e9f52c5238bbc61a2cdd27e3d59db10 (patch)
tree0127ac41cd6400d534b652b5ffda19bf201f6da3 /gdb/arch
parentee8cc2b3f2d121718165b1cab2f537bbf30cae89 (diff)
downloadbinutils-gdb-ac9b8c676e9f52c5238bbc61a2cdd27e3d59db10.tar.gz
Constify target_desc declarations
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
Diffstat (limited to 'gdb/arch')
-rw-r--r--gdb/arch/ppc-linux-common.c2
-rw-r--r--gdb/arch/ppc-linux-tdesc.h40
2 files changed, 21 insertions, 21 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 */