perf symbol-elf: Decode dynsym even if symtab exists
authorMasami Hiramatsu <mhiramat@kernel.org>
Sat, 3 Jul 2021 15:35:27 +0000 (00:35 +0900)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 7 Jul 2021 13:28:10 +0000 (10:28 -0300)
commit87704345cc602a845be713abdc679d65dc600431
treed12a9c0ef9be859c6116a617b7e15f1cbfc7cf86
parenteb4717f733b5941a29ea4e0aec3227a0e0770487
perf symbol-elf: Decode dynsym even if symtab exists

In Fedora34, libc-2.33.so has both .dynsym and .symtab sections and
most of (not all) symbols moved to .dynsym. In this case, perf only
decode the symbols in .symtab, and perf probe can not list up the
functions in the library.

To fix this issue, decode both .symtab and .dynsym sections.

Without this fix,
  -----
  $ ./perf probe -x /usr/lib64/libc-2.33.so -F
  @plt
  @plt
  calloc@plt
  free@plt
  malloc@plt
  memalign@plt
  realloc@plt
  -----

With this fix.

  -----
  $ ./perf probe -x /usr/lib64/libc-2.33.so -F
  @plt
  @plt
  a64l
  abort
  abs
  accept
  accept4
  access
  acct
  addmntent
  -----

Reported-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Acked-by: Thomas Richter <tmricht@linux.ibm.com>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Stefan Liebler <stli@linux.ibm.com>
Cc: Sven Schnelle <svens@linux.ibm.com>
Link: http://lore.kernel.org/lkml/162532652681.393143.10163733179955267999.stgit@devnote2
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/symbol-elf.c