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:
Arnaldo Carvalho de Melo 2021-08-05 10:21:15 -03:00
parent 23ea62817c
commit 74c2078e04
7 changed files with 9 additions and 16 deletions

View File

@ -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)

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -132,8 +132,7 @@ int ctf__load(struct ctf *ctf)
{
int err = -ENOTSUP;
GElf_Shdr shdr;
Elf_Scn *sec = elf_section_by_name(ctf->elf, &ctf->ehdr,
&shdr, ".SUNW_ctf", NULL);
Elf_Scn *sec = elf_section_by_name(ctf->elf, &shdr, ".SUNW_ctf", NULL);
if (sec == NULL)
return -ESRCH;