diff mbox

sim: make LMA loading the default for all targets [committed]

Message ID 1451013013-19856-1-git-send-email-vapier@gentoo.org
State Committed
Delegated to: Mike Frysinger
Headers show

Commit Message

Mike Frysinger Dec. 25, 2015, 3:10 a.m. UTC
Most targets already default to loading code via their LMA, but for
a few, this means the default changes from loading VMA to LMA.  It's
better to have the different targets be consistent, and allows some
code clean up.
---
 sim/bfin/ChangeLog                 |  4 ++++
 sim/bfin/tconfig.h                 |  3 ---
 sim/common/ChangeLog               |  6 ++++++
 sim/common/sim-options.c           | 10 +---------
 sim/cris/ChangeLog                 |  4 ++++
 sim/cris/tconfig.h                 |  3 ---
 sim/frv/ChangeLog                  |  4 ++++
 sim/frv/tconfig.h                  |  3 ---
 sim/iq2000/ChangeLog               |  4 ++++
 sim/iq2000/tconfig.h               |  3 ---
 sim/lm32/ChangeLog                 |  4 ++++
 sim/lm32/tconfig.h                 |  3 ---
 sim/m32r/ChangeLog                 |  4 ++++
 sim/m32r/tconfig.h                 |  3 ---
 sim/m68hc11/ChangeLog              |  4 ++++
 sim/m68hc11/sim-main.h             |  2 --
 sim/mips/ChangeLog                 |  4 ++++
 sim/mips/tconfig.h                 |  7 -------
 sim/mn10300/ChangeLog              |  4 ++++
 sim/mn10300/sim-main.h             |  2 --
 sim/sh64/ChangeLog                 |  4 ++++
 sim/sh64/tconfig.h                 |  3 ---
 sim/testsuite/sim/cr16/ChangeLog   |  5 +++++
 sim/testsuite/sim/cr16/allinsn.exp | 11 ++++++++++-
 sim/testsuite/sim/cr16/misc.exp    | 10 ++++++++++
 25 files changed, 72 insertions(+), 42 deletions(-)
diff mbox

Patch

diff --git a/sim/bfin/ChangeLog b/sim/bfin/ChangeLog
index ac4b774..1deb4ea 100644
--- a/sim/bfin/ChangeLog
+++ b/sim/bfin/ChangeLog
@@ -1,3 +1,7 @@ 
+2015-12-24  Mike Frysinger  <vapier@gentoo.org>
+
+	* tconfig.h (SIM_HANDLES_LMA): Delete.
+
 2015-11-17  Mike Frysinger  <vapier@gentoo.org>
 
 	* tconfig.h (WITH_MODULO_MEMORY): Delete.
diff --git a/sim/bfin/tconfig.h b/sim/bfin/tconfig.h
index a3e6f7b..254aba9 100644
--- a/sim/bfin/tconfig.h
+++ b/sim/bfin/tconfig.h
@@ -1,8 +1,5 @@ 
 /* Blackfin target configuration file.  -*- C -*- */
 
-/* See sim-hload.c.  We properly handle LMA. -- TODO: check this */
-#define SIM_HANDLES_LMA 1
-
 /* We use this so that we are passed the requesting CPU for HW acesses.
    Common sim core by default sets hw_system_cpu to NULL for WITH_HW.  */
 #define WITH_DEVICES 1
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index 8340928..857485c 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,5 +1,11 @@ 
 2015-12-24  Mike Frysinger  <vapier@gentoo.org>
 
+	* sim-options.c (standard_options): Always enable load-lma and
+	load-vma options.
+	(standard_install): Always set STATE_LOAD_AT_LMA_P(sd) to 1.
+
+2015-12-24  Mike Frysinger  <vapier@gentoo.org>
+
 	* sim-module.c (MODULE_LIST): Delete.
 
 2015-12-24  Mike Frysinger  <vapier@gentoo.org>
