[PATCH] arm: rework fix for PR gas/15273
Richard Earnshaw
rearnsha@arm.com
Mon Sep 1 16:15:50 GMT 2025
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 | 4 ++--
gas/testsuite/gas/arm/armv8-ar-bad.l | 10 +++++-----
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index 9b557d97f11..a58949f10ef 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -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);
diff --git a/gas/testsuite/gas/arm/armv8-ar-bad.l b/gas/testsuite/gas/arm/armv8-ar-bad.l
index c7ed4171231..57e375c9913 100644
--- a/gas/testsuite/gas/arm/armv8-ar-bad.l
+++ b/gas/testsuite/gas/arm/armv8-ar-bad.l
@@ -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'
--
2.43.0
More information about the Binutils
mailing list