#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. */
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. */
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
error ("could not read ELF identification information: %s",
elf_errmsg (0));
return false;
-
}
if (!cached_file_attrs.initialized)
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
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;
}