diff --git a/sim/common/sim-options.c b/sim/common/sim-options.c
index 69655b0..95ed2c8 100644
--- a/sim/common/sim-options.c
+++ b/sim/common/sim-options.c
@@ -167,18 +167,12 @@  static const OPTION standard_options[] =
       '\0', "BFDNAME", "Specify the object-code format for the object files",
       standard_option_handler },
 
-#ifdef SIM_HANDLES_LMA
   { {"load-lma", no_argument, NULL, OPTION_LOAD_LMA},
       '\0', NULL,
-#if SIM_HANDLES_LMA
     "Use VMA or LMA addresses when loading image (default LMA)",
-#else
-    "Use VMA or LMA addresses when loading image (default VMA)",
-#endif
       standard_option_handler, "load-{lma,vma}" },
   { {"load-vma", no_argument, NULL, OPTION_LOAD_VMA},
       '\0', NULL, "", standard_option_handler,  "" },
-#endif
 
   { {"sysroot", required_argument, NULL, OPTION_SYSROOT},
       '\0', "SYSROOT",
@@ -423,9 +417,7 @@  standard_install (SIM_DESC sd)
   SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
   if (sim_add_option_table (sd, NULL, standard_options) != SIM_RC_OK)
     return SIM_RC_FAIL;
-#ifdef SIM_HANDLES_LMA
-  STATE_LOAD_AT_LMA_P (sd) = SIM_HANDLES_LMA;
-#endif
+  STATE_LOAD_AT_LMA_P (sd) = 1;
   return SIM_RC_OK;
 }
 
diff --git a/sim/cris/ChangeLog b/sim/cris/ChangeLog
index 4bca1e1..7b7618c 100644
--- a/sim/cris/ChangeLog
+++ b/sim/cris/ChangeLog
@@ -1,3 +1,7 @@ 
+2015-12-24  Mike Frysinger  <vapier@gentoo.org>
+
+	* tconfig.h (SIM_HANDLES_LMA): Delete.
+
 2015-11-15  Mike Frysinger  <vapier@gentoo.org>
 
 	* Makefile.in (SIM_OBJS): Delete sim-reason.o, sim-reg.o, and
diff --git a/sim/cris/tconfig.h b/sim/cris/tconfig.h
index e512c3d..77b000f 100644
--- a/sim/cris/tconfig.h
+++ b/sim/cris/tconfig.h
@@ -24,9 +24,6 @@  along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
    file.  I just copied it from m32r, pruned some stuff and added
    HAVE_MODEL because it seemed useful.  */
 
-/* See sim-hload.c.  We properly handle LMA.  */
-#define SIM_HANDLES_LMA 1
-
 /* For MSPR support.  FIXME: revisit.  */
 #define WITH_DEVICES 1
 
diff --git a/sim/frv/ChangeLog b/sim/frv/ChangeLog
index 5137111..4f0dd8f 100644
--- a/sim/frv/ChangeLog
+++ b/sim/frv/ChangeLog
@@ -1,5 +1,9 @@ 
 2015-12-24  Mike Frysinger  <vapier@gentoo.org>
 
+	* tconfig.h (SIM_HANDLES_LMA): Delete.
+
+2015-12-24  Mike Frysinger  <vapier@gentoo.org>
+
 	* tconfig.h (SIM_HAVE_BREAKPOINTS, SIM_BREAKPOINT,
 	SIM_BREAKPOINT_SIZE): Delete.
 	* traps.c [SIM_HAVE_BREAKPOINTS] (frv_itrap): Delete sim breakpoint
diff --git a/sim/frv/tconfig.h b/sim/frv/tconfig.h
index f0de19a..044cfb0 100644
--- a/sim/frv/tconfig.h
+++ b/sim/frv/tconfig.h
@@ -1,8 +1,5 @@ 
 /* FRV target configuration file.  -*- C -*- */
 
-/* See sim-hload.c.  We properly handle LMA. -- TODO: check this */
-#define SIM_HANDLES_LMA 1
-
 /* For MSPR support.  FIXME: revisit.  */
 #define WITH_DEVICES 1
 
