typedef uint8_t GElf_Byte;
static unsigned int
-handle_core_item (Elf *core, const Ebl_Core_Item *item, const void *desc,
+handle_core_item (Elf *core, const GElf_Ehdr *ehdr,
+ const Ebl_Core_Item *item, const void *desc,
unsigned int colno, size_t *repeated_size)
{
uint_fast16_t count = item->count ?: 1;
high half is the padding; it's presumably zero, but should
be ignored anyway. For big-endian, it means the 32-bit
field went into the high half of USEC. */
- GElf_Ehdr ehdr_mem;
- GElf_Ehdr *ehdr = gelf_getehdr (core, &ehdr_mem);
if (likely (ehdr->e_ident[EI_DATA] == ELFDATA2MSB))
usec >>= 32;
else
}
static unsigned int
-handle_core_items (Elf *core, const void *desc, size_t descsz,
+handle_core_items (Elf *core, const GElf_Ehdr *ehdr,
+ const void *desc, size_t descsz,
const Ebl_Core_Item *items, size_t nitems)
{
if (nitems == 0)
{
assert (items[0].offset == 0);
size_t size = descsz;
- colno = handle_core_item (core, items, desc, colno, &size);
+ colno = handle_core_item (core, ehdr, items, desc, colno, &size);
/* If SIZE is not zero here there is some remaining data. But we do not
know how to process it anyway. */
return colno;
&& ((*item)->group == groups[i][0]->group
|| !strcmp ((*item)->group, groups[i][0]->group)));
++item)
- colno = handle_core_item (core, *item, desc, colno, NULL);
+ colno = handle_core_item (core, ehdr, *item, desc, colno, NULL);
/* Force a line break at the end of the group. */
colno = WRAP_COLUMN;
}
static void
-handle_core_note (Ebl *ebl, const GElf_Nhdr *nhdr,
+handle_core_note (Ebl *ebl, const GElf_Ehdr *ehdr, const GElf_Nhdr *nhdr,
const char *name, const void *desc)
{
GElf_Word regs_offset;
so that the ITEMS array does not describe the whole thing.
For non-register notes, the actual descsz might be a multiple
of the unit size, not just exactly the unit size. */
- unsigned int colno = handle_core_items (ebl->elf, desc,
+ unsigned int colno = handle_core_items (ebl->elf, ehdr, desc,
nregloc == 0 ? nhdr->n_descsz : 0,
items, nitems);
if (colno != 0)
break;
default:
- handle_core_note (ebl, &nhdr, name, desc);
+ handle_core_note (ebl, ehdr, &nhdr, name, desc);
}
else
- handle_core_note (ebl, &nhdr, name, desc);
+ handle_core_note (ebl, ehdr, &nhdr, name, desc);
}
else
ebl_object_note (ebl, nhdr.n_namesz, name, nhdr.n_type,