summaryrefslogtreecommitdiff
path: root/sim/common/sim-options.c
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>1997-09-22 00:24:46 +0000
committerAndrew Cagney <cagney@redhat.com>1997-09-22 00:24:46 +0000
commitb45caf050caea8283ab17a2f6cc76a2208763132 (patch)
treefab0ce895fbabaa22590490edea9826bc7219ce4 /sim/common/sim-options.c
parent2c778bc53aafc06ac2b7705314efcebb5940ebab (diff)
downloadbinutils-gdb-b45caf050caea8283ab17a2f6cc76a2208763132.tar.gz
Add support for --enable-sim-alignment to simulator common aclocal.m4
Add support for --alignment={strict,nonstrict,forced} to simulator common run-time options. For v850 use, make the default NONSTRICT_ALIGNMENT.
Diffstat (limited to 'sim/common/sim-options.c')
-rw-r--r--sim/common/sim-options.c51
1 files changed, 50 insertions, 1 deletions
diff --git a/sim/common/sim-options.c b/sim/common/sim-options.c
index 96e1dba4563..6d4f3daacd0 100644
--- a/sim/common/sim-options.c
+++ b/sim/common/sim-options.c
@@ -89,6 +89,7 @@ static DECLARE_OPTION_HANDLER (standard_option_handler);
#define OPTION_ARCHITECTURE (OPTION_START + 3)
#define OPTION_TARGET (OPTION_START + 4)
#define OPTION_ARCHITECTURE_INFO (OPTION_START + 5)
+#define OPTION_ALIGNMENT (OPTION_START + 6)
static const OPTION standard_options[] =
{
@@ -102,6 +103,10 @@ static const OPTION standard_options[] =
standard_option_handler },
#endif
+ { {"alignment", required_argument, NULL, OPTION_ALIGNMENT},
+ '\0', "strict|nonstrict|forced", "Set memory access alignment",
+ standard_option_handler },
+
{ {"debug", no_argument, NULL, 'D'},
'D', NULL, "Print debugging messages",
standard_option_handler },
@@ -194,6 +199,50 @@ standard_option_handler (sd, opt, arg, is_command)
break;
#endif
+ case OPTION_ALIGNMENT:
+ if (strcmp (arg, "strict") == 0)
+ {
+ if (WITH_ALIGNMENT == 0 || WITH_ALIGNMENT == STRICT_ALIGNMENT)
+ {
+ current_alignment = STRICT_ALIGNMENT;
+ break;
+ }
+ }
+ else if (strcmp (arg, "nonstrict") == 0)
+ {
+ if (WITH_ALIGNMENT == 0 || WITH_ALIGNMENT == NONSTRICT_ALIGNMENT)
+ {
+ current_alignment = NONSTRICT_ALIGNMENT;
+ break;
+ }
+ }
+ else if (strcmp (arg, "forced") == 0)
+ {
+ if (WITH_ALIGNMENT == 0 || WITH_ALIGNMENT == FORCED_ALIGNMENT)
+ {
+ current_alignment = FORCED_ALIGNMENT;
+ break;
+ }
+ }
+ else
+ {
+ sim_io_eprintf (sd, "Invalid alignment specification `%s'\n", arg);
+ return SIM_RC_FAIL;
+ }
+ switch (WITH_ALIGNMENT)
+ {
+ case STRICT_ALIGNMENT:
+ sim_io_eprintf (sd, "Simulator compiled for strict alignment only.\n");
+ break;
+ case NONSTRICT_ALIGNMENT:
+ sim_io_eprintf (sd, "Simulator compiled for nonsitrct alignment only.\n");
+ break;
+ case FORCED_ALIGNMENT:
+ sim_io_eprintf (sd, "Simulator compiled for forced alignment only.\n");
+ break;
+ }
+ return SIM_RC_FAIL;
+
case 'D' :
if (! WITH_DEBUG)
sim_io_eprintf (sd, "Debugging not compiled in, `-D' ignored\n");
@@ -556,7 +605,7 @@ sim_print_help (sd, is_command)
{
const char *chp = opt->doc;
- int doc_width = 80 - indent;
+ unsigned doc_width = 80 - indent;
while (strlen (chp) >= doc_width) /* some slack */
{
const char *end = chp + doc_width - 1;