This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] %L conversions


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=2dcf00ce6c001c42c89e6f6baace708b706994f2

commit 2dcf00ce6c001c42c89e6f6baace708b706994f2
Author: Alan Modra <amodra@gmail.com>
Date:   Mon Feb 19 18:34:15 2018 +1030

    %L conversions
    
    	* bfd-in.h: Include inttypes.h or if not available define
    	PRId64, PRIu64 and PRIx64.
    	* bfd.c (_bfd_doprnt, _bfd_doprnt_scan): Remove support for L
    	modifier to print bfd_vma.
    	* coff-arm.c, * coff-mcore.c, * coff-ppc.c, * coff-rs6000.c,
    	* coff-sh.c, * coff-tic80.c, * coffcode.h, * coffgen.c, * cofflink.c,
    	* compress.c, * dwarf2.c, * elf-m10300.c, * elf.c, * elf32-arc.c,
    	* elf32-arm.c, * elf32-bfin.c, * elf32-cris.c, * elf32-hppa.c,
    	* elf32-i386.c, * elf32-ip2k.c, * elf32-lm32.c, * elf32-m32r.c,
    	* elf32-m68k.c, * elf32-metag.c, * elf32-nds32.c, * elf32-nios2.c,
    	* elf32-ppc.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c,
    	* elf32-score7.c, * elf32-sh.c, * elf32-sh64.c, * elf32-spu.c,
    	* elf32-tic6x.c, * elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c,
    	* elf32-xtensa.c, * elf64-alpha.c, * elf64-hppa.c, * elf64-ia64-vms.c,
    	* elf64-mmix.c, * elf64-s390.c, * elf64-sh64.c, * elf64-x86-64.c,
    	* elfcode.h, * elfcore.h, * elflink.c, * elfnn-aarch64.c,
    	* elfnn-ia64.c, * elfnn-riscv.c, * elfxx-mips.c, * elfxx-sparc.c,
    	* elfxx-tilegx.c, * ieee.c, * ihex.c, * mach-o.c, * merge.c, * mmo.c,
    	* peXXigen.c, * xcofflink.c: Replace use of Lx modifier with PRIx64,
    	and cast input to uint64_t, and similarly for Ld and Lu.
    	* bfd-in2.h: Regenerate.

Diff:
---
 bfd/ChangeLog        |  24 +++++++++++++
 bfd/bfd-in.h         |  18 ++++++++++
 bfd/bfd-in2.h        |  18 ++++++++++
 bfd/bfd.c            |  26 +-------------
 bfd/coff-arm.c       |   4 +--
 bfd/coff-mcore.c     |   5 +--
 bfd/coff-ppc.c       |  13 +++----
 bfd/coff-rs6000.c    |   4 +--
 bfd/coff-sh.c        |  37 +++++++++----------
 bfd/coff-tic80.c     |   4 +--
 bfd/coffcode.h       |   4 +--
 bfd/coffgen.c        |  12 ++++---
 bfd/cofflink.c       |   4 +--
 bfd/compress.c       |   4 +--
 bfd/dwarf2.c         |  22 ++++++------
 bfd/elf-m10300.c     |   5 +--
 bfd/elf.c            |  24 +++++++------
 bfd/elf32-arc.c      |  18 +++++-----
 bfd/elf32-arm.c      |  91 ++++++++++++++++++++++++++++------------------
 bfd/elf32-bfin.c     |  17 +++++----
 bfd/elf32-cris.c     |  24 ++++++-------
 bfd/elf32-hppa.c     |  19 +++++-----
 bfd/elf32-i386.c     |  14 ++++----
 bfd/elf32-ip2k.c     |  16 +++++----
 bfd/elf32-lm32.c     |   9 +++--
 bfd/elf32-m32r.c     |   4 +--
 bfd/elf32-m68k.c     |  21 ++++++-----
 bfd/elf32-metag.c    |   6 ++--
 bfd/elf32-nds32.c    |  48 +++++++++++++------------
 bfd/elf32-nios2.c    |   4 +--
 bfd/elf32-ppc.c      |  10 +++---
 bfd/elf32-rx.c       |   7 ++--
 bfd/elf32-s390.c     |  13 +++----
 bfd/elf32-score.c    |   4 +--
 bfd/elf32-score7.c   |   4 +--
 bfd/elf32-sh.c       | 100 ++++++++++++++++++++++++++++-----------------------
 bfd/elf32-sh64.c     |   5 +--
 bfd/elf32-spu.c      |   5 +--
 bfd/elf32-tic6x.c    |  12 +++----
 bfd/elf32-tilepro.c  |   5 +--
 bfd/elf32-v850.c     |  32 ++++++++---------
 bfd/elf32-vax.c      |  18 +++++-----
 bfd/elf32-xtensa.c   |  39 +++++++++++---------
 bfd/elf64-alpha.c    |  10 +++---
 bfd/elf64-hppa.c     |   8 ++---
 bfd/elf64-ia64-vms.c |  26 +++++++-------
 bfd/elf64-mmix.c     |  13 +++----
 bfd/elf64-s390.c     |  13 +++----
 bfd/elf64-sh64.c     |  17 +++++----
 bfd/elf64-x86-64.c   |  26 +++++++-------
 bfd/elfcode.h        |   5 +--
 bfd/elfcore.h        |   4 +--
 bfd/elflink.c        |  29 +++++++--------
 bfd/elfnn-aarch64.c  |  21 ++++++-----
 bfd/elfnn-ia64.c     |  21 +++++------
 bfd/elfnn-riscv.c    |   5 +--
 bfd/elfxx-mips.c     |  28 ++++++++-------
 bfd/elfxx-sparc.c    |   5 +--
 bfd/elfxx-tilegx.c   |   5 +--
 bfd/ieee.c           |   4 +--
 bfd/ihex.c           |   5 +--
 bfd/mach-o.c         |   5 +--
 bfd/merge.c          |   4 +--
 bfd/mmo.c            |  12 +++----
 bfd/peXXigen.c       |   8 +++--
 bfd/xcofflink.c      |  17 ++++-----
 66 files changed, 603 insertions(+), 461 deletions(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 2a6eeb6..349f212 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,29 @@
 2018-02-19  Alan Modra  <amodra@gmail.com>
 
+	* bfd-in.h: Include inttypes.h or if not available define
+	PRId64, PRIu64 and PRIx64.
+	* bfd.c (_bfd_doprnt, _bfd_doprnt_scan): Remove support for L
+	modifier to print bfd_vma.
+	* coff-arm.c, * coff-mcore.c, * coff-ppc.c, * coff-rs6000.c,
+	* coff-sh.c, * coff-tic80.c, * coffcode.h, * coffgen.c, * cofflink.c,
+	* compress.c, * dwarf2.c, * elf-m10300.c, * elf.c, * elf32-arc.c,
+	* elf32-arm.c, * elf32-bfin.c, * elf32-cris.c, * elf32-hppa.c,
+	* elf32-i386.c, * elf32-ip2k.c, * elf32-lm32.c, * elf32-m32r.c,
+	* elf32-m68k.c, * elf32-metag.c, * elf32-nds32.c, * elf32-nios2.c,
+	* elf32-ppc.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c,
+	* elf32-score7.c, * elf32-sh.c, * elf32-sh64.c, * elf32-spu.c,
+	* elf32-tic6x.c, * elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c,
+	* elf32-xtensa.c, * elf64-alpha.c, * elf64-hppa.c, * elf64-ia64-vms.c,
+	* elf64-mmix.c, * elf64-s390.c, * elf64-sh64.c, * elf64-x86-64.c,
+	* elfcode.h, * elfcore.h, * elflink.c, * elfnn-aarch64.c,
+	* elfnn-ia64.c, * elfnn-riscv.c, * elfxx-mips.c, * elfxx-sparc.c,
+	* elfxx-tilegx.c, * ieee.c, * ihex.c, * mach-o.c, * merge.c, * mmo.c,
+	* peXXigen.c, * xcofflink.c: Replace use of Lx modifier with PRIx64,
+	and cast input to uint64_t, and similarly for Ld and Lu.
+	* bfd-in2.h: Regenerate.
+
+2018-02-19  Alan Modra  <amodra@gmail.com>
+
 	* elf32-arm.c, * elf32-hppa.c, * elf32-lm32.c, * elf32-m32r.c,
 	* elf32-metag.c, * elf32-nds32.c, * elf32-or1k.c, * elf32-ppc.c,
 	* elf32-s390.c, * elf32-sh.c, * elf32-tic6x.c, * elf32-tilepro.c,
diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h
index 2195ce3..a06cd74 100644
--- a/bfd/bfd-in.h
+++ b/bfd/bfd-in.h
@@ -91,6 +91,24 @@ typedef BFD_HOST_64_BIT bfd_int64_t;
 typedef BFD_HOST_U_64_BIT bfd_uint64_t;
 #endif
 
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if BFD_HOST_64BIT_LONG
+#  define BFD_PRI64 "l"
+# elif defined (__MSVCRT__)
+#  define BFD_PRI64 "I64"
+# else
+#  define BFD_PRI64 "ll"
+# endif
+# undef PRId64
+# define PRId64 BFD_PRI64 "d"
+# undef PRIu64
+# define PRIu64 BFD_PRI64 "u"
+# undef PRIx64
+# define PRIx64 BFD_PRI64 "x"
+#endif
+
 #if BFD_ARCH_SIZE >= 64
 #define BFD64
 #endif
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 42991e7..e083135 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -98,6 +98,24 @@ typedef BFD_HOST_64_BIT bfd_int64_t;
 typedef BFD_HOST_U_64_BIT bfd_uint64_t;
 #endif
 
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if BFD_HOST_64BIT_LONG
+#  define BFD_PRI64 "l"
+# elif defined (__MSVCRT__)
+#  define BFD_PRI64 "I64"
+# else
+#  define BFD_PRI64 "ll"
+# endif
+# undef PRId64
+# define PRId64 BFD_PRI64 "d"
+# undef PRIu64
+# define PRIu64 BFD_PRI64 "u"
+# undef PRIx64
+# define PRIx64 BFD_PRI64 "x"
+#endif
+
 #if BFD_ARCH_SIZE >= 64
 #define BFD64
 #endif
diff --git a/bfd/bfd.c b/bfd/bfd.c
index 88f0862..7c9ab25 100644
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -649,10 +649,7 @@ union _bfd_doprnt_args
 };
 
 /* This macro and _bfd_doprnt taken from libiberty _doprnt.c, tidied a
-   little and extended to handle '%pA', '%pB' and positional parameters.
-   'L' as a modifer for integer formats is used for bfd_vma and
-   bfd_size_type args, which vary in size depending on BFD
-   configuration.  */
+   little and extended to handle '%pA', '%pB' and positional parameters.  */
 
 #define PRINT_TYPE(TYPE, FIELD) \
   do								\
