Re: [tip:perf/core] perf symbols: Add support for reading from/proc/ kcore

From: Ingo Molnar
Date: Thu Sep 12 2013 - 09:13:33 EST



* tip-bot for Adrian Hunter <tipbot@xxxxxxxxx> wrote:

> Commit-ID: 8e0cf965f95edd41df11cca50b92b4cb6ea8d80a
> Gitweb: http://git.kernel.org/tip/8e0cf965f95edd41df11cca50b92b4cb6ea8d80a
> Author: Adrian Hunter <adrian.hunter@xxxxxxxxx>
> AuthorDate: Wed, 7 Aug 2013 14:38:51 +0300
> Committer: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
> CommitDate: Wed, 7 Aug 2013 17:35:33 -0300
>
> perf symbols: Add support for reading from /proc/kcore
>
> In the absence of vmlinux, perf tools uses kallsyms for symbols. If the
> user has access, now also map to /proc/kcore.

> +static int elf_read_maps(Elf *elf, bool exe, mapfn_t mapfn, void *data)
> +{
> + GElf_Phdr phdr;
> + size_t i, phdrnum;
> + int err;
> + u64 sz;
> +
> + if (elf_getphdrnum(elf, &phdrnum))
> + return -1;

This doesn't build on old distros with old libelf.

The wrapper below builds fine, but I've not tested it otherwise. Also, the
feature detection bits in config/* filling in HAVE_ELF_GETPHDRNUM are
missing.

Thanks,

Ingo

diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
index a7b9ab5..5fb9d61 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -8,6 +8,13 @@
#include "symbol.h"
#include "debug.h"

+#ifndef HAVE_ELF_GETPHDRNUM
+static int elf_getphdrnum (Elf *__elf __maybe_unused, size_t *__dst __maybe_unused)
+{
+ return 1;
+}
+#endif
+
#ifndef NT_GNU_BUILD_ID
#define NT_GNU_BUILD_ID 3
#endif

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/