Commit 33ff581eddf744ea91a50d46c2f0961b375a9595

Authored by Jiri Olsa
Committed by Arnaldo Carvalho de Melo
1 parent e7c72d888d

perf symbols: Read plt symbols from proper symtab_type binary

When loading symbols from DSO we check multiple paths of DSO binary
until we succeed to load symbols ('.symtab' section). Once symbols are
read we try to load also plt symbols.

During the reading of plt symbols, the dso file is reopened from
location given by dso->long_name. This could be wrong in case we want
process buildid binaries.

The change is to make the plt symbols being read from the DSO path, that
normal symbols were read from.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1334756818-6631-1-git-send-email-jolsa@redhat.com
[ committer note: moved dso to be the first parameter of that function ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

Showing 1 changed file with 6 additions and 7 deletions Side-by-side Diff

tools/perf/util/symbol.c
... ... @@ -977,8 +977,9 @@
977 977 * And always look at the original dso, not at debuginfo packages, that
978 978 * have the PLT data stripped out (shdr_rel_plt.sh_type == SHT_NOBITS).
979 979 */
980   -static int dso__synthesize_plt_symbols(struct dso *dso, struct map *map,
981   - symbol_filter_t filter)
  980 +static int
  981 +dso__synthesize_plt_symbols(struct dso *dso, char *name, struct map *map,
  982 + symbol_filter_t filter)
982 983 {
983 984 uint32_t nr_rel_entries, idx;
984 985 GElf_Sym sym;
985 986  
... ... @@ -993,10 +994,7 @@
993 994 char sympltname[1024];
994 995 Elf *elf;
995 996 int nr = 0, symidx, fd, err = 0;
996   - char name[PATH_MAX];
997 997  
998   - snprintf(name, sizeof(name), "%s%s",
999   - symbol_conf.symfs, dso->long_name);
1000 998 fd = open(name, O_RDONLY);
1001 999 if (fd < 0)
1002 1000 goto out;
... ... @@ -1703,8 +1701,9 @@
1703 1701 continue;
1704 1702  
1705 1703 if (ret > 0) {
1706   - int nr_plt = dso__synthesize_plt_symbols(dso, map,
1707   - filter);
  1704 + int nr_plt;
  1705 +
  1706 + nr_plt = dso__synthesize_plt_symbols(dso, name, map, filter);
1708 1707 if (nr_plt > 0)
1709 1708 ret += nr_plt;
1710 1709 break;