[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <48dcbc10-8a68-0979-a00b-c8b3592b1924@codeweavers.com>
Date: Wed, 5 Aug 2020 08:50:21 +0200
From: Remi Bernon <rbernon@...eweavers.com>
To: Jiri Olsa <jolsa@...hat.com>
Cc: linux-kernel@...r.kernel.org,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Ingo Molnar <mingo@...hat.com>,
Mark Rutland <mark.rutland@....com>,
Namhyung Kim <namhyung@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Jacek Caban <jacek@...eweavers.com>
Subject: Re: [PATCH v2 2/3] perf symbols: Try reading the symbol table with
libbfd
On 2020-08-04 22:32, Jiri Olsa wrote:
> 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
>
Maybe it could but because libbfd exposes the common subset of all its
backends, it doesn't provide symbol sizes for instance (that's how I
understand it). So I didn't want to lose features compared to what the
libelf path is currently doing.
For non-elf objects, the implementation here works around that by
assuming that all the symbols are following each other contiguously, but
that's a little bit incorrect.
--
RĂ©mi Bernon <rbernon@...eweavers.com>
Powered by blists - more mailing lists