]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
perf machine: Don't ignore _etext when not a text symbol
authorChristophe Leroy <christophe.leroy@csgroup.eu>
Wed, 8 Jan 2025 09:15:24 +0000 (10:15 +0100)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 8 Jan 2025 20:20:42 +0000 (17:20 -0300)
Depending on how vmlinux.lds is written, _etext might be the very first
data symbol instead of the very last text symbol.

Don't require it to be a text symbol, accept any symbol type.

Comitter notes:

See the first Link for further discussion, but it all boils down to
this:

 ---
  # grep -e _stext -e _etext -e _edata /proc/kallsyms
  c0000000 T _stext
  c08b8000 D _etext

  So there is no _edata and _etext is not text

  $ ppc-linux-objdump -x vmlinux | grep -e _stext -e _etext -e _edata
  c0000000 g       .head.text 00000000 _stext
  c08b8000 g       .rodata 00000000 _etext
  c1378000 g       .sbss 00000000 _edata
 ---

Fixes: ed9adb2035b5be58 ("perf machine: Read also the end of the kernel")
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: linuxppc-dev@lists.ozlabs.org
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Song Liu <songliubraving@fb.com>
Link: https://lore.kernel.org/r/b3ee1994d95257cb7f2de037c5030ba7d1bed404.1736327613.git.christophe.leroy@csgroup.eu
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/machine.c

index 27d5345d2b307a97ee8dfacac19833465b95a3e1..9be2f4479f52572c3687411d27b95d79d6139b5f 100644 (file)
@@ -1003,7 +1003,7 @@ static int machine__get_running_kernel_start(struct machine *machine,
 
        err = kallsyms__get_symbol_start(filename, "_edata", &addr);
        if (err)
-               err = kallsyms__get_function_start(filename, "_etext", &addr);
+               err = kallsyms__get_symbol_start(filename, "_etext", &addr);
        if (!err)
                *end = addr;