/* If there is an .eh_frame_hdr section it must be
referenced by this program header entry. */
Elf_Scn *scn = NULL;
+ GElf_Shdr shdr_mem;
+ GElf_Shdr *shdr = NULL;
while ((scn = elf_nextscn (ebl->elf, scn)) != NULL)
{
- GElf_Shdr shdr_mem;
- GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem);
+ shdr = gelf_getshdr (scn, &shdr_mem);
if (shdr != NULL && shdr->sh_type == SHT_PROGBITS
&& ! strcmp (".eh_frame_hdr",
elf_strptr (ebl->elf, shstrndx, shdr->sh_name)))
if ((phdr->p_flags & PF_R) == 0)
ERROR (gettext ("\
call frame search table must be allocated\n"));
+ else if (shdr != NULL && (shdr->sh_flags & SHF_ALLOC) != 0)
+ ERROR (gettext ("\
+section [%2zu] '%s' must be allocated\n"), elf_ndxscn (scn), ".eh_frame_hdr");
+
if ((phdr->p_flags & PF_W) != 0)
ERROR (gettext ("\
call frame search table must not be writable\n"));
+ else if (shdr != NULL && (shdr->sh_flags & SHF_WRITE) != 0)
+ ERROR (gettext ("\
+section [%2zu] '%s' must not be writable\n"),
+ elf_ndxscn (scn), ".eh_frame_hdr");
+
if ((phdr->p_flags & PF_X) != 0)
ERROR (gettext ("\
call frame search table must not be executable\n"));
+ else if (shdr != NULL && (shdr->sh_flags & SHF_EXECINSTR) != 0)
+ ERROR (gettext ("\
+section [%2zu] '%s' must not be executable\n"),
+ elf_ndxscn (scn), ".eh_frame_hdr");
/* Remember which entry this is. */
pt_gnu_eh_frame_pndx = cnt;
static void
-check_exception_data (Ebl *ebl, GElf_Ehdr *ehdr)
+check_exception_data (Ebl *ebl __attribute__ ((unused)),
+ GElf_Ehdr *ehdr __attribute__ ((unused)))
{
- ebl;
- ehdr;
}
int ar_disp;
get_sleb128 (ar_disp, readp);
- printf (" [%4u] ar_filter: %d\n"
- " ar_disp: %d\n",
- u++, ar_filter, ar_disp);
+ printf (" [%4u] ar_filter: % d\n"
+ " ar_disp: % -5d",
+ u, ar_filter, ar_disp);
+ if (abs (ar_disp) & 1)
+ printf (" -> [%4u]\n", u + (ar_disp + 1) / 2);
+ else if (ar_disp != 0)
+ puts (" -> ???");
+ else
+ putchar_unlocked ('\n');
+ ++u;
}
while (readp < action_table_end);
}