]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
sim: model: constify sim_machs storage
authorMike Frysinger <vapier@gentoo.org>
Sun, 27 Jun 2021 05:26:30 +0000 (01:26 -0400)
committerMike Frysinger <vapier@gentoo.org>
Wed, 30 Jun 2021 00:08:10 +0000 (20:08 -0400)
The array of pointers is never modified, so mark it const so it ends
up in the read-only data section.

21 files changed:
sim/bfin/ChangeLog
sim/bfin/machs.c
sim/bpf/ChangeLog
sim/bpf/arch.c
sim/common/ChangeLog
sim/common/sim-model.c
sim/common/sim-model.h
sim/cris/ChangeLog
sim/cris/arch.c
sim/frv/ChangeLog
sim/frv/arch.c
sim/iq2000/ChangeLog
sim/iq2000/arch.c
sim/lm32/ChangeLog
sim/lm32/arch.c
sim/m32r/ChangeLog
sim/m32r/arch.c
sim/or1k/ChangeLog
sim/or1k/arch.c
sim/riscv/ChangeLog
sim/riscv/machs.c

index d84d44f8e816f4b1d9dcca1b741e4030ae44d95c..a26a35a136c1c29f599568641572e041a17e9e6f 100644 (file)
@@ -1,3 +1,7 @@
+2021-06-29  Mike Frysinger  <vapier@gentoo.org>
+
+       * machs.c (sim_machs): Mark const.
+
 2021-06-27  Mike Frysinger  <vapier@gentoo.org>
 
        * Makefile.in: Change to $(SDL_CFLAGS) & $(SDL_LIBS).
index e94af5d0f5b8d4666ee7f37a97040c9201a0177c..ff49bb7c3bb037fffc92ff283d8373e9dfc6b664 100644 (file)
@@ -1962,7 +1962,7 @@ static const SIM_MACH bfin_mach =
   bfin_prepare_run
 };
 
