summaryrefslogtreecommitdiffstats
path: root/src/elflint.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/elflint.c')
-rw-r--r--src/elflint.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/elflint.c b/src/elflint.c
index e4ebac4c..10032874 100644
--- a/src/elflint.c
+++ b/src/elflint.c
@@ -2352,9 +2352,9 @@ section [%2d] '%s': section groups only allowed in relocatable object files\n"),
}
/* Check that sh_link is an index of a symbol table. */
+ Elf_Scn *symscn = elf_getscn (ebl->elf, shdr->sh_link);
GElf_Shdr symshdr_mem;
- GElf_Shdr *symshdr = gelf_getshdr (elf_getscn (ebl->elf, shdr->sh_link),
- &symshdr_mem);
+ GElf_Shdr *symshdr = gelf_getshdr (symscn, &symshdr_mem);
if (symshdr == NULL)
ERROR (gettext ("section [%2d] '%s': cannot get symbol table: %s\n"),
idx, section_name (ebl, idx), elf_errmsg (-1));
@@ -2375,6 +2375,19 @@ section [%2d] '%s': invalid symbol index in sh_info\n"),
ERROR (gettext ("section [%2d] '%s': sh_flags not zero\n"),
idx, section_name (ebl, idx));
+ GElf_Sym sym_data;
+ GElf_Sym *sym = gelf_getsym (elf_getdata (symscn, NULL), shdr->sh_info,
+ &sym_data);
+ if (sym == NULL)
+ ERROR (gettext ("\
+section [%2d] '%s': cannot get symbol for signature\n"),
+ idx, section_name (ebl, idx));
+ else if (strcmp (elf_strptr (ebl->elf, symshdr->sh_link, sym->st_name),
+ "") == 0)
+ ERROR (gettext ("\
+section [%2d] '%s': signature symbol canot be empty string\n"),
+ idx, section_name (ebl, idx));
+
if (be_strict
&& shdr->sh_entsize != elf32_fsize (ELF_T_WORD, 1, EV_CURRENT))
ERROR (gettext ("section [%2d] '%s': sh_flags not set correctly\n"),