Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf symbols: Parse NOTE segments until the build id is found

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>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20231130135723.17562-1-chengen.du@canonical.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Chengen Du and committed by
Arnaldo Carvalho de Melo
d0acce68 030ac3ca

+6 -4
+6 -4
tools/perf/util/symbol-minimal.c
··· 159 159 goto out_free; 160 160 161 161 ret = read_build_id(buf, buf_size, bid, need_swap); 162 - if (ret == 0) 162 + if (ret == 0) { 163 163 ret = bid->size; 164 - break; 164 + break; 165 + } 165 166 } 166 167 } else { 167 168 Elf64_Ehdr ehdr; ··· 211 210 goto out_free; 212 211 213 212 ret = read_build_id(buf, buf_size, bid, need_swap); 214 - if (ret == 0) 213 + if (ret == 0) { 215 214 ret = bid->size; 216 - break; 215 + break; 216 + } 217 217 } 218 218 } 219 219 out_free: