OSDN Git Service

Mark ChangeLog
[pf3gnuchains/gcc-fork.git] / lto-plugin / lto-plugin.c
index 9323bd2..8d55cb8 100644 (file)
@@ -62,6 +62,14 @@ along with this program; see the file COPYING3.  If not see
 #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
@@ -130,7 +138,7 @@ enum symbol_style
 static char *arguments_file_name;
 static ld_plugin_register_claim_file register_claim_file;
 static ld_plugin_register_all_symbols_read register_all_symbols_read;
-static ld_plugin_get_symbols get_symbols;
+static ld_plugin_get_symbols get_symbols, get_symbols_v2;
 static ld_plugin_register_cleanup register_cleanup;
 static ld_plugin_add_input_file add_input_file;
 static ld_plugin_add_input_library add_input_library;
@@ -360,7 +368,7 @@ dump_symtab (FILE *f, struct plugin_symtab *symtab)
       
       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);
@@ -443,7 +451,12 @@ write_resolution (void)
       struct plugin_symtab *symtab = &info->symtab;
       struct ld_plugin_symbol *syms = symtab->syms;
 
-      get_symbols (info->handle, symtab->nsyms, syms);
+      /* Version 2 of API supports IRONLY_EXP resolution that is
+         accepted by GCC-4.7 and newer.  */
+      if (get_symbols_v2)
+        get_symbols_v2 (info->handle, symtab->nsyms, syms);
+      else
+        get_symbols (info->handle, symtab->nsyms, syms);
 
       finish_conflict_resolution (symtab, &info->conflicts);
 
@@ -811,7 +824,7 @@ process_symtab (void *data, const char *name, off_t offset, off_t length)
 
   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)
@@ -988,6 +1001,9 @@ onload (struct ld_plugin_tv *tv)
        case LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK:
          register_all_symbols_read = p->tv_u.tv_register_all_symbols_read;
          break;
+       case LDPT_GET_SYMBOLS_V2:
+         get_symbols_v2 = p->tv_u.tv_get_symbols;
+         break;
        case LDPT_GET_SYMBOLS:
          get_symbols = p->tv_u.tv_get_symbols;
          break;