- if (strcmp (t, name) == 0)
- return section;
- }
- return NULL;
-}
-
-/* Returns the IL symbol table of file ELF. */
-
-static Elf_Data *
-get_symtab (Elf *elf)
-{
- Elf_Data *data = 0;
- Elf_Scn *section = get_section (elf, ".gnu.lto_.symtab");
- if (!section)
- return NULL;
-
- data = elf_getdata (section, data);
- assert (data);
- return data;
-}
-
-/* Translate the IL symbol table SYMTAB. Write the slots and symbols in OUT. */
-
-static void
-translate (Elf_Data *symtab, struct plugin_symtab *out)
-{
- uint32_t *slots = NULL;
- char *data = symtab->d_buf;
- char *end = data + symtab->d_size;
- struct ld_plugin_symbol *syms = NULL;
- int n = 0;
-
- while (data < end)
- {
- n++;
- syms = realloc (syms, n * sizeof (struct ld_plugin_symbol));
- check (syms, LDPL_FATAL, "could not allocate memory");
- slots = realloc (slots, n * sizeof (uint32_t));
- check (slots, LDPL_FATAL, "could not allocate memory");
- data = parse_table_entry (data, &syms[n - 1], &slots[n - 1]);
+ if (strncmp (t, LTO_SECTION_PREFIX, strlen (LTO_SECTION_PREFIX)) == 0)
+ {
+ char *s = strrchr (t, '.');
+ if (s)
+ sscanf (s, ".%x", &out->id);
+ translate (elf_getdata (section, NULL), out);
+ found = 1;
+ }