aboutsummaryrefslogtreecommitdiff
path: root/sim/common
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2021-06-05 22:50:57 -0400
committerMike Frysinger <vapier@gentoo.org>2021-06-09 18:24:59 -0400
commitcfc6061bd857d4b2e90d00a3bc2bbac038874f51 (patch)
treec29d37cefdc537610f58fdad9798948278390f86 /sim/common
parenteee649922f026dd8857abb0476188e0508efcf8b (diff)
downloadgdb-cfc6061bd857d4b2e90d00a3bc2bbac038874f51.zip
gdb-cfc6061bd857d4b2e90d00a3bc2bbac038874f51.tar.gz
gdb-cfc6061bd857d4b2e90d00a3bc2bbac038874f51.tar.bz2
sim: nrun: tweak init of callback endian
Allow ports to initialize the callback endian if they want. This will allow delegation of the logic out of common code in the future. Also switch from the CURRENT_TARGET_BYTE_ORDER macro to the underlying current_target_byte_order storage since the latter has been setup by the sim-config module based on the same macros. This will allow the nrun module to be moved to common building for sharing.
Diffstat (limited to 'sim/common')
-rw-r--r--sim/common/ChangeLog5
-rw-r--r--sim/common/nrun.c11
2 files changed, 11 insertions, 5 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index dbe9236..b5b6db2 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,5 +1,10 @@
2021-06-09 Mike Frysinger <vapier@gentoo.org>
+ * nrun.c (main): Set default_callback.target_endian to
+ current_target_byte_order when it's BFD_ENDIAN_UNKNOWN.
+
+2021-06-09 Mike Frysinger <vapier@gentoo.org>
+
* cgen-defs.h (STATE_RUN_FAST_P, CGEN_STATE, cgen_init): Delete.
* cgen-run.c (cgen_get_fast_p): New function.
(sim_resume): Move fast_p up and call cgen_get_fast_p.
diff --git a/sim/common/nrun.c b/sim/common/nrun.c
index 2cccff6..e39a0c6 100644
--- a/sim/common/nrun.c
+++ b/sim/common/nrun.c
@@ -88,11 +88,12 @@ main (int argc, char **argv)
abort ();
}
- /* We can't set the endianness in the callback structure until
- sim_config is called, which happens in sim_open. */
- default_callback.target_endian
- = (CURRENT_TARGET_BYTE_ORDER == BFD_ENDIAN_BIG
- ? BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE);
+ /* We can't set the endianness in the callback structure until sim_config is
+ called, which happens in sim_open. If it's still the default, switch it.
+ Don't use CURRENT_TARGET_BYTE_ORDER as all its internal processing already
+ happened in sim_config. */
+ if (default_callback.target_endian == BFD_ENDIAN_UNKNOWN)
+ default_callback.target_endian = current_target_byte_order;
/* Was there a program to run? */
prog_argv = STATE_PROG_ARGV (sd);