perf build: Rename HAVE_DWARF_SUPPORT to HAVE_LIBDW_SUPPORT
authorIan Rogers <irogers@google.com>
Thu, 17 Oct 2024 00:13:53 +0000 (17:13 -0700)
committerNamhyung Kim <namhyung@kernel.org>
Fri, 18 Oct 2024 17:17:40 +0000 (10:17 -0700)
In Makefile.config for unwinding the name dwarf implies either
libunwind or libdw. Make it clearer that HAVE_DWARF_SUPPORT is really
just defined when libdw is present by renaming to HAVE_LIBDW_SUPPORT.

Signed-off-by: Ian Rogers <irogers@google.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Tested-by: Leo Yan <leo.yan@arm.com>
Cc: Anup Patel <anup@brainfault.org>
Cc: Yang Jihong <yangjihong@bytedance.com>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: Shenlin Liang <liangshenlin@eswincomputing.com>
Cc: Nick Terrell <terrelln@fb.com>
Cc: Guilherme Amadio <amadio@gentoo.org>
Cc: Steinar H. Gunderson <sesse@google.com>
Cc: Changbin Du <changbin.du@huawei.com>
Cc: Alexander Lobakin <aleksander.lobakin@intel.com>
Cc: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Cc: Huacai Chen <chenhuacai@kernel.org>
Cc: Guo Ren <guoren@kernel.org>
Cc: Masahiro Yamada <masahiroy@kernel.org>
Cc: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Cc: Will Deacon <will@kernel.org>
Cc: James Clark <james.clark@linaro.org>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Chen Pei <cp0613@linux.alibaba.com>
Cc: Leo Yan <leo.yan@linux.dev>
Cc: Oliver Upton <oliver.upton@linux.dev>
Cc: Aditya Gupta <adityag@linux.ibm.com>
Cc: Kajol Jain <kjain@linux.ibm.com>
Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-riscv@lists.infradead.org
Cc: Bibo Mao <maobibo@loongson.cn>
Cc: John Garry <john.g.garry@oracle.com>
Cc: Atish Patra <atishp@rivosinc.com>
Cc: Dima Kogan <dima@secretsauce.net>
Cc: Paul Walmsley <paul.walmsley@sifive.com>
Cc: Dr. David Alan Gilbert <linux@treblig.org>
Cc: linux-csky@vger.kernel.org
Link: https://lore.kernel.org/r/20241017001354.56973-11-irogers@google.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
17 files changed:
tools/perf/Documentation/perf-check.txt
tools/perf/Makefile.config
tools/perf/arch/powerpc/annotate/instructions.c
tools/perf/arch/x86/annotate/instructions.c
tools/perf/builtin-annotate.c
tools/perf/builtin-check.c
tools/perf/builtin-probe.c
tools/perf/builtin-report.c
tools/perf/util/annotate-data.h
tools/perf/util/debuginfo.h
tools/perf/util/disasm.c
tools/perf/util/disasm.h
tools/perf/util/genelf.c
tools/perf/util/genelf.h
tools/perf/util/include/dwarf-regs.h
tools/perf/util/probe-event.c
tools/perf/util/probe-finder.h

index 45101a8e4154ed6dbb38cda9d371ee9c58be5c4b..31741499e7867c9b712227f31a2958fd641d474a 100644 (file)
@@ -47,15 +47,15 @@ feature::
                 bpf                     /  HAVE_LIBBPF_SUPPORT
                 bpf_skeletons           /  HAVE_BPF_SKEL
                 debuginfod              /  HAVE_DEBUGINFOD_SUPPORT
