public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Commit: elfxx-loongarch64.c: Fix printf formatting issues.
@ 2023-05-31  9:21 Nick Clifton
  0 siblings, 0 replies; only message in thread
From: Nick Clifton @ 2023-05-31  9:21 UTC (permalink / raw)
  To: binutils

Hi Guys,

  I am applying the patch below to add some casts to the
  elfxx-loongarch64.c file where it prints vma values as
  if they were longs.  Whilst this usually works, on a
  32-bit host (or a 64-bit host, compiling in 32-bit mode)
  it produces a compile-time warning about the bfd_vma type
  not fiting the %lx format specifier.

Cheers
  Nick

diff --git a/bfd/elfxx-loongarch.c b/bfd/elfxx-loongarch.c
index 9cfbef1431f..ac644fff2f6 100644
--- a/bfd/elfxx-loongarch.c
+++ b/bfd/elfxx-loongarch.c
@@ -1669,7 +1669,7 @@ reloc_bits_pcrel20_s2 (bfd *abfd, reloc_howto_type *howto, bfd_vma *fix_val)
       && (val & ((((bfd_signed_vma) 1) << howto->rightshift) - 1)))
     {
       (*_bfd_error_handler) (_("%pB: relocation %s right shift %d error 0x%lx"),
-			     abfd, howto->name, howto->rightshift, val);
+			     abfd, howto->name, howto->rightshift, (long) val);
       bfd_set_error (bfd_error_bad_value);
       return false;
     }
@@ -1679,7 +1679,7 @@ reloc_bits_pcrel20_s2 (bfd *abfd, reloc_howto_type *howto, bfd_vma *fix_val)
   if ((val & ~mask) && ((val & ~mask) != ~mask))
     {
       (*_bfd_error_handler) (_("%pB: relocation %s overflow 0x%lx"),
-			     abfd, howto->name, val);
+			     abfd, howto->name, (long) val);
       bfd_set_error (bfd_error_bad_value);
       return false;
     }
@@ -1715,7 +1715,7 @@ reloc_bits_b16 (bfd *abfd, reloc_howto_type *howto, bfd_vma *fix_val)
   if ((val & ~mask) && ((val & ~mask) != ~mask))
     {
       (*_bfd_error_handler) (_("%pB: relocation %s overflow 0x%lx"),
-			     abfd, howto->name, val);
+			     abfd, howto->name, (long) val);
       bfd_set_error (bfd_error_bad_value);
       return false;
     }
@@ -1750,7 +1750,7 @@ reloc_bits_b21 (bfd *abfd, reloc_howto_type *howto, bfd_vma *fix_val)
   if ((val & ~mask) && ((val & ~mask) != ~mask))
     {
       (*_bfd_error_handler) (_("%pB: relocation %s overflow 0x%lx"),
-			     abfd, howto->name, val);
+			     abfd, howto->name, (long) val);
       bfd_set_error (bfd_error_bad_value);
       return false;
     }
@@ -1787,7 +1787,7 @@ reloc_bits_b26 (bfd *abfd, reloc_howto_type *howto, bfd_vma *fix_val)
   if ((val & ~mask) && ((val & ~mask) != ~mask))
     {
       (*_bfd_error_handler) (_("%pB: relocation %s overflow 0x%lx"),
-			     abfd, howto->name, val);
+			     abfd, howto->name, (long) val);
       bfd_set_error (bfd_error_bad_value);
       return false;
     }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-05-31  9:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-31  9:21 Commit: elfxx-loongarch64.c: Fix printf formatting issues Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).