@@ -247,6 +247,8 @@ static int glue(load_elf, SZ)(const char *name, int fd,
glue(bswap_ehdr, SZ)(&ehdr);
}
+ handlers->header_notify_fn(handlers->header_notify_opaque, &ehdr, SZ);
+
switch (elf_machine) {
case EM_PPC64:
if (EM_PPC64 != ehdr.e_machine)
@@ -239,11 +239,18 @@ static uint64_t elf_default_translate(void *opaque, uint64_t addr)
return addr;
}
+static void elf_default_header_notify(void *opaque, void *ehdr, int bits)
+{
+ return;
+}
+
ElfHandlers elf_default_handlers = {
.translate_fn = elf_default_translate,
.translate_opaque = NULL,
.note_fn = elf_default_note,
.note_opaque = NULL,
+ .header_notify_fn = elf_default_header_notify,
+ .header_notify_opaque = NULL,
};
@@ -12,6 +12,8 @@ typedef struct ElfHandlers {
void (*note_fn)(void *opaque, uint8_t *name, uint32_t name_len,
uint8_t *desc, uint32_t desc_len, uint32_t type);
void *note_opaque;
+ void (*header_notify_fn)(void *opaque, void *ehdr, int bits);
+ void *header_notify_opaque;
} ElfHandlers;
extern ElfHandlers elf_default_handlers;