From: Jiri Olsa <jolsa@kernel.org> Date: 2021-01-21 20:30:18
hi,
kpatch guys hit an issue with pahole over their vmlinux, which
contains many (over 100000) sections, pahole crashes.
With so many sections, ELF is using extended section index table,
which is used to hold values for some of the indexes and extra
code is needed to retrieve them.
This patchset adds the support for pahole to properly read string
table index and symbol's section index, which are used in btf_encoder.
This patchset also adds support for libbpf to properly parse .BTF
section on such object.
This patchset is based on previously posted fix [1].
v2 changes:
- many variables renames [Andrii]
- use elf_getshdrstrndx() unconditionally [Andrii]
- add elf_symtab__for_each_symbol_index macro [Andrii]
- add more comments [Andrii]
- verify that extended symtab section type is SHT_SYMTAB_SHNDX [Andrii]
- fix Joe's crash in dwarves build, wrong sym.st_shndx assignment
thanks,
jirka
[1] https://lore.kernel.org/bpf/20210113102509.1338601-1-jolsa@kernel.org/
---
dwarves:
Jiri Olsa (2):
elf_symtab: Add support for SHN_XINDEX index to elf_section_by_name
bpf_encoder: Translate SHN_XINDEX in symbol's st_shndx values
btf_encoder.c | 36 ++++++++++++++++++++++++++++++++----
dutil.c | 8 ++++++--
elf_symtab.c | 39 ++++++++++++++++++++++++++++++++++++++-
elf_symtab.h | 2 ++
4 files changed, 78 insertions(+), 7 deletions(-)
libbpf:
Jiri Olsa (1):
libbpf: Use string table index from index table if needed
tools/lib/bpf/btf.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
From: Jiri Olsa <jolsa@kernel.org> Date: 2021-01-21 20:24:03
In case the elf's header e_shstrndx contains SHN_XINDEX,
we need to call elf_getshdrstrndx to get the proper
string table index.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
dutil.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
From: Jiri Olsa <jolsa@kernel.org> Date: 2021-01-21 20:30:16
For very large ELF objects (with many sections), we could
get special value SHN_XINDEX (65535) for symbol's st_shndx.
This patch is adding code to detect the optional extended
section index table and use it to resolve symbol's section
index.
Adding elf_symtab__for_each_symbol_index macro that returns
symbol's section index and usign it in collect_symbols function.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
btf_encoder.c | 36 ++++++++++++++++++++++++++++++++----
elf_symtab.c | 39 ++++++++++++++++++++++++++++++++++++++-
elf_symtab.h | 2 ++
3 files changed, 72 insertions(+), 5 deletions(-)
@@ -49,6 +57,35 @@ struct elf_symtab *elf_symtab__new(const char *name, Elf *elf, GElf_Ehdr *ehdr)if(symtab->symstrs==NULL)gotoout_free_name;+/*+*The.symtabsectionhasoptionalextendedsectionindex+*table,loaditsdatasoitcanbeusedtoresolvesymbol's+*sectionindex.+**/+if(symtab_xindex>0){+GElf_Shdrshdr_xindex;+Elf_Scn*sec_xindex;++sec_xindex=elf_getscn(elf,symtab_xindex);+if(sec_xindex==NULL)+gotoout_free_name;++if(gelf_getshdr(sec_xindex,&shdr_xindex)==NULL)+gotoout_free_name;++/* Extra check to verify it's correct type */+if(shdr_xindex.sh_type!=SHT_SYMTAB_SHNDX)+gotoout_free_name;++/* Extra check to verify it belongs to the .symtab */+if(symtab_index!=shdr_xindex.sh_link)+gotoout_free_name;++symtab->syms_sec_idx_table=elf_getdata(elf_getscn(elf,symtab_xindex),NULL);+if(symtab->syms_sec_idx_table==NULL)+gotoout_free_name;+}+symtab->nr_syms=shdr.sh_size/shdr.sh_entsize;returnsymtab;
From: Jiri Olsa <jolsa@kernel.org> Date: 2021-01-21 20:35:06
For very large ELF objects (with many sections), we could
get special value SHN_XINDEX (65535) for elf object's string
table index - e_shstrndx.
Call elf_getshdrstrndx to get the proper string table index,
instead of reading it directly from ELF header.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/lib/bpf/btf.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
@@ -858,6 +858,7 @@ static struct btf *btf_parse_elf(const char *path, struct btf *base_btf,Elf_Scn*scn=NULL;Elf*elf=NULL;GElf_Ehdrehdr;+size_tshstrndx;if(elf_version(EV_CURRENT)==EV_NONE){pr_warn("failed to init libelf for %s\n",path);
@@ -882,7 +883,14 @@ static struct btf *btf_parse_elf(const char *path, struct btf *base_btf,pr_warn("failed to get EHDR from %s\n",path);gotodone;}-if(!elf_rawdata(elf_getscn(elf,ehdr.e_shstrndx),NULL)){++if(elf_getshdrstrndx(elf,&shstrndx)){+pr_warn("failed to get section names section index for %s\n",+path);+gotodone;+}++if(!elf_rawdata(elf_getscn(elf,shstrndx),NULL)){pr_warn("failed to get e_shstrndx from %s\n",path);gotodone;}
@@ -897,7 +905,7 @@ static struct btf *btf_parse_elf(const char *path, struct btf *base_btf,idx,path);gotodone;}-name=elf_strptr(elf,ehdr.e_shstrndx,sh.sh_name);+name=elf_strptr(elf,shstrndx,sh.sh_name);if(!name){pr_warn("failed to get section(%d) name from %s\n",idx,path);
On Thu, Jan 21, 2021 at 12:24 PM Jiri Olsa [off-list ref] wrote:
quoted hunk
In case the elf's header e_shstrndx contains SHN_XINDEX,
we need to call elf_getshdrstrndx to get the proper
string table index.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
dutil.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
On Thu, Jan 21, 2021 at 12:25 PM Jiri Olsa [off-list ref] wrote:
For very large ELF objects (with many sections), we could
get special value SHN_XINDEX (65535) for symbol's st_shndx.
This patch is adding code to detect the optional extended
section index table and use it to resolve symbol's section
index.
Adding elf_symtab__for_each_symbol_index macro that returns
symbol's section index and usign it in collect_symbols function.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
You missed fixing up collect_function() as well, which is using
elf_sym__section(), which doesn't know about extended numbering.
gelf_getsymshndx() is supposed to work even for cases that don't use
extended numbering, so this should work, right?
if (!gelf_getsymshndx(syms, syms_sec_idx_table, id, sym, sym_sec_idx))
return false;
if (sym->st_shndx == SHN_XINDEX)
*sym_sec_idx = sym->st_shndx;
return true;
?
what do we want to do if elf_sym__get() returns error (false)? We can
either stop or ignore that symbol, right? But currently you are
returning invalid symbol data.
so either
for (id = 0; id < symtab->nr_syms && elf_sym__get(symtab->syms,
symtab->syms_sec_idx_table, d, &sym, &sym_sec_idx); id++)
or
for (id = 0; id < symtab->nr_syms; id++)
if (elf_sym__get(symtab->syms, symtab->syms_sec_idx_table, d, &sym,
&sym_sec_idx))
But the current variant looks broken. Oh, and
elf_symtab__for_each_symbol() is similarly broken, can you please fix
that as well?
And this new macro should probably be in elf_symtab.h, along the
elf_symtab__for_each_symbol.
From: Jiri Olsa <hidden> Date: 2021-01-21 23:35:51
On Thu, Jan 21, 2021 at 03:10:25PM -0800, Andrii Nakryiko wrote:
On Thu, Jan 21, 2021 at 12:24 PM Jiri Olsa [off-list ref] wrote:
quoted
In case the elf's header e_shstrndx contains SHN_XINDEX,
we need to call elf_getshdrstrndx to get the proper
string table index.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
dutil.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
if (!str) would be an error? should we bail out here?
seems like if elf_nextscn returns NULL, it will be the case for all the
sections in here.. but bailing out on (!str) is more direct and safer
I'll send an update
thanks,
jirka
On Thu, Jan 21, 2021 at 12:26 PM Jiri Olsa [off-list ref] wrote:
For very large ELF objects (with many sections), we could
get special value SHN_XINDEX (65535) for elf object's string
table index - e_shstrndx.
Call elf_getshdrstrndx to get the proper string table index,
instead of reading it directly from ELF header.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
I've applied this patch to bpf-next, you don't need to re-send it in
the next version of this patch set.
@@ -858,6 +858,7 @@ static struct btf *btf_parse_elf(const char *path, struct btf *base_btf,Elf_Scn*scn=NULL;Elf*elf=NULL;GElf_Ehdrehdr;+size_tshstrndx;if(elf_version(EV_CURRENT)==EV_NONE){pr_warn("failed to init libelf for %s\n",path);
@@ -882,7 +883,14 @@ static struct btf *btf_parse_elf(const char *path, struct btf *base_btf,pr_warn("failed to get EHDR from %s\n",path);gotodone;}-if(!elf_rawdata(elf_getscn(elf,ehdr.e_shstrndx),NULL)){++if(elf_getshdrstrndx(elf,&shstrndx)){+pr_warn("failed to get section names section index for %s\n",+path);+gotodone;+}++if(!elf_rawdata(elf_getscn(elf,shstrndx),NULL)){pr_warn("failed to get e_shstrndx from %s\n",path);gotodone;}
@@ -897,7 +905,7 @@ static struct btf *btf_parse_elf(const char *path, struct btf *base_btf,idx,path);gotodone;}-name=elf_strptr(elf,ehdr.e_shstrndx,sh.sh_name);+name=elf_strptr(elf,shstrndx,sh.sh_name);if(!name){pr_warn("failed to get section(%d) name from %s\n",idx,path);--
From: Jiri Olsa <hidden> Date: 2021-01-22 10:27:16
On Thu, Jan 21, 2021 at 03:32:40PM -0800, Andrii Nakryiko wrote:
On Thu, Jan 21, 2021 at 12:25 PM Jiri Olsa [off-list ref] wrote:
quoted
For very large ELF objects (with many sections), we could
get special value SHN_XINDEX (65535) for symbol's st_shndx.
This patch is adding code to detect the optional extended
section index table and use it to resolve symbol's section
index.
Adding elf_symtab__for_each_symbol_index macro that returns
symbol's section index and usign it in collect_symbols function.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
You missed fixing up collect_function() as well, which is using
elf_sym__section(), which doesn't know about extended numbering.
ah right, it's for modules, I guess it's why it did not show up
thanks,
jirka
From: Jiri Olsa <hidden> Date: 2021-01-22 21:17:53
On Thu, Jan 21, 2021 at 03:32:40PM -0800, Andrii Nakryiko wrote:
SNIP
quoted
@@ -598,9 +599,36 @@ static void collect_symbol(GElf_Sym *sym, struct funcs_layout *fl) fl->mcount_stop = sym->st_value; }+static bool elf_sym__get(Elf_Data *syms, Elf_Data *syms_sec_idx_table,+ int id, GElf_Sym *sym, Elf32_Word *sym_sec_idx)+{+ if (!gelf_getsym(syms, id, sym))+ return false;++ *sym_sec_idx = sym->st_shndx;++ if (sym->st_shndx == SHN_XINDEX) {+ if (!syms_sec_idx_table)+ return false;+ if (!gelf_getsymshndx(syms, syms_sec_idx_table,+ id, sym, sym_sec_idx))
gelf_getsymshndx() is supposed to work even for cases that don't use
extended numbering, so this should work, right?
if (!gelf_getsymshndx(syms, syms_sec_idx_table, id, sym, sym_sec_idx))
return false;
it seems you're right, gelf_getsymshndx seem to work for
both cases, I'll check
if (sym->st_shndx == SHN_XINDEX)
*sym_sec_idx = sym->st_shndx;
I don't understand this.. gelf_getsymshndx will return both
symbol and proper index, no? also sym_sec_idx is already
assigned from previou call
what do we want to do if elf_sym__get() returns error (false)? We can
either stop or ignore that symbol, right? But currently you are
returning invalid symbol data.
so either
for (id = 0; id < symtab->nr_syms && elf_sym__get(symtab->syms,
symtab->syms_sec_idx_table, d, &sym, &sym_sec_idx); id++)
or
for (id = 0; id < symtab->nr_syms; id++)
if (elf_sym__get(symtab->syms, symtab->syms_sec_idx_table, d, &sym,
&sym_sec_idx))
if we go ahead with skipping symbols, this one seems good
But the current variant looks broken. Oh, and
elf_symtab__for_each_symbol() is similarly broken, can you please fix
that as well?
And this new macro should probably be in elf_symtab.h, along the
elf_symtab__for_each_symbol.
On Fri, Jan 22, 2021 at 12:47 PM Jiri Olsa [off-list ref] wrote:
On Thu, Jan 21, 2021 at 03:32:40PM -0800, Andrii Nakryiko wrote:
SNIP
quoted
quoted
@@ -598,9 +599,36 @@ static void collect_symbol(GElf_Sym *sym, struct funcs_layout *fl) fl->mcount_stop = sym->st_value; }+static bool elf_sym__get(Elf_Data *syms, Elf_Data *syms_sec_idx_table,+ int id, GElf_Sym *sym, Elf32_Word *sym_sec_idx)+{+ if (!gelf_getsym(syms, id, sym))+ return false;++ *sym_sec_idx = sym->st_shndx;++ if (sym->st_shndx == SHN_XINDEX) {+ if (!syms_sec_idx_table)+ return false;+ if (!gelf_getsymshndx(syms, syms_sec_idx_table,+ id, sym, sym_sec_idx))
gelf_getsymshndx() is supposed to work even for cases that don't use
extended numbering, so this should work, right?
if (!gelf_getsymshndx(syms, syms_sec_idx_table, id, sym, sym_sec_idx))
return false;
it seems you're right, gelf_getsymshndx seem to work for
both cases, I'll check
quoted
if (sym->st_shndx == SHN_XINDEX)
*sym_sec_idx = sym->st_shndx;
I don't understand this.. gelf_getsymshndx will return both
symbol and proper index, no? also sym_sec_idx is already
assigned from previou call
Reading (some) implementation of gelf_getsymshndx() that I found
online, it won't set sym_sec_idx, if the symbol *doesn't* use extended
numbering. But it will still return symbol data. So to return the
section index in all cases, we need to check again *after* we got
symbol, and if it's not extended, then set index manually.
what do we want to do if elf_sym__get() returns error (false)? We can
either stop or ignore that symbol, right? But currently you are
returning invalid symbol data.
so either
for (id = 0; id < symtab->nr_syms && elf_sym__get(symtab->syms,
symtab->syms_sec_idx_table, d, &sym, &sym_sec_idx); id++)
or
for (id = 0; id < symtab->nr_syms; id++)
if (elf_sym__get(symtab->syms, symtab->syms_sec_idx_table, d, &sym,
&sym_sec_idx))
if we go ahead with skipping symbols, this one seems good
I think skipping symbols is nicer. If ELF is totally broken, then all
symbols are going to be ignored anyway. If it's some one-off issue for
a specific symbol, we'll just ignore it (unfortunately, silently).
quoted
But the current variant looks broken. Oh, and
elf_symtab__for_each_symbol() is similarly broken, can you please fix
that as well?
And this new macro should probably be in elf_symtab.h, along the
elf_symtab__for_each_symbol.
From: Jiri Olsa <hidden> Date: 2021-01-23 18:53:34
On Fri, Jan 22, 2021 at 02:55:51PM -0800, Andrii Nakryiko wrote:
On Fri, Jan 22, 2021 at 12:47 PM Jiri Olsa [off-list ref] wrote:
quoted
On Thu, Jan 21, 2021 at 03:32:40PM -0800, Andrii Nakryiko wrote:
SNIP
quoted
quoted
@@ -598,9 +599,36 @@ static void collect_symbol(GElf_Sym *sym, struct funcs_layout *fl) fl->mcount_stop = sym->st_value; }+static bool elf_sym__get(Elf_Data *syms, Elf_Data *syms_sec_idx_table,+ int id, GElf_Sym *sym, Elf32_Word *sym_sec_idx)+{+ if (!gelf_getsym(syms, id, sym))+ return false;++ *sym_sec_idx = sym->st_shndx;++ if (sym->st_shndx == SHN_XINDEX) {+ if (!syms_sec_idx_table)+ return false;+ if (!gelf_getsymshndx(syms, syms_sec_idx_table,+ id, sym, sym_sec_idx))
gelf_getsymshndx() is supposed to work even for cases that don't use
extended numbering, so this should work, right?
if (!gelf_getsymshndx(syms, syms_sec_idx_table, id, sym, sym_sec_idx))
return false;
it seems you're right, gelf_getsymshndx seem to work for
both cases, I'll check
quoted
if (sym->st_shndx == SHN_XINDEX)
*sym_sec_idx = sym->st_shndx;
I don't understand this.. gelf_getsymshndx will return both
symbol and proper index, no? also sym_sec_idx is already
assigned from previou call
Reading (some) implementation of gelf_getsymshndx() that I found
online, it won't set sym_sec_idx, if the symbol *doesn't* use extended
numbering. But it will still return symbol data. So to return the
the latest upstream code seems to set it always,
but I agree we should be careful
Mark, any insight in here? thanks
section index in all cases, we need to check again *after* we got
symbol, and if it's not extended, then set index manually.
hum, then we should use '!=', right?
if (sym->st_shndx != SHN_XINDEX)
*sym_sec_idx = sym->st_shndx;
SNIP
quoted
quoted
so either
for (id = 0; id < symtab->nr_syms && elf_sym__get(symtab->syms,
symtab->syms_sec_idx_table, d, &sym, &sym_sec_idx); id++)
or
for (id = 0; id < symtab->nr_syms; id++)
if (elf_sym__get(symtab->syms, symtab->syms_sec_idx_table, d, &sym,
&sym_sec_idx))
if we go ahead with skipping symbols, this one seems good
I think skipping symbols is nicer. If ELF is totally broken, then all
symbols are going to be ignored anyway. If it's some one-off issue for
a specific symbol, we'll just ignore it (unfortunately, silently).
On Sat, Jan 23, 2021 at 10:51 AM Jiri Olsa [off-list ref] wrote:
On Fri, Jan 22, 2021 at 02:55:51PM -0800, Andrii Nakryiko wrote:
quoted
On Fri, Jan 22, 2021 at 12:47 PM Jiri Olsa [off-list ref] wrote:
quoted
On Thu, Jan 21, 2021 at 03:32:40PM -0800, Andrii Nakryiko wrote:
SNIP
quoted
quoted
@@ -598,9 +599,36 @@ static void collect_symbol(GElf_Sym *sym, struct funcs_layout *fl) fl->mcount_stop = sym->st_value; }+static bool elf_sym__get(Elf_Data *syms, Elf_Data *syms_sec_idx_table,+ int id, GElf_Sym *sym, Elf32_Word *sym_sec_idx)+{+ if (!gelf_getsym(syms, id, sym))+ return false;++ *sym_sec_idx = sym->st_shndx;++ if (sym->st_shndx == SHN_XINDEX) {+ if (!syms_sec_idx_table)+ return false;+ if (!gelf_getsymshndx(syms, syms_sec_idx_table,+ id, sym, sym_sec_idx))
gelf_getsymshndx() is supposed to work even for cases that don't use
extended numbering, so this should work, right?
if (!gelf_getsymshndx(syms, syms_sec_idx_table, id, sym, sym_sec_idx))
return false;
it seems you're right, gelf_getsymshndx seem to work for
both cases, I'll check
quoted
if (sym->st_shndx == SHN_XINDEX)
*sym_sec_idx = sym->st_shndx;
I don't understand this.. gelf_getsymshndx will return both
symbol and proper index, no? also sym_sec_idx is already
assigned from previou call
Reading (some) implementation of gelf_getsymshndx() that I found
online, it won't set sym_sec_idx, if the symbol *doesn't* use extended
numbering. But it will still return symbol data. So to return the
the latest upstream code seems to set it always,
but I agree we should be careful
oh, then maybe it's not necessary. I honestly don't even know where
the authoritative source code of libelf is, so I just found some
random source code with Google.
Mark, any insight in here? thanks
quoted
section index in all cases, we need to check again *after* we got
symbol, and if it's not extended, then set index manually.
hum, then we should use '!=', right?
if (sym->st_shndx != SHN_XINDEX)
*sym_sec_idx = sym->st_shndx;
yeah, sorry, that was a typo
SNIP
quoted
quoted
quoted
so either
for (id = 0; id < symtab->nr_syms && elf_sym__get(symtab->syms,
symtab->syms_sec_idx_table, d, &sym, &sym_sec_idx); id++)
or
for (id = 0; id < symtab->nr_syms; id++)
if (elf_sym__get(symtab->syms, symtab->syms_sec_idx_table, d, &sym,
&sym_sec_idx))
if we go ahead with skipping symbols, this one seems good
I think skipping symbols is nicer. If ELF is totally broken, then all
symbols are going to be ignored anyway. If it's some one-off issue for
a specific symbol, we'll just ignore it (unfortunately, silently).
From: Jiri Olsa <hidden> Date: 2021-01-23 20:17:13
On Sat, Jan 23, 2021 at 09:08:15PM +0100, Mark Wielaard wrote:
Hi Jiri,
On Sat, 2021-01-23 at 19:51 +0100, Jiri Olsa wrote:
quoted
On Fri, Jan 22, 2021 at 02:55:51PM -0800, Andrii Nakryiko wrote:
quoted
quoted
I don't understand this.. gelf_getsymshndx will return both
symbol and proper index, no? also sym_sec_idx is already
assigned from previou call
Reading (some) implementation of gelf_getsymshndx() that I found
online, it won't set sym_sec_idx, if the symbol *doesn't* use
extended
numbering. But it will still return symbol data. So to return the
the latest upstream code seems to set it always,
but I agree we should be careful
Mark, any insight in here? thanks
GElf_Sym *
gelf_getsymshndx (Elf_Data *symdata, Elf_Data *shndxdata, int ndx,
GElf_Sym *dst, Elf32_Word *dstshndx)
Will always set *dst, but only set *dstshndx if both it and shndxdata
are not NULL and no error occurred (the function returns NULL and set
libelf_error in case of error).
So as long as shndxdata != NULL you can rely on *dstshndx being set.
Otherwise you get the section index from dst->st_shndx.
ok, so it's as Andrii said, I'll make the extra check then
thanks,
jirka
From: Mark Wielaard <hidden> Date: 2021-01-23 20:17:23
Hi Jiri,
On Sat, 2021-01-23 at 19:51 +0100, Jiri Olsa wrote:
On Fri, Jan 22, 2021 at 02:55:51PM -0800, Andrii Nakryiko wrote:
quoted
quoted
I don't understand this.. gelf_getsymshndx will return both
symbol and proper index, no? also sym_sec_idx is already
assigned from previou call
Reading (some) implementation of gelf_getsymshndx() that I found
online, it won't set sym_sec_idx, if the symbol *doesn't* use
extended
numbering. But it will still return symbol data. So to return the
the latest upstream code seems to set it always,
but I agree we should be careful
Mark, any insight in here? thanks
GElf_Sym *
gelf_getsymshndx (Elf_Data *symdata, Elf_Data *shndxdata, int ndx,
GElf_Sym *dst, Elf32_Word *dstshndx)
Will always set *dst, but only set *dstshndx if both it and shndxdata
are not NULL and no error occurred (the function returns NULL and set
libelf_error in case of error).
So as long as shndxdata != NULL you can rely on *dstshndx being set.
Otherwise you get the section index from dst->st_shndx.
Cheers,
Mark
From: Mark Wielaard <hidden> Date: 2021-01-23 20:22:58
Hi,
On Sat, 2021-01-23 at 12:07 -0800, Andrii Nakryiko wrote:
quoted
the latest upstream code seems to set it always,
but I agree we should be careful
oh, then maybe it's not necessary. I honestly don't even know where
the authoritative source code of libelf is, so I just found some
random source code with Google.
The elfutils.org libelf implementation can be found here:
https://sourceware.org/git/?p=elfutils.git;a=tree;f=libelf;hb=HEAD
There are some other implementations, but some aren't maintained and
others aren't packaged for any distro (anymore). libelf is a semi-
standard "SVR4 Unix" library, so you might also find it for some none
GNU/Linux OSes like Solaris. The ELF specification itself is contained
in the System V Application Binary Interface (gABI). The libelf library
itself isn't actually officially part of the specification. But we
still do try to keep the implementations (source) compatible through
the generic-abi mailinglist.
Cheers,
Mark
From: Jiri Olsa <hidden> Date: 2021-01-23 21:25:43
On Thu, Jan 21, 2021 at 03:32:40PM -0800, Andrii Nakryiko wrote:
SNIP
But the current variant looks broken. Oh, and
elf_symtab__for_each_symbol() is similarly broken, can you please fix
that as well?
we'll have to change its callers a bit, because of hanging 'else'
I'll send this separately if that's ok, when I figure out how to
test ctf code
jirka
---