summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlrich Drepper <[email protected]>2009-01-17 15:21:07 -0800
committerUlrich Drepper <[email protected]>2009-01-17 15:21:07 -0800
commit978360c6ec51192ab7f1333ae9f1c105bcdb5ecd (patch)
tree9568e1b4afa9cd0cca54c6fbe42902c511aaaf32
parent3a52c7a528e41cc28e69e68ef817f0b2d7f130e5 (diff)
Beginning of exception table testing.
-rw-r--r--src/elflint.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/elflint.c b/src/elflint.c
index 35368a5e..497f959e 100644
--- a/src/elflint.c
+++ b/src/elflint.c
@@ -3359,6 +3359,13 @@ static const struct
&& !memcmp (special_sections[idx].name, string, \
sizeof string - (prefix ? 1 : 0)))
+
+/* Indeces of some sections we need later. */
+static size_t eh_frame_hdr_scnndx;
+static size_t eh_frame_scnndx;
+static size_t gcc_except_table_scnndx;
+
+
static void
check_sections (Ebl *ebl, GElf_Ehdr *ehdr)
{
@@ -3555,6 +3562,14 @@ section [%2zu] '%s' has SHF_ALLOC flag not set but there are loadable segments\n
break;
}
+
+ /* Remember a few special sections for later. */
+ if (strcmp (scnname, ".eh_frame_hdr") == 0)
+ eh_frame_hdr_scnndx = cnt;
+ else if (strcmp (scnname, ".eh_frame") == 0)
+ eh_frame_scnndx = cnt;
+ else if (strcmp (scnname, ".gcc_except_table") == 0)
+ gcc_except_table_scnndx = cnt;
}
if (shdr->sh_entsize != 0 && shdr->sh_size % shdr->sh_entsize)
@@ -3962,6 +3977,7 @@ section [%2d] '%s': unknown object file note type %" PRIu32
return last_offset;
}
+
static void
check_note (Ebl *ebl, GElf_Ehdr *ehdr, GElf_Phdr *phdr, int cnt)
{
@@ -3993,6 +4009,7 @@ phdr[%d]: no note entries defined for the type of file\n"),
cnt, phdr->p_filesz - notes_size);
}
+
static void
check_note_section (Ebl *ebl, GElf_Ehdr *ehdr, GElf_Shdr *shdr, int idx)
{
@@ -4024,6 +4041,11 @@ section [%2d] '%s': no note entries defined for the type of file\n"),
idx, section_name (ebl, idx), shdr->sh_size - notes_size);
}
+
+/* Index of the PT_GNU_EH_FRAME program eader entry. */
+static int pt_gnu_eh_frame_pndx;
+
+
static void
check_program_header (Ebl *ebl, GElf_Ehdr *ehdr)
{
@@ -4207,6 +4229,9 @@ call frame search table must not be writable\n"));
if ((phdr->p_flags & PF_X) != 0)
ERROR (gettext ("\
call frame search table must not be executable\n"));
+
+ /* Remember which entry this is. */
+ pt_gnu_eh_frame_pndx = cnt;
}
if (phdr->p_filesz > phdr->p_memsz
@@ -4228,6 +4253,14 @@ program header entry %d: file offset and virtual address not module of alignment
}
+static void
+check_exception_data (Ebl *ebl, GElf_Ehdr *ehdr)
+{
+ ebl;
+ ehdr;
+}
+
+
/* Process one file. */
static void
process_elf_file (Elf *elf, const char *prefix, const char *suffix,
@@ -4276,6 +4309,11 @@ process_elf_file (Elf *elf, const char *prefix, const char *suffix,
headers at all. */
check_sections (ebl, ehdr);
+ /* Check the exception handling data, if it exists. */
+ if (pt_gnu_eh_frame_pndx != 0 || eh_frame_hdr_scnndx != 0
+ || eh_frame_scnndx != 0 || gcc_except_table_scnndx != 0)
+ check_exception_data (ebl, ehdr);
+
/* Report if no relocation section needed the text relocation flag. */
if (textrel && !needed_textrel)
ERROR (gettext ("text relocation flag set but not needed\n"));