-                dwarf                   /  HAVE_DWARF_SUPPORT
-                dwarf_getlocations      /  HAVE_DWARF_SUPPORT
+                dwarf                   /  HAVE_LIBDW_SUPPORT
+                dwarf_getlocations      /  HAVE_LIBDW_SUPPORT
                 dwarf-unwind            /  HAVE_DWARF_UNWIND_SUPPORT
                 auxtrace                /  HAVE_AUXTRACE_SUPPORT
                 libaudit                /  HAVE_LIBAUDIT_SUPPORT
                 libbfd                  /  HAVE_LIBBFD_SUPPORT
                 libcapstone             /  HAVE_LIBCAPSTONE_SUPPORT
                 libcrypto               /  HAVE_LIBCRYPTO_SUPPORT
-                libdw-dwarf-unwind      /  HAVE_DWARF_SUPPORT
+                libdw-dwarf-unwind      /  HAVE_LIBDW_SUPPORT
                 libelf                  /  HAVE_LIBELF_SUPPORT
                 libnuma                 /  HAVE_LIBNUMA_SUPPORT
                 libopencsd              /  HAVE_CSTRACE_SUPPORT
index 7dbcf8394f3dcdd1cf2c23c36ebbad812007a80a..d0ad2919983c06132d72a2f6c3cc6a26c255f1ef 100644 (file)
@@ -559,7 +559,7 @@ ifndef NO_LIBELF
       $(warning DWARF register mappings have not been defined for architecture $(SRCARCH), DWARF support disabled)
       NO_LIBDW := 1
     else
-      CFLAGS += -DHAVE_DWARF_SUPPORT $(LIBDW_CFLAGS)
+      CFLAGS += -DHAVE_LIBDW_SUPPORT $(LIBDW_CFLAGS)
       LDFLAGS += $(LIBDW_LDFLAGS)
       EXTLIBS += ${DWARFLIBS}
       $(call detected,CONFIG_DWARF)
index ede9eeade0ab34b75257135ea008f575de69bd5d..54478cf5cccc95a782624c33137dc809a6e8bd04 100644 (file)
@@ -255,7 +255,7 @@ static struct ins_ops *check_ppc_insn(struct disasm_line *dl)
  * is moved to r31. update_insn_state_powerpc tracks these state
  * changes
  */
-#ifdef HAVE_DWARF_SUPPORT
+#ifdef HAVE_LIBDW_SUPPORT
 static void update_insn_state_powerpc(struct type_state *state,
                struct data_loc_info *dloc, Dwarf_Die * cu_die __maybe_unused,
                struct disasm_line *dl)
@@ -300,7 +300,7 @@ static void update_insn_state_powerpc(struct type_state *state,
                        insn_offset, src->reg1, dst->reg1);
        pr_debug_type_name(&tsr->type, tsr->kind);
 }
-#endif /* HAVE_DWARF_SUPPORT */
+#endif /* HAVE_LIBDW_SUPPORT */
 
 static int powerpc__annotate_init(struct arch *arch, char *cpuid __maybe_unused)
 {
index 5caf5a17f03d8fd57684b045430f6563bc97c2e7..c869abe3c31da4fd72ea3fb90f6eedac8dc963ba 100644 (file)
@@ -207,7 +207,7 @@ static int x86__annotate_init(struct arch *arch, char *cpuid)
        return err;
 }
 
-#ifdef HAVE_DWARF_SUPPORT
+#ifdef HAVE_LIBDW_SUPPORT
 static void update_insn_state_x86(struct type_state *state,
                                  struct data_loc_info *dloc, Dwarf_Die *cu_die,
                                  struct disasm_line *dl)
index 04af13eb4a4c91fcd075e9c65a16b0558cf060d6..bb87e6e7687dc12feffef9960a2b115ec755eb9d 100644 (file)
@@ -840,7 +840,7 @@ int cmd_annotate(int argc, const char **argv)
        }
 #endif
 
