libbpf-tools: fix uprobe helper get_elf_func_offset
authorHengqi Chen <chenhengqi@outlook.com>
Thu, 1 Jul 2021 13:16:15 +0000 (21:16 +0800)
committeryonghong-song <ys114321@gmail.com>
Mon, 12 Jul 2021 06:08:23 +0000 (23:08 -0700)
commitad83318d09cb9729d8c0792e5e33f25102df7014
tree08b38b53bafd5a21273bc1d580dfecae2bf99fcd
parent423656396e3c8454924daefc9a8dc0496414d748
libbpf-tools: fix uprobe helper get_elf_func_offset

get_elf_func_offset didn't work properly when use with
statically linked binary. It seems like not subtract the
base load address cause the problem. This commits fixes
that like BCC does. see [0] and [1].

[0]: https://github.com/iovisor/bcc/blob/v0.20.0/src/cc/bcc_syms.cc#L751-L764
[1]: https://github.com/iovisor/bcc/blob/v0.20.0/src/cc/bcc_elf.c#L723-L756

Signed-off-by: Hengqi Chen <chenhengqi@outlook.com>
libbpf-tools/uprobe_helpers.c