diff --git a/sim/iq2000/ChangeLog b/sim/iq2000/ChangeLog
index 30f9501..770a2be 100644
--- a/sim/iq2000/ChangeLog
+++ b/sim/iq2000/ChangeLog
@@ -1,5 +1,9 @@ 
 2015-12-24  Mike Frysinger  <vapier@gentoo.org>
 
+	* tconfig.h (SIM_HANDLES_LMA): Delete.
+
+2015-12-24  Mike Frysinger  <vapier@gentoo.org>
+
 	* tconfig.h (SIM_HAVE_BREAKPOINTS, SIM_BREAKPOINT,
 	SIM_BREAKPOINT_SIZE): Delete.
 
diff --git a/sim/iq2000/tconfig.h b/sim/iq2000/tconfig.h
index ae0bf3a..bd5a3ae 100644
--- a/sim/iq2000/tconfig.h
+++ b/sim/iq2000/tconfig.h
@@ -1,8 +1,5 @@ 
 /* IQ2000 target configuration file.  -*- C -*- */
 
-/* See sim-hload.c.  We properly handle LMA. -- TODO: check this */
-#define SIM_HANDLES_LMA 1
-
 /* For MSPR support.  FIXME: revisit.  */
 #define WITH_DEVICES 0
 
diff --git a/sim/lm32/ChangeLog b/sim/lm32/ChangeLog
index 081be37..93e7d98 100644
--- a/sim/lm32/ChangeLog
+++ b/sim/lm32/ChangeLog
@@ -1,3 +1,7 @@ 
+2015-12-24  Mike Frysinger  <vapier@gentoo.org>
+
+	* tconfig.h (SIM_HANDLES_LMA): Delete.
+
 2015-11-15  Mike Frysinger  <vapier@gentoo.org>
 
 	* Makefile.in (SIM_OBJS): Delete sim-reason.o, sim-reg.o, and
diff --git a/sim/lm32/tconfig.h b/sim/lm32/tconfig.h
index 0970c81..7db04f9 100644
--- a/sim/lm32/tconfig.h
+++ b/sim/lm32/tconfig.h
@@ -19,9 +19,6 @@ 
 #ifndef LM32_TCONFIG_H
 #define LM32_TCONFIG_H
 
-/* See sim-hload.c.  We properly handle LMA.  */
-#define SIM_HANDLES_LMA 1
-
 #define WITH_SCACHE_PBB 1
 
 #endif /* LM32_TCONFIG_H */
diff --git a/sim/m32r/ChangeLog b/sim/m32r/ChangeLog
index 616fb2a..f81e61b 100644
--- a/sim/m32r/ChangeLog
+++ b/sim/m32r/ChangeLog
@@ -1,5 +1,9 @@ 
 2015-12-24  Mike Frysinger  <vapier@gentoo.org>
 
+	* tconfig.h (SIM_HANDLES_LMA): Delete.
+
+2015-12-24  Mike Frysinger  <vapier@gentoo.org>
+
 	* tconfig.h (SIM_HAVE_BREAKPOINTS, SIM_BREAKPOINT,
 	SIM_BREAKPOINT_SIZE): Delete.
 	* traps-linux.c [SIM_HAVE_BREAKPOINTS] (m32r_trap): Delete sim
diff --git a/sim/m32r/tconfig.h b/sim/m32r/tconfig.h
index 72a7f68..0a43607 100644
--- a/sim/m32r/tconfig.h
+++ b/sim/m32r/tconfig.h
@@ -3,9 +3,6 @@ 
 #ifndef M32R_TCONFIG_H
 #define M32R_TCONFIG_H
 
-/* See sim-hload.c.  We properly handle LMA.  */
-#define SIM_HANDLES_LMA 1
-
 /* For MSPR support.  FIXME: revisit.  */
 #define WITH_DEVICES 1
 
