Convert 'L' to 'l' when setting wide_width to 1
authorH.J. Lu <hjl.tools@gmail.com>
Thu, 6 Jul 2017 13:52:13 +0000 (06:52 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Thu, 6 Jul 2017 13:52:13 +0000 (06:52 -0700)
When setting wide_width to 1, convert 'L' to 'l'.  Otherwise, %Lx/%Lu/%Ld
will be passed to fprintf which will treat the argument as long long.

* bfd.c (_doprnt): Convert 'L' to 'l' when setting wide_width
to 1.

bfd/ChangeLog
bfd/bfd.c

index f7363ba61e284c4eafe9711dd1275aa431b948e9..eda1e3edea51d2f3d897c07421f26ec5bfc8ed2f 100644 (file)
@@ -1,3 +1,8 @@
+2017-07-06  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * bfd.c (_doprnt): Convert 'L' to 'l' when setting wide_width
+       to 1.
+
 2017-07-05  H.J. Lu  <hongjiu.lu@intel.com>
 
        * dwarf2.c (line_info_add_include_dir_stub): Replace time with
index b6cdf3f0ab4c8b87d394588e53a9ad53767220d4..a119ac4f54e67e98a6de958c263e1531d24b0284 100644 (file)
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -727,7 +727,10 @@ _doprnt (FILE *stream, const char *format, va_list ap)
                       either long long or long.  */
                    if ((BFD_ARCH_SIZE < 64 || BFD_HOST_64BIT_LONG)
                        && sptr[-2] == 'L')
-                     wide_width = 1;
+                     {
+                       wide_width = 1;
+                       sptr[-2] = 'l';
+                     }
 
                    switch (wide_width)
                      {