diff options
author | Mark Wielaard <mjw@redhat.com> | 2014-11-22 23:08:48 +0100 |
---|---|---|
committer | Mark Wielaard <mjw@redhat.com> | 2014-11-26 20:17:22 +0100 |
commit | 712c8faddc08844fb1f2814c8b6e817f03b0698e (patch) | |
tree | df68a29bd32a009875438dfbbd68cbe6f30425c0 /libebl | |
parent | 2deeb7c51020df07d752107cdc6822d70ae1da4e (diff) | |
download | elfutils-712c8faddc08844fb1f2814c8b6e817f03b0698e.tar.gz |
Use elf_getphdrnum instead of accessing ehdr->e_phnum directly.
Using elf_getphdrnum lets us handle ELF files that use more than PN_XNUM
phdrs. And guards against some corrupt files.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
Diffstat (limited to 'libebl')
-rw-r--r-- | libebl/ChangeLog | 7 | ||||
-rw-r--r-- | libebl/ebl-hooks.h | 2 | ||||
-rw-r--r-- | libebl/eblbsspltp.c | 7 | ||||
-rw-r--r-- | libebl/eblopenbackend.c | 5 | ||||
-rw-r--r-- | libebl/libebl.h | 2 |
5 files changed, 14 insertions, 9 deletions
diff --git a/libebl/ChangeLog b/libebl/ChangeLog index b6a0e632..5e635f21 100644 --- a/libebl/ChangeLog +++ b/libebl/ChangeLog @@ -1,3 +1,10 @@ +2014-11-22 Mark Wielaard <mjw@redhat.com> + + * ebl-hooks.h (bss_plt_p): Remove ehdr argument. + * eblbsspltp.c (ebl_bss_plt_p): Likewise. + * eblopenbackend.c (default_bss_plt_p): Likewise. + * libebl.h (ebl_bss_plt_p): Likewise. + 2014-11-17 Mark Wielaard <mjw@redhat.com> * ebldebugscnp.c (ebl_debugscn_p): Check name is not NULL. diff --git a/libebl/ebl-hooks.h b/libebl/ebl-hooks.h index e1186f86..2e314464 100644 --- a/libebl/ebl-hooks.h +++ b/libebl/ebl-hooks.h @@ -132,7 +132,7 @@ bool EBLHOOK(check_special_symbol) (Elf *, GElf_Ehdr *, const GElf_Sym *, bool EBLHOOK(check_st_other_bits) (unsigned char st_other); /* Check if backend uses a bss PLT in this file. */ -bool EBLHOOK(bss_plt_p) (Elf *, GElf_Ehdr *); +bool EBLHOOK(bss_plt_p) (Elf *); /* Return location expression to find return value given the DW_AT_type DIE of a DW_TAG_subprogram DIE. */ diff --git a/libebl/eblbsspltp.c b/libebl/eblbsspltp.c index 080e7c5c..95a5d8af 100644 --- a/libebl/eblbsspltp.c +++ b/libebl/eblbsspltp.c @@ -1,5 +1,5 @@ /* Check if backend uses a bss PLT. - Copyright (C) 2005 Red Hat, Inc. + Copyright (C) 2005, 2014 Red Hat, Inc. This file is part of elfutils. This file is free software; you can redistribute it and/or modify @@ -35,9 +35,8 @@ bool -ebl_bss_plt_p (ebl, ehdr) +ebl_bss_plt_p (ebl) Ebl *ebl; - GElf_Ehdr *ehdr; { - return ebl == NULL ? false : ebl->bss_plt_p (ebl->elf, ehdr); + return ebl == NULL ? false : ebl->bss_plt_p (ebl->elf); } diff --git a/libebl/eblopenbackend.c b/libebl/eblopenbackend.c index bd947599..3a22f53d 100644 --- a/libebl/eblopenbackend.c +++ b/libebl/eblopenbackend.c @@ -186,7 +186,7 @@ static bool default_check_special_symbol (Elf *elf, GElf_Ehdr *ehdr, static bool default_check_st_other_bits (unsigned char st_other); static bool default_check_special_section (Ebl *, int, const GElf_Shdr *, const char *); -static bool default_bss_plt_p (Elf *elf, GElf_Ehdr *ehdr); +static bool default_bss_plt_p (Elf *elf); static int default_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locops); static ssize_t default_register_info (Ebl *ebl, @@ -693,8 +693,7 @@ default_check_st_other_bits (unsigned char st_other __attribute__ ((unused))) static bool -default_bss_plt_p (Elf *elf __attribute__ ((unused)), - GElf_Ehdr *ehdr __attribute__ ((unused))) +default_bss_plt_p (Elf *elf __attribute__ ((unused))) { return false; } diff --git a/libebl/libebl.h b/libebl/libebl.h index bb993bf0..7c3c7647 100644 --- a/libebl/libebl.h +++ b/libebl/libebl.h @@ -201,7 +201,7 @@ extern bool ebl_section_strip_p (Ebl *ebl, const GElf_Ehdr *ehdr, bool remove_comment, bool only_remove_debug); /* Check if backend uses a bss PLT in this file. */ -extern bool ebl_bss_plt_p (Ebl *ebl, GElf_Ehdr *ehdr); +extern bool ebl_bss_plt_p (Ebl *ebl); /* Return size of entry in SysV-style hash table. */ extern int ebl_sysvhash_entrysize (Ebl *ebl); |