diff --git a/sim/m68hc11/ChangeLog b/sim/m68hc11/ChangeLog
index 7ba16fa..4a20b55 100644
--- a/sim/m68hc11/ChangeLog
+++ b/sim/m68hc11/ChangeLog
@@ -1,5 +1,9 @@ 
 2015-12-24  Mike Frysinger  <vapier@gentoo.org>
 
+	* sim-main.h (SIM_HANDLES_LMA): Delete.
+
+2015-12-24  Mike Frysinger  <vapier@gentoo.org>
+
 	* sim-main.h (WITH_WATCHPOINTS): Delete.
 
 2015-11-17  Mike Frysinger  <vapier@gentoo.org>
diff --git a/sim/m68hc11/sim-main.h b/sim/m68hc11/sim-main.h
index 144095a..208b6ab 100644
--- a/sim/m68hc11/sim-main.h
+++ b/sim/m68hc11/sim-main.h
@@ -20,8 +20,6 @@  along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 #ifndef _SIM_MAIN_H
 #define _SIM_MAIN_H
 
-#define SIM_HANDLES_LMA 1
-
 #include "sim-basics.h"
 #include "sim-signal.h"
 #include "sim-base.h"
diff --git a/sim/mips/ChangeLog b/sim/mips/ChangeLog
index 93c1814..9974526 100644
--- a/sim/mips/ChangeLog
+++ b/sim/mips/ChangeLog
@@ -1,5 +1,9 @@ 
 2015-12-24  Mike Frysinger  <vapier@gentoo.org>
 
+	* tconfig.h (SIM_HANDLES_LMA): Delete.
+
+2015-12-24  Mike Frysinger  <vapier@gentoo.org>
+
 	* sim-main.h (WITH_WATCHPOINTS): Delete.
 
 2015-12-24  Mike Frysinger  <vapier@gentoo.org>
diff --git a/sim/mips/tconfig.h b/sim/mips/tconfig.h
index 136015a..a8c9185 100644
--- a/sim/mips/tconfig.h
+++ b/sim/mips/tconfig.h
@@ -1,11 +1,4 @@ 
 /* mips target configuration file.  */
 
-/* See sim-hload.c.  We properly handle LMA.  */
-#ifdef TARGET_TX3904
-#define SIM_HANDLES_LMA 1
-#else
-#define SIM_HANDLES_LMA 0
-#endif
-
 /* MIPS uses an unusual format for floating point quiet NaNs.  */
 #define SIM_QUIET_NAN_NEGATED
diff --git a/sim/mn10300/ChangeLog b/sim/mn10300/ChangeLog
index 0034efc..bce1772 100644
--- a/sim/mn10300/ChangeLog
+++ b/sim/mn10300/ChangeLog
@@ -1,5 +1,9 @@ 
 2015-12-24  Mike Frysinger  <vapier@gentoo.org>
 
+	* sim-main.h (SIM_HANDLES_LMA): Delete.
+
+2015-12-24  Mike Frysinger  <vapier@gentoo.org>
+
 	* sim-main.h (WITH_WATCHPOINTS): Delete.
 
 2015-11-21  Mike Frysinger  <vapier@gentoo.org>
diff --git a/sim/mn10300/sim-main.h b/sim/mn10300/sim-main.h
index b489ad0..64562ee 100644
--- a/sim/mn10300/sim-main.h
+++ b/sim/mn10300/sim-main.h
@@ -22,8 +22,6 @@ 
 #ifndef SIM_MAIN_H
 #define SIM_MAIN_H
 
-#define SIM_HANDLES_LMA 1
-
 #define SIM_ENGINE_HALT_HOOK(SD,LAST_CPU,CIA) 0 /* disable this hook */
 
 #include "sim-basics.h"
diff --git a/sim/sh64/ChangeLog b/sim/sh64/ChangeLog
index cd8f50b..92fcf75 100644
--- a/sim/sh64/ChangeLog
+++ b/sim/sh64/ChangeLog
@@ -1,5 +1,9 @@ 
 2015-12-24  Mike Frysinger  <vapier@gentoo.org>
 
