]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
x86: make offset_in_range()'s warning contents useful (again)
authorJan Beulich <jbeulich@suse.com>
Tue, 15 Jun 2021 05:58:57 +0000 (07:58 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 15 Jun 2021 05:58:57 +0000 (07:58 +0200)
In case there is something which gets shortened (perhaps only on a BFD64
build targeting a 32-bit binary), seeing the full original value is
often helpful to understand what's actually going wrong. Of course for
non-64-bit binaries we better wouldn't be seeing such warnings at all,
as they're often indicative of a behavioral difference between BFD64 and
!BFD64 builds.

Prior to "gas: drop sprint_value()", which introduced the use of
bfd_sprintf_vma(), the output had other shortcomings.

gas/ChangeLog
gas/config/tc-i386.c

index 8a3684a756fcc7709197a9e07c79f03dd11a268d..97bb57bd4777719d0a30e92bbc5051f1a2e7f5d2 100644 (file)
@@ -1,3 +1,8 @@
+2021-06-15  Jan Beulich  <jbeulich@suse.com>
+
+       * config/tc-i386.c (offset_in_range): Replace uses of
+       bfd_sprintf_vma.
+
 2021-06-15  Jan Beulich  <jbeulich@suse.com>
 
        * config/tc-i386.c (offset_in_range): Adjust conditional.
index c9bcccfe9f79e4d281725f460b513a29dcc45b07..da4998caaf595d0fb16014b2b88e7da0081bc9eb 100644 (file)
@@ -2564,13 +2564,9 @@ offset_in_range (offsetT val, int size)
     }
 
   if ((val & ~mask) != 0 && (-val & ~mask) != 0)
-    {
-      char buf1[40], buf2[40];
+    as_warn (_("%"BFD_VMA_FMT"x shortened to %"BFD_VMA_FMT"x"),
+             val, val & mask);
 
-      bfd_sprintf_vma (stdoutput, buf1, val);
-      bfd_sprintf_vma (stdoutput, buf2, val & mask);
-      as_warn (_("%s shortened to %s"), buf1, buf2);
-    }
   return val & mask;
 }