Re: [PATCH v2 2/3] perf symbols: Try reading the symbol table with libbfd

From: Jiri Olsa
Date: Tue Aug 04 2020 - 16:33:04 EST


On Tue, Aug 04, 2020 at 10:57:35AM +0200, Remi Bernon wrote:

SNIP

> +
> +int dso__load_bfd_symbols(struct dso *dso, const char *debugfile)
> +{
> + int err = -1;
> + long symbols_size, symbols_count;
> + asection *section;
> + asymbol **symbols, *sym;
> + struct symbol *symbol;
> + bfd *abfd;
> + u_int i;
> + u64 start, len;
> +
> + abfd = bfd_openr(dso->long_name, NULL);
> + if (!abfd)
> + return -1;
> +
> + if (!bfd_check_format(abfd, bfd_object)) {
> + pr_debug2("%s: cannot read %s bfd file.\n", __func__,
> + dso->long_name);
> + goto out_close;
> + }
> +
> + if (bfd_get_flavour(abfd) == bfd_target_elf_flavour)
> + goto out_close;

aah, so the code is actualy only for non elf objects,
somehow I thought it's replacing the symbol load globaly

jirka