-#ifndef HAVE_DWARF_SUPPORT
+#ifndef HAVE_LIBDW_SUPPORT
        if (annotate.data_type) {
                pr_err("Error: Data type profiling is disabled due to missing DWARF support\n");
                return -ENOTSUP;
index 18c0a815243b2e1d65d38cc1549ca917c7797913..2346536a5ee14f91ecd10bd130a64676e871e1b2 100644 (file)
@@ -27,15 +27,15 @@ struct feature_status supported_features[] = {
        FEATURE_STATUS("bpf", HAVE_LIBBPF_SUPPORT),
        FEATURE_STATUS("bpf_skeletons", HAVE_BPF_SKEL),
        FEATURE_STATUS("debuginfod", HAVE_DEBUGINFOD_SUPPORT),
-       FEATURE_STATUS("dwarf", HAVE_DWARF_SUPPORT),
-       FEATURE_STATUS("dwarf_getlocations", HAVE_DWARF_SUPPORT),
+       FEATURE_STATUS("dwarf", HAVE_LIBDW_SUPPORT),
+       FEATURE_STATUS("dwarf_getlocations", HAVE_LIBDW_SUPPORT),
        FEATURE_STATUS("dwarf-unwind", HAVE_DWARF_UNWIND_SUPPORT),
        FEATURE_STATUS("auxtrace", HAVE_AUXTRACE_SUPPORT),
        FEATURE_STATUS("libaudit", HAVE_LIBAUDIT_SUPPORT),
        FEATURE_STATUS("libbfd", HAVE_LIBBFD_SUPPORT),
        FEATURE_STATUS("libcapstone", HAVE_LIBCAPSTONE_SUPPORT),
        FEATURE_STATUS("libcrypto", HAVE_LIBCRYPTO_SUPPORT),
-       FEATURE_STATUS("libdw-dwarf-unwind", HAVE_DWARF_SUPPORT),
+       FEATURE_STATUS("libdw-dwarf-unwind", HAVE_LIBDW_SUPPORT),
        FEATURE_STATUS("libelf", HAVE_LIBELF_SUPPORT),
        FEATURE_STATUS("libnuma", HAVE_LIBNUMA_SUPPORT),
        FEATURE_STATUS("libopencsd", HAVE_CSTRACE_SUPPORT),
index 91672bb3047c3d81beb15ca61b1992b3de7622ca..69800e4d9530b6292bf0aa4c2e02b38d645d8de9 100644 (file)
@@ -229,7 +229,7 @@ static int opt_set_target_ns(const struct option *opt __maybe_unused,
 
 /* Command option callbacks */
 
-#ifdef HAVE_DWARF_SUPPORT
+#ifdef HAVE_LIBDW_SUPPORT
 static int opt_show_lines(const struct option *opt,
                          const char *str, int unset __maybe_unused)
 {
@@ -505,7 +505,7 @@ out:
        return ret;
 }
 
-#ifdef HAVE_DWARF_SUPPORT
+#ifdef HAVE_LIBDW_SUPPORT
 #define PROBEDEF_STR   \
        "[EVENT=]FUNC[@SRC][+OFF|%return|:RL|;PT]|SRC:AL|SRC;PT [[NAME=]ARG ...]"
 #else
@@ -521,7 +521,7 @@ __cmd_probe(int argc, const char **argv)
                "perf probe [<options>] --add 'PROBEDEF' [--add 'PROBEDEF' ...]",
                "perf probe [<options>] --del '[GROUP:]EVENT' ...",
                "perf probe --list [GROUP:]EVENT ...",
-#ifdef HAVE_DWARF_SUPPORT
+#ifdef HAVE_LIBDW_SUPPORT
                "perf probe [<options>] --line 'LINEDESC'",
                "perf probe [<options>] --vars 'PROBEPOINT'",
 #endif
@@ -545,7 +545,7 @@ __cmd_probe(int argc, const char **argv)
                "\t\tFUNC:\tFunction name\n"
                "\t\tOFF:\tOffset from function entry (in byte)\n"
                "\t\t%return:\tPut the probe at function return\n"
-#ifdef HAVE_DWARF_SUPPORT
+#ifdef HAVE_LIBDW_SUPPORT
                "\t\tSRC:\tSource code path\n"
                "\t\tRL:\tRelative line number from function entry.\n"
                "\t\tAL:\tAbsolute line number in file.\n"
@@ -612,7 +612,7 @@ __cmd_probe(int argc, const char **argv)
        set_option_flag(options, 'd', "del", PARSE_OPT_EXCLUSIVE);
        set_option_flag(options, 'D', "definition", PARSE_OPT_EXCLUSIVE);
        set_option_flag(options, 'l', "list", PARSE_OPT_EXCLUSIVE);
-#ifdef HAVE_DWARF_SUPPORT
+#ifdef HAVE_LIBDW_SUPPORT
        set_option_flag(options, 'L', "line", PARSE_OPT_EXCLUSIVE);
        set_option_flag(options, 'V', "vars", PARSE_OPT_EXCLUSIVE);
 #else
@@ -694,7 +694,7 @@ __cmd_probe(int argc, const char **argv)
                if (ret < 0)
                        pr_err_with_code("  Error: Failed to show functions.", ret);
                return ret;
-#ifdef HAVE_DWARF_SUPPORT
+#ifdef HAVE_LIBDW_SUPPORT
        case 'L':
                ret = show_line_range(&params->line_range, params->target,
                                      params->nsi, params->uprobes);
index 2251aa61ea53db32c3f16339efc4644705a66ee5..45304ee5537cb01da1982b1beb8ea12acfb7fe40 100644 (file)
@@ -455,7 +455,7 @@ static int report__setup_sample_type(struct report *rep)
        if (!(evlist__combined_branch_type(session->evlist) & PERF_SAMPLE_BRANCH_ANY))
                rep->nonany_branch_mode = true;
 
-#if !defined(HAVE_LIBUNWIND_SUPPORT) && !defined(HAVE_DWARF_SUPPORT)
+#if !defined(HAVE_LIBUNWIND_SUPPORT) && !defined(HAVE_LIBDW_SUPPORT)
        if (dwarf_callchain_users) {
                ui__warning("Please install libunwind or libdw "
                            "development packages during the perf build.\n");
@@ -1705,7 +1705,7 @@ repeat:
                report.data_type = true;
                annotate_opts.annotate_src = false;
 
-#ifndef HAVE_DWARF_SUPPORT
+#ifndef HAVE_LIBDW_SUPPORT
                pr_err("Error: Data type profiling is disabled due to missing DWARF support\n");
                goto error;
 #endif
index 8ac0fd94a0ba4e4b84fe6c6debd0f08cd41a9496..98c80b2268dde88970eb5c310eef0f69aa09a759 100644 (file)
@@ -9,7 +9,7 @@
 #include "dwarf-regs.h"
 #include "annotate.h"
 
-#ifdef HAVE_DWARF_SUPPORT
+#ifdef HAVE_LIBDW_SUPPORT
 #include "debuginfo.h"
 #endif
 
@@ -165,7 +165,7 @@ struct annotated_data_stat {
 };
 extern struct annotated_data_stat ann_data_stat;
 
-#ifdef HAVE_DWARF_SUPPORT
+#ifdef HAVE_LIBDW_SUPPORT
 /*
  * Type information in a register, valid when @ok is true.
  * The @caller_saved registers are invalidated after a function call.
@@ -244,7 +244,7 @@ bool get_global_var_info(struct data_loc_info *dloc, u64 addr,
                                const char **var_name, int *var_offset);
 void pr_debug_type_name(Dwarf_Die *die, enum type_state_kind kind);
 
-#else /* HAVE_DWARF_SUPPORT */
+#else /* HAVE_LIBDW_SUPPORT */
 
 static inline struct annotated_data_type *
 find_data_type(struct data_loc_info *dloc __maybe_unused)
@@ -276,7 +276,7 @@ static inline int hist_entry__annotate_data_tty(struct hist_entry *he __maybe_un
        return -1;
 }
 
-#endif /* HAVE_DWARF_SUPPORT */
+#endif /* HAVE_LIBDW_SUPPORT */
 
 #ifdef HAVE_SLANG_SUPPORT
 int hist_entry__annotate_data_tui(struct hist_entry *he, struct evsel *evsel,
index ad6422c3f8ca3ef6d694d6e710c448aa7bcac7aa..a52d69932815cd72740c4d17a7ce37cb9a64d8df 100644 (file)
@@ -5,7 +5,7 @@
 #include <errno.h>
 #include <linux/compiler.h>
 
-#ifdef HAVE_DWARF_SUPPORT
+#ifdef HAVE_LIBDW_SUPPORT
 
 #include "dwarf-aux.h"
 
@@ -25,7 +25,7 @@ void debuginfo__delete(struct debuginfo *dbg);
 int debuginfo__get_text_offset(struct debuginfo *dbg, Dwarf_Addr *offs,
                               bool adjust_offset);
 
-#else /* HAVE_DWARF_SUPPORT */
+#else /* HAVE_LIBDW_SUPPORT */
 
 /* dummy debug information structure */
 struct debuginfo {
@@ -49,7 +49,7 @@ static inline int debuginfo__get_text_offset(struct debuginfo *dbg __maybe_unuse
        return -EINVAL;
 }
 
-#endif /* HAVE_DWARF_SUPPORT */
+#endif /* HAVE_LIBDW_SUPPORT */
 
 #ifdef HAVE_DEBUGINFOD_SUPPORT
 int get_source_from_debuginfod(const char *raw_path, const char *sbuild_id,
index 2c8063660f2e8cb54917b73f58b48039812fe7ec..aef06a36bf40a7dfc3ba807283908a2ad72b7a33 100644 (file)
@@ -151,14 +151,14 @@ static struct arch architectures[] = {
                        .memory_ref_char = '(',
                        .imm_char = '$',
                },
-#ifdef HAVE_DWARF_SUPPORT
+#ifdef HAVE_LIBDW_SUPPORT
                .update_insn_state = update_insn_state_x86,
 #endif
        },
        {
                .name = "powerpc",
                .init = powerpc__annotate_init,
-#ifdef HAVE_DWARF_SUPPORT
+#ifdef HAVE_LIBDW_SUPPORT
                .update_insn_state = update_insn_state_powerpc,
 #endif
        },
index f56beedeb9dadb4b6bfac7d342c5548cf83e8aec..486c269b29ba5cf7624d56cc9b430814740d26e9 100644 (file)
@@ -4,7 +4,7 @@
 
 #include "map_symbol.h"
 
-#ifdef HAVE_DWARF_SUPPORT
+#ifdef HAVE_LIBDW_SUPPORT
 #include "dwarf-aux.h"
 #endif
 
@@ -39,7 +39,7 @@ struct arch {
                char memory_ref_char;
                char imm_char;
        } objdump;
-#ifdef HAVE_DWARF_SUPPORT
+#ifdef HAVE_LIBDW_SUPPORT
        void            (*update_insn_state)(struct type_state *state,
                                struct data_loc_info *dloc, Dwarf_Die *cu_die,
                                struct disasm_line *dl);
index c8f6bee1fa6190b7971cb56c8e9b9f06359c1c10..cdce7f173d00a9bcb3b24ba8e06f7743589abd81 100644 (file)
@@ -16,7 +16,7 @@
 #include <inttypes.h>
 #include <fcntl.h>
 #include <err.h>
-#ifdef HAVE_DWARF_SUPPORT
+#ifdef HAVE_LIBDW_SUPPORT
 #include <dwarf.h>
 #endif
 
@@ -499,7 +499,7 @@ jit_write_elf(int fd, uint64_t load_addr, const char *sym,
        shdr->sh_size = sizeof(bnote);
        shdr->sh_entsize = 0;
 
-#ifdef HAVE_DWARF_SUPPORT
+#ifdef HAVE_LIBDW_SUPPORT
        if (debug && nr_debug_entries) {
                retval = jit_add_debug_info(e, load_addr, debug, nr_debug_entries);
                if (retval)
index 4e2e4f40e134fd839b28a8b7ddbb1b2be773c5fb..9f0b875d6548cf26571a8b854b68c91c8020171d 100644 (file)
@@ -8,7 +8,7 @@
 int jit_write_elf(int fd, uint64_t code_addr, const char *sym,
                  const void *code, int csize, void *debug, int nr_debug_entries,
                  void *unwinding, uint64_t unwinding_header_size, uint64_t unwinding_size);
-#ifdef HAVE_DWARF_SUPPORT
+#ifdef HAVE_LIBDW_SUPPORT
 /* genelf_debug.c */
 int jit_add_debug_info(Elf *e, uint64_t code_addr, void *debug, int nr_debug_entries);
 #endif
index 75b28dcc8317db96372fe91ee05544d1c408282d..29a7d0546b823627df070f289cbeec038317a1f3 100644 (file)
@@ -6,7 +6,7 @@
 #define DWARF_REG_PC  0xd3af9c /* random number */
 #define DWARF_REG_FB  0xd3affb /* random number */
 
-#ifdef HAVE_DWARF_SUPPORT
+#ifdef HAVE_LIBDW_SUPPORT
 const char *get_arch_regstr(unsigned int n);
 /*
  * get_dwarf_regstr - Returns ftrace register string from DWARF regnum
@@ -23,7 +23,7 @@ int get_arch_regnum(const char *name);
  */
 int get_dwarf_regnum(const char *name, unsigned int machine);
 
-#else /* HAVE_DWARF_SUPPORT */
+#else /* HAVE_LIBDW_SUPPORT */
 
 static inline int get_dwarf_regnum(const char *name __maybe_unused,
                                   unsigned int machine __maybe_unused)
@@ -32,7 +32,7 @@ static inline int get_dwarf_regnum(const char *name __maybe_unused,
 }
 #endif
 
-#if !defined(__powerpc__) || !defined(HAVE_DWARF_SUPPORT)
+#if !defined(__powerpc__) || !defined(HAVE_LIBDW_SUPPORT)
 static inline void get_powerpc_regs(u32 raw_insn __maybe_unused, int is_source __maybe_unused,
                struct annotated_op_loc *op_loc __maybe_unused)
 {
index 2c8d94d09e86c48c62c3e3330a8c75140b3116c0..a580aa2cd51208cd658b8b0ac7fd09f339f2ec3d 100644 (file)
@@ -345,7 +345,7 @@ elf_err:
        return mod_name;
 }
 
-#ifdef HAVE_DWARF_SUPPORT
+#ifdef HAVE_LIBDW_SUPPORT
 
 static int kernel_get_module_dso(const char *module, struct dso **pdso)
 {
@@ -1253,7 +1253,7 @@ out:
        return ret;
 }
 
-#else  /* !HAVE_DWARF_SUPPORT */
+#else  /* !HAVE_LIBDW_SUPPORT */
 
 static void debuginfo_cache__exit(void)
 {
index 5ced3b058fd8c2bfab996bdc189d67f2e5bf8063..dfcf8cdd9e8dbe23921ffa880f70faae131b31cd 100644 (file)
@@ -21,7 +21,7 @@ static inline int is_c_varname(const char *name)
        return isalpha(name[0]) || name[0] == '_';
 }
 
-#ifdef HAVE_DWARF_SUPPORT
+#ifdef HAVE_LIBDW_SUPPORT
 
 #include "dwarf-aux.h"
 #include "debuginfo.h"
@@ -102,6 +102,6 @@ struct line_finder {
        int                     found;
 };
 
-#endif /* HAVE_DWARF_SUPPORT */
+#endif /* HAVE_LIBDW_SUPPORT */
 
 #endif /*_PROBE_FINDER_H */