Commit Graph

13 Commits

Author SHA1 Message Date
Arnaldo Carvalho de Melo 24404190b8 elf_symtab: Remove needless GElf_Ehdr pointer argument from the constructor
We don't need it as we used it only for calling elf_section_by_name(),
that doesn't need it anymore.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-20 16:40:27 -03:00
Jiri Olsa 1bb49897dd bpf_encoder: Translate SHN_XINDEX in symbol's st_shndx values
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 functions.

Tested by running pahole on kernel compiled with:

  make KCFLAGS="-ffunction-sections -fdata-sections" -j$(nproc) vmlinux

and ensure FUNC records are generated and match normal build (without
above KCFLAGS).

Also bpf selftest passed and generated kernel BTF, is same as without
the patch.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Hao Luo <haoluo@google.com>
Cc: Joe Lawrence <joe.lawrence@redhat.com>
Cc: John Fastabend <john.fastabend@gmail.com>
Cc: KP Singh <kpsingh@chromium.org>
Cc: Mark Wieelard <mjw@redhat.com>
Cc: Martin KaFai Lau <kafai@fb.com>
Cc: Song Liu <songliubraving@fb.com>
Cc: Yonghong Song <yhs@fb.com>
Cc: bpf@vger.kernel.org
Cc: dwarves@vger.kernel.org
Cc: netdev@vger.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-01-26 22:36:36 -03:00
Domenico Andreoli e714d2eaa1 Adopt SPDX-License-Identifier
Signed-off-by: Domenico Andreoli <domenico.andreoli@linux.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2019-01-18 15:41:48 -03:00
Arnaldo Carvalho de Melo fd3838ae9a dwarves: Stop using 'self'
As Thomas Gleixner wisely pointed out, using 'self' is stoopid, it
doesn't convey useful information, so use sensible names

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2014-01-06 16:46:50 -03:00
Arnaldo Carvalho de Melo f74ad7eb4c elf_symtab: Add elf_sym__section helper
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-03 11:56:03 -03:00
Arnaldo Carvalho de Melo deb509cf6c libctf: Ignore hidden symbols
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-01 14:03:04 -03:00
Arnaldo Carvalho de Melo 2584df6335 ctf_loader: Fill in the binding information for variables and functions
Using elf_sym__bind, i.e. Elf_Sym->st_info bind subfield.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-01 11:38:37 -03:00
Arnaldo Carvalho de Melo 1d7bd94e2f elf_symtab: Introduce elf_sym__is_local_object
Will be used when encoding the OBJECT symtab entries in the
objects CTF section (varibles/data).

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-03-31 16:04:27 -03:00
Arnaldo Carvalho de Melo 31fd625644 elf_symtab: Fix bogus elf_symtab__is_local_function
It should look for functions, not OBJECTS (variables).

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-03-28 19:27:00 -03:00
Arnaldo Carvalho de Melo ba47890b18 elf_symtab: Allow passing the name of the symtab to be parsed
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-03-25 18:02:48 -03:00
Arnaldo Carvalho de Melo 33cec4c457 elf_symtab: Add accessor for the symbol size
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-03-25 17:26:27 -03:00
Arnaldo Carvalho de Melo 717f7ab8b0 elf_symtab: Introduce elf_symtab__for_each_symbol
And ditch the iterate calling a function interface. I'm trying to get rid of
that in the core (cu__for_each+callback+filter, etc) because doit it
explicitely, like in the kernel, where you have a foo__for_each_bar and do the
filtering directly and process the data, if the processing is simple, right in
the body of the loop, instead of having to go back and forth thru functions.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-03-25 17:17:25 -03:00
Arnaldo Carvalho de Melo 0954d75152 elf_symtab: Introduce elf_symtab
We will need this when encoding the CTF functions section.  Things like lookup
a function by its address when converting from a DW_TAG_subprogram to a CTF
function, for instance.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-03-24 16:58:44 -03:00