* [PATCH] perf symbols: Parse NOTE segments until the build id is found
@ 2023-11-30 13:57 Chengen Du
2023-11-30 18:23 ` Ian Rogers
0 siblings, 1 reply; 3+ messages in thread
From: Chengen Du @ 2023-11-30 13:57 UTC (permalink / raw)
To: namhyung
Cc: peterz, mingo, acme, mark.rutland, alexander.shishkin, jolsa,
irogers, adrian.hunter, linux-perf-users, linux-kernel,
Chengen Du
In the ELF file, multiple NOTE segments may exist.
To locate the build id, the process shall persist
in parsing NOTE segments until the build id is found.
Signed-off-by: Chengen Du <chengen.du@canonical.com>
---
tools/perf/util/symbol-minimal.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/tools/perf/util/symbol-minimal.c b/tools/perf/util/symbol-minimal.c
index a81a14769bd1..1da8b713509c 100644
--- a/tools/perf/util/symbol-minimal.c
+++ b/tools/perf/util/symbol-minimal.c
@@ -159,9 +159,10 @@ int filename__read_build_id(const char *filename, struct build_id *bid)
goto out_free;
ret = read_build_id(buf, buf_size, bid, need_swap);
- if (ret == 0)
+ if (ret == 0) {
ret = bid->size;
- break;
+ break;
+ }
}
} else {
Elf64_Ehdr ehdr;
@@ -210,9 +211,10 @@ int filename__read_build_id(const char *filename, struct build_id *bid)
goto out_free;
ret = read_build_id(buf, buf_size, bid, need_swap);
- if (ret == 0)
+ if (ret == 0) {
ret = bid->size;
- break;
+ break;
+ }
}
}
out_free:
--
2.40.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] perf symbols: Parse NOTE segments until the build id is found
2023-11-30 13:57 [PATCH] perf symbols: Parse NOTE segments until the build id is found Chengen Du
@ 2023-11-30 18:23 ` Ian Rogers
2023-12-05 15:56 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 3+ messages in thread
From: Ian Rogers @ 2023-11-30 18:23 UTC (permalink / raw)
To: Chengen Du
Cc: namhyung, peterz, mingo, acme, mark.rutland, alexander.shishkin,
jolsa, adrian.hunter, linux-perf-users, linux-kernel
On Thu, Nov 30, 2023 at 5:57 AM Chengen Du <chengen.du@canonical.com> wrote:
>
> In the ELF file, multiple NOTE segments may exist.
> To locate the build id, the process shall persist
> in parsing NOTE segments until the build id is found.
>
> Signed-off-by: Chengen Du <chengen.du@canonical.com>
Acked-by: Ian Rogers <irogers@google.com>
For this code to be run then libelf needs to be disabled, I guess this
is why the problem has existed, out of curiosity why not use libelf?
If you look at tools/perf/Makefile.config, disabling libelf disables
libbpf, which means a whole heap of perf tool features are going to be
missing for you.
It may also be possible to add:
Fixes b691f64360ec ("perf symbols: Implement poor man's ELF parser")
Thanks,
Ian
> ---
> tools/perf/util/symbol-minimal.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/tools/perf/util/symbol-minimal.c b/tools/perf/util/symbol-minimal.c
> index a81a14769bd1..1da8b713509c 100644
> --- a/tools/perf/util/symbol-minimal.c
> +++ b/tools/perf/util/symbol-minimal.c
> @@ -159,9 +159,10 @@ int filename__read_build_id(const char *filename, struct build_id *bid)
> goto out_free;
>
> ret = read_build_id(buf, buf_size, bid, need_swap);
> - if (ret == 0)
> + if (ret == 0) {
> ret = bid->size;
> - break;
> + break;
> + }
> }
> } else {
> Elf64_Ehdr ehdr;
> @@ -210,9 +211,10 @@ int filename__read_build_id(const char *filename, struct build_id *bid)
> goto out_free;
>
> ret = read_build_id(buf, buf_size, bid, need_swap);
> - if (ret == 0)
> + if (ret == 0) {
> ret = bid->size;
> - break;
> + break;
> + }
> }
> }
> out_free:
> --
> 2.40.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] perf symbols: Parse NOTE segments until the build id is found
2023-11-30 18:23 ` Ian Rogers
@ 2023-12-05 15:56 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2023-12-05 15:56 UTC (permalink / raw)
To: Ian Rogers
Cc: Chengen Du, namhyung, peterz, mingo, mark.rutland,
alexander.shishkin, jolsa, adrian.hunter, linux-perf-users,
linux-kernel
Em Thu, Nov 30, 2023 at 10:23:31AM -0800, Ian Rogers escreveu:
> On Thu, Nov 30, 2023 at 5:57 AM Chengen Du <chengen.du@canonical.com> wrote:
> >
> > In the ELF file, multiple NOTE segments may exist.
> > To locate the build id, the process shall persist
> > in parsing NOTE segments until the build id is found.
> >
> > Signed-off-by: Chengen Du <chengen.du@canonical.com>
>
> Acked-by: Ian Rogers <irogers@google.com>
Thanks, applied to perf-tools-next.
- Arnaldo
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-12-05 15:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-30 13:57 [PATCH] perf symbols: Parse NOTE segments until the build id is found Chengen Du
2023-11-30 18:23 ` Ian Rogers
2023-12-05 15:56 ` Arnaldo Carvalho de Melo
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).