From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Cc: irogers@google.com, maddy@linux.ibm.com, kjain@linux.ibm.com,
linux-perf-users@vger.kernel.org, jolsa@kernel.org,
namhyung@kernel.org, disgoel@linux.vnet.ibm.com,
linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 1/2] tools/perf: Add text_end to "struct dso" to save .text section size
Date: Fri, 11 Aug 2023 10:55:27 -0300 [thread overview]
Message-ID: <ZNY9zwZOs47ETwnU@kernel.org> (raw)
In-Reply-To: <20230811052128.70282-1-atrajeev@linux.vnet.ibm.com>
Em Fri, Aug 11, 2023 at 10:51:27AM +0530, Athira Rajeev escreveu:
> Update "struct dso" to include new member "text_end".
> This new field will represent the offset for end of text
> section for a dso. This value is derived as:
> sh_size (Size of section in byes) + sh_offset (Section file
> offst) of the elf header for text.
You're stating what this patch does, but not why. So far was not needed,
why now?
Probably the second patch will have the answer, but please try to add
the reason on the patch that introduces the new field.
Thanks,
- Arnaldo
> Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
> ---
> tools/perf/util/dso.h | 1 +
> tools/perf/util/symbol-elf.c | 4 +++-
> 2 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/dso.h b/tools/perf/util/dso.h
> index b41c9782c754..70fe0fe69bef 100644
> --- a/tools/perf/util/dso.h
> +++ b/tools/perf/util/dso.h
> @@ -181,6 +181,7 @@ struct dso {
> u8 rel;
> struct build_id bid;
> u64 text_offset;
> + u64 text_end;
> const char *short_name;
> const char *long_name;
> u16 long_name_len;
> diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
> index 8bd466d1c2bd..252d26a59e64 100644
> --- a/tools/perf/util/symbol-elf.c
> +++ b/tools/perf/util/symbol-elf.c
> @@ -1512,8 +1512,10 @@ dso__load_sym_internal(struct dso *dso, struct map *map, struct symsrc *syms_ss,
> }
>
> if (elf_section_by_name(runtime_ss->elf, &runtime_ss->ehdr, &tshdr,
> - ".text", NULL))
> + ".text", NULL)) {
> dso->text_offset = tshdr.sh_addr - tshdr.sh_offset;
> + dso->text_end = tshdr.sh_offset + tshdr.sh_size;
> + }
>
> if (runtime_ss->opdsec)
> opddata = elf_rawdata(runtime_ss->opdsec, NULL);
> --
> 2.31.1
>
--
- Arnaldo
prev parent reply other threads:[~2023-08-11 13:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-11 5:21 [PATCH 1/2] tools/perf: Add text_end to "struct dso" to save .text section size Athira Rajeev
2023-08-11 5:21 ` [PATCH 2/2] tools/perf/tests: Fix object code reading to skip address that falls out of text section Athira Rajeev
2023-08-11 13:55 ` Arnaldo Carvalho de Melo [this message]
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=ZNY9zwZOs47ETwnU@kernel.org \
--to=acme@kernel.org \
--cc=atrajeev@linux.vnet.ibm.com \
--cc=disgoel@linux.vnet.ibm.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=kjain@linux.ibm.com \
--cc=linux-perf-users@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=namhyung@kernel.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;
as well as URLs for NNTP newsgroup(s).