x86: make "-msyntax=intel -mnaked-reg" match ".intel_syntax noprefix"
Checks
Commit Message
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.
---
If we wanted to also generalize the bfd_get_symbol_leading_char()
dependency, we'd need to defer processing until at least
tc_init_after_args(), perhaps md_begin().
@@ -2708,6 +2708,16 @@ set_16bit_gcc_code_flag (int new_code_fl
}
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
@@ -15212,9 +15218,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;
@@ -15225,6 +15231,7 @@ md_parse_option (int c, const char *arg)
case OPTION_MNAKED_REG:
allow_naked_reg = 1;
+ register_prefix = "";
break;
case OPTION_MSSE2AVX:
@@ -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"
@@ -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 .*
@@ -1,2 +1,2 @@
.*: Assembler messages:
-.*:155: Warning: redundant segment overrides
+.*:157: Warning: redundant segment overrides
@@ -1,4 +1,6 @@
+ .ifdef USE_DIRECTIVE
.intel_syntax noprefix
+ .endif
.text
start:
@@ -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