@@ -800,21 +797,6 @@ _bfd_doprnt (FILE *stream, const char *format, union _bfd_doprnt_args *args)
 		  PRINT_TYPE (int, i);
 		else
 		  {
-		    /* L modifier for bfd_vma or bfd_size_type may be
-		       either long long or long.  */
-		    if (ptr[-2] == 'L')
-		      {
-			sptr[-2] = 'l';
-			if (BFD_ARCH_SIZE < 64 || BFD_HOST_64BIT_LONG)
-			  wide_width = 1;
-			else
-			  {
-			    sptr[-1] = 'l';
-			    *sptr++ = ptr[-1];
-			    *sptr = '\0';
-			  }
-		      }
-
 		    switch (wide_width)
 		      {
 		      case 0:
@@ -1051,12 +1033,6 @@ _bfd_doprnt_scan (const char *format, union _bfd_doprnt_args *args)
 		  arg_type = Int;
 		else
 		  {
-		    if (ptr[-2] == 'L')
-		      {
-			if (BFD_ARCH_SIZE < 64 || BFD_HOST_64BIT_LONG)
-			  wide_width = 1;
-		      }
-
 		    switch (wide_width)
 		      {
 		      case 0:
diff --git a/bfd/coff-arm.c b/bfd/coff-arm.c
index c81b433..50c62ca 100644
--- a/bfd/coff-arm.c
+++ b/bfd/coff-arm.c
@@ -1748,8 +1748,8 @@ coff_arm_relocate_section (bfd *output_bfd,
 	case bfd_reloc_outofrange:
 	  _bfd_error_handler
 	    /* xgettext:c-format */
-	    (_("%pB: bad reloc address %#Lx in section `%pA'"),
-	     input_bfd, rel->r_vaddr, input_section);
+	    (_("%pB: bad reloc address %#" PRIx64 " in section `%pA'"),
+	     input_bfd, (uint64_t) rel->r_vaddr, input_section);
 	  return FALSE;
 	case bfd_reloc_overflow:
 	  {
diff --git a/bfd/coff-mcore.c b/bfd/coff-mcore.c
index 5e3b7d4..fccd4ad 100644
--- a/bfd/coff-mcore.c
+++ b/bfd/coff-mcore.c
@@ -479,9 +479,10 @@ coff_mcore_relocate_section (bfd * output_bfd,
 	  _bfd_error_handler
 	    /* xgettext: c-format */
 	    (_("Warning: unsupported reloc %s <file %pB, section %pA>\n"
-	       "sym %ld (%s), r_vaddr %Ld (%#Lx)"),
+	       "sym %ld (%s), r_vaddr %" PRId64 " (%#" PRIx64 ")"),
 	     howto->name, input_bfd, input_section,
-	     rel->r_symndx, my_name, rel->r_vaddr, rel->r_vaddr);
+	     rel->r_symndx, my_name, (int64_t) rel->r_vaddr,
+	     (uint64_t) rel->r_vaddr);
 	  break;
 
 	case IMAGE_REL_MCORE_PCREL_IMM8BY4:
diff --git a/bfd/coff-ppc.c b/bfd/coff-ppc.c
index 8cdfd80..a27b8b6 100644
--- a/bfd/coff-ppc.c
+++ b/bfd/coff-ppc.c
@@ -1131,9 +1131,9 @@ coff_ppc_relocate_section (bfd *output_bfd,
 		      {
 			_bfd_error_handler
 			  /* xgettext: c-format */
-			  (_("%pB: Relocation for %s of %#Lx exceeds "
+			  (_("%pB: Relocation for %s of %#" PRIx64 " exceeds "
 			     "Toc size limit"),
-			   input_bfd, name, our_toc_offset);
+			   input_bfd, name, (uint64_t) our_toc_offset);
 			bfd_set_error (bfd_error_bad_value);
 			return FALSE;
 		      }
@@ -1185,8 +1185,8 @@ coff_ppc_relocate_section (bfd *output_bfd,
 	      {
 		_bfd_error_handler
 		  /* xgettext: c-format */
-		  (_("%pB: Relocation exceeds allocated TOC (%#Lx)"),
-		   input_bfd, toc_section->size);
+		  (_("%pB: Relocation exceeds allocated TOC (%#" PRIx64 ")"),
+		   input_bfd, (uint64_t) toc_section->size);
 		bfd_set_error (bfd_error_bad_value);
 		return FALSE;
 	      }
@@ -1241,9 +1241,10 @@ coff_ppc_relocate_section (bfd *output_bfd,
 	    _bfd_error_handler
 	      /* xgettext: c-format */
 	      (_("Warning: unsupported reloc %s <file %pB, section %pA>\n"
-		 "sym %ld (%s), r_vaddr %Ld (%#Lx)"),
+		 "sym %ld (%s), r_vaddr %" PRId64 " (%#" PRIx64 ")"),
 	       howto->name, input_bfd, input_section,
-	       rel->r_symndx, my_name, rel->r_vaddr, rel->r_vaddr);
+	       rel->r_symndx, my_name,
+	       (int64_t) rel->r_vaddr, (uint64_t) rel->r_vaddr);
 	  }
 	  break;
 	case IMAGE_REL_PPC_IMGLUE:
diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c
index a28e935..d1253df 100644
--- a/bfd/coff-rs6000.c
+++ b/bfd/coff-rs6000.c
@@ -2856,8 +2856,8 @@ xcoff_reloc_type_toc (bfd *input_bfd,
 	{
 	  _bfd_error_handler
 	    /* xgettext: c-format */
-	    (_("%pB: TOC reloc at %#Lx to symbol `%s' with no TOC entry"),
-	     input_bfd, rel->r_vaddr, h->root.root.string);
+	    (_("%pB: TOC reloc at %#" PRIx64 " to symbol `%s' with no TOC entry"),
+	     input_bfd, (uint64_t) rel->r_vaddr, h->root.root.string);
 	  bfd_set_error (bfd_error_bad_value);
 	  return FALSE;
 	}
diff --git a/bfd/coff-sh.c b/bfd/coff-sh.c
index a7a0ec3..c4ad234 100644
--- a/bfd/coff-sh.c
+++ b/bfd/coff-sh.c
@@ -775,8 +775,9 @@ sh_relax_section (bfd *abfd,
       if (laddr >= sec->size)
 	{
 	  /* xgettext: c-format */
-	  _bfd_error_handler (_("%pB: %#Lx: warning: bad R_SH_USES offset"),
-			      abfd, irel->r_vaddr);
+	  _bfd_error_handler
+	    (_("%pB: %#" PRIx64 ": warning: bad R_SH_USES offset"),
+	     abfd, (uint64_t) irel->r_vaddr);
 	  continue;
 	}
       insn = bfd_get_16 (abfd, contents + laddr);
@@ -786,8 +787,8 @@ sh_relax_section (bfd *abfd,
 	{
 	  _bfd_error_handler
 	    /* xgettext: c-format */
-	    (_("%pB: %#Lx: warning: R_SH_USES points to unrecognized insn %#x"),
-	     abfd, irel->r_vaddr, insn);
+	    (_("%pB: %#" PRIx64 ": warning: R_SH_USES points to unrecognized insn %#x"),
+	     abfd, (uint64_t) irel->r_vaddr, insn);
 	  continue;
 	}
 
@@ -804,8 +805,8 @@ sh_relax_section (bfd *abfd,
 	{
 	  _bfd_error_handler
 	    /* xgettext: c-format */
-	    (_("%pB: %#Lx: warning: bad R_SH_USES load offset"),
-	     abfd, irel->r_vaddr);
+	    (_("%pB: %#" PRIx64 ": warning: bad R_SH_USES load offset"),
+	     abfd, (uint64_t) irel->r_vaddr);
 	  continue;
 	}
 
@@ -829,8 +830,8 @@ sh_relax_section (bfd *abfd,
 	{
 	  _bfd_error_handler
 	    /* xgettext: c-format */
-	    (_("%pB: %#Lx: warning: could not find expected reloc"),
-	     abfd, paddr);
+	    (_("%pB: %#" PRIx64 ": warning: could not find expected reloc"),
+	     abfd, (uint64_t) paddr);
 	  continue;
 	}
 
@@ -846,8 +847,8 @@ sh_relax_section (bfd *abfd,
 	{
 	  _bfd_error_handler
 	    /* xgettext: c-format */
-	    (_("%pB: %#Lx: warning: symbol in unexpected section"),
-	     abfd, paddr);
+	    (_("%pB: %#" PRIx64 ": warning: symbol in unexpected section"),
+	     abfd, (uint64_t) paddr);
 	  continue;
 	}
 
@@ -972,8 +973,8 @@ sh_relax_section (bfd *abfd,
 	{
 	  _bfd_error_handler
 	    /* xgettext: c-format */
-	    (_("%pB: %#Lx: warning: could not find expected COUNT reloc"),
-	     abfd, paddr);
+	    (_("%pB: %#" PRIx64 ": warning: could not find expected COUNT reloc"),
+	     abfd, (uint64_t) paddr);
 	  continue;
 	}
 
@@ -982,8 +983,8 @@ sh_relax_section (bfd *abfd,
       if (irelcount->r_offset == 0)
 	{
 	  /* xgettext: c-format */
-	  _bfd_error_handler (_("%pB: %#Lx: warning: bad count"),
-			      abfd, paddr);
+	  _bfd_error_handler (_("%pB: %#" PRIx64 ": warning: bad count"),
+			      abfd, (uint64_t) paddr);
 	  continue;
 	}
 
@@ -1354,8 +1355,8 @@ sh_relax_delete_bytes (bfd *abfd,
 	    {
 	      _bfd_error_handler
 		/* xgettext: c-format */
-		(_("%pB: %#Lx: fatal: reloc overflow while relaxing"),
-		 abfd, irel->r_vaddr);
+		(_("%pB: %#" PRIx64 ": fatal: reloc overflow while relaxing"),
+		 abfd, (uint64_t) irel->r_vaddr);
 	      bfd_set_error (bfd_error_bad_value);
 	      return FALSE;
 	    }
@@ -2642,8 +2643,8 @@ sh_swap_insns (bfd *      abfd,
 	    {
 	      _bfd_error_handler
 		/* xgettext: c-format */
-		(_("%pB: %#Lx: fatal: reloc overflow while relaxing"),
-		 abfd, irel->r_vaddr);
+		(_("%pB: %#" PRIx64 ": fatal: reloc overflow while relaxing"),
+		 abfd, (uint64_t) irel->r_vaddr);
 	      bfd_set_error (bfd_error_bad_value);
 	      return FALSE;
 	    }
diff --git a/bfd/coff-tic80.c b/bfd/coff-tic80.c
index 2920531..dda34fa 100644
--- a/bfd/coff-tic80.c
+++ b/bfd/coff-tic80.c
@@ -669,8 +669,8 @@ coff_tic80_relocate_section (bfd *output_bfd,
 	case bfd_reloc_outofrange:
 	  _bfd_error_handler
 	    /* xgettext: c-format */
-	    (_("%pB: bad reloc address %#Lx in section `%pA'"),
-	     input_bfd, rel->r_vaddr, input_section);
+	    (_("%pB: bad reloc address %#" PRIx64 " in section `%pA'"),
+	     input_bfd, (uint64_t) rel->r_vaddr, input_section);
 	  return FALSE;
 	case bfd_reloc_overflow:
 	  {
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index f3d061b..0cb1fc8 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -5380,8 +5380,8 @@ coff_slurp_reloc_table (bfd * abfd, sec_ptr asect, asymbol ** symbols)
 	{
 	  _bfd_error_handler
 	    /* xgettext:c-format */
-	    (_("%pB: illegal relocation type %d at address %#Lx"),
-	     abfd, dst.r_type, dst.r_vaddr);
+	    (_("%pB: illegal relocation type %d at address %#" PRIx64),
+	     abfd, dst.r_type, (uint64_t) dst.r_vaddr);
 	  bfd_set_error (bfd_error_bad_value);
 	  return FALSE;
 	}
diff --git a/bfd/coffgen.c b/bfd/coffgen.c
index 7f2d181..3d32968 100644
--- a/bfd/coffgen.c
+++ b/bfd/coffgen.c
@@ -1647,8 +1647,8 @@ _bfd_coff_get_external_symbols (bfd *abfd)
 	  && size > bfd_get_file_size (abfd)))
 
     {
-      _bfd_error_handler (_("%pB: corrupt symbol count: %#Lx"),
-			  abfd, obj_raw_syment_count (abfd));
+      _bfd_error_handler (_("%pB: corrupt symbol count: %#" PRIx64 ""),
+			  abfd, (uint64_t) obj_raw_syment_count (abfd));
       return FALSE;
     }
 
@@ -1656,8 +1656,10 @@ _bfd_coff_get_external_symbols (bfd *abfd)
   if (syms == NULL)
     {
       /* PR 21013: Provide an error message when the alloc fails.  */
-      _bfd_error_handler (_("%pB: not enough memory to allocate space for %#Lx symbols of size %#Lx"),
-			  abfd, obj_raw_syment_count (abfd), symesz);
+      _bfd_error_handler (_("%pB: not enough memory to allocate space "
+			    "for %#" PRIx64 " symbols of size %#" PRIx64),
+			  abfd, (uint64_t) obj_raw_syment_count (abfd),
+			  (uint64_t) symesz);
       return FALSE;
     }
 
@@ -1723,7 +1725,7 @@ _bfd_coff_read_string_table (bfd *abfd)
     {
       _bfd_error_handler
 	/* xgettext: c-format */
-	(_("%pB: bad string table size %Lu"), abfd, strsize);
+	(_("%pB: bad string table size %" PRIu64), abfd, (uint64_t) strsize);
       bfd_set_error (bfd_error_bad_value);
       return NULL;
     }
diff --git a/bfd/cofflink.c b/bfd/cofflink.c
index 2b2a8d6..ce41dde 100644
--- a/bfd/cofflink.c
+++ b/bfd/cofflink.c
@@ -3124,8 +3124,8 @@ _bfd_coff_generic_relocate_section (bfd *output_bfd,
 	case bfd_reloc_outofrange:
 	  _bfd_error_handler
 	    /* xgettext: c-format */
-	    (_("%pB: bad reloc address %#Lx in section `%pA'"),
-	     input_bfd, rel->r_vaddr, input_section);
+	    (_("%pB: bad reloc address %#" PRIx64 " in section `%pA'"),
+	     input_bfd, (uint64_t) rel->r_vaddr, input_section);
 	  return FALSE;
 	case bfd_reloc_overflow:
 	  {
diff --git a/bfd/compress.c b/bfd/compress.c
index 6a3aabb..53e566e 100644
--- a/bfd/compress.c
+++ b/bfd/compress.c
@@ -252,8 +252,8 @@ bfd_get_full_section_contents (bfd *abfd, sec_ptr sec, bfd_byte **ptr)
 	      if (bfd_get_error () == bfd_error_no_memory)
 		_bfd_error_handler
 		  /* xgettext:c-format */
-		  (_("error: %pB(%pA) is too large (%#Lx bytes)"),
-		  abfd, sec, sz);
+		  (_("error: %pB(%pA) is too large (%#" PRIx64 " bytes)"),
+		  abfd, sec, (uint64_t) sz);
 	      return FALSE;
 	    }
 	}
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index c027542..f956188 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -570,8 +570,9 @@ read_section (bfd *	      abfd,
     {
       /* xgettext: c-format */
       _bfd_error_handler (_("Dwarf Error: Offset (%llu)"
-			    " greater than or equal to %s size (%Lu)."),
-			  (long long) offset, section_name, *section_size);
+			    " greater than or equal to %s size (%" PRIu64 ")."),
+			  (long long) offset, section_name,
+			  (uint64_t) *section_size);
       bfd_set_error (bfd_error_bad_value);
       return FALSE;
     }
@@ -1918,8 +1919,9 @@ read_formatted_entries (struct comp_unit *unit, bfd_byte **bufp,
      if we know that we are going to run out of buffer.  */
   if (data_count > (bfd_vma) (buf_end - buf))
     {
-      _bfd_error_handler (_("Dwarf Error: data count (%Lx) larger than buffer size."),
-			  data_count);
+      _bfd_error_handler
+	(_("Dwarf Error: data count (%" PRIx64 ") larger than buffer size."),
+	 (uint64_t) data_count);
       bfd_set_error (bfd_error_bad_value);
       return FALSE;
     }
@@ -1959,8 +1961,8 @@ read_formatted_entries (struct comp_unit *unit, bfd_byte **bufp,
 	      break;
 	    default:
 	      _bfd_error_handler
-		(_("Dwarf Error: Unknown format content type %Lu."),
-		 content_type);
+		(_("Dwarf Error: Unknown format content type %" PRIu64 "."),
+		 (uint64_t) content_type);
 	      bfd_set_error (bfd_error_bad_value);
 	      return FALSE;
 	    }
@@ -2039,8 +2041,8 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash)
   if (stash->dwarf_line_size < 16)
     {
       _bfd_error_handler
-	(_("Dwarf Error: Line info section is too small (%Ld)"),
-	 stash->dwarf_line_size);
+	(_("Dwarf Error: Line info section is too small (%" PRId64 ")"),
+	 (int64_t) stash->dwarf_line_size);
       bfd_set_error (bfd_error_bad_value);
       return NULL;
     }
@@ -2069,9 +2071,9 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash)
     {
       _bfd_error_handler
 	/* xgettext: c-format */
-	(_("Dwarf Error: Line info data is bigger (%#Lx)"
+	(_("Dwarf Error: Line info data is bigger (%#" PRIx64 ")"
 	   " than the space remaining in the section (%#lx)"),
-	 lh.total_length, (unsigned long) (line_end - line_ptr));
+	 (uint64_t) lh.total_length, (unsigned long) (line_end - line_ptr));
       bfd_set_error (bfd_error_bad_value);
       return NULL;
     }
diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c
index efb0003..795944e 100644
--- a/bfd/elf-m10300.c
+++ b/bfd/elf-m10300.c
@@ -2090,10 +2090,11 @@ mn10300_elf_relocate_section (bfd *output_bfd,
 
 	    _bfd_error_handler
 	      /* xgettext:c-format */
-	      (_("%pB(%pA+%#Lx): unresolvable %s relocation against symbol `%s'"),
+	      (_("%pB(%pA+%#" PRIx64 "): "
+		 "unresolvable %s relocation against symbol `%s'"),
 	       input_bfd,
 	       input_section,
-	       rel->r_offset,
+	       (uint64_t) rel->r_offset,
 	       howto->name,
 	       h->root.root.root.string);
 	}
diff --git a/bfd/elf.c b/bfd/elf.c
index 489e5e2..2fb8377 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -355,8 +355,8 @@ bfd_elf_string_from_elf_section (bfd *abfd,
       unsigned int shstrndx = elf_elfheader(abfd)->e_shstrndx;
       _bfd_error_handler
 	/* xgettext:c-format */
-	(_("%pB: invalid string offset %u >= %Lu for section `%s'"),
-	 abfd, strindex, hdr->sh_size,
+	(_("%pB: invalid string offset %u >= %" PRIu64 " for section `%s'"),
+	 abfd, strindex, (uint64_t) hdr->sh_size,
 	 (shindex == shstrndx && strindex == hdr->sh_name
 	  ? ".shstrtab"
 	  : bfd_elf_string_from_elf_section (abfd, shstrndx, hdr->sh_name)));
@@ -659,7 +659,8 @@ setup_group (bfd *abfd, Elf_Internal_Shdr *hdr, asection *newsect)
 		      _bfd_error_handler
 			/* xgettext:c-format */
 			(_("%pB: corrupt size field in group section"
-			   " header: %#Lx"), abfd, shdr->sh_size);
+			   " header: %#" PRIx64),
+			 abfd, (uint64_t) shdr->sh_size);
 		      bfd_set_error (bfd_error_bad_value);
 		      -- num_group;
 		      continue;
@@ -674,7 +675,8 @@ setup_group (bfd *abfd, Elf_Internal_Shdr *hdr, asection *newsect)
 		      _bfd_error_handler
 			/* xgettext:c-format */
 			(_("%pB: invalid size field in group section"
-			   " header: %#Lx"), abfd, shdr->sh_size);
+			   " header: %#" PRIx64 ""),
+			 abfd, (uint64_t) shdr->sh_size);
 		      bfd_set_error (bfd_error_bad_value);
 		      -- num_group;
 		      /* PR 17510: If the group contents are even
@@ -5558,8 +5560,8 @@ assign_file_positions_for_load_sections (bfd *abfd,
 		{
 		  _bfd_error_handler
 		    /* xgettext:c-format */
-		    (_("%pB: section %pA lma %#Lx adjusted to %#Lx"),
-		     abfd, sec, s_start, p_end);
+		    (_("%pB: section %pA lma %#" PRIx64 " adjusted to %#" PRIx64),
+		     abfd, sec, (uint64_t) s_start, (uint64_t) p_end);
 		  adjust = 0;
 		  sec->lma = p_end;
 		}
@@ -6836,8 +6838,8 @@ rewrite_elf_program_header (bfd *ibfd, bfd *obfd)
 	      && (segment->p_filesz > 0 || segment->p_memsz == 0))
 	    /* xgettext:c-format */
 	    _bfd_error_handler (_("%pB: warning: Empty loadable segment detected"
-				  " at vaddr=%#Lx, is this intentional?"),
-				ibfd, segment->p_vaddr);
+				  " at vaddr=%#" PRIx64 ", is this intentional?"),
+				ibfd, (uint64_t) segment->p_vaddr);
 
 	  map->count = 0;
 	  *pointer_to_map = map;
@@ -7449,9 +7451,9 @@ rewrite:
 	    /* PR 17512: file: f17299af.  */
 	    if (segment->p_align > (bfd_vma) 1 << ((sizeof (bfd_vma) * 8) - 2))
 	      /* xgettext:c-format */
-	      _bfd_error_handler (_("%pB: warning: segment alignment of %#Lx"
-				    " is too large"),
-				  ibfd, segment->p_align);
+	      _bfd_error_handler (_("%pB: warning: segment alignment of %#"
+				    PRIx64 " is too large"),
+				  ibfd, (uint64_t) segment->p_align);
 	    else
 	      maxpagesize = segment->p_align;
 	  }
diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c
index 86fa391..f6c6a8c 100644
--- a/bfd/elf32-arc.c
+++ b/bfd/elf32-arc.c
@@ -1125,26 +1125,26 @@ arc_special_overflow_checks (const struct arc_relocation_data reloc_data,
 	  if (reloc_data.reloc_addend == 0)
 	    _bfd_error_handler
 	      /* xgettext:c-format */
-	      (_("%pB(%pA+%#Lx): CMEM relocation to `%s' is invalid, "
-		 "16 MSB should be %#x (value is %#Lx)"),
+	      (_("%pB(%pA+%#" PRIx64 "): CMEM relocation to `%s' is invalid, "
+		 "16 MSB should be %#x (value is %#" PRIx64 ")"),
 	       reloc_data.input_section->owner,
 	       reloc_data.input_section,
-	       reloc_data.reloc_offset,
+	       (uint64_t) reloc_data.reloc_offset,
 	       reloc_data.symbol_name,
 	       NPS_CMEM_HIGH_VALUE,
-	       relocation);
+	       (uint64_t) relocation);
 	  else
 	    _bfd_error_handler
 	      /* xgettext:c-format */
-	      (_("%pB(%pA+%#Lx): CMEM relocation to `%s+%#Lx' is invalid, "
-		 "16 MSB should be %#x (value is %#Lx)"),
+	      (_("%pB(%pA+%#" PRIx64 "): CMEM relocation to `%s+%#" PRIx64
+		 "' is invalid, 16 MSB should be %#x (value is %#" PRIx64 ")"),
 	       reloc_data.input_section->owner,
 	       reloc_data.input_section,
-	       reloc_data.reloc_offset,
+	       (uint64_t) reloc_data.reloc_offset,
 	       reloc_data.symbol_name,
-	       reloc_data.reloc_addend,
+	       (uint64_t) reloc_data.reloc_addend,
 	       NPS_CMEM_HIGH_VALUE,
-	       relocation);
+	       (uint64_t) relocation);
 	  return bfd_reloc_overflow;
 	}
       break;
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index 6109dab..b599b1e 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -9720,8 +9720,9 @@ elf32_arm_tls_relax (struct elf32_arm_link_hash_table *globals,
 	      | bfd_get_16 (input_bfd, contents + rel->r_offset + 2);
 	  _bfd_error_handler
 	    /* xgettext:c-format */
-	    (_("%pB(%pA+%#Lx): unexpected Thumb instruction '%#lx' in TLS trampoline"),
-	     input_bfd, input_sec, rel->r_offset, insn);
+	    (_("%pB(%pA+%#" PRIx64 "): "
+	       "unexpected Thumb instruction '%#lx' in TLS trampoline"),
+	     input_bfd, input_sec, (uint64_t) rel->r_offset, insn);
 	  return bfd_reloc_notsupported;
 	}
       break;
@@ -9760,8 +9761,9 @@ elf32_arm_tls_relax (struct elf32_arm_link_hash_table *globals,
 	{
 	  _bfd_error_handler
 	    /* xgettext:c-format */
-	    (_("%pB(%pA+%#Lx): unexpected ARM instruction '%#lx' in TLS trampoline"),
-	     input_bfd, input_sec, rel->r_offset, insn);
+	    (_("%pB(%pA+%#" PRIx64 "): "
+	       "unexpected ARM instruction '%#lx' in TLS trampoline"),
+	     input_bfd, input_sec, (uint64_t) rel->r_offset, insn);
 	  return bfd_reloc_notsupported;
 	}
       break;
@@ -11531,8 +11533,11 @@ elf32_arm_final_link_relocate (reloc_howto_type *	    howto,
 		  {
 		    _bfd_error_handler
 		      /* xgettext:c-format */
-		      (_("%pB(%pA+%#Lx): unexpected Thumb instruction '%#lx' referenced by TLS_GOTDESC"),
-		       input_bfd, input_section, rel->r_offset, insn);
+		      (_("%pB(%pA+%#" PRIx64 "): "
+			 "unexpected Thumb instruction '%#lx' "
+			 "referenced by TLS_GOTDESC"),
+		       input_bfd, input_section, (uint64_t) rel->r_offset,
+		       insn);
 		    return bfd_reloc_notsupported;
 		  }
 	      }
@@ -11554,8 +11559,11 @@ elf32_arm_final_link_relocate (reloc_howto_type *	    howto,
 		  default:
 		    _bfd_error_handler
 		      /* xgettext:c-format */
-		      (_("%pB(%pA+%#Lx): unexpected ARM instruction '%#lx' referenced by TLS_GOTDESC"),
-		       input_bfd, input_section, rel->r_offset, insn);
+		      (_("%pB(%pA+%#" PRIx64 "): "
+			 "unexpected ARM instruction '%#lx' "
+			 "referenced by TLS_GOTDESC"),
+		       input_bfd, input_section, (uint64_t) rel->r_offset,
+		       insn);
 		    return bfd_reloc_notsupported;
 		  }
 	      }
@@ -11583,8 +11591,9 @@ elf32_arm_final_link_relocate (reloc_howto_type *	    howto,
 	{
 	  _bfd_error_handler
 	    /* xgettext:c-format */
-	    (_("%pB(%pA+%#Lx): %s relocation not permitted in shared object"),
-	     input_bfd, input_section, rel->r_offset, howto->name);
+	    (_("%pB(%pA+%#" PRIx64 "): %s relocation not permitted "
+	       "in shared object"),
+	     input_bfd, input_section, (uint64_t) rel->r_offset, howto->name);
 	  return bfd_reloc_notsupported;
 	}
       else
@@ -11796,8 +11805,9 @@ elf32_arm_final_link_relocate (reloc_howto_type *	    howto,
 	      {
 		_bfd_error_handler
 		  /* xgettext:c-format */
-		  (_("%pB(%pA+%#Lx): Only ADD or SUB instructions are allowed for ALU group relocations"),
-		  input_bfd, input_section, rel->r_offset);
+		  (_("%pB(%pA+%#" PRIx64 "): Only ADD or SUB instructions "
+		     "are allowed for ALU group relocations"),
+		  input_bfd, input_section, (uint64_t) rel->r_offset);
 		return bfd_reloc_overflow;
 	      }
 
@@ -11836,9 +11846,11 @@ elf32_arm_final_link_relocate (reloc_howto_type *	    howto,
 	  {
 	    _bfd_error_handler
 	      /* xgettext:c-format */
-	      (_("%pB(%pA+%#Lx): Overflow whilst splitting %#Lx for group relocation %s"),
-	       input_bfd, input_section, rel->r_offset,
-	       signed_value < 0 ? -signed_value : signed_value, howto->name);
+	      (_("%pB(%pA+%#" PRIx64 "): Overflow whilst "
+		 "splitting %#" PRIx64 " for group relocation %s"),
+	       input_bfd, input_section, (uint64_t) rel->r_offset,
+	       (uint64_t) (signed_value < 0 ? -signed_value : signed_value),
+	       howto->name);
 	    return bfd_reloc_overflow;
 	  }
 
@@ -11926,9 +11938,11 @@ elf32_arm_final_link_relocate (reloc_howto_type *	    howto,
 	  {
 	    _bfd_error_handler
 	      /* xgettext:c-format */
-	      (_("%pB(%pA+%#Lx): Overflow whilst splitting %#Lx for group relocation %s"),
-	       input_bfd, input_section, rel->r_offset,
-	       signed_value < 0 ? -signed_value : signed_value, howto->name);
+	      (_("%pB(%pA+%#" PRIx64 "): Overflow whilst "
+		 "splitting %#" PRIx64 " for group relocation %s"),
+	       input_bfd, input_section, (uint64_t) rel->r_offset,
+	       (uint64_t) (signed_value < 0 ? -signed_value : signed_value),
+	       howto->name);
 	    return bfd_reloc_overflow;
 	  }
 
@@ -12012,9 +12026,11 @@ elf32_arm_final_link_relocate (reloc_howto_type *	    howto,
 	  {
 	    _bfd_error_handler
 	      /* xgettext:c-format */
-	      (_("%pB(%pA+%#Lx): Overflow whilst splitting %#Lx for group relocation %s"),
-	       input_bfd, input_section, rel->r_offset,
-	       signed_value < 0 ? -signed_value : signed_value, howto->name);
+	      (_("%pB(%pA+%#" PRIx64 "): Overflow whilst "
+		 "splitting %#" PRIx64 " for group relocation %s"),
+	       input_bfd, input_section, (uint64_t) rel->r_offset,
+	       (uint64_t) (signed_value < 0 ? -signed_value : signed_value),
+	       howto->name);
 	    return bfd_reloc_overflow;
 	  }
 
@@ -12100,9 +12116,11 @@ elf32_arm_final_link_relocate (reloc_howto_type *	    howto,
 	  {
 	    _bfd_error_handler
 	      /* xgettext:c-format */
-	      (_("%pB(%pA+%#Lx): Overflow whilst splitting %#Lx for group relocation %s"),
-	       input_bfd, input_section, rel->r_offset,
-	       signed_value < 0 ? -signed_value : signed_value, howto->name);
+	      (_("%pB(%pA+%#" PRIx64 "): Overflow whilst "
+		 "splitting %#" PRIx64 " for group relocation %s"),
+	       input_bfd, input_section, (uint64_t) rel->r_offset,
+	       (uint64_t) (signed_value < 0 ? -signed_value : signed_value),
+	       howto->name);
 	    return bfd_reloc_overflow;
 	  }
 
@@ -12366,9 +12384,10 @@ elf32_arm_relocate_section (bfd *		   output_bfd,
 			{
 			  _bfd_error_handler
 			    /* xgettext:c-format */
-			    (_("%pB(%pA+%#Lx): %s relocation against SEC_MERGE section"),
+			    (_("%pB(%pA+%#" PRIx64 "): "
+			       "%s relocation against SEC_MERGE section"),
 			     input_bfd, input_section,
-			     rel->r_offset, howto->name);
+			     (uint64_t) rel->r_offset, howto->name);
 			  return FALSE;
 			}
 
@@ -12478,12 +12497,12 @@ elf32_arm_relocate_section (bfd *		   output_bfd,
 	  _bfd_error_handler
 	    ((sym_type == STT_TLS
 	      /* xgettext:c-format */
-	      ? _("%pB(%pA+%#Lx): %s used with TLS symbol %s")
+	      ? _("%pB(%pA+%#" PRIx64 "): %s used with TLS symbol %s")
 	      /* xgettext:c-format */
-	      : _("%pB(%pA+%#Lx): %s used with non-TLS symbol %s")),
+	      : _("%pB(%pA+%#" PRIx64 "): %s used with non-TLS symbol %s")),
 	     input_bfd,
 	     input_section,
-	     rel->r_offset,
+	     (uint64_t) rel->r_offset,
 	     howto->name,
 	     name);
 	}
@@ -12533,10 +12552,11 @@ elf32_arm_relocate_section (bfd *		   output_bfd,
 	{
 	  _bfd_error_handler
 	    /* xgettext:c-format */
-	    (_("%pB(%pA+%#Lx): unresolvable %s relocation against symbol `%s'"),
+	    (_("%pB(%pA+%#" PRIx64 "): "
+	       "unresolvable %s relocation against symbol `%s'"),
 	     input_bfd,
 	     input_section,
-	     rel->r_offset,
+	     (uint64_t) rel->r_offset,
 	     howto->name,
 	     h->root.root.string);
 	  return FALSE;
@@ -18418,12 +18438,13 @@ elf32_arm_write_section (bfd *output_bfd,
 		      branch_to_veneer - (1 << 24) : 0;
 
 		    _bfd_error_handler
-		      (_("%pB(%#Lx): error: Cannot create STM32L4XX veneer. "
-			 "Jump out of range by %Ld bytes. "
+		      (_("%pB(%#" PRIx64 "): error: "
+			 "Cannot create STM32L4XX veneer. "
+			 "Jump out of range by %" PRId64 " bytes. "
 			 "Cannot encode branch instruction. "),
 		       output_bfd,
-		       stm32l4xx_errnode->vma - 4,
-		       out_of_range);
+		       (uint64_t) (stm32l4xx_errnode->vma - 4),
+		       (int64_t) out_of_range);
 		    continue;
 		  }
 
diff --git a/bfd/elf32-bfin.c b/bfd/elf32-bfin.c
index afd316b..6964e07 100644
--- a/bfd/elf32-bfin.c
+++ b/bfd/elf32-bfin.c
@@ -1574,9 +1574,10 @@ bfin_relocate_section (bfd * output_bfd,
 	{
 	  _bfd_error_handler
 	    /* xgettext:c-format */
-	    (_("%pB(%pA+%#Lx): unresolvable relocation against symbol `%s'"),
-	     input_bfd,
-	     input_section, rel->r_offset, h->root.root.string);
+	    (_("%pB(%pA+%#" PRIx64 "): "
+	       "unresolvable relocation against symbol `%s'"),
+	     input_bfd, input_section, (uint64_t) rel->r_offset,
+	     h->root.root.string);
 	  return FALSE;
 	}
 
@@ -1605,8 +1606,9 @@ bfin_relocate_section (bfd * output_bfd,
 	    {
 	      _bfd_error_handler
 		/* xgettext:c-format */
-		(_("%pB(%pA+%#Lx): reloc against `%s': error %d"),
-		 input_bfd, input_section, rel->r_offset, name, (int) r);
+		(_("%pB(%pA+%#" PRIx64 "): reloc against `%s': error %d"),
+		 input_bfd, input_section, (uint64_t) rel->r_offset,
+		 name, (int) r);
 	      return FALSE;
 	    }
 	}
@@ -2625,8 +2627,9 @@ bfinfdpic_relocate_section (bfd * output_bfd,
 	    {
 	      _bfd_error_handler
 		/* xgettext:c-format */
-		(_("%pB: relocation at `%pA+%#Lx' references symbol `%s' with nonzero addend"),
-		 input_bfd, input_section, rel->r_offset, name);
+		(_("%pB: relocation at `%pA+%#" PRIx64 "' "
+		   "references symbol `%s' with nonzero addend"),
+		 input_bfd, input_section, (uint64_t) rel->r_offset, name);
 	      return FALSE;
 
 	    }
diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c
index 1408d80..31c06d3 100644
--- a/bfd/elf32-cris.c
+++ b/bfd/elf32-cris.c
@@ -1305,21 +1305,21 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
 		if (h == NULL)
 		  _bfd_error_handler
 		    /* xgettext:c-format */
-		    (_("%pB, section %pA: relocation %s with non-zero addend %Ld"
-		       " against local symbol"),
+		    (_("%pB, section %pA: relocation %s with non-zero addend"
+		       " %" PRId64 " against local symbol"),
 		     input_bfd,
 		     input_section,
 		     cris_elf_howto_table[r_type].name,
-		     rel->r_addend);
+		     (int64_t) rel->r_addend);
 		else
 		  _bfd_error_handler
 		    /* xgettext:c-format */
-		    (_("%pB, section %pA: relocation %s with non-zero addend %Ld"
-		       " against symbol `%s'"),
+		    (_("%pB, section %pA: relocation %s with non-zero addend"
+		       " %" PRId64 " against symbol `%s'"),
 		     input_bfd,
 		     input_section,
 		     cris_elf_howto_table[r_type].name,
-		     rel->r_addend,
+		     (int64_t) rel->r_addend,
 		     symname[0] != '\0' ? symname : _("[whose name is lost]"));
 
 		bfd_set_error (bfd_error_bad_value);
@@ -1662,12 +1662,12 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
 		 to pass us these kinds of things.  */
 	      _bfd_error_handler
 		/* xgettext:c-format */
-		(_("%pB, section %pA: relocation %s with non-zero addend %Ld"
-		   " against symbol `%s'"),
+		(_("%pB, section %pA: relocation %s with non-zero addend"
+		   " %" PRId64 " against symbol `%s'"),
 		 input_bfd,
 		 input_section,
 		 cris_elf_howto_table[r_type].name,
-		 rel->r_addend,
+		 (int64_t) rel->r_addend,
 		 symname[0] != '\0' ? symname : _("[whose name is lost]"));
 
 	      bfd_set_error (bfd_error_bad_value);
@@ -1815,12 +1815,12 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
 		 things.  */
 	      _bfd_error_handler
 		/* xgettext:c-format */
-		(_("%pB, section %pA: relocation %s with non-zero addend %Ld"
-		   " against symbol `%s'"),
+		(_("%pB, section %pA: relocation %s with non-zero addend"
+		   " %" PRId64 " against symbol `%s'"),
 		 input_bfd,
 		 input_section,
 		 cris_elf_howto_table[r_type].name,
-		 rel->r_addend,
+		 (int64_t) rel->r_addend,
 		 symname[0] != '\0' ? symname : _("[whose name is lost]"));
 	      bfd_set_error (bfd_error_bad_value);
 	      return FALSE;
diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c
index f4f1297..3ce3807 100644
--- a/bfd/elf32-hppa.c
+++ b/bfd/elf32-hppa.c
@@ -826,10 +826,11 @@ hppa_build_one_stub (struct bfd_hash_entry *bh, void *in_arg)
 	{
 	  _bfd_error_handler
 	    /* xgettext:c-format */
-	    (_("%pB(%pA+%#Lx): cannot reach %s, recompile with -ffunction-sections"),
+	    (_("%pB(%pA+%#" PRIx64 "): "
+	       "cannot reach %s, recompile with -ffunction-sections"),
 	     hsh->target_section->owner,
 	     stub_sec,
-	     hsh->stub_offset,
+	     (uint64_t) hsh->stub_offset,
 	     hsh->bh_root.string);
 	  bfd_set_error (bfd_error_bad_value);
 	  return FALSE;
@@ -3330,10 +3331,11 @@ final_link_relocate (asection *input_section,
 		   error.  */
 		_bfd_error_handler
 		  /* xgettext:c-format */
-		  (_("%pB(%pA+%#Lx): %s fixup for insn %#x is not supported in a non-shared link"),
+		  (_("%pB(%pA+%#" PRIx64 "): %s fixup for insn %#x "
+		     "is not supported in a non-shared link"),
 		   input_bfd,
 		   input_section,
-		   offset,
+		   (uint64_t) offset,
 		   howto->name,
 		   insn);
 	    }
@@ -3496,10 +3498,11 @@ final_link_relocate (asection *input_section,
     {
       _bfd_error_handler
 	/* xgettext:c-format */
-	(_("%pB(%pA+%#Lx): cannot reach %s, recompile with -ffunction-sections"),
+	(_("%pB(%pA+%#" PRIx64 "): cannot reach %s, "
+	   "recompile with -ffunction-sections"),
 	 input_bfd,
 	 input_section,
-	 offset,
+	 (uint64_t) offset,
 	 hsh->bh_root.string);
       bfd_set_error (bfd_error_bad_value);
       return bfd_reloc_notsupported;
@@ -4198,10 +4201,10 @@ elf32_hppa_relocate_section (bfd *output_bfd,
 	    {
 	      _bfd_error_handler
 		/* xgettext:c-format */
-		(_("%pB(%pA+%#Lx): cannot handle %s for %s"),
+		(_("%pB(%pA+%#" PRIx64 "): cannot handle %s for %s"),
 		 input_bfd,
 		 input_section,
-		 rela->r_offset,
+		 (uint64_t) rela->r_offset,
 		 howto->name,
 		 sym_name);
 	      bfd_set_error (bfd_error_bad_value);
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index a6ea113..0906785 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -1156,10 +1156,10 @@ elf_i386_tls_transition (struct bfd_link_info *info, bfd *abfd,
 
       _bfd_error_handler
 	/* xgettext:c-format */
-	(_("%pB: TLS transition from %s to %s against `%s' at %#Lx "
-	   "in section `%pA' failed"),
+	(_("%pB: TLS transition from %s to %s against `%s'"
+	   " at %#" PRIx64 " in section `%pA' failed"),
 	 abfd, from->name, to->name, name,
-	 rel->r_offset, sec);
+	 (uint64_t) rel->r_offset, sec);
       bfd_set_error (bfd_error_bad_value);
       return FALSE;
     }
@@ -3442,10 +3442,10 @@ disallow_got32:
 	{
 	  _bfd_error_handler
 	    /* xgettext:c-format */
-	    (_("%pB(%pA+%#Lx): unresolvable %s relocation against symbol `%s'"),
+	    (_("%pB(%pA+%#" PRIx64 "): unresolvable %s relocation against symbol `%s'"),
 	     input_bfd,
 	     input_section,
-	     rel->r_offset,
+	     (uint64_t) rel->r_offset,
 	     howto->name,
 	     h->root.root.string);
 	  return FALSE;
@@ -3482,9 +3482,9 @@ check_relocation_error:
 	    {
 	      _bfd_error_handler
 		/* xgettext:c-format */
-		(_("%pB(%pA+%#Lx): reloc against `%s': error %d"),
+		(_("%pB(%pA+%#" PRIx64 "): reloc against `%s': error %d"),
 		 input_bfd, input_section,
-		 rel->r_offset, name, (int) r);
+		 (uint64_t) rel->r_offset, name, (int) r);
 	      return FALSE;
 	    }
 	}
diff --git a/bfd/elf32-ip2k.c b/bfd/elf32-ip2k.c
index 66b1351..361f320 100644
--- a/bfd/elf32-ip2k.c
+++ b/bfd/elf32-ip2k.c
@@ -1295,9 +1295,11 @@ ip2k_final_link_relocate (reloc_howto_type *  howto,
 	      ip2k_nominal_page_bits (input_bfd, input_section,
 				      rel->r_offset, contents))
 	    /* xgettext:c-format */
-	    _bfd_error_handler (_("ip2k linker: missing page instruction at %#Lx (dest = %#Lx)"),
-				BASEADDR (input_section) + rel->r_offset,
-				relocation + rel->r_addend);
+	    _bfd_error_handler
+	      (_("ip2k linker: missing page instruction "
+		 "at %#" PRIx64 " (dest = %#" PRIx64 ")"),
+	       (uint64_t) (BASEADDR (input_section) + rel->r_offset),
+	       (uint64_t) (relocation + rel->r_addend));
 	}
       else if (ip2k_relaxed)
 	{
@@ -1312,9 +1314,11 @@ ip2k_final_link_relocate (reloc_howto_type *  howto,
 		  ip2k_nominal_page_bits (input_bfd, input_section,
 					  rel->r_offset - 2, contents)))
 	    /* xgettext:c-format */
-	    _bfd_error_handler (_("ip2k linker: redundant page instruction at %#Lx (dest = %#Lx)"),
-				page_addr,
-				relocation + rel->r_addend);
+	    _bfd_error_handler
+	      (_("ip2k linker: redundant page instruction "
+		 "at %#" PRIx64 " (dest = %#" PRIx64 ")"),
+	       (uint64_t) page_addr,
+	       (uint64_t) (relocation + rel->r_addend));
 	}
       if ((relocation & IP2K_INSN_MASK) == IP2K_INSN_VALUE)
 	relocation &= ~IP2K_INSN_MASK;
diff --git a/bfd/elf32-lm32.c b/bfd/elf32-lm32.c
index 6269775..23b8872 100644
--- a/bfd/elf32-lm32.c
+++ b/bfd/elf32-lm32.c
@@ -1427,8 +1427,9 @@ lm32_elf_finish_dynamic_sections (bfd *output_bfd,
 	      != (lm32fdpic_fixup32_section (info)->reloc_count * 4))
 	{
 	  _bfd_error_handler
-	    ("LINKER BUG: .rofixup section size mismatch: size/4 %Ld != relocs %d",
-	    lm32fdpic_fixup32_section (info)->size/4,
+	    ("LINKER BUG: .rofixup section size mismatch: size/4 %" PRId64
+	     " != relocs %d",
+	    (int64_t) (lm32fdpic_fixup32_section (info)->size / 4),
 	    lm32fdpic_fixup32_section (info)->reloc_count);
 	  return FALSE;
 	}
@@ -1449,7 +1450,9 @@ lm32_elf_finish_dynamic_sections (bfd *output_bfd,
 	  if (hend->u.def.value != value)
 	    {
 	      _bfd_error_handler
-		("LINKER BUG: .rofixup section hend->u.def.value != value: %Ld != %Ld", hend->u.def.value, value);
+		("LINKER BUG: .rofixup section hend->u.def.value != value: %"
+		 PRId64 " != %" PRId64,
+		 (int64_t) hend->u.def.value, (int64_t) value);
 	      return FALSE;
 	    }
 	}
diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c
index 985047e..2801f04 100644
--- a/bfd/elf32-m32r.c
+++ b/bfd/elf32-m32r.c
@@ -2523,11 +2523,11 @@ m32r_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
 		{
 		  _bfd_error_handler
 		    /* xgettext:c-format */
-		    (_("%pB(%pA+%#Lx): unresolvable %s relocation "
+		    (_("%pB(%pA+%#" PRIx64 "): unresolvable %s relocation "
 		       "against symbol `%s'"),
 		     input_bfd,
 		     input_section,
-		     rel->r_offset,
+		     (uint64_t) rel->r_offset,
 		     howto->name,
 		     h->root.root.string);
 		}
diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c
index d7f5d5f..3414d28 100644
--- a/bfd/elf32-m68k.c
+++ b/bfd/elf32-m68k.c
@@ -3698,8 +3698,10 @@ elf_m68k_relocate_section (bfd *output_bfd,
 	    {
 	      _bfd_error_handler
 		/* xgettext:c-format */
-		(_("%pB(%pA+%#Lx): %s relocation not permitted in shared object"),
-		 input_bfd, input_section, rel->r_offset, howto->name);
+		(_("%pB(%pA+%#" PRIx64 "): "
+		   "%s relocation not permitted in shared object"),
+		 input_bfd, input_section, (uint64_t) rel->r_offset,
+		 howto->name);
 
 	      return FALSE;
 	    }
@@ -3892,10 +3894,11 @@ elf_m68k_relocate_section (bfd *output_bfd,
 	{
 	  _bfd_error_handler
 	    /* xgettext:c-format */
-	    (_("%pB(%pA+%#Lx): unresolvable %s relocation against symbol `%s'"),
+	    (_("%pB(%pA+%#" PRIx64 "): "
+	       "unresolvable %s relocation against symbol `%s'"),
 	     input_bfd,
 	     input_section,
-	     rel->r_offset,
+	     (uint64_t) rel->r_offset,
 	     howto->name,
 	     h->root.root.string);
 	  return FALSE;
@@ -3928,12 +3931,12 @@ elf_m68k_relocate_section (bfd *output_bfd,
 	      _bfd_error_handler
 		((sym_type == STT_TLS
 		  /* xgettext:c-format */
-		  ? _("%pB(%pA+%#Lx): %s used with TLS symbol %s")
+		  ? _("%pB(%pA+%#" PRIx64 "): %s used with TLS symbol %s")
 		  /* xgettext:c-format */
-		  : _("%pB(%pA+%#Lx): %s used with non-TLS symbol %s")),
+		  : _("%pB(%pA+%#" PRIx64 "): %s used with non-TLS symbol %s")),
 		 input_bfd,
 		 input_section,
-		 rel->r_offset,
+		 (uint64_t) rel->r_offset,
 		 howto->name,
 		 name);
 	    }
@@ -3968,9 +3971,9 @@ elf_m68k_relocate_section (bfd *output_bfd,
 	    {
 	      _bfd_error_handler
 		/* xgettext:c-format */
-		(_("%pB(%pA+%#Lx): reloc against `%s': error %d"),
+		(_("%pB(%pA+%#" PRIx64 "): reloc against `%s': error %d"),
 		 input_bfd, input_section,
-		 rel->r_offset, name, (int) r);
+		 (uint64_t) rel->r_offset, name, (int) r);
 	      return FALSE;
 	    }
 	}
diff --git a/bfd/elf32-metag.c b/bfd/elf32-metag.c
index dc867ce..c09a2ea 100644
--- a/bfd/elf32-metag.c
+++ b/bfd/elf32-metag.c
@@ -1913,8 +1913,10 @@ elf_metag_relocate_section (bfd *output_bfd,
 	    {
 	      _bfd_error_handler
 		/* xgettext:c-format */
-		(_("%pB(%pA+%#Lx): %s relocation not permitted in shared object"),
-		 input_bfd, input_section, rel->r_offset, howto->name);
+		(_("%pB(%pA+%#" PRIx64 "): "
+		   "%s relocation not permitted in shared object"),
+		 input_bfd, input_section, (uint64_t) rel->r_offset,
+		 howto->name);
 	      return FALSE;
 	    }
 	  else
diff --git a/bfd/elf32-nds32.c b/bfd/elf32-nds32.c
index 70cf1dc..bd7c0f1 100644
--- a/bfd/elf32-nds32.c
+++ b/bfd/elf32-nds32.c
@@ -8791,7 +8791,7 @@ relax_range_measurement (bfd *abfd)
 
 static const char * unrecognized_reloc_msg =
   /* xgettext:c-format */
-  N_("%pB: warning: %s points to unrecognized reloc at %#Lx");
+  N_("%pB: warning: %s points to unrecognized reloc at %#" PRIx64);
 
 /* Relax LONGCALL1 relocation for nds32_elf_relax_section.  */
 
@@ -8844,7 +8844,7 @@ nds32_elf_relax_longcall1 (bfd *abfd, asection *sec, Elf_Internal_Rela *irel,
   if (hi_irelfn == irelend || lo_irelfn == irelend)
     {
       _bfd_error_handler (unrecognized_reloc_msg, abfd, "R_NDS32_LONGCALL1",
-			  irel->r_offset);
+			  (uint64_t) irel->r_offset);
       return FALSE;
     }
 
@@ -8925,7 +8925,7 @@ nds32_elf_relax_longcall2 (bfd *abfd, asection *sec, Elf_Internal_Rela *irel,
   if (i1_irelfn == irelend)
     {
       _bfd_error_handler (unrecognized_reloc_msg, abfd, "R_NDS32_LONGCALL2",
-			  irel->r_offset);
+			  (uint64_t) irel->r_offset);
       return FALSE;
     }
 
@@ -9031,7 +9031,7 @@ nds32_elf_relax_longcall3 (bfd *abfd, asection *sec, Elf_Internal_Rela *irel,
   if (hi_irelfn == irelend || lo_irelfn == irelend)
     {
       _bfd_error_handler (unrecognized_reloc_msg, abfd, "R_NDS32_LONGCALL3",
-			  irel->r_offset);
+			  (uint64_t) irel->r_offset);
       return FALSE;
     }
 
@@ -9165,7 +9165,7 @@ nds32_elf_relax_longjump1 (bfd *abfd, asection *sec, Elf_Internal_Rela *irel,
   if (hi_irelfn == irelend || lo_irelfn == irelend)
     {
       _bfd_error_handler (unrecognized_reloc_msg, abfd, "R_NDS32_LONGJUMP1",
-			  irel->r_offset);
+			  (uint64_t) irel->r_offset);
       return FALSE;
     }
 
@@ -9371,7 +9371,7 @@ nds32_elf_relax_longjump2 (bfd *abfd, asection *sec, Elf_Internal_Rela *irel,
   if (i2_irelfn == irelend || cond_irelfn == irelend)
     {
       _bfd_error_handler (unrecognized_reloc_msg, abfd, "R_NDS32_LONGJUMP2",
-			  irel->r_offset);
+			  (uint64_t) irel->r_offset);
       return FALSE;
     }
 
@@ -9563,7 +9563,7 @@ nds32_elf_relax_longjump3 (bfd *abfd, asection *sec, Elf_Internal_Rela *irel,
   if (hi_irelfn == irelend || lo_irelfn == irelend || cond_irelfn == irelend)
     {
       _bfd_error_handler (unrecognized_reloc_msg, abfd, "R_NDS32_LONGJUMP3",
-			  irel->r_offset);
+			  (uint64_t) irel->r_offset);
       return FALSE;
     }
 
@@ -9742,7 +9742,7 @@ nds32_elf_relax_longcall4 (bfd *abfd, asection *sec, Elf_Internal_Rela *irel,
   if (hi_irel == irelend)
     {
       _bfd_error_handler (unrecognized_reloc_msg, abfd, "R_NDS32_LONGCALL4",
-			  irel->r_offset);
+			  (uint64_t) irel->r_offset);
       return FALSE;
     }
 
@@ -9772,7 +9772,7 @@ nds32_elf_relax_longcall4 (bfd *abfd, asection *sec, Elf_Internal_Rela *irel,
   if (ptr_irel == irelend || em_irel == irelend)
     {
       _bfd_error_handler (unrecognized_reloc_msg, abfd, "R_NDS32_LONGCALL4",
-			  irel->r_offset);
+			  (uint64_t) irel->r_offset);
       return FALSE;
     }
   /* Check these is enough space to insert jal in R_NDS32_EMPTY.  */
@@ -9843,7 +9843,7 @@ nds32_elf_relax_longcall5 (bfd *abfd, asection *sec, Elf_Internal_Rela *irel,
   if (cond_irel == irelend)
     {
       _bfd_error_handler (unrecognized_reloc_msg, abfd, "R_NDS32_LONGCALL5",
-			  irel->r_offset);
+			  (uint64_t) irel->r_offset);
       return FALSE;
     }
 
@@ -9921,7 +9921,7 @@ nds32_elf_relax_longcall6 (bfd *abfd, asection *sec, Elf_Internal_Rela *irel,
   if (em_irel == irelend)
     {
       _bfd_error_handler (unrecognized_reloc_msg, abfd, "R_NDS32_LONGCALL6",
-			  irel->r_offset);
+			  (uint64_t) irel->r_offset);
       return FALSE;
     }
 
@@ -9959,7 +9959,7 @@ nds32_elf_relax_longcall6 (bfd *abfd, asection *sec, Elf_Internal_Rela *irel,
       if (cond_irel == irelend)
 	{
 	  _bfd_error_handler (unrecognized_reloc_msg, abfd,
-			      "R_NDS32_LONGCALL6", irel->r_offset);
+			      "R_NDS32_LONGCALL6", (uint64_t) irel->r_offset);
 	  return FALSE;
 	}
       cond_irel->r_addend = 1;
@@ -10008,7 +10008,7 @@ nds32_elf_relax_longcall6 (bfd *abfd, asection *sec, Elf_Internal_Rela *irel,
       if (cond_irel == irelend)
 	{
 	  _bfd_error_handler (unrecognized_reloc_msg, abfd,
-			      "R_NDS32_LONGCALL6", irel->r_offset);
+			      "R_NDS32_LONGCALL6", (uint64_t) irel->r_offset);
 	  return FALSE;
 	}
       cond_irel->r_addend = 1;
@@ -10058,7 +10058,7 @@ nds32_elf_relax_longjump4 (bfd *abfd, asection *sec, Elf_Internal_Rela *irel,
   if (hi_irel == irelend)
     {
       _bfd_error_handler (unrecognized_reloc_msg, abfd, "R_NDS32_LONGJUMP4",
-			  irel->r_offset);
+			  (uint64_t) irel->r_offset);
       return FALSE;
     }
 
@@ -10080,7 +10080,7 @@ nds32_elf_relax_longjump4 (bfd *abfd, asection *sec, Elf_Internal_Rela *irel,
   if (ptr_irel == irelend || em_irel == irelend)
     {
       _bfd_error_handler (unrecognized_reloc_msg, abfd, "R_NDS32_LONGJUMP4",
-			  irel->r_offset);
+			  (uint64_t) irel->r_offset);
       return FALSE;
     }
 
@@ -10154,7 +10154,7 @@ nds32_elf_relax_longjump5 (bfd *abfd, asection *sec, Elf_Internal_Rela *irel,
   if (cond_irel == irelend)
     {
       _bfd_error_handler (unrecognized_reloc_msg, abfd, "R_NDS32_LONGJUMP5",
-			  irel->r_offset);
+			  (uint64_t) irel->r_offset);
       return FALSE;
     }
 
@@ -10283,7 +10283,7 @@ nds32_elf_relax_longjump6 (bfd *abfd, asection *sec, Elf_Internal_Rela *irel,
   if (em_irel == irelend)
     {
       _bfd_error_handler (unrecognized_reloc_msg, abfd, "R_NDS32_LONGJUMP6",
-			  irel->r_offset);
+			  (uint64_t) irel->r_offset);
       return FALSE;
     }
 
@@ -10453,7 +10453,7 @@ nds32_elf_relax_longjump7 (bfd *abfd, asection *sec, Elf_Internal_Rela *irel,
   if (cond_irel == irelend)
     {
       _bfd_error_handler (unrecognized_reloc_msg, abfd, "R_NDS32_LONGJUMP7",
-			  irel->r_offset);
+			  (uint64_t) irel->r_offset);
       return FALSE;
     }
 
@@ -10558,7 +10558,7 @@ nds32_elf_relax_loadstore (struct bfd_link_info *link_info, bfd *abfd,
   if (hi_irelfn == irelend)
     {
       _bfd_error_handler (unrecognized_reloc_msg, abfd, "R_NDS32_LOADSTORE",
-			  irel->r_offset);
+			  (uint64_t) irel->r_offset);
 	return FALSE;
     }
 
@@ -11032,7 +11032,7 @@ nds32_elf_relax_ptr (bfd *abfd, asection *sec, Elf_Internal_Rela *irel,
   if (re_irel == irelend)
     {
       _bfd_error_handler (unrecognized_reloc_msg, abfd, "R_NDS32_PTR",
-			  irel->r_offset);
+			  (uint64_t) irel->r_offset);
       return FALSE;
     }
 
@@ -15238,9 +15238,11 @@ nds32_elf_ex9_build_hash_table (bfd *abfd, asection *sec,
 			  _bfd_error_handler
 			    /* xgettext:c-format */
 			    (_("%pB: warning: unaligned small data access "
-			       "for entry: {%Ld, %Ld, %Ld}, addr = %#Lx, align = %#x"),
-			     abfd, irel->r_offset,
-			     irel->r_info, irel->r_addend, relocation, align);
+			       "for entry: {%" PRId64 ", %" PRId64 ", %" PRId64
+			       "}, addr = %#" PRIx64 ", align = %#x"),
+			     abfd, (int64_t) irel->r_offset,
+			     (int64_t) irel->r_info, (int64_t) irel->r_addend,
+			     (uint64_t) relocation, align);
 			  off += 4;
 			  continue;
 			}
diff --git a/bfd/elf32-nios2.c b/bfd/elf32-nios2.c
index b4849db..450eeed 100644
--- a/bfd/elf32-nios2.c
+++ b/bfd/elf32-nios2.c
@@ -4355,10 +4355,10 @@ nios2_elf32_relocate_section (bfd *output_bfd,
 		{
 		  _bfd_error_handler
 		    /* xgettext:c-format */
-		    (_("%pB(%pA+%#Lx): %s relocation not "
+		    (_("%pB(%pA+%#" PRIx64 "): %s relocation not "
 		       "permitted in shared object"),
 		     input_bfd, input_section,
-		     rel->r_offset, howto->name);
+		     (uint64_t) rel->r_offset, howto->name);
 		  return FALSE;
 		}
 	      else
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index c9db21c..7d6196c 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -8161,8 +8161,9 @@ ppc_elf_relocate_section (bfd *output_bfd,
 	      else
 		_bfd_error_handler
 		  /* xgettext:c-format */
-		  (_("%pB(%pA+%#Lx): error: %s with unexpected instruction %#x"),
-		   input_bfd, input_section, rel->r_offset,
+		  (_("%pB(%pA+%#" PRIx64 "): error: "
+		     "%s with unexpected instruction %#x"),
+		   input_bfd, input_section, (uint64_t) rel->r_offset,
 		   "R_PPC_ADDR16_HA", insn);
 	    }
 	  else if (r_type == R_PPC_ADDR16_LO)
@@ -8196,8 +8197,9 @@ ppc_elf_relocate_section (bfd *output_bfd,
 	      else
 		_bfd_error_handler
 		  /* xgettext:c-format */
-		  (_("%pB(%pA+%#Lx): error: %s with unexpected instruction %#x"),
-		   input_bfd, input_section, rel->r_offset,
+		  (_("%pB(%pA+%#" PRIx64 "): error: "
+		     "%s with unexpected instruction %#x"),
+		   input_bfd, input_section, (uint64_t) rel->r_offset,
 		   "R_PPC_ADDR16_LO", insn);
 	    }
 	}
diff --git a/bfd/elf32-rx.c b/bfd/elf32-rx.c
index 93eb79c..b393a50 100644
--- a/bfd/elf32-rx.c
+++ b/bfd/elf32-rx.c
@@ -684,9 +684,12 @@ rx_elf_relocate_section
 	  && strcmp (name, "__romdatastart") != 0			\
 	  && !saw_subtract)						\
 	/* xgettext:c-format */						\
-	_bfd_error_handler (_("%pB(%pA): unsafe PID relocation %s at %#Lx (against %s in %s)"), \
+	_bfd_error_handler (_("%pB(%pA): unsafe PID relocation %s "	\
+			      "at %#" PRIx64 " (against %s in %s)"),	\
 			    input_bfd, input_section, howto->name,	\
-			    input_section->output_section->vma + input_section->output_offset + rel->r_offset, \
+			    (uint64_t) (input_section->output_section->vma \
+					+ input_section->output_offset	\
+					+ rel->r_offset),		\
 			    name, sec->name);				\
     }									\
   while (0)
diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c
index 3ddbd469..64bfb2d 100644
--- a/bfd/elf32-s390.c
+++ b/bfd/elf32-s390.c
@@ -2134,10 +2134,10 @@ invalid_tls_insn (bfd *input_bfd,
   howto = elf_howto_table + ELF32_R_TYPE (rel->r_info);
   _bfd_error_handler
     /* xgettext:c-format */
-    (_("%pB(%pA+%#Lx): invalid instruction for TLS relocation %s"),
+    (_("%pB(%pA+%#" PRIx64 "): invalid instruction for TLS relocation %s"),
      input_bfd,
      input_section,
-     rel->r_offset,
+     (uint64_t) rel->r_offset,
      howto->name);
   bfd_set_error (bfd_error_bad_value);
 }
@@ -3201,10 +3201,11 @@ elf_s390_relocate_section (bfd *output_bfd,
 				      rel->r_offset) != (bfd_vma) -1)
 	_bfd_error_handler
 	  /* xgettext:c-format */
-	  (_("%pB(%pA+%#Lx): unresolvable %s relocation against symbol `%s'"),
+	  (_("%pB(%pA+%#" PRIx64 "): "
+	     "unresolvable %s relocation against symbol `%s'"),
 	   input_bfd,
 	   input_section,
-	   rel->r_offset,
+	   (uint64_t) rel->r_offset,
 	   howto->name,
 	   h->root.root.string);
 
@@ -3258,9 +3259,9 @@ elf_s390_relocate_section (bfd *output_bfd,
 	    {
 	      _bfd_error_handler
 		/* xgettext:c-format */
-		(_("%pB(%pA+%#Lx): reloc against `%s': error %d"),
+		(_("%pB(%pA+%#" PRIx64 "): reloc against `%s': error %d"),
 		 input_bfd, input_section,
-		 rel->r_offset, name, (int) r);
+		 (uint64_t) rel->r_offset, name, (int) r);
 	      return FALSE;
 	    }
 	}
diff --git a/bfd/elf32-score.c b/bfd/elf32-score.c
index 3832115..66ae645 100644
--- a/bfd/elf32-score.c
+++ b/bfd/elf32-score.c
@@ -2876,8 +2876,8 @@ s3_bfd_score_elf_check_relocs (bfd *abfd,
 	    {
 	      _bfd_error_handler
 		/* xgettext:c-format */
-		(_("%pB: CALL15 reloc at %#Lx not against global symbol"),
-		 abfd, rel->r_offset);
+		(_("%pB: CALL15 reloc at %#" PRIx64 " not against global symbol"),
+		 abfd, (uint64_t) rel->r_offset);
 	      bfd_set_error (bfd_error_bad_value);
 	      return FALSE;
 	    }
diff --git a/bfd/elf32-score7.c b/bfd/elf32-score7.c
index ef42d7b..e3f795c 100644
--- a/bfd/elf32-score7.c
+++ b/bfd/elf32-score7.c
@@ -2681,8 +2681,8 @@ s7_bfd_score_elf_check_relocs (bfd *abfd,
 	    {
 	      _bfd_error_handler
 		/* xgettext:c-format */
-		(_("%pB: CALL15 reloc at %#Lx not against global symbol"),
-		 abfd, rel->r_offset);
+		(_("%pB: CALL15 reloc at %#" PRIx64 " not against global symbol"),
+		 abfd, (uint64_t) rel->r_offset);
 	      bfd_set_error (bfd_error_bad_value);
 	      return FALSE;
 	    }
diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c
index 7c8ec6c..5cb4acc 100644
--- a/bfd/elf32-sh.c
+++ b/bfd/elf32-sh.c
@@ -577,8 +577,9 @@ sh_elf_relax_section (bfd *abfd, asection *sec,
       if (laddr >= sec->size)
 	{
 	  /* xgettext:c-format */
-	  _bfd_error_handler (_("%pB: %#Lx: warning: bad R_SH_USES offset"),
-			      abfd, irel->r_offset);
+	  _bfd_error_handler
+	    (_("%pB: %#" PRIx64 ": warning: bad R_SH_USES offset"),
+	     abfd, (uint64_t) irel->r_offset);
 	  continue;
 	}
       insn = bfd_get_16 (abfd, contents + laddr);
@@ -589,8 +590,9 @@ sh_elf_relax_section (bfd *abfd, asection *sec,
 	{
 	  _bfd_error_handler
 	    /* xgettext:c-format */
-	    (_("%pB: %#Lx: warning: R_SH_USES points to unrecognized insn 0x%x"),
-	     abfd, irel->r_offset, insn);
+	    (_("%pB: %#" PRIx64 ": warning: "
+	       "R_SH_USES points to unrecognized insn 0x%x"),
+	     abfd, (uint64_t) irel->r_offset, insn);
 	  continue;
 	}
 
@@ -607,8 +609,8 @@ sh_elf_relax_section (bfd *abfd, asection *sec,
 	{
 	  _bfd_error_handler
 	    /* xgettext:c-format */
-	    (_("%pB: %#Lx: warning: bad R_SH_USES load offset"),
-	     abfd, irel->r_offset);
+	    (_("%pB: %#" PRIx64 ": warning: bad R_SH_USES load offset"),
+	     abfd, (uint64_t) irel->r_offset);
 	  continue;
 	}
 
@@ -623,8 +625,8 @@ sh_elf_relax_section (bfd *abfd, asection *sec,
 	{
 	  _bfd_error_handler
 	    /* xgettext:c-format */
-	    (_("%pB: %#Lx: warning: could not find expected reloc"),
-	     abfd, paddr);
+	    (_("%pB: %#" PRIx64 ": warning: could not find expected reloc"),
+	     abfd, (uint64_t) paddr);
 	  continue;
 	}
 
@@ -652,8 +654,8 @@ sh_elf_relax_section (bfd *abfd, asection *sec,
 	    {
 	      _bfd_error_handler
 		/* xgettext:c-format */
-		(_("%pB: %#Lx: warning: symbol in unexpected section"),
-		 abfd, paddr);
+		(_("%pB: %#" PRIx64 ": warning: symbol in unexpected section"),
+		 abfd, (uint64_t) paddr);
 	      continue;
 	    }
 
@@ -782,8 +784,9 @@ sh_elf_relax_section (bfd *abfd, asection *sec,
 	{
 	  _bfd_error_handler
 	    /* xgettext:c-format */
-	    (_("%pB: %#Lx: warning: could not find expected COUNT reloc"),
-	     abfd, paddr);
+	    (_("%pB: %#" PRIx64 ": warning: "
+	       "could not find expected COUNT reloc"),
+	     abfd, (uint64_t) paddr);
 	  continue;
 	}
 
@@ -792,8 +795,8 @@ sh_elf_relax_section (bfd *abfd, asection *sec,
       if (irelcount->r_addend == 0)
 	{
 	  /* xgettext:c-format */
-	  _bfd_error_handler (_("%pB: %#Lx: warning: bad count"),
-			      abfd, paddr);
+	  _bfd_error_handler (_("%pB: %#" PRIx64 ": warning: bad count"),
+			      abfd, (uint64_t) paddr);
 	  continue;
 	}
 
@@ -1196,8 +1199,8 @@ sh_elf_relax_delete_bytes (bfd *abfd, asection *sec, bfd_vma addr,
 	    {
 	      _bfd_error_handler
 		/* xgettext:c-format */
-		(_("%pB: %#Lx: fatal: reloc overflow while relaxing"),
-		 abfd, irel->r_offset);
+		(_("%pB: %#" PRIx64 ": fatal: reloc overflow while relaxing"),
+		 abfd, (uint64_t) irel->r_offset);
 	      bfd_set_error (bfd_error_bad_value);
 	      return FALSE;
 	    }
@@ -1567,8 +1570,8 @@ sh_elf_swap_insns (bfd *abfd, asection *sec, void *relocs,
 	    {
 	      _bfd_error_handler
 		/* xgettext:c-format */
-		(_("%pB: %#Lx: fatal: reloc overflow while relaxing"),
-		 abfd, irel->r_offset);
+		(_("%pB: %#" PRIx64 ": fatal: reloc overflow while relaxing"),
+		 abfd, (uint64_t) irel->r_offset);
 	      bfd_set_error (bfd_error_bad_value);
 	      return FALSE;
 	    }
@@ -4000,9 +4003,10 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
 		{
 		  _bfd_error_handler
 		    /* xgettext:c-format */
-		    (_("%pB(%pA+%#Lx): %s relocation against SEC_MERGE section"),
+		    (_("%pB(%pA+%#" PRIx64 "): "
+		       "%s relocation against SEC_MERGE section"),
 		     input_bfd, input_section,
-		     rel->r_offset, howto->name);
+		     (uint64_t) rel->r_offset, howto->name);
 		  return FALSE;
 		}
 
@@ -4118,10 +4122,11 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
 		{
 		  _bfd_error_handler
 		    /* xgettext:c-format */
-		    (_("%pB(%pA+%#Lx): unresolvable %s relocation against symbol `%s'"),
+		    (_("%pB(%pA+%#" PRIx64 "): "
+		       "unresolvable %s relocation against symbol `%s'"),
 		     input_bfd,
 		     input_section,
-		     rel->r_offset,
+		     (uint64_t) rel->r_offset,
 		     howto->name,
 		     h->root.root.string);
 		  return FALSE;
@@ -4197,9 +4202,10 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
 		{
 		  _bfd_error_handler
 		    /* xgettext:c-format */
-		    (_("%pB: %#Lx: fatal: unaligned branch target for relax-support relocation"),
+		    (_("%pB: %#" PRIx64 ": fatal: "
+		       "unaligned branch target for relax-support relocation"),
 		     input_section->owner,
-		     rel->r_offset);
+		     (uint64_t) rel->r_offset);
 		  bfd_set_error (bfd_error_bad_value);
 		  return FALSE;
 		}
@@ -4231,10 +4237,10 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
 	    {
 	      _bfd_error_handler
 		/* xgettext:c-format */
-		(_("%pB: %#Lx: fatal: unaligned %s relocation %#Lx"),
-		 input_section->owner,
-		 rel->r_offset, howto->name,
-		 relocation);
+		(_("%pB: %#" PRIx64 ": fatal: "
+		   "unaligned %s relocation %#" PRIx64),
+		 input_section->owner, (uint64_t) rel->r_offset,
+		 howto->name, (uint64_t) relocation);
 	      bfd_set_error (bfd_error_bad_value);
 	      return FALSE;
 	    }
@@ -4247,10 +4253,11 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
 	    {
 	      _bfd_error_handler
 		/* xgettext:c-format */
-		(_("%pB: %#Lx: fatal: unaligned %s relocation %#Lx"),
+		(_("%pB: %#" PRIx64 ": fatal: "
+		   "unaligned %s relocation %#" PRIx64 ""),
 		 input_section->owner,
-		 rel->r_offset, howto->name,
-		 relocation);
+		 (uint64_t) rel->r_offset, howto->name,
+		 (uint64_t) relocation);
 	      bfd_set_error (bfd_error_bad_value);
 	      return FALSE;
 	    }
@@ -4262,10 +4269,11 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
 	    {
 	      _bfd_error_handler
 		/* xgettext:c-format */
-		(_("%pB: %#Lx: fatal: R_SH_PSHA relocation %Ld not in range -32..32"),
+		(_("%pB: %#" PRIx64 ": fatal: R_SH_PSHA relocation %" PRId64
+		   " not in range -32..32"),
 		 input_section->owner,
-		 rel->r_offset,
-		 relocation);
+		 (uint64_t) rel->r_offset,
+		 (int64_t) relocation);
 	      bfd_set_error (bfd_error_bad_value);
 	      return FALSE;
 	    }
@@ -4277,10 +4285,11 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
 	    {
 	      _bfd_error_handler
 		/* xgettext:c-format */
-		(_("%pB: %#Lx: fatal: R_SH_PSHL relocation %Ld not in range -32..32"),
+		(_("%pB: %#" PRIx64 ": fatal: R_SH_PSHL relocation %" PRId64
+		   " not in range -32..32"),
 		 input_section->owner,
-		 rel->r_offset,
-		 relocation);
+		 (uint64_t) rel->r_offset,
+		 (int64_t) relocation);
 	      bfd_set_error (bfd_error_bad_value);
 	      return FALSE;
 	    }
@@ -4423,10 +4432,11 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
 		  {
 		    _bfd_error_handler
 		      /* xgettext:c-format */
-		      (_("%pB(%pA+%#Lx): cannot emit fixup to `%s' in read-only section"),
+		      (_("%pB(%pA+%#" PRIx64 "): "
+			 "cannot emit fixup to `%s' in read-only section"),
 		       input_bfd,
 		       input_section,
-		       rel->r_offset,
+		       (uint64_t) rel->r_offset,
 		       symname);
 		    return FALSE;
 		  }
@@ -4896,10 +4906,11 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
 		  {
 		    _bfd_error_handler
 		      /* xgettext:c-format */
-		      (_("%pB(%pA+%#Lx): cannot emit fixup to `%s' in read-only section"),
+		      (_("%pB(%pA+%#" PRIx64 "): "
+			 "cannot emit fixup to `%s' in read-only section"),
 		       input_bfd,
 		       input_section,
-		       rel->r_offset,
+		       (uint64_t) rel->r_offset,
 		       symname);
 		    return FALSE;
 		  }
@@ -4998,9 +5009,10 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
 	    {
 	      _bfd_error_handler
 		/* xgettext:c-format */
-		(_("%pB(%pA+%#Lx): %s relocation against external symbol \"%s\""),
-		 input_bfd, input_section, rel->r_offset, howto->name,
-		 h->root.root.string);
+		(_("%pB(%pA+%#" PRIx64 "): "
+		   "%s relocation against external symbol \"%s\""),
+		 input_bfd, input_section, (uint64_t) rel->r_offset,
+		 howto->name, h->root.root.string);
 	      return FALSE;
 	    }
 	  else
diff --git a/bfd/elf32-sh64.c b/bfd/elf32-sh64.c
index 1870072..b635841 100644
--- a/bfd/elf32-sh64.c
+++ b/bfd/elf32-sh64.c
@@ -597,9 +597,10 @@ shmedia_prepare_reloc (struct bfd_link_info *info, bfd *abfd,
     {
       _bfd_error_handler
 	/* xgettext:c-format */
-	(_("%pB: error: unaligned relocation type %d at %#Lx reloc %#Lx"),
+	(_("%pB: error: unaligned relocation type %d "
+	   "at %#" PRIx64 " reloc %#" PRIx64),
 	 input_section->owner, (int) ELF32_R_TYPE (rel->r_info),
-	 rel->r_offset, *relocation);
+	 (uint64_t) rel->r_offset, (uint64_t) *relocation);
       return FALSE;
     }
 
diff --git a/bfd/elf32-spu.c b/bfd/elf32-spu.c
index 62afc69..0ce3e9c 100644
--- a/bfd/elf32-spu.c
+++ b/bfd/elf32-spu.c
@@ -5040,10 +5040,11 @@ spu_elf_relocate_section (bfd *output_bfd,
 	{
 	  _bfd_error_handler
 	    /* xgettext:c-format */
-	    (_("%pB(%s+%#Lx): unresolvable %s relocation against symbol `%s'"),
+	    (_("%pB(%s+%#" PRIx64 "): "
+	       "unresolvable %s relocation against symbol `%s'"),
 	     input_bfd,
 	     bfd_get_section_name (input_bfd, input_section),
-	     rel->r_offset,
+	     (uint64_t) rel->r_offset,
 	     howto->name,
 	     sym_name);
 	  ret = FALSE;
diff --git a/bfd/elf32-tic6x.c b/bfd/elf32-tic6x.c
index 24920b0..d5d264d 100644
--- a/bfd/elf32-tic6x.c
+++ b/bfd/elf32-tic6x.c
@@ -2567,21 +2567,21 @@ elf32_tic6x_relocate_section (bfd *output_bfd,
 	      if (h == NULL)
 		_bfd_error_handler
 		  /* xgettext:c-format */
-		  (_("%pB, section %pA: relocation %s with non-zero addend %Ld"
-		     " against local symbol"),
+		  (_("%pB, section %pA: relocation %s with non-zero addend %"
+		     PRId64 " against local symbol"),
 		   input_bfd,
 		   input_section,
 		   elf32_tic6x_howto_table[r_type].name,
-		   rel->r_addend);
+		   (int64_t) rel->r_addend);
 	      else
 		_bfd_error_handler
 		  /* xgettext:c-format */
-		  (_("%pB, section %pA: relocation %s with non-zero addend %Ld"
-		     " against symbol `%s'"),
+		  (_("%pB, section %pA: relocation %s with non-zero addend %"
+		     PRId64 " against symbol `%s'"),
 		   input_bfd,
 		   input_section,
 		   elf32_tic6x_howto_table[r_type].name,
-		   rel->r_addend,
+		   (int64_t) rel->r_addend,
 		   h->root.root.string[0] != '\0' ? h->root.root.string
 		   : _("[whose name is lost]"));
 
diff --git a/bfd/elf32-tilepro.c b/bfd/elf32-tilepro.c
index 442e582..24fc64e 100644
--- a/bfd/elf32-tilepro.c
+++ b/bfd/elf32-tilepro.c
@@ -3398,10 +3398,11 @@ tilepro_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
 				      rel->r_offset) != (bfd_vma) -1)
 	_bfd_error_handler
 	  /* xgettext:c-format */
-	  (_("%pB(%pA+%#Lx): unresolvable %s relocation against symbol `%s'"),
+	  (_("%pB(%pA+%#" PRIx64 "): "
+	     "unresolvable %s relocation against symbol `%s'"),
 	   input_bfd,
 	   input_section,
-	   rel->r_offset,
+	   (uint64_t) rel->r_offset,
 	   howto->name,
 	   h->root.root.string);
 
diff --git a/bfd/elf32-v850.c b/bfd/elf32-v850.c
index 5fb3732..3b5ce94 100644
--- a/bfd/elf32-v850.c
+++ b/bfd/elf32-v850.c
@@ -3598,9 +3598,9 @@ v850_elf_relax_section (bfd *abfd,
 		{
 		  _bfd_error_handler
 		    /* xgettext:c-format */
-		    (_("%pB: %#Lx: warning: R_V850_LONGCALL points to "
+		    (_("%pB: %#" PRIx64 ": warning: R_V850_LONGCALL points to "
 		       "unrecognized insns"),
-		     abfd, irel->r_offset);
+		     abfd, (uint64_t) irel->r_offset);
 		  continue;
 		}
 
@@ -3608,10 +3608,10 @@ v850_elf_relax_section (bfd *abfd,
 		{
 		  _bfd_error_handler
 		    /* xgettext:c-format */
-		    (_("%pB: %#Lx: warning: R_V850_LONGCALL points to "
+		    (_("%pB: %#" PRIx64 ": warning: R_V850_LONGCALL points to "
 		       "unrecognized insn %#x"),
 		     abfd,
-		     irel->r_offset + no_match,
+		     (uint64_t) (irel->r_offset + no_match),
 		     insn[no_match]);
 		  continue;
 		}
@@ -3653,9 +3653,9 @@ v850_elf_relax_section (bfd *abfd,
 		{
 		  _bfd_error_handler
 		    /* xgettext:c-format */
-		    (_("%pB: %#Lx: warning: R_V850_LONGCALL points to "
+		    (_("%pB: %#" PRIx64 ": warning: R_V850_LONGCALL points to "
 		       "unrecognized reloc"),
-		     abfd, irel->r_offset);
+		     abfd, (uint64_t) irel->r_offset);
 
 		  continue;
 		}
@@ -3693,10 +3693,10 @@ v850_elf_relax_section (bfd *abfd,
 		{
 		  _bfd_error_handler
 		    /* xgettext:c-format */
-		    (_("%pB: %#Lx: warning: R_V850_LONGCALL points to "
-		       "unrecognized reloc %#Lx"),
-		     abfd, irel->r_offset,
-		     irelcall->r_offset);
+		    (_("%pB: %#" PRIx64 ": warning: R_V850_LONGCALL points to "
+		       "unrecognized reloc %#" PRIx64),
+		     abfd, (uint64_t) irel->r_offset,
+		     (uint64_t) irelcall->r_offset);
 		  continue;
 		}
 
@@ -3836,9 +3836,9 @@ v850_elf_relax_section (bfd *abfd,
 		{
 		  _bfd_error_handler
 		    /* xgettext:c-format */
-		    (_("%pB: %#Lx: warning: R_V850_LONGJUMP points to "
+		    (_("%pB: %#" PRIx64 ": warning: R_V850_LONGJUMP points to "
 		       "unrecognized insns"),
-		     abfd, irel->r_offset);
+		     abfd, (uint64_t) irel->r_offset);
 		  continue;
 		}
 
@@ -3846,10 +3846,10 @@ v850_elf_relax_section (bfd *abfd,
 		{
 		  _bfd_error_handler
 		    /* xgettext:c-format */
-		    (_("%pB: %#Lx: warning: R_V850_LONGJUMP points to "
+		    (_("%pB: %#" PRIx64 ": warning: R_V850_LONGJUMP points to "
 		       "unrecognized insn %#x"),
 		     abfd,
-		     irel->r_offset + no_match,
+		     (uint64_t) (irel->r_offset + no_match),
 		     insn[no_match]);
 		  continue;
 		}
@@ -3880,9 +3880,9 @@ v850_elf_relax_section (bfd *abfd,
 		{
 		  _bfd_error_handler
 		    /* xgettext:c-format */
-		    (_("%pB: %#Lx: warning: R_V850_LONGJUMP points to "
+		    (_("%pB: %#" PRIx64 ": warning: R_V850_LONGJUMP points to "
 		       "unrecognized reloc"),
-		     abfd, irel->r_offset);
+		     abfd, (uint64_t) irel->r_offset);
 		  continue;
 		}
 
diff --git a/bfd/elf32-vax.c b/bfd/elf32-vax.c
index 773e06d..6cee38b 100644
--- a/bfd/elf32-vax.c
+++ b/bfd/elf32-vax.c
@@ -628,10 +628,10 @@ elf_vax_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
 		  if (eh->got_addend != (bfd_vma) rel->r_addend)
 		    _bfd_error_handler
 		      /* xgettext:c-format */
-		      (_("%pB: warning: GOT addend of %Ld to `%s' does"
-			 " not match previous GOT addend of %Ld"),
-			 abfd, rel->r_addend, h->root.root.string,
-			 eh->got_addend);
+		      (_("%pB: warning: GOT addend of %" PRId64 " to `%s' does"
+			 " not match previous GOT addend of %" PRId64),
+			 abfd, (int64_t) rel->r_addend, h->root.root.string,
+			 (int64_t) eh->got_addend);
 
 		}
 	    }
@@ -1442,9 +1442,10 @@ elf_vax_relocate_section (bfd *output_bfd,
 	  else if (rel->r_addend != 0)
 	    _bfd_error_handler
 	      /* xgettext:c-format */
-	      (_("%pB: warning: PLT addend of %Ld to `%s'"
+	      (_("%pB: warning: PLT addend of %" PRId64 " to `%s'"
 		 " from %pA section ignored"),
-	       input_bfd, rel->r_addend, h->root.root.string, input_section);
+	       input_bfd, (int64_t) rel->r_addend, h->root.root.string,
+	       input_section);
 	  rel->r_addend = 0;
 
 	  break;
@@ -1574,8 +1575,9 @@ elf_vax_relocate_section (bfd *output_bfd,
 		  else
 		    _bfd_error_handler
 		      /* xgettext:c-format */
-		      (_("%pB: warning: %s relocation to %#Lx from %pA section"),
-		      input_bfd, howto->name, outrel.r_addend,
+		      (_("%pB: warning: %s relocation to %#" PRIx64
+			 " from %pA section"),
+		      input_bfd, howto->name, (uint64_t) outrel.r_addend,
 		      input_section);
 		}
 	      loc = sreloc->contents;
diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c
index 44c8589..86ecbcb 100644
--- a/bfd/elf32-xtensa.c
+++ b/bfd/elf32-xtensa.c
@@ -2652,8 +2652,10 @@ elf_xtensa_relocate_section (bfd *output_bfd,
 	{
 	  _bfd_error_handler
 	    /* xgettext:c-format */
-	    (_("%pB(%pA+%#Lx): relocation offset out of range (size=%#Lx)"),
-	     input_bfd, input_section, rel->r_offset, input_size);
+	    (_("%pB(%pA+%#" PRIx64 "): "
+	       "relocation offset out of range (size=%#" PRIx64 ")"),
+	     input_bfd, input_section, (uint64_t) rel->r_offset,
+	     (uint64_t) input_size);
 	  bfd_set_error (bfd_error_bad_value);
 	  return FALSE;
 	}
@@ -2678,12 +2680,12 @@ elf_xtensa_relocate_section (bfd *output_bfd,
 	  _bfd_error_handler
 	    ((sym_type == STT_TLS
 	      /* xgettext:c-format */
-	      ? _("%pB(%pA+%#Lx): %s used with TLS symbol %s")
+	      ? _("%pB(%pA+%#" PRIx64 "): %s used with TLS symbol %s")
 	      /* xgettext:c-format */
-	      : _("%pB(%pA+%#Lx): %s used with non-TLS symbol %s")),
+	      : _("%pB(%pA+%#" PRIx64 "): %s used with non-TLS symbol %s")),
 	     input_bfd,
 	     input_section,
-	     rel->r_offset,
+	     (uint64_t) rel->r_offset,
 	     howto->name,
 	     name);
 	}
@@ -2936,10 +2938,11 @@ elf_xtensa_relocate_section (bfd *output_bfd,
 	{
 	  _bfd_error_handler
 	    /* xgettext:c-format */
-	    (_("%pB(%pA+%#Lx): unresolvable %s relocation against symbol `%s'"),
+	    (_("%pB(%pA+%#" PRIx64 "): "
+	       "unresolvable %s relocation against symbol `%s'"),
 	     input_bfd,
 	     input_section,
-	     rel->r_offset,
+	     (uint64_t) rel->r_offset,
 	     howto->name,
 	     name);
 	  return FALSE;
@@ -6414,9 +6417,10 @@ extend_ebb_bounds_forward (ebb_t *ebb)
 	{
 	  _bfd_error_handler
 	    /* xgettext:c-format */
-	    (_("%pB(%pA+%#Lx): could not decode instruction; "
+	    (_("%pB(%pA+%#" PRIx64 "): could not decode instruction; "
 	       "possible configuration mismatch"),
-	     ebb->sec->owner, ebb->sec, ebb->end_offset + insn_block_len);
+	     ebb->sec->owner, ebb->sec,
+	     (uint64_t) (ebb->end_offset + insn_block_len));
 	  return FALSE;
 	}
       ebb->end_offset += insn_block_len;
@@ -6492,9 +6496,10 @@ extend_ebb_bounds_backward (ebb_t *ebb)
 	{
 	  _bfd_error_handler
 	    /* xgettext:c-format */
-	    (_("%pB(%pA+%#Lx): could not decode instruction; "
+	    (_("%pB(%pA+%#" PRIx64 "): could not decode instruction; "
 	       "possible configuration mismatch"),
-	     ebb->sec->owner, ebb->sec, ebb->end_offset + insn_block_len);
+	     ebb->sec->owner, ebb->sec,
+	     (uint64_t) (ebb->end_offset + insn_block_len));
 	  return FALSE;
 	}
       ebb->start_offset -= insn_block_len;
@@ -7607,10 +7612,10 @@ compute_text_actions (bfd *abfd,
 	{
 	  _bfd_error_handler
 	    /* xgettext:c-format */
-	    (_("%pB(%pA+%#Lx): could not decode instruction for "
+	    (_("%pB(%pA+%#" PRIx64 "): could not decode instruction for "
 	       "XTENSA_ASM_SIMPLIFY relocation; "
 	       "possible configuration mismatch"),
-	     sec->owner, sec, r_offset);
+	     sec->owner, sec, (uint64_t) r_offset);
 	  continue;
 	}
 
@@ -7868,9 +7873,9 @@ compute_ebb_proposed_actions (ebb_constraint *ebb_table)
  decode_error:
   _bfd_error_handler
     /* xgettext:c-format */
-    (_("%pB(%pA+%#Lx): could not decode instruction; "
+    (_("%pB(%pA+%#" PRIx64 "): could not decode instruction; "
        "possible configuration mismatch"),
-     ebb->sec->owner, ebb->sec, offset);
+     ebb->sec->owner, ebb->sec, (uint64_t) offset);
   return FALSE;
 }
 
@@ -10646,8 +10651,8 @@ do_fix_for_relocatable_link (Elf_Internal_Rela *rel,
 	{
 	  _bfd_error_handler
 	    /* xgettext:c-format */
-	    (_("%pB(%pA+%#Lx): unexpected fix for %s relocation"),
-	     input_bfd, input_section, rel->r_offset,
+	    (_("%pB(%pA+%#" PRIx64 "): unexpected fix for %s relocation"),
+	     input_bfd, input_section, (uint64_t) rel->r_offset,
 	     elf_howto_table[r_type].name);
 	  return FALSE;
 	}
diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c
index eb71153..8db0987 100644
--- a/bfd/elf64-alpha.c
+++ b/bfd/elf64-alpha.c
@@ -3014,8 +3014,9 @@ elf64_alpha_relax_got_load (struct alpha_relax_info *info, bfd_vma symval,
       reloc_howto_type *howto = elf64_alpha_howto_table + r_type;
       _bfd_error_handler
 	/* xgettext:c-format */
-	(_("%pB: %pA+%#Lx: warning: %s relocation against unexpected insn"),
-	 info->abfd, info->sec, irel->r_offset, howto->name);
+	(_("%pB: %pA+%#" PRIx64 ": warning: "
+	   "%s relocation against unexpected insn"),
+	 info->abfd, info->sec, (uint64_t) irel->r_offset, howto->name);
       return TRUE;
     }
 
@@ -3209,8 +3210,9 @@ elf64_alpha_relax_with_lituse (struct alpha_relax_info *info,
     {
       _bfd_error_handler
 	/* xgettext:c-format */
-	(_("%pB: %pA+%#Lx: warning: LITERAL relocation against unexpected insn"),
-	 abfd, info->sec, irel->r_offset);
+	(_("%pB: %pA+%#" PRIx64 ": warning: "
+	   "LITERAL relocation against unexpected insn"),
+	 abfd, info->sec, (uint64_t) irel->r_offset);
       return TRUE;
     }
 
diff --git a/bfd/elf64-hppa.c b/bfd/elf64-hppa.c
index a289c73..2e66c92 100644
--- a/bfd/elf64-hppa.c
+++ b/bfd/elf64-hppa.c
@@ -2078,8 +2078,8 @@ elf64_hppa_finish_dynamic_symbol (bfd *output_bfd,
 	{
 	  _bfd_error_handler
 	    /* xgettext:c-format */
-	    (_("stub entry for %s cannot load .plt, dp offset = %Ld"),
-	     hh->eh.root.root.string, value);
+	    (_("stub entry for %s cannot load .plt, dp offset = %" PRId64),
+	     hh->eh.root.root.string, (int64_t) value);
 	  return FALSE;
 	}
 
@@ -3283,10 +3283,10 @@ elf_hppa_final_link_relocate (Elf_Internal_Rela *rel,
 	  {
 	    _bfd_error_handler
 	      /* xgettext:c-format */
-	      (_("%pB(%pA+%#Lx): cannot reach %s"),
+	      (_("%pB(%pA+%#" PRIx64 "): cannot reach %s"),
 	      input_bfd,
 	      input_section,
-	      offset,
+	      (uint64_t) offset,
 	      eh ? eh->root.root.string : "unknown");
 	    bfd_set_error (bfd_error_bad_value);
 	    return bfd_reloc_overflow;
diff --git a/bfd/elf64-ia64-vms.c b/bfd/elf64-ia64-vms.c
index c536e15..e8cae73 100644
--- a/bfd/elf64-ia64-vms.c
+++ b/bfd/elf64-ia64-vms.c
@@ -584,9 +584,9 @@ elf64_ia64_relax_section (bfd *abfd, asection *sec,
 	    {
 	      _bfd_error_handler
 		/* xgettext:c-format */
-		(_("%pB: Can't relax br at %#Lx in section `%pA'."
+		(_("%pB: Can't relax br at %#" PRIx64 " in section `%pA'."
 		   " Please use brl or indirect branch."),
-		 sec->owner, roff, sec);
+		 sec->owner, (uint64_t) roff, sec);
 	      bfd_set_error (bfd_error_bad_value);
 	      goto error_return;
 	    }
@@ -3278,8 +3278,8 @@ elf64_ia64_choose_gp (bfd *abfd, struct bfd_link_info *info, bfd_boolean final)
 overflow:
 	  _bfd_error_handler
 	    /* xgettext:c-format */
-	    (_("%pB: short data segment overflowed (%#Lx >= 0x400000)"),
-	     abfd, max_short_vma - min_short_vma);
+	    (_("%pB: short data segment overflowed (%#" PRIx64 " >= 0x400000)"),
+	     abfd, (uint64_t) (max_short_vma - min_short_vma));
 	  return FALSE;
 	}
       else if ((gp_val > min_short_vma
@@ -3947,9 +3947,9 @@ elf64_ia64_relocate_section (bfd *output_bfd,
 		_bfd_error_handler
 		  /* xgettext:c-format */
 		  (_("%pB: missing TLS section for relocation %s against `%s'"
-		     " at %#Lx in section `%pA'."),
+		     " at %#" PRIx64 " in section `%pA'."),
 		   input_bfd, howto->name, name,
-		   rel->r_offset, input_section);
+		   (uint64_t) rel->r_offset, input_section);
 		break;
 
 	      case R_IA64_PCREL21B:
@@ -3963,10 +3963,11 @@ elf64_ia64_relocate_section (bfd *output_bfd,
 		       that the section is too big to relax.  */
 		    _bfd_error_handler
 		      /* xgettext:c-format */
-		      (_("%pB: Can't relax br (%s) to `%s' at %#Lx in section"
-			 " `%pA' with size %#Lx (> 0x1000000)."),
-		       input_bfd, howto->name, name, rel->r_offset,
-		       input_section, input_section->size);
+		      (_("%pB: Can't relax br (%s) to `%s' "
+			 "at %#" PRIx64 " in section `%pA' "
+			 "with size %#" PRIx64 " (> 0x1000000)."),
+		       input_bfd, howto->name, name, (uint64_t) rel->r_offset,
+		       input_section, (uint64_t) input_section->size);
 		    break;
 		  }
 		/* Fall through.  */
@@ -5158,8 +5159,9 @@ error_free_dyn:
 		_bfd_error_handler
 		  /* xgettext:c-format */
 		  (_("Warning: size of symbol `%s' changed"
-		     " from %Lu in %pB to %Lu in %pB"),
-		   name, h->size, old_bfd, isym->st_size, abfd);
+		     " from %" PRIu64 " in %pB to %" PRIu64 " in %pB"),
+		   name, (uint64_t) h->size, old_bfd,
+		   (uint64_t) isym->st_size, abfd);
 
 	      h->size = isym->st_size;
 	    }
diff --git a/bfd/elf64-mmix.c b/bfd/elf64-mmix.c
index 472f56e..126133b 100644
--- a/bfd/elf64-mmix.c
+++ b/bfd/elf64-mmix.c
@@ -1193,10 +1193,10 @@ mmix_elf_perform_relocation (asection *isec, reloc_howto_type *howto,
 	    _bfd_error_handler
 	      /* xgettext:c-format */
 	      (_("%pB: Internal inconsistency error for value for\n\
- linker-allocated global register: linked: %#Lx != relaxed: %#Lx"),
+ linker-allocated global register: linked: %#" PRIx64 " != relaxed: %#" PRIx64 ""),
 	       isec->owner,
-	       value,
-	       gregdata->reloc_request[bpo_index].value);
+	       (uint64_t) value,
+	       (uint64_t) gregdata->reloc_request[bpo_index].value);
 	    bfd_set_error (bfd_error_bad_value);
 	    return bfd_reloc_overflow;
 	  }
@@ -1738,9 +1738,10 @@ mmix_final_link_relocate (reloc_howto_type *howto, asection *input_section,
 	    /* FIXME: Better error message.  */
 	    _bfd_error_handler
 	      /* xgettext:c-format */
-	      (_("%pB: LOCAL directive: Register $%Ld is not a local register."
-		 "  First global register is $%Ld."),
-	       input_section->owner, srel, first_global);
+	      (_("%pB: LOCAL directive: "
+		 "Register $%" PRId64 " is not a local register."
+		 "  First global register is $%" PRId64 "."),
+	       input_section->owner, (int64_t) srel, (int64_t) first_global);
 
 	    return bfd_reloc_overflow;
 	  }
diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c
index 9a3ee44..1e1b39b 100644
--- a/bfd/elf64-s390.c
+++ b/bfd/elf64-s390.c
@@ -2072,10 +2072,10 @@ invalid_tls_insn (bfd *input_bfd,
   howto = elf_howto_table + ELF64_R_TYPE (rel->r_info);
   _bfd_error_handler
     /* xgettext:c-format */
-    (_("%pB(%pA+%#Lx): invalid instruction for TLS relocation %s"),
+    (_("%pB(%pA+%#" PRIx64 "): invalid instruction for TLS relocation %s"),
      input_bfd,
      input_section,
-     rel->r_offset,
+     (uint64_t) rel->r_offset,
      howto->name);
   bfd_set_error (bfd_error_bad_value);
 }
@@ -3115,10 +3115,11 @@ elf_s390_relocate_section (bfd *output_bfd,
 				      rel->r_offset) != (bfd_vma) -1)
 	_bfd_error_handler
 	  /* xgettext:c-format */
-	  (_("%pB(%pA+%#Lx): unresolvable %s relocation against symbol `%s'"),
+	  (_("%pB(%pA+%#" PRIx64 "): "
+	     "unresolvable %s relocation against symbol `%s'"),
 	   input_bfd,
 	   input_section,
-	   rel->r_offset,
+	   (uint64_t) rel->r_offset,
 	   howto->name,
 	   h->root.root.string);
 
@@ -3172,9 +3173,9 @@ elf_s390_relocate_section (bfd *output_bfd,
 	    {
 	      _bfd_error_handler
 		/* xgettext:c-format */
-		(_("%pB(%pA+%#Lx): reloc against `%s': error %d"),
+		(_("%pB(%pA+%#" PRIx64 "): reloc against `%s': error %d"),
 		 input_bfd, input_section,
-		 rel->r_offset, name, (int) r);
+		 (uint64_t) rel->r_offset, name, (int) r);
 	      return FALSE;
 	    }
 	}
diff --git a/bfd/elf64-sh64.c b/bfd/elf64-sh64.c
index 8d64046..5c8c2e8 100644
--- a/bfd/elf64-sh64.c
+++ b/bfd/elf64-sh64.c
@@ -1536,9 +1536,10 @@ sh_elf64_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
 		{
 		  _bfd_error_handler
 		    /* xgettext:c-format */
-		    (_("%pB(%pA+%#Lx): %s relocation against SEC_MERGE section"),
+		    (_("%pB(%pA+%#" PRIx64 "): "
+		       "%s relocation against SEC_MERGE section"),
 		     input_bfd, input_section,
-		     rel->r_offset, howto->name);
+		     (uint64_t) rel->r_offset, howto->name);
 		  return FALSE;
 		}
 
@@ -1633,10 +1634,11 @@ sh_elf64_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
 		{
 		  _bfd_error_handler
 		    /* xgettext:c-format */
-		    (_("%pB(%pA+%#Lx): unresolvable %s relocation against symbol `%s'"),
+		    (_("%pB(%pA+%#" PRIx64 "): "
+		       "unresolvable %s relocation against symbol `%s'"),
 		     input_bfd,
 		     input_section,
-		     rel->r_offset,
+		     (uint64_t) rel->r_offset,
 		     howto->name,
 		     h->root.root.string);
 		}
@@ -1677,9 +1679,10 @@ sh_elf64_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
 	{
 	  _bfd_error_handler
 	    /* xgettext:c-format */
-	    (_("%pB: error: unaligned relocation type %d at %08Lx reloc %08Lx"),
-	     input_bfd, (int) r_type, rel->r_offset,
-	     relocation);
+	    (_("%pB: error: unaligned relocation type %d at "
+	       "%08" PRIx64 " reloc %08" PRIx64 ""),
+	     input_bfd, (int) r_type,
+	     (uint64_t) rel->r_offset, (uint64_t) relocation);
 	  bfd_set_error (bfd_error_bad_value);
 	  return FALSE;
 	}
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index b9efcfc..d66d9ba 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -1332,9 +1332,9 @@ elf_x86_64_tls_transition (struct bfd_link_info *info, bfd *abfd,
 
       _bfd_error_handler
 	/* xgettext:c-format */
-	(_("%pB: TLS transition from %s to %s against `%s' at %#Lx "
-	   "in section `%pA' failed"),
-	 abfd, from->name, to->name, name, rel->r_offset, sec);
+	(_("%pB: TLS transition from %s to %s against `%s' at %#" PRIx64
+	   " in section `%pA' failed"),
+	 abfd, from->name, to->name, name, (uint64_t) rel->r_offset, sec);
       bfd_set_error (bfd_error_bad_value);
       return FALSE;
     }
@@ -2645,8 +2645,8 @@ do_ifunc_pointer:
 		  _bfd_error_handler
 		    /* xgettext:c-format */
 		    (_("%pB: relocation %s against STT_GNU_IFUNC "
-		       "symbol `%s' has non-zero addend: %Ld"),
-		     input_bfd, howto->name, name, rel->r_addend);
+		       "symbol `%s' has non-zero addend: %" PRId64),
+		     input_bfd, howto->name, name, (int64_t) rel->r_addend);
 		  bfd_set_error (bfd_error_bad_value);
 		  return FALSE;
 		}
@@ -3156,10 +3156,11 @@ direct:
 			  _bfd_error_handler
 			    /* xgettext:c-format */
 			    (_("%pB: addend %s%#x in relocation %s against "
-			       "symbol `%s' at %#Lx in section `%pA' is "
-			       "out of range"),
+			       "symbol `%s' at %#" PRIx64
+			       " in section `%pA' is out of range"),
 			     input_bfd, addend < 0 ? "-" : "", addend,
-			     howto->name, name, rel->r_offset, input_section);
+			     howto->name, name, (uint64_t) rel->r_offset,
+			     input_section);
 			  bfd_set_error (bfd_error_bad_value);
 			  return FALSE;
 			}
@@ -3792,10 +3793,11 @@ direct:
 	    default:
 	      _bfd_error_handler
 		/* xgettext:c-format */
-		(_("%pB(%pA+%#Lx): unresolvable %s relocation against symbol `%s'"),
+		(_("%pB(%pA+%#" PRIx64 "): "
+		   "unresolvable %s relocation against symbol `%s'"),
 		 input_bfd,
 		 input_section,
-		 rel->r_offset,
+		 (uint64_t) rel->r_offset,
 		 howto->name,
 		 h->root.root.string);
 	      return FALSE;
@@ -3841,9 +3843,9 @@ check_relocation_error:
 	    {
 	      _bfd_error_handler
 		/* xgettext:c-format */
-		(_("%pB(%pA+%#Lx): reloc against `%s': error %d"),
+		(_("%pB(%pA+%#" PRIx64 "): reloc against `%s': error %d"),
 		 input_bfd, input_section,
-		 rel->r_offset, name, (int) r);
+		 (uint64_t) rel->r_offset, name, (int) r);
 	      return FALSE;
 	    }
 	}
diff --git a/bfd/elfcode.h b/bfd/elfcode.h
index 947b193..14c8187 100644
--- a/bfd/elfcode.h
+++ b/bfd/elfcode.h
@@ -1196,9 +1196,10 @@ elf_slurp_symbol_table (bfd *abfd, asymbol **symptrs, bfd_boolean dynamic)
 	{
 	  _bfd_error_handler
 	    /* xgettext:c-format */
-	    (_("%pB: version count (%Ld) does not match symbol count (%ld)"),
+	    (_("%pB: version count (%" PRId64 ")"
+	       " does not match symbol count (%ld)"),
 	     abfd,
-	     verhdr->sh_size / sizeof (Elf_External_Versym),
+	     (int64_t) (verhdr->sh_size / sizeof (Elf_External_Versym)),
 	     symcount);
 
 	  /* Slurp in the symbols without the version information,
diff --git a/bfd/elfcore.h b/bfd/elfcore.h
index 34a18a5..e0b39a7 100644
--- a/bfd/elfcore.h
+++ b/bfd/elfcore.h
@@ -298,8 +298,8 @@ elf_core_file_p (bfd *abfd)
 	    _bfd_error_handler
 	      /* xgettext:c-format */
 	      (_("warning: %pB is truncated: expected core file "
-		 "size >= %Lu, found: %llu"),
-	       abfd, high, (unsigned long long) statbuf.st_size);
+		 "size >= %" PRIu64 ", found: %llu"),
+	       abfd, (uint64_t) high, (unsigned long long) statbuf.st_size);
 	  }
       }
   }
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 5d95b2e..d9be924 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -2440,10 +2440,10 @@ elf_link_read_relocs_from_section (bfd *abfd,
 	    {
 	      _bfd_error_handler
 		/* xgettext:c-format */
-		(_("%pB: bad reloc symbol index (%#Lx >= %#lx)"
-		   " for offset %#Lx in section `%pA'"),
-		 abfd, r_symndx, (unsigned long) nsyms,
-		 irela->r_offset, sec);
+		(_("%pB: bad reloc symbol index (%#" PRIx64 " >= %#lx)"
+		   " for offset %#" PRIx64 " in section `%pA'"),
+		 abfd, (uint64_t) r_symndx, (unsigned long) nsyms,
+		 (uint64_t) irela->r_offset, sec);
 	      bfd_set_error (bfd_error_bad_value);
 	      return FALSE;
 	    }
@@ -2452,11 +2452,11 @@ elf_link_read_relocs_from_section (bfd *abfd,
 	{
 	  _bfd_error_handler
 	    /* xgettext:c-format */
-	    (_("%pB: non-zero symbol index (%#Lx)"
-	       " for offset %#Lx in section `%pA'"
+	    (_("%pB: non-zero symbol index (%#" PRIx64 ")"
+	       " for offset %#" PRIx64 " in section `%pA'"
 	       " when the object file has no symbol table"),
-	     abfd, r_symndx,
-	     irela->r_offset, sec);
+	     abfd, (uint64_t) r_symndx,
+	     (uint64_t) irela->r_offset, sec);
 	  bfd_set_error (bfd_error_bad_value);
 	  return FALSE;
 	}
@@ -4804,8 +4804,9 @@ error_free_dyn:
 		_bfd_error_handler
 		  /* xgettext:c-format */
 		  (_("Warning: size of symbol `%s' changed"
-		     " from %Lu in %pB to %Lu in %pB"),
-		   name, h->size, old_bfd, isym->st_size, abfd);
+		     " from %" PRIu64 " in %pB to %" PRIu64 " in %pB"),
+		   name, (uint64_t) h->size, old_bfd,
+		   (uint64_t) isym->st_size, abfd);
 
 	      h->size = isym->st_size;
 	    }
@@ -10584,9 +10585,9 @@ elf_link_input_bfd (struct elf_final_link_info *flinfo, bfd *input_bfd)
 		    {
 		      _bfd_error_handler
 			/* xgettext:c-format */
-			(_("error: %pB contains a reloc (%#Lx) for section %pA "
+			(_("error: %pB contains a reloc (%#" PRIx64 ") for section %pA "
 			   "that references a non-existent global symbol"),
-			 input_bfd, rel->r_info, o);
+			 input_bfd, (uint64_t) rel->r_info, o);
 		      bfd_set_error (bfd_error_bad_value);
 		      return FALSE;
 		    }
@@ -13508,8 +13509,8 @@ bfd_elf_gc_record_vtinherit (bfd *abfd,
     }
 
   /* xgettext:c-format */
-  _bfd_error_handler (_("%pB: %pA+%#Lx: No symbol found for INHERIT"),
-		      abfd, sec, offset);
+  _bfd_error_handler (_("%pB: %pA+%#" PRIx64 ": No symbol found for INHERIT"),
+		      abfd, sec, (uint64_t) offset);
   bfd_set_error (bfd_error_invalid_operation);
   return FALSE;
 
diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
index 70fbe93..e1797b3 100644
--- a/bfd/elfnn-aarch64.c
+++ b/bfd/elfnn-aarch64.c
@@ -5106,8 +5106,10 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto,
 	    name = bfd_elf_sym_name (input_bfd, symtab_hdr, sym, NULL);
 	  _bfd_error_handler
 	    /* xgettext:c-format */
-	    (_("%pB(%pA+%#Lx): unresolvable %s relocation against symbol `%s'"),
-	     input_bfd, input_section, rel->r_offset, howto->name, name);
+	    (_("%pB(%pA+%#" PRIx64 "): "
+	       "unresolvable %s relocation against symbol `%s'"),
+	     input_bfd, input_section, (uint64_t) rel->r_offset,
+	     howto->name, name);
 	  bfd_set_error (bfd_error_bad_value);
 	  return bfd_reloc_notsupported;
 	}
@@ -5146,8 +5148,8 @@ bad_ifunc_reloc:
 	      _bfd_error_handler
 		/* xgettext:c-format */
 		(_("%pB: relocation %s against STT_GNU_IFUNC "
-		   "symbol `%s' has non-zero addend: %Ld"),
-		 input_bfd, howto->name, name, rel->r_addend);
+		   "symbol `%s' has non-zero addend: %" PRId64),
+		 input_bfd, howto->name, name, (int64_t) rel->r_addend);
 	      bfd_set_error (bfd_error_bad_value);
 	      return bfd_reloc_notsupported;
 	    }
@@ -6297,11 +6299,11 @@ elfNN_aarch64_relocate_section (bfd *output_bfd,
 	  _bfd_error_handler
 	    ((sym_type == STT_TLS
 	      /* xgettext:c-format */
-	      ? _("%pB(%pA+%#Lx): %s used with TLS symbol %s")
+	      ? _("%pB(%pA+%#" PRIx64 "): %s used with TLS symbol %s")
 	      /* xgettext:c-format */
-	      : _("%pB(%pA+%#Lx): %s used with non-TLS symbol %s")),
+	      : _("%pB(%pA+%#" PRIx64 "): %s used with non-TLS symbol %s")),
 	     input_bfd,
-	     input_section, rel->r_offset, howto->name, name);
+	     input_section, (uint64_t) rel->r_offset, howto->name, name);
 	}
 
       /* We relax only if we can see that there can be a valid transition
@@ -6569,8 +6571,9 @@ elfNN_aarch64_relocate_section (bfd *output_bfd,
 	{
 	  _bfd_error_handler
 	    /* xgettext:c-format */
-	    (_("%pB(%pA+%#Lx): unresolvable %s relocation against symbol `%s'"),
-	     input_bfd, input_section, rel->r_offset, howto->name,
+	    (_("%pB(%pA+%#" PRIx64 "): "
+	       "unresolvable %s relocation against symbol `%s'"),
+	     input_bfd, input_section, (uint64_t) rel->r_offset, howto->name,
 	     h->root.root.string);
 	  return FALSE;
 	}
diff --git a/bfd/elfnn-ia64.c b/bfd/elfnn-ia64.c
index 9d46ed5..842417a 100644
--- a/bfd/elfnn-ia64.c
+++ b/bfd/elfnn-ia64.c
@@ -617,9 +617,9 @@ elfNN_ia64_relax_section (bfd *abfd, asection *sec,
 	    {
 	      _bfd_error_handler
 		/* xgettext:c-format */
-		(_("%pB: Can't relax br at %#Lx in section `%pA'."
+		(_("%pB: Can't relax br at %#" PRIx64 " in section `%pA'."
 		   " Please use brl or indirect branch."),
-		 sec->owner, roff, sec);
+		 sec->owner, (uint64_t) roff, sec);
 	      bfd_set_error (bfd_error_bad_value);
 	      goto error_return;
 	    }
@@ -3693,8 +3693,8 @@ elfNN_ia64_choose_gp (bfd *abfd, struct bfd_link_info *info, bfd_boolean final)
 overflow:
 	  _bfd_error_handler
 	    /* xgettext:c-format */
-	    (_("%pB: short data segment overflowed (%#Lx >= 0x400000)"),
-	     abfd, max_short_vma - min_short_vma);
+	    (_("%pB: short data segment overflowed (%#" PRIx64 " >= 0x400000)"),
+	     abfd, (uint64_t) (max_short_vma - min_short_vma));
 	  return FALSE;
 	}
       else if ((gp_val > min_short_vma
@@ -4482,9 +4482,9 @@ missing_tls_sec:
 		_bfd_error_handler
 		  /* xgettext:c-format */
 		  (_("%pB: missing TLS section for relocation %s against `%s'"
-		     " at %#Lx in section `%pA'."),
+		     " at %#" PRIx64 " in section `%pA'."),
 		   input_bfd, howto->name, name,
-		   rel->r_offset, input_section);
+		   (uint64_t) rel->r_offset, input_section);
 		break;
 
 	      case R_IA64_PCREL21B:
@@ -4498,10 +4498,11 @@ missing_tls_sec:
 		       that the section is too big to relax.  */
 		    _bfd_error_handler
 		      /* xgettext:c-format */
-		      (_("%pB: Can't relax br (%s) to `%s' at %#Lx"
-			 " in section `%pA' with size %#Lx (> 0x1000000)."),
-		       input_bfd, howto->name, name, rel->r_offset,
-		       input_section, input_section->size);
+		      (_("%pB: Can't relax br (%s) to `%s' at %#" PRIx64
+			 " in section `%pA' with size %#" PRIx64
+			 " (> 0x1000000)."),
+		       input_bfd, howto->name, name, (uint64_t) rel->r_offset,
+		       input_section, (uint64_t) input_section->size);
 		    break;
 		  }
 		/* Fall through.  */
diff --git a/bfd/elfnn-riscv.c b/bfd/elfnn-riscv.c
index efbd882..5c8d4ab 100644
--- a/bfd/elfnn-riscv.c
+++ b/bfd/elfnn-riscv.c
@@ -2213,10 +2213,11 @@ riscv_elf_relocate_section (bfd *output_bfd,
 				      rel->r_offset) != (bfd_vma) -1)
 	{
 	  (*_bfd_error_handler)
-	    (_("%pB(%pA+%#Lx): unresolvable %s relocation against symbol `%s'"),
+	    (_("%pB(%pA+%#" PRIx64 "): "
+	       "unresolvable %s relocation against symbol `%s'"),
 	     input_bfd,
 	     input_section,
-	     rel->r_offset,
+	     (uint64_t) rel->r_offset,
 	     howto->name,
 	     h->root.root.string);
 	  continue;
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index 3d09048..7253090 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -7107,9 +7107,10 @@ _bfd_mips_elf_section_processing (bfd *abfd, Elf_Internal_Shdr *hdr)
       if (hdr->sh_size != sizeof (Elf32_External_RegInfo))
 	{
 	  _bfd_error_handler
-	    (_("%pB: Incorrect `.reginfo' section size; expected %Lu, got %Lu"),
-	     abfd, (bfd_size_type) sizeof (Elf32_External_RegInfo),
-	     hdr->sh_size);
+	    (_("%pB: Incorrect `.reginfo' section size; "
+	       "expected %" PRIu64 ", got %" PRIu64),
+	     abfd, (uint64_t) sizeof (Elf32_External_RegInfo),
+	     (uint64_t) hdr->sh_size);
 	  bfd_set_error (bfd_error_bad_value);
 	  return FALSE;
 	}
@@ -8471,8 +8472,8 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
 	    {
 	      _bfd_error_handler
 		/* xgettext:c-format */
-		(_("%pB: GOT reloc at %#Lx not expected in executables"),
-		 abfd, rel->r_offset);
+		(_("%pB: GOT reloc at %#" PRIx64 " not expected in executables"),
+		 abfd, (uint64_t) rel->r_offset);
 	      bfd_set_error (bfd_error_bad_value);
 	      return FALSE;
 	    }
@@ -8609,8 +8610,8 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
 	    {
 	      _bfd_error_handler
 		/* xgettext:c-format */
-		(_("%pB: CALL16 reloc at %#Lx not against global symbol"),
-		 abfd, rel->r_offset);
+		(_("%pB: CALL16 reloc at %#" PRIx64 " not against global symbol"),
+		 abfd, (uint64_t) rel->r_offset);
 	      bfd_set_error (bfd_error_bad_value);
 	      return FALSE;
 	    }
@@ -10153,9 +10154,9 @@ _bfd_mips_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
 		      _bfd_error_handler
 			/* xgettext:c-format */
 			(_("%pB: Can't find matching LO16 reloc against `%s'"
-			   " for %s at %#Lx in section `%pA'"),
+			   " for %s at %#" PRIx64 " in section `%pA'"),
 			 input_bfd, name,
-			 howto->name, rel->r_offset, input_section);
+			 howto->name, (uint64_t) rel->r_offset, input_section);
 		    }
 		}
 	      else
@@ -10696,11 +10697,11 @@ _bfd_mips_elf_finish_dynamic_symbol (bfd *output_bfd,
 		{
 		  _bfd_error_handler
 		    /* xgettext:c-format */
-		    (_("%pB: `%pA' offset of %Ld from `%pA' "
+		    (_("%pB: `%pA' offset of %" PRId64 " from `%pA' "
 		       "beyond the range of ADDIUPC"),
 		     output_bfd,
 		     htab->root.sgotplt->output_section,
-		    [...]

[diff truncated at 100000 bytes]


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]