Support %Lx, %Lu, %Ld in _bfd_error_handler format
[deliverable/binutils-gdb.git] / bfd / bfd.c
index 23a435043a01533ae3fb902bf5e98a0ff2bb4734..b6cdf3f0ab4c8b87d394588e53a9ad53767220d4 100644 (file)
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -612,7 +612,9 @@ CODE_FRAGMENT
 static const char *_bfd_error_program_name;
 
 /* This macro and _doprnt taken from libiberty _doprnt.c, tidied a
-   little and extended to handle '%A' and '%B'.  */
+   little and extended to handle '%A' and '%B'.  '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.  */
 
 #define PRINT_TYPE(TYPE) \
   do                                                           \
@@ -721,6 +723,12 @@ _doprnt (FILE *stream, const char *format, va_list ap)
                  PRINT_TYPE (int);
                else
                  {
+                   /* L modifier for bfd_vma or bfd_size_type may be
+                      either long long or long.  */
+                   if ((BFD_ARCH_SIZE < 64 || BFD_HOST_64BIT_LONG)
+                       && sptr[-2] == 'L')
+                     wide_width = 1;
+
                    switch (wide_width)
                      {
                      case 0:
@@ -731,7 +739,17 @@ _doprnt (FILE *stream, const char *format, va_list ap)
                        break;
                      case 2:
                      default:
-#if defined(__GNUC__) || defined(HAVE_LONG_LONG)
+#if defined (__GNUC__) || defined (HAVE_LONG_LONG)
+# if defined (__MSVCRT__)
+                       sptr--;
+                       while (sptr[-1] == 'L' || sptr[-1] == 'l')
+                         sptr--;
+                       *sptr++ = 'I';
+                       *sptr++ = '6';
+                       *sptr++ = '4';
+                       *sptr++ = ptr[-1];
+                       *sptr = '\0';
+# endif
                        PRINT_TYPE (long long);
 #else
                        /* Fake it and hope for the best.  */
@@ -752,7 +770,7 @@ _doprnt (FILE *stream, const char *format, va_list ap)
                  PRINT_TYPE (double);
                else
                  {
-#if defined(__GNUC__) || defined(HAVE_LONG_DOUBLE)
+#if defined (__GNUC__) || defined (HAVE_LONG_DOUBLE)
                    PRINT_TYPE (long double);
 #else
                    /* Fake it and hope for the best.  */
@@ -1064,18 +1082,10 @@ DESCRIPTION
        section @var{sec} to the values @var{rel} and @var{count}.
        The argument @var{abfd} is ignored.
 
+.#define bfd_set_reloc(abfd, asect, location, count) \
+.     BFD_SEND (abfd, _bfd_set_reloc, (abfd, asect, location, count))
 */
 
-void
-bfd_set_reloc (bfd *ignore_abfd ATTRIBUTE_UNUSED,
-              sec_ptr asect,
-              arelent **location,
-              unsigned int count)
-{
-  asect->orelocation = location;
-  asect->reloc_count = count;
-}
-
 /*
 FUNCTION
        bfd_set_file_flags
@@ -1371,7 +1381,7 @@ bfd_scan_vma (const char *string, const char **end, int base)
   if (sizeof (bfd_vma) <= sizeof (unsigned long))
     return strtoul (string, (char **) end, base);
 
-#ifdef HAVE_STRTOULL
+#if defined (HAVE_STRTOULL) && defined (HAVE_LONG_LONG)
   if (sizeof (bfd_vma) <= sizeof (unsigned long long))
     return strtoull (string, (char **) end, base);
 #endif
This page took 0.024252 seconds and 4 git commands to generate.