+2018-09-12 Mark Wielaard <mark@klomp.org>
+
+ * aarch64_symbol.c (aarch64_check_special_symbol): Drop ehdr argument,
+ use elf_getshdrstrndx.
+ * alpha_symbol.c (alpha_check_special_symbol): Drop ehdr argument.
+ * ppc64_symbol.c (ppc64_check_special_symbol): Likewise and use
+ elf_getshdrstrndx.
+ * ppc_symbol.c (ppc_check_special_symbol): Likewise.
+ * riscv_symbol.c (riscv_check_special_symbol): Likewise.
+
2018-07-21 Andreas Schwab <schwab@linux-m68k.org>
* Makefile.am (m68k_SRCS): Add m68k_cfi.c and m68k_initreg.c.
https://bugzilla.redhat.com/show_bug.cgi?id=1201778
*/
bool
-aarch64_check_special_symbol (Elf *elf, GElf_Ehdr *ehdr, const GElf_Sym *sym,
+aarch64_check_special_symbol (Elf *elf, const GElf_Sym *sym,
const char *name, const GElf_Shdr *destshdr)
{
if (name != NULL
&& strcmp (name, "_GLOBAL_OFFSET_TABLE_") == 0)
{
- const char *sname = elf_strptr (elf, ehdr->e_shstrndx, destshdr->sh_name);
+ size_t shstrndx;
+ if (elf_getshdrstrndx (elf, &shstrndx) != 0)
+ return false;
+ const char *sname = elf_strptr (elf, shstrndx, destshdr->sh_name);
if (sname != NULL
&& (strcmp (sname, ".got") == 0 || strcmp (sname, ".got.plt") == 0))
{
GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem);
if (shdr != NULL)
{
- sname = elf_strptr (elf, ehdr->e_shstrndx, shdr->sh_name);
+ sname = elf_strptr (elf, shstrndx, shdr->sh_name);
if (sname != NULL && strcmp (sname, ".got") == 0)
return (sym->st_value >= shdr->sh_addr
&& sym->st_value < shdr->sh_addr + shdr->sh_size);
normal checks. */
bool
alpha_check_special_symbol (Elf *elf __attribute__ ((unused)),
- GElf_Ehdr *ehdr __attribute__ ((unused)),
const GElf_Sym *sym __attribute__ ((unused)),
const char *name,
const GElf_Shdr *destshdr __attribute__ ((unused)))
/* Check whether given symbol's st_value and st_size are OK despite failing
normal checks. */
bool
-ppc64_check_special_symbol (Elf *elf, GElf_Ehdr *ehdr,
+ppc64_check_special_symbol (Elf *elf,
const GElf_Sym *sym __attribute__ ((unused)),
const char *name __attribute__ ((unused)),
const GElf_Shdr *destshdr)
{
- const char *sname = elf_strptr (elf, ehdr->e_shstrndx, destshdr->sh_name);
+ size_t shstrndx;
+ if (elf_getshdrstrndx (elf, &shstrndx) != 0)
+ return false;
+ const char *sname = elf_strptr (elf, shstrndx, destshdr->sh_name);
if (sname == NULL)
return false;
return strcmp (sname, ".opd") == 0;
/* Check whether given symbol's st_value and st_size are OK despite failing
normal checks. */
bool
-ppc_check_special_symbol (Elf *elf, GElf_Ehdr *ehdr, const GElf_Sym *sym,
+ppc_check_special_symbol (Elf *elf, const GElf_Sym *sym,
const char *name, const GElf_Shdr *destshdr)
{
if (name == NULL)
return true;
}
- const char *sname = elf_strptr (elf, ehdr->e_shstrndx, destshdr->sh_name);
+ size_t shstrndx;
+ if (elf_getshdrstrndx (elf, &shstrndx) != 0)
+ return false;
+ const char *sname = elf_strptr (elf, shstrndx, destshdr->sh_name);
if (sname == NULL)
return false;
/* Check whether given symbol's st_value and st_size are OK despite failing
normal checks. */
bool
-riscv_check_special_symbol (Elf *elf, GElf_Ehdr *ehdr, const GElf_Sym *sym,
+riscv_check_special_symbol (Elf *elf, const GElf_Sym *sym,
const char *name, const GElf_Shdr *destshdr)
{
if (name == NULL)
return false;
- const char *sname = elf_strptr (elf, ehdr->e_shstrndx, destshdr->sh_name);
+ size_t shstrndx;
+ if (elf_getshdrstrndx (elf, &shstrndx) != 0)
+ return false;
+ const char *sname = elf_strptr (elf, shstrndx, destshdr->sh_name);
if (sname == NULL)
return false;
+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.
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. */
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);
}
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);
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)))
/* 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);
+2018-09-12 Mark Wielaard <mark@klomp.org>
+
+ * elflint.c (check_symtab): Call ebl_check_special_symbol without
+ ehdr.
+
2018-07-30 Mark Wielaard <mark@klomp.org>
* strip.c (handle_elf): Track allocated/unallocated sections seen. Set
st_value = sym->st_value;
if (GELF_ST_TYPE (sym->st_info) != STT_TLS)
{
- if (! ebl_check_special_symbol (ebl, ehdr, sym, name,
+ if (! ebl_check_special_symbol (ebl, sym, name,
destshdr))
{
if (st_value - sh_addr > destshdr->sh_size)
if (destshdr != NULL)
{
/* Found it. */
- if (!ebl_check_special_symbol (ebl, ehdr, sym, name,
+ if (!ebl_check_special_symbol (ebl, sym, name,
destshdr))
{
if (ehdr->e_type != ET_REL