diff mbox

[lto-plugin] : Fix pr 50616

Message ID CAEwic4Z_uQ3Y7qt7UNt=_0magxXt6ovO9hQB1oA_1Tdmsm04-w@mail.gmail.com
State New
Headers show

Commit Message

Kai Tietz Feb. 22, 2012, 10:05 a.m. UTC
Here is revised patch.  Sadly inttypes.h can't be used here.  So we
need local check for this.

ChangeLog

2012-02-22  Kai Tietz  <ktietz@redhat.com>

        PR lto/50616
        * lto-plugin.c (PRI_LL): New macro.
        (dump_symtab): Use PRI_LL instead of ll in print.
        (process_symtab): Use PRI_LL instead of ll in scan.

Tested for i686-w64-mingw32, x86_64-w64-mingw32, and for
x86_64-unknown-linux-gnu.

Ok for apply?

Regards,
Kai

Comments

Richard Biener Feb. 22, 2012, 10:12 a.m. UTC | #1
On Wed, Feb 22, 2012 at 11:05 AM, Kai Tietz <ktietz70@googlemail.com> wrote:
> Here is revised patch.  Sadly inttypes.h can't be used here.  So we
> need local check for this.
>
> ChangeLog
>
> 2012-02-22  Kai Tietz  <ktietz@redhat.com>
>
>        PR lto/50616
>        * lto-plugin.c (PRI_LL): New macro.
>        (dump_symtab): Use PRI_LL instead of ll in print.
>        (process_symtab): Use PRI_LL instead of ll in scan.
>
> Tested for i686-w64-mingw32, x86_64-w64-mingw32, and for
> x86_64-unknown-linux-gnu.
>
> Ok for apply?

Ok.

Thanks,
Richard.

> Regards,
> Kai
>
>
> Index: lto-plugin.c
> ===================================================================
> --- lto-plugin.c        (revision 184426)
> +++ lto-plugin.c        (working copy)
> @@ -62,6 +62,14 @@
>  #include "simple-object.h"
>  #include "plugin-api.h"
>
> +/* We need to use I64 instead of ll width-specifier on native Windows.
> +   The reason for this is that older MS-runtimes don't support the ll.  */
> +#ifdef __MINGW32__
> +#define PRI_LL "I64"
> +#else
> +#define PRI_LL "ll"
> +#endif
> +
>  /* Handle opening elf files on hosts, such as Windows, that may use
>    text file handling that will break binary access.  */
>  #ifndef O_BINARY
> @@ -360,7 +368,7 @@
>
>       assert (resolution != LDPR_UNKNOWN);
>
> -      fprintf (f, "%u %llx %s %s\n",
> +      fprintf (f, "%u %" PRI_LL "x %s %s\n",
>                (unsigned int) slot, symtab->aux[j].id,
>               lto_resolution_str[resolution],
>               symtab->syms[j].name);
> @@ -816,7 +824,7 @@
>
>   s = strrchr (name, '.');
>   if (s)
> -    sscanf (s, ".%llx", &obj->out->id);
> +    sscanf (s, ".%" PRI_LL "x", &obj->out->id);
>   secdata = xmalloc (length);
>   offset += obj->file->offset;
>   if (offset != lseek (obj->file->fd, offset, SEEK_SET)
Joseph Myers Feb. 22, 2012, 3:57 p.m. UTC | #2
On Wed, 22 Feb 2012, Kai Tietz wrote:

> 2012-02-22  Kai Tietz  <ktietz@redhat.com>
> 
>         PR lto/50616
>         * lto-plugin.c (PRI_LL): New macro.

Doesn't HOST_LONG_LONG_FORMAT already exist for this, so you don't need a 
local definition in this file?
diff mbox

Patch

Index: lto-plugin.c
===================================================================
--- lto-plugin.c        (revision 184426)
+++ lto-plugin.c        (working copy)
@@ -62,6 +62,14 @@ 
 #include "simple-object.h"
 #include "plugin-api.h"

+/* We need to use I64 instead of ll width-specifier on native Windows.
+   The reason for this is that older MS-runtimes don't support the ll.  */
+#ifdef __MINGW32__
+#define PRI_LL "I64"
+#else
+#define PRI_LL "ll"
+#endif
+
 /* Handle opening elf files on hosts, such as Windows, that may use
    text file handling that will break binary access.  */
 #ifndef O_BINARY
@@ -360,7 +368,7 @@ 

       assert (resolution != LDPR_UNKNOWN);

-      fprintf (f, "%u %llx %s %s\n",
+      fprintf (f, "%u %" PRI_LL "x %s %s\n",
                (unsigned int) slot, symtab->aux[j].id,
               lto_resolution_str[resolution],
               symtab->syms[j].name);
@@ -816,7 +824,7 @@ 

   s = strrchr (name, '.');
   if (s)
-    sscanf (s, ".%llx", &obj->out->id);
+    sscanf (s, ".%" PRI_LL "x", &obj->out->id);
   secdata = xmalloc (length);
   offset += obj->file->offset;
   if (offset != lseek (obj->file->fd, offset, SEEK_SET)