+	* tconfig.h (SIM_HANDLES_LMA): Delete.
+
+2015-12-24  Mike Frysinger  <vapier@gentoo.org>
+
 	* tconfig.h (SIM_HAVE_BREAKPOINTS, SIM_BREAKPOINT,
 	SIM_BREAKPOINT_SIZE): Delete.
 
diff --git a/sim/sh64/tconfig.h b/sim/sh64/tconfig.h
index 1440566..4f4d9b7 100644
--- a/sim/sh64/tconfig.h
+++ b/sim/sh64/tconfig.h
@@ -1,8 +1,5 @@ 
 /* SH64 target configuration file.  -*- C -*- */
 
-/* See sim-hload.c.  We properly handle LMA. -- TODO: check this */
-#define SIM_HANDLES_LMA 1
-
 /* For MSPR support.  FIXME: revisit.  */
 #define WITH_DEVICES 0
 
diff --git a/sim/testsuite/sim/cr16/ChangeLog b/sim/testsuite/sim/cr16/ChangeLog
index e6b2466..4cb008b 100644
--- a/sim/testsuite/sim/cr16/ChangeLog
+++ b/sim/testsuite/sim/cr16/ChangeLog
@@ -1,3 +1,8 @@ 
+2015-12-24  Mike Frysinger  <vapier@gentoo.org>
+
+	* allinsn.exp: Append --load-vma to global_sim_options.
+	* misc.exp: Likewise.
+
 2015-03-29  Mike Frysinger  <vapier@gentoo.org>
 
 	PR sim/12385
diff --git a/sim/testsuite/sim/cr16/allinsn.exp b/sim/testsuite/sim/cr16/allinsn.exp
index 392e70f..852a673 100644
--- a/sim/testsuite/sim/cr16/allinsn.exp
+++ b/sim/testsuite/sim/cr16/allinsn.exp
@@ -1,6 +1,5 @@ 
 # CR16 simulator testsuite.
 
-
 if [istarget cr16*-*-*] {
     # load support procs
     # load_lib cgen.exp
@@ -8,6 +7,14 @@  if [istarget cr16*-*-*] {
     # all machines
     set all_machs "cr16"
 
+    global global_sim_options
+    if ![info exists global_sim_options] {
+	set global_sim_options ""
+    }
+    set saved_global_sim_options $global_sim_options
+    # The cr16 linker sets the default LMA base to 0, and all the code
+    # expects the VMA when running, so use that when running the tests.
+    set global_sim_options "$saved_global_sim_options --load-vma"
 
     # The .cgs suffix is for "cgen .s".
     foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.cgs]] {
@@ -19,4 +26,6 @@  if [istarget cr16*-*-*] {
 
 	run_sim_test $src $all_machs
     }
+
+    set global_sim_options $saved_global_sim_options
 }
diff --git a/sim/testsuite/sim/cr16/misc.exp b/sim/testsuite/sim/cr16/misc.exp
index 5fe512d..39dd3a4 100644
--- a/sim/testsuite/sim/cr16/misc.exp
+++ b/sim/testsuite/sim/cr16/misc.exp
@@ -7,6 +7,14 @@  if [istarget cr16*-*-*] {
     # all machines
     set all_machs "cr16"
 
+    global global_sim_options
+    if ![info exists global_sim_options] {
+	set global_sim_options ""
+    }
+    set saved_global_sim_options $global_sim_options
+    # The cr16 linker sets the default LMA base to 0, and all the code
+    # expects the VMA when running, so use that when running the tests.
+    set global_sim_options "$saved_global_sim_options --load-vma"
 
     # The .ms suffix is for "miscellaneous .s".
     foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.ms]] {
@@ -18,4 +26,6 @@  if [istarget cr16*-*-*] {
 
 	run_sim_test $src $all_machs
     }
+
+    set global_sim_options $saved_global_sim_options
 }