* [PATCH] sim: nrun: tweak init of callback endian
@ 2021-06-06 17:33 Mike Frysinger
0 siblings, 0 replies; only message in thread
From: Mike Frysinger @ 2021-06-06 17:33 UTC (permalink / raw)
To: gdb-patches
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.
---
sim/common/nrun.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/sim/common/nrun.c b/sim/common/nrun.c
index 2cccff6a211f..e39a0c6ed546 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);
--
2.31.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-06-06 17:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-06 17:33 [PATCH] sim: nrun: tweak init of callback endian Mike Frysinger
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).