public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Remi Bernon <rbernon@codeweavers.com>
To: Jiri Olsa <jolsa@redhat.com>
Cc: linux-kernel@vger.kernel.org,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Ingo Molnar <mingo@redhat.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Namhyung Kim <namhyung@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Jacek Caban <jacek@codeweavers.com>
Subject: Re: [PATCH v2 2/3] perf symbols: Try reading the symbol table with libbfd
Date: Wed, 5 Aug 2020 08:50:21 +0200	[thread overview]
Message-ID: <48dcbc10-8a68-0979-a00b-c8b3592b1924@codeweavers.com> (raw)
In-Reply-To: <20200804203249.GJ139381@krava>

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@codeweavers.com>

  reply	other threads:[~2020-08-05  6:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-04  8:57 [PATCH v2 1/3] perf dso: Use libbfd to read build_id and .gnu_debuglink section Remi Bernon
2020-08-04  8:57 ` [PATCH v2 2/3] perf symbols: Try reading the symbol table with libbfd Remi Bernon
2020-08-04 20:32   ` Jiri Olsa
2020-08-05  6:50     ` Remi Bernon [this message]
2020-08-04  8:57 ` [PATCH v2 3/3] perf tests: Add test for PE binary format support Remi Bernon
2020-08-04 21:14   ` Jiri Olsa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48dcbc10-8a68-0979-a00b-c8b3592b1924@codeweavers.com \
    --to=rbernon@codeweavers.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=jacek@codeweavers.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox