aboutsummaryrefslogtreecommitdiff
path: root/sim/common
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2021-06-15 19:51:52 -0400
committerMike Frysinger <vapier@gentoo.org>2021-06-17 23:20:13 -0400
commitf9a4d54332f9e1f75701ba43249a03cc631ec736 (patch)
tree2dd0b32c633005ac4378a2282d9726885e09a7b5 /sim/common
parent4470708442cef1c818c4322f975d9017307f0243 (diff)
downloadgdb-f9a4d54332f9e1f75701ba43249a03cc631ec736.zip
gdb-f9a4d54332f9e1f75701ba43249a03cc631ec736.tar.gz
gdb-f9a4d54332f9e1f75701ba43249a03cc631ec736.tar.bz2
sim: overhaul & unify endian settings management
The m4 macro has 2 args: the "wire" settings (which represents the hardwired port behavior), and the default settings (which are used if nothing else is specified). If none are specified, the arch is expected to support both, and the value will be probed based on the user runtime options or the input program. Only two arches today set the default value (bpf & mips). We can probably let this go as it only shows up in one scenario: the sim is invoked, but with no inputs, and no user endian selection. This means bpf will not behave like the other arches: an error is shown and forces the user to make a choice. If an input program is used though, we'll still switch the default to that. This allows us to remove the WITH_DEFAULT_TARGET_BYTE_ORDER setting. For the ports that set a "wire" endian, move it to the runtime init of the respective sim_open calls. This allows us to change the WITH_TARGET_BYTE_ORDER to purely a user-selected configure setting if they want to force a specific endianness. With all the endian logic moved to runtime selection, we can move the configure call up to the common dir so we only process it once across all ports. The ppc arch was picking the wire endian based on the target used, but since we weren't doing that for other biendian arches, we can let this go too. We'll rely on the input selecting the endian, or make the user decide.
Diffstat (limited to 'sim/common')
-rw-r--r--sim/common/ChangeLog8
-rw-r--r--sim/common/Make-common.in2
-rw-r--r--sim/common/sim-config.c5
-rw-r--r--sim/common/sim-config.h8
4 files changed, 8 insertions, 15 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index abb2ec6..0d260eb 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,5 +1,13 @@
2021-06-17 Mike Frysinger <vapier@gentoo.org>
+ * Make-common.in (SIM_ENDIAN): Delete.
+ * sim-config.c (sim_config): Delete WITH_DEFAULT_TARGET_BYTE_ORDER.
+ (sim_config_print): Likewise.
+ * sim-config.h (WITH_TARGET_BYTE_ORDER): Delete.
+ (WITH_DEFAULT_TARGET_BYTE_ORDER): Likewise.
+
+2021-06-17 Mike Frysinger <vapier@gentoo.org>
+
* cgen-trace.c: Include sim/callback.h.
* nrun.c, sim-hw.c, sim-io.c, sim-syscall.c, sim-trace.c: Likewise.
* sim-basics.h: Delete sim/callback.h include.
diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in
index 0ab9e79..7a6a203 100644
--- a/sim/common/Make-common.in
+++ b/sim/common/Make-common.in
@@ -86,7 +86,6 @@ LDFLAGS = @LDFLAGS@
SIM_BITSIZE = @sim_bitsize@
SIM_DEFAULT_MODEL = @sim_default_model@
-SIM_ENDIAN = @sim_endian@
SIM_FLOAT = @sim_float@
SIM_HW_CFLAGS = @sim_hw_cflags@
SIM_HW_OBJS = @sim_hw_objs@
@@ -223,7 +222,6 @@ CONFIG_CFLAGS = \
-DHAVE_CONFIG_H \
$(SIM_DEFAULT_MODEL) \
$(SIM_BITSIZE) \
- $(SIM_ENDIAN) \
$(SIM_FLOAT) \
$(SIM_HW_CFLAGS) \
$(SIM_INLINE) \
diff --git a/sim/common/sim-config.c b/sim/common/sim-config.c
index c9005f4..fc6b09a 100644
--- a/sim/common/sim-config.c
+++ b/sim/common/sim-config.c
@@ -169,8 +169,6 @@ sim_config (SIM_DESC sd)
current_target_byte_order = prefered_target_byte_order;
if (current_target_byte_order == BFD_ENDIAN_UNKNOWN)
current_target_byte_order = WITH_TARGET_BYTE_ORDER;
- if (current_target_byte_order == BFD_ENDIAN_UNKNOWN)
- current_target_byte_order = WITH_DEFAULT_TARGET_BYTE_ORDER;
/* verify the target byte order */
if (CURRENT_TARGET_BYTE_ORDER == BFD_ENDIAN_UNKNOWN)
@@ -302,9 +300,6 @@ sim_config_print (SIM_DESC sd)
sim_io_printf (sd, "WITH_TARGET_BYTE_ORDER = %s\n",
config_byte_order_to_a (WITH_TARGET_BYTE_ORDER));
- sim_io_printf (sd, "WITH_DEFAULT_TARGET_BYTE_ORDER = %s\n",
- config_byte_order_to_a (WITH_DEFAULT_TARGET_BYTE_ORDER));
-
sim_io_printf (sd, "HOST_BYTE_ORDER = %s\n",
config_byte_order_to_a (HOST_BYTE_ORDER));
diff --git a/sim/common/sim-config.h b/sim/common/sim-config.h
index 2b6ed3d..5b1713c 100644
--- a/sim/common/sim-config.h
+++ b/sim/common/sim-config.h
@@ -50,14 +50,6 @@
Possible values are BFD_ENDIAN_UNKNOWN, BFD_ENDIAN_LITTLE, or BFD_ENDIAN_BIG. */
-#ifndef WITH_TARGET_BYTE_ORDER
-#define WITH_TARGET_BYTE_ORDER BFD_ENDIAN_UNKNOWN
-#endif
-
-#ifndef WITH_DEFAULT_TARGET_BYTE_ORDER
-#define WITH_DEFAULT_TARGET_BYTE_ORDER BFD_ENDIAN_UNKNOWN
-#endif
-
extern enum bfd_endian current_target_byte_order;
#define CURRENT_TARGET_BYTE_ORDER \
(WITH_TARGET_BYTE_ORDER != BFD_ENDIAN_UNKNOWN \