]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
arm: rework fix for PR gas/15273
authorRichard Earnshaw <rearnsha@arm.com>
Mon, 1 Sep 2025 15:52:54 +0000 (16:52 +0100)
committerRichard Earnshaw <rearnsha@arm.com>
Tue, 2 Sep 2025 15:12:12 +0000 (16:12 +0100)
PR gas/15273

The apparent intent of the original code added in
https://sourceware.org/pipermail/binutils/2012-August/078044.html was
to emit an error message if the instruction was obsolete and only to
emit a deprecation warning if an error hadn't already been emitted.
However, when the insn has not yet been obsoleted, the code would
generate a warning with a (null) message body if the selected CPU was
'any'.

The previous fix for this bug was to remove the support for the
obsoletion message entirely, which was probably the wrong approach.  A
better fix is to only call check_obsolete if obs_msg is non-null; we
can use this as a proxy for the instruction not being obsolete on any
architecture.

While we are here, fix an incorrect capitalization in the deprecation
message ('This' to 'this').

gas/config/tc-arm.c
gas/testsuite/gas/arm/armv8-ar-bad.l

index 9b557d97f11b968c18e55226fb1a962f8672b7e7..a58949f10ef9cba326fa39af989ed14cee7b4b5a 100644 (file)
@@ -9455,7 +9455,7 @@ struct deprecated_coproc_regs_s
 };
 
 #define DEPR_ACCESS_V8 \
-  N_("This coprocessor register access is deprecated in ARMv8")
+  N_("this coprocessor register access is deprecated in ARMv8")
 
 /* Table of all deprecated coprocessor registers.  */
 static struct deprecated_coproc_regs_s deprecated_coproc_regs[] =
@@ -9517,7 +9517,7 @@ do_co_reg (void)
            && inst.operands[4].reg == r->crm
            && inst.operands[5].imm == r->opc2)
          {
-           if (! ARM_CPU_IS_ANY (cpu_variant)
+           if (!(r->obs_msg && check_obsolete (&r->obsoleted, r->obs_msg))
                && warn_on_deprecated
                && ARM_CPU_HAS_FEATURE (cpu_variant, r->deprecated))
              as_tsktsk ("%s", r->dep_msg);
index c7ed41712315146546b65b95f064e21b94cc4571..57e375c99134662bd2f24c39b65c90935f10b37b 100644 (file)
@@ -1,10 +1,10 @@
 .*: Assembler messages:
 .*:6: Error: swp{b} use is obsoleted for ARMv8 and later
-.*:9: Warning: This coprocessor register access is deprecated in ARMv8
-.*:10: Warning: This coprocessor register access is deprecated in ARMv8
-.*:11: Warning: This coprocessor register access is deprecated in ARMv8
-.*:12: Warning: This coprocessor register access is deprecated in ARMv8
-.*:13: Warning: This coprocessor register access is deprecated in ARMv8
+.*:9: Warning: this coprocessor register access is deprecated in ARMv8
+.*:10: Warning: this coprocessor register access is deprecated in ARMv8
+.*:11: Warning: this coprocessor register access is deprecated in ARMv8
+.*:12: Warning: this coprocessor register access is deprecated in ARMv8
+.*:13: Warning: this coprocessor register access is deprecated in ARMv8
 .*:16: Warning: setend use is deprecated for ARMv8
 .*:19: Warning: setend use is deprecated for ARMv8
 .*:23: Error: immediate value out of range -- `hlt 0x10000'