From: Leo Yan <leo.yan@linaro.org>
To: Ajay Kaher <akaher@vmware.com>
Cc: peterz@infradead.org, mingo@redhat.com, acme@kernel.org,
mark.rutland@arm.com, alexander.shishkin@linux.intel.com,
jolsa@kernel.org, namhyung@kernel.org, rostedt@goodmis.org,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
srivatsab@vmware.com, srivatsa@csail.mit.edu,
amakhalov@vmware.com, vsirnapalli@vmware.com
Subject: Re: [PATCH] perf symbol: correction while adjusting symbol
Date: Thu, 24 Nov 2022 17:50:23 +0800 [thread overview]
Message-ID: <Y38+NGjF1tZNHkwr@leoy-yangtze.lan> (raw)
In-Reply-To: <1669198696-50547-1-git-send-email-akaher@vmware.com>
Hi Ajay,
On Wed, Nov 23, 2022 at 03:48:16PM +0530, Ajay Kaher wrote:
> perf doesn't provide proper symbol information for specially crafted
> .debug files.
>
> Sometimes .debug file may not have similar program header as runtime
> ELF file. For example if we generate .debug file using objcopy
> --only-keep-debug resulting file will not contain .text, .data and
> other runtime sections. That means corresponding program headers will
> have zero FileSiz and modified Offset.
>
> Example: program header of text section of libxxx.so:
>
> Type Offset VirtAddr PhysAddr
> FileSiz MemSiz Flags Align
> LOAD 0x00000000003d3000 0x00000000003d3000 0x00000000003d3000
> 0x000000000055ae80 0x000000000055ae80 R E 0x1000
>
> Same program header after executing:
> objcopy --only-keep-debug libxxx.so libxxx.so.debug
>
> LOAD 0x0000000000001000 0x00000000003d3000 0x00000000003d3000
> 0x0000000000000000 0x000000000055ae80 R E 0x1000
>
> Offset and FileSiz have been changed.
>
> Following formula will not provide correct value, if program header
> taken from .debug file (syms_ss):
>
> sym.st_value -= phdr.p_vaddr - phdr.p_offset;
>
> Correct program header information is located inside runtime ELF
> file (runtime_ss).
>
> Fixes: 2d86612aacb7 ("perf symbol: Correct address for bss symbols")
> Signed-off-by: Ajay Kaher <akaher@vmware.com>
Just curious how you can produce this issue? IIUC, the runtime symbol
files are copied into .debug folder and they can be found by perf tool
by matching build ID. Seems to me, you manully use
"objcopy --only-keep-debug" command to strip runtime info from elf files
under .debug folder. Do I understand correctly?
Though I have above question, this patch itself looks good to me,
thanks for the fixing!
Reviewed-by: Leo Yan <leo.yan@linaro.org>
next prev parent reply other threads:[~2022-11-24 9:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-23 10:18 Ajay Kaher
2022-11-24 9:50 ` Leo Yan [this message]
2022-11-24 10:20 ` Ajay Kaher
2022-11-24 12:55 ` Arnaldo Carvalho de Melo
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=Y38+NGjF1tZNHkwr@leoy-yangtze.lan \
--to=leo.yan@linaro.org \
--cc=acme@kernel.org \
--cc=akaher@vmware.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=amakhalov@vmware.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=srivatsa@csail.mit.edu \
--cc=srivatsab@vmware.com \
--cc=vsirnapalli@vmware.com \
/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
all inboxes | Powered by JetHome®