OSDN Git Service

* lto.c (add_cgraph_node_to_partition,
[pf3gnuchains/gcc-fork.git] / gcc / lto / lto-elf.c
index 3798feb..6268a9c 100644 (file)
@@ -42,10 +42,15 @@ along with GCC; see the file COPYING3.  If not see
 #ifndef ELFOSABI_NONE
 # define ELFOSABI_NONE 0
 #endif
+
 #ifndef ELFOSABI_LINUX
 # define ELFOSABI_LINUX 3
 #endif
 
+#ifndef SHN_XINDEX
+# define SHN_XINDEX 0xffff
+#endif
+
 
 /* Handle opening elf files on hosts, such as Windows, that may use 
    text file handling that will break binary access.  */
@@ -158,31 +163,6 @@ lto_elf_free_shdr (Elf64_Shdr *shdr)
     free (shdr);
 }
 
-
-/* Returns a hash code for P.  */
-
-static hashval_t
-hash_name (const void *p)
-{
-  const struct lto_section_slot *ds = (const struct lto_section_slot *) p;
-  return (hashval_t) htab_hash_string (ds->name);
-}
-
-
-/* Returns nonzero if P1 and P2 are equal.  */
-
-static int
-eq_name (const void *p1, const void *p2)
-{
-  const struct lto_section_slot *s1 =
-    (const struct lto_section_slot *) p1;
-  const struct lto_section_slot *s2 =
-    (const struct lto_section_slot *) p2;
-
-  return strcmp (s1->name, s2->name) == 0;
-}
-
-
 /* Build a hash table whose key is the section names and whose data is
    the start and size of each section in the .o file.  */
 
@@ -194,7 +174,7 @@ lto_obj_build_section_table (lto_file *lto_file)
   Elf_Scn *section;
   size_t base_offset;
 
-  section_hash_table = htab_create (37, hash_name, eq_name, free);
+  section_hash_table = lto_obj_create_section_hash_table ();
 
   base_offset = elf_getbase (elf_file->elf);
   /* We are reasonably sure that elf_getbase does not fail at this
@@ -504,7 +484,6 @@ validate_file (lto_elf_file *elf_file)
       error ("could not read ELF identification information: %s",
              elf_errmsg (0));
       return false;
-            
     }
 
   if (!cached_file_attrs.initialized)
@@ -547,7 +526,10 @@ validate_file (lto_elf_file *elf_file)
 
       if (memcmp (elf_ident_buf, cached_file_attrs.elf_ident,
                  sizeof cached_file_attrs.elf_ident))
-       return false;
+       {
+         error ("incompatible ELF identification");
+         return false;
+       }
     }
 
   /* Check that the input file is a relocatable object file with the correct
@@ -697,7 +679,7 @@ lto_obj_file_open (const char *filename, bool writable)
                             NULL);
   if (!elf_file->elf)
     {
-      error ("could not open ELF file: %s", elf_errmsg (0));
+      error ("could not open %s as an ELF file: %s", fname, elf_errmsg (0));
       goto fail;
     }