dutil: elf_symtab__new() doesn't need the GElf_Ehdr *ep argument
In 3f8aad340b
("elf_symtab: Handle SHN_XINDEX index in
elf_section_by_name()") we stopped using that argument as we switched to
using elf_getshdrstrndx() to get SHN_XINDEX.
So just remove that argument and fixup its callers, this will allow
removing a good chunk of calls and variables.
Cc: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
23ea62817c
commit
74c2078e04
@ -1322,7 +1322,7 @@ struct btf_encoder *btf_encoder__new(struct cu *cu, const char *detached_filenam
|
||||
/* find percpu section's shndx */
|
||||
|
||||
GElf_Shdr shdr;
|
||||
Elf_Scn *sec = elf_section_by_name(cu->elf, &encoder->ehdr, &shdr, PERCPU_SECTION, NULL);
|
||||
Elf_Scn *sec = elf_section_by_name(cu->elf, &shdr, PERCPU_SECTION, NULL);
|
||||
|
||||
if (!sec) {
|
||||
if (encoder->verbose)
|
||||
|
@ -830,8 +830,7 @@ static int elf__open(const char *filename)
|
||||
|
||||
GElf_Shdr shdr;
|
||||
size_t init_index;
|
||||
Elf_Scn *init = elf_section_by_name(elf, &ehdr, &shdr, ".init.text",
|
||||
&init_index);
|
||||
Elf_Scn *init = elf_section_by_name(elf, &shdr, ".init.text", &init_index);
|
||||
if (init == NULL)
|
||||
goto out_elf_end;
|
||||
|
||||
|
3
dutil.c
3
dutil.c
@ -180,8 +180,7 @@ bool strlist__has_entry(struct strlist *slist, const char *entry)
|
||||
return false;
|
||||
}
|
||||
|
||||
Elf_Scn *elf_section_by_name(Elf *elf, GElf_Ehdr *ep,
|
||||
GElf_Shdr *shp, const char *name, size_t *index)
|
||||
Elf_Scn *elf_section_by_name(Elf *elf, GElf_Shdr *shp, const char *name, size_t *index)
|
||||
{
|
||||
Elf_Scn *sec = NULL;
|
||||
size_t cnt = 1;
|
||||
|
3
dutil.h
3
dutil.h
@ -321,8 +321,7 @@ static inline bool strstarts(const char *str, const char *prefix)
|
||||
|
||||
void *zalloc(const size_t size);
|
||||
|
||||
Elf_Scn *elf_section_by_name(Elf *elf, GElf_Ehdr *ep,
|
||||
GElf_Shdr *shp, const char *name, size_t *index);
|
||||
Elf_Scn *elf_section_by_name(Elf *elf, GElf_Shdr *shp, const char *name, size_t *index);
|
||||
|
||||
Elf_Scn *elf_section_by_idx(Elf *elf, GElf_Shdr *shp, int idx);
|
||||
|
||||
|
@ -2142,18 +2142,15 @@ static int elf_read_build_id(Elf *elf, void *bf, size_t size)
|
||||
* '.note' (VDSO specific)
|
||||
*/
|
||||
do {
|
||||
sec = elf_section_by_name(elf, &ehdr, &shdr,
|
||||
".note.gnu.build-id", NULL);
|
||||
sec = elf_section_by_name(elf, &shdr, ".note.gnu.build-id", NULL);
|
||||
if (sec)
|
||||
break;
|
||||
|
||||
sec = elf_section_by_name(elf, &ehdr, &shdr,
|
||||
".notes", NULL);
|
||||
sec = elf_section_by_name(elf, &shdr, ".notes", NULL);
|
||||
if (sec)
|
||||
break;
|
||||
|
||||
sec = elf_section_by_name(elf, &ehdr, &shdr,
|
||||
".note", NULL);
|
||||
sec = elf_section_by_name(elf, &shdr, ".note", NULL);
|
||||
if (sec)
|
||||
break;
|
||||
|
||||
|
@ -23,7 +23,7 @@ struct elf_symtab *elf_symtab__new(const char *name, Elf *elf, GElf_Ehdr *ehdr)
|
||||
name = ".symtab";
|
||||
|
||||
GElf_Shdr shdr;
|
||||
Elf_Scn *sec = elf_section_by_name(elf, ehdr, &shdr, name, &symtab_index);
|
||||
Elf_Scn *sec = elf_section_by_name(elf, &shdr, name, &symtab_index);
|
||||
|
||||
if (sec == NULL)
|
||||
return NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user