aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2024-01-26 10:32:37 +0100
committerJan Beulich <jbeulich@suse.com>2024-01-26 10:32:37 +0100
commit213f15cf1b2d29e0e6f1467c0df05c8cb97d9d6e (patch)
tree7dc7169fb2fe12fa2feb096b4a1b1b5b164cd9f0 /gas
parent0ebcbb1bd03c4fde91b032b50ec9c3a8f376b8be (diff)
downloadgdb-213f15cf1b2d29e0e6f1467c0df05c8cb97d9d6e.zip
gdb-213f15cf1b2d29e0e6f1467c0df05c8cb97d9d6e.tar.gz
gdb-213f15cf1b2d29e0e6f1467c0df05c8cb97d9d6e.tar.bz2
x86: make "-msyntax=intel -mnaked-reg" match ".intel_syntax noprefix"
Adjustments made for the directive (by set_intel_syntax()) need also making for the command line option. Break out respective code into a new helper function, to also be invoked during command line processing. Further also set register_prefix when processing -mnaked-reg.
Diffstat (limited to 'gas')
-rw-r--r--gas/config/tc-i386.c23
-rw-r--r--gas/testsuite/gas/i386/i386.exp1
-rw-r--r--gas/testsuite/gas/i386/intelok.d4
-rw-r--r--gas/testsuite/gas/i386/intelok.e2
-rw-r--r--gas/testsuite/gas/i386/intelok.s2
-rw-r--r--gas/testsuite/gas/i386/intelok2.d6
6 files changed, 27 insertions, 11 deletions
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 3d3d4a3..3c64057 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -2708,6 +2708,16 @@ set_16bit_gcc_code_flag (int new_code_flag)
}
static void
+_set_intel_syntax (int syntax_flag)
+{
+ intel_syntax = syntax_flag;
+
+ expr_set_rank (O_full_ptr, syntax_flag ? 10 : 0);
+
+ register_prefix = allow_naked_reg ? "" : "%";
+}
+
+static void
set_intel_syntax (int syntax_flag)
{
/* Find out if register prefixing is specified. */
@@ -2729,17 +2739,13 @@ set_intel_syntax (int syntax_flag)
}
demand_empty_rest_of_line ();
- intel_syntax = syntax_flag;
-
if (ask_naked_reg == 0)
- allow_naked_reg = (intel_syntax
+ allow_naked_reg = (syntax_flag
&& (bfd_get_symbol_leading_char (stdoutput) != '\0'));
else
allow_naked_reg = (ask_naked_reg < 0);
- expr_set_rank (O_full_ptr, syntax_flag ? 10 : 0);
-
- register_prefix = allow_naked_reg ? "" : "%";
+ _set_intel_syntax (syntax_flag);
}
static void
@@ -16307,9 +16313,9 @@ md_parse_option (int c, const char *arg)
case OPTION_MSYNTAX:
if (strcasecmp (arg, "att") == 0)
- intel_syntax = 0;
+ _set_intel_syntax (0);
else if (strcasecmp (arg, "intel") == 0)
- intel_syntax = 1;
+ _set_intel_syntax (1);
else
as_fatal (_("invalid -msyntax= option: `%s'"), arg);
break;
@@ -16320,6 +16326,7 @@ md_parse_option (int c, const char *arg)
case OPTION_MNAKED_REG:
allow_naked_reg = 1;
+ register_prefix = "";
break;
case OPTION_MSSE2AVX:
diff --git a/gas/testsuite/gas/i386/i386.exp b/gas/testsuite/gas/i386/i386.exp
index f0c03ce..46689a8 100644
--- a/gas/testsuite/gas/i386/i386.exp
+++ b/gas/testsuite/gas/i386/i386.exp
@@ -66,6 +66,7 @@ if [gas_32_check] then {
run_dump_test "intel16"
run_list_test "intelbad" ""
run_dump_test "intelok"
+ run_dump_test "intelok2"
run_dump_test "prefix"
run_list_test "prefix32" "-al"
run_dump_test "insn-32"
diff --git a/gas/testsuite/gas/i386/intelok.d b/gas/testsuite/gas/i386/intelok.d
index b1bb6f1..e4f1c87 100644
--- a/gas/testsuite/gas/i386/intelok.d
+++ b/gas/testsuite/gas/i386/intelok.d
@@ -1,6 +1,6 @@
-#as: -J --divide
+#as: -J --divide --defsym USE_DIRECTIVE=1
#objdump: -dwMintel
-#name: i386 intel-ok
+#name: i386 intel-ok (directive)
#warning_output: intelok.e
.*: +file format .*
diff --git a/gas/testsuite/gas/i386/intelok.e b/gas/testsuite/gas/i386/intelok.e
index fa08182..d8c0a29 100644
--- a/gas/testsuite/gas/i386/intelok.e
+++ b/gas/testsuite/gas/i386/intelok.e
@@ -1,2 +1,2 @@
.*: Assembler messages:
-.*:155: Warning: redundant segment overrides
+.*:157: Warning: redundant segment overrides
diff --git a/gas/testsuite/gas/i386/intelok.s b/gas/testsuite/gas/i386/intelok.s
index abd98b4..ff7e2df 100644
--- a/gas/testsuite/gas/i386/intelok.s
+++ b/gas/testsuite/gas/i386/intelok.s
@@ -1,4 +1,6 @@
+ .ifdef USE_DIRECTIVE
.intel_syntax noprefix
+ .endif
.text
start:
diff --git a/gas/testsuite/gas/i386/intelok2.d b/gas/testsuite/gas/i386/intelok2.d
new file mode 100644
index 0000000..203220f
--- /dev/null
+++ b/gas/testsuite/gas/i386/intelok2.d
@@ -0,0 +1,6 @@
+#as: -J --divide -msyntax=intel -mnaked-reg
+#objdump: -dwMintel
+#name: i386 intel-ok (cmdline option)
+#source: intelok.s
+#dump: intelok.d
+#warning_output: intelok.e