perf symbols: Move symsrc prototypes to a separate header
authorArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 30 Aug 2019 13:26:37 +0000 (10:26 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Sun, 1 Sep 2019 01:24:05 +0000 (22:24 -0300)
So that we can remove dso.h from symbol.h and reduce the header
dependency tree.

Fixup cases where struct dso guts are needed but were obtained via
symbol.h, indirectly.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lkml.kernel.org/n/tip-ip683cegt306ncu3gsz7ii21@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/arch/powerpc/util/sym-handling.c
tools/perf/builtin-probe.c
tools/perf/ui/browsers/map.c
tools/perf/ui/gtk/annotate.c
tools/perf/util/symbol-elf.c
tools/perf/util/symbol-minimal.c
tools/perf/util/symbol.c
tools/perf/util/symbol.h
tools/perf/util/symbol_fprintf.c
tools/perf/util/symsrc.h [new file with mode: 0644]

index b0a67eaf2ce8c12246809cbffbdae5719b75d753..8a4b717e0a533993af7a087c4b8e2df90b6493d7 100644 (file)
@@ -5,6 +5,7 @@
  */
 
 #include "debug.h"
+#include "dso.h"
 #include "symbol.h"
 #include "map.h"
 #include "probe-event.h"
index 8950c05ef8fdbb316d4b89f1a5271ffb78a35ce9..6dce1724a3788df7b961db16122f28a002442ed2 100644 (file)
@@ -18,6 +18,7 @@
 
 #include "builtin.h"
 #include "namespaces.h"
+#include "util/build-id.h"
 #include "util/strlist.h"
 #include "util/strfilter.h"
 #include "util/symbol.h"
index 4c545b92e20dc342dc80b2c2006dddfbe3cde8cc..893b065971f668c146019a17bf1aeed462b8017b 100644 (file)
@@ -8,6 +8,7 @@
 #include "../../util/util.h"
 #include "../../util/debug.h"
 #include "../../util/map.h"
+#include "../../util/dso.h"
 #include "../../util/symbol.h"
 #include "../browser.h"
 #include "../helpline.h"
index d7f984436dec3df1d0650386c2c8fe1ada66363d..8e744af24f7c83e29fb95dca94f979a49adae7e1 100644 (file)
@@ -5,6 +5,7 @@
 #include "util/annotate.h"
 #include "util/evsel.h"
 #include "util/map.h"
+#include "util/dso.h"
 #include "util/symbol.h"
 #include "ui/helpline.h"
 #include <inttypes.h>
index 6d22437e88aee2be812ac1a8297b0962cdaca9e0..9428639872a645eb81177aaf5217631d09ed1eaf 100644 (file)
@@ -10,6 +10,7 @@
 #include "map.h"
 #include "map_groups.h"
 #include "symbol.h"
+#include "symsrc.h"
 #include "demangle-java.h"
 #include "demangle-rust.h"
 #include "machine.h"
index 3bc8b7e3300e9dff7e668e8725ebd25e530fd33e..7e2813ec94983b31438afe9c9e87d08f75a0d52b 100644 (file)
@@ -1,5 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
+#include "dso.h"
 #include "symbol.h"
+#include "symsrc.h"
 #include "util.h"
 
 #include <errno.h>
index b11a6968166244d58fdb9b29004ada424a920076..e5ffe61ad66b3306be4d65e669d7ea65590a4ef2 100644 (file)
@@ -25,6 +25,7 @@
 #include "machine.h"
 #include "map.h"
 #include "symbol.h"
+#include "symsrc.h"
 #include "strlist.h"
 #include "intlist.h"
 #include "namespaces.h"
index 22660c7614a5c2f67c6201e70882ad2b448d65b3..5a58407c2945ed2c9980a182781c1c80f26dda25 100644 (file)
@@ -20,8 +20,7 @@
 #endif
 #include <elf.h>
 
-#include "dso.h"
-
+struct dso;
 struct map;
 struct map_groups;
 struct option;
@@ -148,37 +147,6 @@ struct addr_location {
        s32           socket;
 };
 
-struct symsrc {
-       char *name;
-       int fd;
-       enum dso_binary_type type;
-
-#ifdef HAVE_LIBELF_SUPPORT
-       Elf *elf;
-       GElf_Ehdr ehdr;
-
-       Elf_Scn *opdsec;
-       size_t opdidx;
-       GElf_Shdr opdshdr;
-
-       Elf_Scn *symtab;
-       GElf_Shdr symshdr;
-
-       Elf_Scn *dynsym;
-       size_t dynsym_idx;
-       GElf_Shdr dynshdr;
-
-       bool adjust_symbols;
-       bool is_64_bit;
-#endif
-};
-
-void symsrc__destroy(struct symsrc *ss);
-int symsrc__init(struct symsrc *ss, struct dso *dso, const char *name,
-                enum dso_binary_type type);
-bool symsrc__has_symtab(struct symsrc *ss);
-bool symsrc__possibly_runtime(struct symsrc *ss);
-
 int dso__load(struct dso *dso, struct map *map);
 int dso__load_vmlinux(struct dso *dso, struct map *map,
                      const char *vmlinux, bool vmlinux_allocated);
@@ -232,6 +200,8 @@ bool symbol__restricted_filename(const char *filename,
 int symbol__config_symfs(const struct option *opt __maybe_unused,
                         const char *dir, int unset __maybe_unused);
 
+struct symsrc;
+
 int dso__load_sym(struct dso *dso, struct map *map, struct symsrc *syms_ss,
                  struct symsrc *runtime_ss, int kmodule);
 int dso__synthesize_plt_symbols(struct dso *dso, struct symsrc *ss);
index 02e89b02c2cefc9e0cab6c0d0059603e898685a8..35c936ce33efa6ea202cd7374d86a7eaeaf5f818 100644 (file)
@@ -3,6 +3,7 @@
 #include <inttypes.h>
 #include <stdio.h>
 
+#include "dso.h"
 #include "map.h"
 #include "symbol.h"
 
diff --git a/tools/perf/util/symsrc.h b/tools/perf/util/symsrc.h
new file mode 100644 (file)
index 0000000..2665b4b
--- /dev/null
@@ -0,0 +1,46 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __PERF_SYMSRC_
+#define __PERF_SYMSRC_ 1
+
+#include <stdbool.h>
+#include <stddef.h>
+#include "dso.h"
+
+#ifdef HAVE_LIBELF_SUPPORT
+#include <libelf.h>
+#include <gelf.h>
+#endif
+#include <elf.h>
+
+struct symsrc {
+       char                 *name;
+       int                  fd;
+       enum dso_binary_type type;
+
+#ifdef HAVE_LIBELF_SUPPORT
+       Elf                  *elf;
+       GElf_Ehdr            ehdr;
+
+       Elf_Scn              *opdsec;
+       size_t               opdidx;
+       GElf_Shdr            opdshdr;
+
+       Elf_Scn              *symtab;
+       GElf_Shdr            symshdr;
+
+       Elf_Scn              *dynsym;
+       size_t               dynsym_idx;
+       GElf_Shdr            dynshdr;
+
+       bool                 adjust_symbols;
+       bool                 is_64_bit;
+#endif
+};
+
+int symsrc__init(struct symsrc *ss, struct dso *dso, const char *name, enum dso_binary_type type);
+void symsrc__destroy(struct symsrc *ss);
+
+bool symsrc__has_symtab(struct symsrc *ss);
+bool symsrc__possibly_runtime(struct symsrc *ss);
+
+#endif /* __PERF_SYMSRC_ */