diff options
author | Mark Wielaard <mark@klomp.org> | 2018-08-04 20:36:09 +0200 |
---|---|---|
committer | Mark Wielaard <mark@klomp.org> | 2018-09-13 14:30:30 +0200 |
commit | ba2a7f4fa5f453c2b0a729bf519240a8f66a1867 (patch) | |
tree | 6fd2f8cd25f5750e815d7cab22adbd4f5d345e68 /libebl | |
parent | fb0457f4671e7e0f8331453348005ed6beab275e (diff) |
backends: Always use elf_getshdrstrndx in check_special_symbol.
The check_special_symbol backend functions used the Ehdr e_shstrndx
field to get at the name of sections. This is not correct if there
are more than SHN_LORESERVE sections. Always use elf_getshdrstrndx
to get the shstrtab section. And drop the Ehdr argument that isn't
necessary anymore.
Signed-off-by: Mark Wielaard <mark@klomp.org>
Diffstat (limited to 'libebl')
-rw-r--r-- | libebl/ChangeLog | 7 | ||||
-rw-r--r-- | libebl/ebl-hooks.h | 2 | ||||
-rw-r--r-- | libebl/ebl_check_special_symbol.c | 4 | ||||
-rw-r--r-- | libebl/eblopenbackend.c | 3 | ||||
-rw-r--r-- | libebl/libebl.h | 2 |
5 files changed, 12 insertions, 6 deletions
diff --git a/libebl/ChangeLog b/libebl/ChangeLog index f76afd10..574aae6e 100644 --- a/libebl/ChangeLog +++ b/libebl/ChangeLog @@ -1,3 +1,10 @@ +2018-09-12 Mark Wielaard <mark@klomp.org> + + * ebl-hooks.h (check_special_symbol): Drop ehdr argument. + * ebl_check_special_symbol.c (ebl_check_special_symbol): Likewise. + * eblopenbackend.c (default_check_special_symbol): Likewise. + * libebl.h (ebl_check_special_symbol): Likewise. + 2018-07-04 Ross Burton <ross.burton@intel.com> * eblopenbackend.c: Remove error.h include. diff --git a/libebl/ebl-hooks.h b/libebl/ebl-hooks.h index f3a0e64a..7a355cd1 100644 --- a/libebl/ebl-hooks.h +++ b/libebl/ebl-hooks.h @@ -118,7 +118,7 @@ bool EBLHOOK(none_reloc_p) (int); bool EBLHOOK(relative_reloc_p) (int); /* Check whether given symbol's value is ok despite normal checks. */ -bool EBLHOOK(check_special_symbol) (Elf *, GElf_Ehdr *, const GElf_Sym *, +bool EBLHOOK(check_special_symbol) (Elf *, const GElf_Sym *, const char *, const GElf_Shdr *); /* Check if this is a data marker symbol. e.g. '$d' symbols for ARM. */ diff --git a/libebl/ebl_check_special_symbol.c b/libebl/ebl_check_special_symbol.c index bdcb026c..1f60c3f0 100644 --- a/libebl/ebl_check_special_symbol.c +++ b/libebl/ebl_check_special_symbol.c @@ -35,11 +35,11 @@ bool -ebl_check_special_symbol (Ebl *ebl, GElf_Ehdr *ehdr, const GElf_Sym *sym, +ebl_check_special_symbol (Ebl *ebl, const GElf_Sym *sym, const char *name, const GElf_Shdr *destshdr) { if (ebl == NULL) return false; - return ebl->check_special_symbol (ebl->elf, ehdr, sym, name, destshdr); + return ebl->check_special_symbol (ebl->elf, sym, name, destshdr); } diff --git a/libebl/eblopenbackend.c b/libebl/eblopenbackend.c index 1962e608..f5b3de29 100644 --- a/libebl/eblopenbackend.c +++ b/libebl/eblopenbackend.c @@ -181,7 +181,7 @@ static bool default_debugscn_p (const char *name); static bool default_copy_reloc_p (int reloc); static bool default_none_reloc_p (int reloc); static bool default_relative_reloc_p (int reloc); -static bool default_check_special_symbol (Elf *elf, GElf_Ehdr *ehdr, +static bool default_check_special_symbol (Elf *elf, const GElf_Sym *sym, const char *name, const GElf_Shdr *destshdr); @@ -673,7 +673,6 @@ strong_alias (default_copy_reloc_p, default_relative_reloc_p) static bool default_check_special_symbol (Elf *elf __attribute__ ((unused)), - GElf_Ehdr *ehdr __attribute__ ((unused)), const GElf_Sym *sym __attribute__ ((unused)), const char *name __attribute__ ((unused)), const GElf_Shdr *destshdr __attribute__ ((unused))) diff --git a/libebl/libebl.h b/libebl/libebl.h index 882bdb99..0e1f41be 100644 --- a/libebl/libebl.h +++ b/libebl/libebl.h @@ -152,7 +152,7 @@ extern bool ebl_dynamic_tag_check (Ebl *ebl, int64_t tag); /* Check whether given symbol's st_value and st_size are OK despite failing normal checks. */ -extern bool ebl_check_special_symbol (Ebl *ebl, GElf_Ehdr *ehdr, +extern bool ebl_check_special_symbol (Ebl *ebl, const GElf_Sym *sym, const char *name, const GElf_Shdr *destshdr); |