-const SIM_MACH *sim_machs[] =
+const SIM_MACH * const sim_machs[] =
 {
   & bfin_mach,
   NULL
index 046c450198d15729739c53b7f3d6dd680a5307af..2d847bb0278c2bd511c40d27e480895fb5028000 100644 (file)
@@ -1,3 +1,7 @@
+2021-06-29  Mike Frysinger  <vapier@gentoo.org>
+
+       * arch.c (sim_machs): Mark const.
+
 2021-06-28  Mike Frysinger  <vapier@gentoo.org>
 
        * Makefile.in (SIM_WERROR_CFLAGS): Delete.
index cb3a206f1e8a64186216e18d1791dd9037d04e49..8ceaa34cef831fc44df435ae8d57636cf94e4f00 100644 (file)
@@ -25,7 +25,7 @@ This file is part of the GNU simulators.
 #include "sim-main.h"
 #include "bfd.h"
 
-const SIM_MACH *sim_machs[] =
+const SIM_MACH * const sim_machs[] =
 {
 #ifdef HAVE_CPU_BPFBF
   & bpf_mach,
index 6926fd3438b2195aedc41de27a7ecee9d8e61e33..7b21b00c880e7736ced7fd03179695d6e31828df 100644 (file)
@@ -1,3 +1,12 @@
+2021-06-29  Mike Frysinger  <vapier@gentoo.org>
+
+       * sim-model.c (model_option_handler): Make machp const.
+       (sim_model_lookup): Likewise.
+       (sim_mach_lookup): Likewise.
+       (sim_mach_lookup_bfd_name): Likewise.
+       (sim_machs): Add const.
+       * sim-model.h (sim_machs): Likewise.
+
 2021-06-29  Mike Frysinger  <vapier@gentoo.org>
 
        * sim-io.h (sim_io_vprintf): Add ATTRIBUTE_PRINTF.
index e1af9d4b1e46fba2faa884b3fe7f52d3682b3e54..bfdb3c24bc8bb35766f5217d177d0c502e29faec 100644 (file)
@@ -74,7 +74,7 @@ model_option_handler (SIM_DESC sd, sim_cpu *cpu, int opt,
 
     case OPTION_MODEL_INFO :
       {
-       const SIM_MACH **machp;
+       const SIM_MACH * const *machp;
        const SIM_MODEL *model;
        for (machp = & sim_machs[0]; *machp != NULL; ++machp)
          {
@@ -140,7 +140,7 @@ sim_model_set (SIM_DESC sd, sim_cpu *cpu, const SIM_MODEL *model)
 const SIM_MODEL *
 sim_model_lookup (const char *name)
 {
-  const SIM_MACH **machp;
+  const SIM_MACH * const *machp;
   const SIM_MODEL *model;
 
   for (machp = & sim_machs[0]; *machp != NULL; ++machp)
@@ -160,7 +160,7 @@ sim_model_lookup (const char *name)
 const SIM_MACH *
 sim_mach_lookup (const char *name)
 {
-  const SIM_MACH **machp;
+  const SIM_MACH * const *machp;
 
   for (machp = & sim_machs[0]; *machp != NULL; ++machp)
     {
@@ -176,7 +176,7 @@ sim_mach_lookup (const char *name)
 const SIM_MACH *
 sim_mach_lookup_bfd_name (const char *name)
 {
-  const SIM_MACH **machp;
+  const SIM_MACH * const *machp;
 
   for (machp = & sim_machs[0]; *machp != NULL; ++machp)
     {
@@ -251,7 +251,7 @@ sim_model_init (SIM_DESC sd)
 #if !WITH_MODEL_P
 /* Set up basic model support.  This is a stub for ports that do not define
    models.  See sim-model.h for more details.  */
-const SIM_MACH *sim_machs[] =
+const SIM_MACH * const sim_machs[] =
 {
   NULL
 };
index 3a028d5f32f3474931cbc4c2b7ac500100c21b24..d6edf649d6e28cc27a3f6c72108ea0b51696e338 100644 (file)
@@ -140,7 +140,7 @@ typedef struct model {
 /* ??? In a simulator of multiple architectures, will need multiple copies of
    this.  Have an `archs' array that contains a pointer to the machs array
    for each (which in turn has a pointer to the models array for each).  */
-extern const SIM_MACH *sim_machs[];
+extern const SIM_MACH * const sim_machs[];
 
 /* Model module handlers.  */
 extern MODULE_INSTALL_FN sim_model_install;
index f369739af8b7eb20c3a0380c8d927dc59ac51f54..8c36ffeae3232ced1e4d0556a538a86c548e3504 100644 (file)
@@ -1,3 +1,7 @@
+2021-06-29  Mike Frysinger  <vapier@gentoo.org>
+
+       * arch.c (sim_machs): Mark const.
+
 2021-06-28  Mike Frysinger  <vapier@gentoo.org>
 
        * cpuv10.c (crisv10f_record_trace_results): Delete function.
index 1395cc7472d15fc5f6b6dbe2bcfbfbb9f784c46f..1635ef6a9557a21f8f54a873e08e2dd631499569 100644 (file)
@@ -24,7 +24,7 @@ This file is part of the GNU simulators.
 #include "sim-main.h"
 #include "bfd.h"
 
-const SIM_MACH *sim_machs[] =
+const SIM_MACH * const sim_machs[] =
 {
 #ifdef HAVE_CPU_CRISV10F
   & crisv10_mach,
index 36ea3ef6b5402c168aaf60e0fda40afc185df7be..78208fbf1541ca553070e1da9d73a48cf9481d38 100644 (file)
@@ -1,3 +1,7 @@
+2021-06-29  Mike Frysinger  <vapier@gentoo.org>
+
+       * arch.c (sim_machs): Mark const.
+
 2021-06-28  Mike Frysinger  <vapier@gentoo.org>
 
        * cpu.c (frvbf_record_trace_results): Delete function.
index 80b620fae6056aeae6b34c4c58af030f80d163f8..f58ed1168162608aded755b377dfbbbd21beb9be 100644 (file)
@@ -24,7 +24,7 @@ This file is part of the GNU simulators.
 #include "sim-main.h"
 #include "bfd.h"
 
-const SIM_MACH *sim_machs[] =
+const SIM_MACH * const sim_machs[] =
 {
 #ifdef HAVE_CPU_FRVBF
   & frv_mach,
index a8cea4d69950fb5e016d436760e6d99cc412082d..cc5d594e0a930c1ce051a25f474ffb9a058130b4 100644 (file)
@@ -1,3 +1,7 @@
+2021-06-29  Mike Frysinger  <vapier@gentoo.org>
+
+       * arch.c (sim_machs): Mark const.
+
 2021-06-28  Mike Frysinger  <vapier@gentoo.org>
 
        * cpu.c (iq2000bf_record_trace_results): Delete function.
index 30ce2f5ca6cec550960864670f989c1d4a42330a..22dc565b1bcac09f7b982401d1beb257490a8264 100644 (file)
@@ -24,7 +24,7 @@ This file is part of the GNU simulators.
 #include "sim-main.h"
 #include "bfd.h"
 
-const SIM_MACH *sim_machs[] =
+const SIM_MACH * const sim_machs[] =
 {
 #ifdef HAVE_CPU_IQ2000BF
   & iq2000_mach,
index bc3c5fe8221fc43eebac4876abd48fd9f51c37ec..689eb6461afbeae9a2e62a8809653e09e871a640 100644 (file)
@@ -1,3 +1,7 @@
+2021-06-29  Mike Frysinger  <vapier@gentoo.org>
+
+       * arch.c (sim_machs): Mark const.
+
 2021-06-28  Mike Frysinger  <vapier@gentoo.org>
 
        * cpu.c (lm32bf_record_trace_results): Delete function.
index e8a826adc70a76b623593d0832c1401f085524ea..72fe4b43b87bd58c48ba2f2e265761ad18379deb 100644 (file)
@@ -24,7 +24,7 @@ This file is part of the GNU simulators.
 #include "sim-main.h"
 #include "bfd.h"
 
-const SIM_MACH *sim_machs[] =
+const SIM_MACH * const sim_machs[] =
 {
 #ifdef HAVE_CPU_LM32BF
   & lm32_mach,
index 00b0a7a8c118429d7d6c9cb253dd0f4cc1b55fa9..d8171c600aeecc926bf1a8a4e70051ea9004428a 100644 (file)
@@ -1,3 +1,7 @@
+2021-06-29  Mike Frysinger  <vapier@gentoo.org>
+
+       * arch.c (sim_machs): Mark const.
+
 2021-06-28  Mike Frysinger  <vapier@gentoo.org>
 
        * cpu.c (m32rbf_record_trace_results): Delete function.
index eb4bc06baefe1a659928c1aa83876302f116e851..4b789759eb65d8a5e27709e3038f27febd1e8782 100644 (file)
@@ -24,7 +24,7 @@ This file is part of the GNU simulators.
 #include "sim-main.h"
 #include "bfd.h"
 
-const SIM_MACH *sim_machs[] =
+const SIM_MACH * const sim_machs[] =
 {
 #ifdef HAVE_CPU_M32RBF
   & m32r_mach,
index eb14a13adc6c97621c4efc0235db534ff008d8b2..89a89aca725d05c92fd0c21a573dbd1ef5a1e45a 100644 (file)
@@ -1,3 +1,7 @@
+2021-06-29  Mike Frysinger  <vapier@gentoo.org>
+
+       * arch.c (sim_machs): Mark const.
+
 2021-06-28  Mike Frysinger  <vapier@gentoo.org>
 
        * cpu.c (or1k32bf_record_trace_results): Delete function.
index 97a7a3806a697926472d9508016f65024ed52dd4..ef3c403c9435fd1947d5597b3d8fbf692dbcc0a1 100644 (file)
@@ -25,7 +25,7 @@ This file is part of the GNU simulators.
 #include "sim-main.h"
 #include "bfd.h"
 
-const SIM_MACH *sim_machs[] =
+const SIM_MACH * const sim_machs[] =
 {
 #ifdef HAVE_CPU_OR1K32BF
   & or32_mach,
index bcb630ae34cc6727d939614bb088aea5bf47ef50..69c0808ce327edc465ddea8989ec1d8c4a8986a8 100644 (file)
@@ -1,3 +1,7 @@
+2021-06-29  Mike Frysinger  <vapier@gentoo.org>
+
+       * machs.c (sim_machs): Mark const.
+
 2021-06-22  Mike Frysinger  <vapier@gentoo.org>
 
        * configure: Regenerate.
index 9ff23033678767c5988fd4db55c56f7b8a5bc397..eb75a1dd2002b7b2d781d36992f2993daab1611e 100644 (file)
@@ -111,7 +111,7 @@ static const SIM_MACH rv128i_mach =
 #endif
 
 /* Order matters here.  */
-const SIM_MACH *sim_machs[] =
+const SIM_MACH * const sim_machs[] =
 {
 #if WITH_TARGET_WORD_BITSIZE >= 128
   &rv128i_mach,