diff options
Diffstat (limited to 'libebl')
-rw-r--r-- | libebl/ChangeLog | 5 | ||||
-rw-r--r-- | libebl/eblobjnote.c | 20 |
2 files changed, 20 insertions, 5 deletions
diff --git a/libebl/ChangeLog b/libebl/ChangeLog index a2f89562..0174f331 100644 --- a/libebl/ChangeLog +++ b/libebl/ChangeLog @@ -1,3 +1,8 @@ +2018-12-02 Mark Wielaard <mark@klomp.org> + + * eblobjnte.c (ebl_object_note): For GNU_PROPERTY_STACK_SIZE use + an Elf32_Addr or Elf64_Addr to read and print the size. + 2018-11-15 Mark Wielaard <mark@klomp.org> * eblobjnotetypename.c (ebl_object_note_type_name): Don't update diff --git a/libebl/eblobjnote.c b/libebl/eblobjnote.c index 58ac86d7..c19ea37f 100644 --- a/libebl/eblobjnote.c +++ b/libebl/eblobjnote.c @@ -360,15 +360,22 @@ ebl_object_note (Ebl *ebl, uint32_t namesz, const char *name, uint32_t type, if (prop.pr_type == GNU_PROPERTY_STACK_SIZE) { printf ("STACK_SIZE "); - if (prop.pr_datasz == 4 || prop.pr_datasz == 8) + union + { + Elf64_Addr a64; + Elf32_Addr a32; + } addr; + if ((elfclass == ELFCLASS32 && prop.pr_datasz == 4) + || (elfclass == ELFCLASS64 && prop.pr_datasz == 8)) { - GElf_Addr addr; in.d_type = ELF_T_ADDR; out.d_type = ELF_T_ADDR; in.d_size = prop.pr_datasz; - out.d_size = sizeof (addr); + out.d_size = prop.pr_datasz; in.d_buf = (void *) desc; - out.d_buf = (void *) &addr; + out.d_buf = (elfclass == ELFCLASS32 + ? (void *) &addr.a32 + : (void *) &addr.a64); if (gelf_xlatetom (ebl->elf, &out, &in, elfident[EI_DATA]) == NULL) @@ -376,7 +383,10 @@ ebl_object_note (Ebl *ebl, uint32_t namesz, const char *name, uint32_t type, printf ("%s\n", elf_errmsg (-1)); return; } - printf ("%#" PRIx64 "\n", addr); + if (elfclass == ELFCLASS32) + printf ("%#" PRIx32 "\n", addr.a32); + else + printf ("%#" PRIx64 "\n", addr.a64); } else printf (" (garbage datasz: %" PRIx32 ")\n", |