aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2022-08-18 09:20:05 +0200
committerJan Beulich <jbeulich@suse.com>2022-08-18 09:20:05 +0200
commitd59a54c2c350ba65c65dde5e2a8976918ac59046 (patch)
tree5b76f58c98d0a1782209363c74830e87fbbb685f /gas
parentb4d65f2d0b445fee54a2eefcec25336b4238ab82 (diff)
downloadgdb-d59a54c2c350ba65c65dde5e2a8976918ac59046.zip
gdb-d59a54c2c350ba65c65dde5e2a8976918ac59046.tar.gz
gdb-d59a54c2c350ba65c65dde5e2a8976918ac59046.tar.bz2
x86: move / quiesce pre-386 non-16-bit warning
Emitting this warning for every insn, including ones having actual errors, is annoying. Introduce a boolean variable to emit the warning just once on the first insn after .arch may have changed the things, and move the warning to output_insn(). (I didn't want to go as far as checking whether the .arch actually turned off the i386 bit, but doing so would be an option.)
Diffstat (limited to 'gas')
-rw-r--r--gas/config/tc-i386.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 3c0b73f..6598b0e 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -765,6 +765,9 @@ int optimize_align_code = 1;
/* Non-zero to quieten some warnings. */
static int quiet_warnings = 0;
+/* Guard to avoid repeated warnings about non-16-bit code on 16-bit CPUs. */
+static bool pre_386_16bit_warned;
+
/* CPU name. */
static const char *cpu_arch_name = NULL;
static char *cpu_sub_arch_name = NULL;
@@ -2809,6 +2812,7 @@ set_cpu_arch (int dummy ATTRIBUTE_UNUSED)
cpu_arch_tune = cpu_arch_isa;
cpu_arch_tune_flags = cpu_arch_isa_flags;
}
+ pre_386_16bit_warned = false;
break;
}
@@ -5486,12 +5490,7 @@ parse_insn (char *line, char *mnemonic)
{
supported |= cpu_flags_match (t);
if (supported == CPU_FLAGS_PERFECT_MATCH)
- {
- if (!cpu_arch_flags.bitfield.cpui386 && (flag_code != CODE_16BIT))
- as_warn (_("use .code16 to ensure correct addressing mode"));
-
- return l;
- }
+ return l;
}
if (!(supported & CPU_FLAGS_64BIT_MATCH))
@@ -9541,6 +9540,13 @@ output_insn (void)
fragP->tc_frag_data.max_bytes = max_branch_padding_size;
}
+ if (!cpu_arch_flags.bitfield.cpui386 && (flag_code != CODE_16BIT)
+ && !pre_386_16bit_warned)
+ {
+ as_warn (_("use .code16 to ensure correct addressing mode"));
+ pre_386_16bit_warned = true;
+ }
+
/* Output jumps. */
if (i.tm.opcode_modifier.jump == JUMP)
output_branch ();