+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.
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);