aboutsummaryrefslogtreecommitdiffstats
path: root/tools/lib/bpf/elf.c
diff options
context:
space:
mode:
authorJiri Olsa <[email protected]>2023-11-25 19:31:25 +0000
committerAndrii Nakryiko <[email protected]>2023-11-29 05:50:09 +0000
commit48f0dfd8d3e212ab27b6db147ed10407ff6aaa88 (patch)
tree346ef8da903564feb9d80aba778b6a8684ea69cf /tools/lib/bpf/elf.c
parentselftests/bpf: update test_offload to use new orphaned property (diff)
downloadkernel-48f0dfd8d3e212ab27b6db147ed10407ff6aaa88.tar.gz
kernel-48f0dfd8d3e212ab27b6db147ed10407ff6aaa88.zip
libbpf: Add st_type argument to elf_resolve_syms_offsets function
We need to get offsets for static variables in following changes, so making elf_resolve_syms_offsets to take st_type value as argument and passing it to elf_sym_iter_new. Signed-off-by: Jiri Olsa <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]> Acked-by: Andrii Nakryiko <[email protected]> Acked-by: Song Liu <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
Diffstat (limited to 'tools/lib/bpf/elf.c')
-rw-r--r--tools/lib/bpf/elf.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/lib/bpf/elf.c b/tools/lib/bpf/elf.c
index 2a62bf411bb3..b02faec748a5 100644
--- a/tools/lib/bpf/elf.c
+++ b/tools/lib/bpf/elf.c
@@ -407,7 +407,8 @@ static int symbol_cmp(const void *a, const void *b)
* size, that needs to be released by the caller.
*/
int elf_resolve_syms_offsets(const char *binary_path, int cnt,
- const char **syms, unsigned long **poffsets)
+ const char **syms, unsigned long **poffsets,
+ int st_type)
{
int sh_types[2] = { SHT_DYNSYM, SHT_SYMTAB };
int err = 0, i, cnt_done = 0;
@@ -438,7 +439,7 @@ int elf_resolve_syms_offsets(const char *binary_path, int cnt,
struct elf_sym_iter iter;
struct elf_sym *sym;
- err = elf_sym_iter_new(&iter, elf_fd.elf, binary_path, sh_types[i], STT_FUNC);
+ err = elf_sym_iter_new(&iter, elf_fd.elf, binary_path, sh_types[i], st_type);
if (err == -ENOENT)
continue;
if (err)