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

perf build: Rename HAVE_DWARF_SUPPORT to HAVE_LIBDW_SUPPORT

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>

authored by

Ian Rogers and committed by
Namhyung Kim
8838abf6 5eb22425

+40 -40
+3 -3
tools/perf/Documentation/perf-check.txt
··· 47 47 bpf / HAVE_LIBBPF_SUPPORT 48 48 bpf_skeletons / HAVE_BPF_SKEL 49 49 debuginfod / HAVE_DEBUGINFOD_SUPPORT 50 - dwarf / HAVE_DWARF_SUPPORT 51 - dwarf_getlocations / HAVE_DWARF_SUPPORT 50 + dwarf / HAVE_LIBDW_SUPPORT 51 + dwarf_getlocations / HAVE_LIBDW_SUPPORT 52 52 dwarf-unwind / HAVE_DWARF_UNWIND_SUPPORT 53 53 auxtrace / HAVE_AUXTRACE_SUPPORT 54 54 libaudit / HAVE_LIBAUDIT_SUPPORT 55 55 libbfd / HAVE_LIBBFD_SUPPORT 56 56 libcapstone / HAVE_LIBCAPSTONE_SUPPORT 57 57 libcrypto / HAVE_LIBCRYPTO_SUPPORT 58 - libdw-dwarf-unwind / HAVE_DWARF_SUPPORT 58 + libdw-dwarf-unwind / HAVE_LIBDW_SUPPORT 59 59 libelf / HAVE_LIBELF_SUPPORT 60 60 libnuma / HAVE_LIBNUMA_SUPPORT 61 61 libopencsd / HAVE_CSTRACE_SUPPORT
+1 -1
tools/perf/Makefile.config
··· 559 559 $(warning DWARF register mappings have not been defined for architecture $(SRCARCH), DWARF support disabled) 560 560 NO_LIBDW := 1 561 561 else 562 - CFLAGS += -DHAVE_DWARF_SUPPORT $(LIBDW_CFLAGS) 562 + CFLAGS += -DHAVE_LIBDW_SUPPORT $(LIBDW_CFLAGS) 563 563 LDFLAGS += $(LIBDW_LDFLAGS) 564 564 EXTLIBS += ${DWARFLIBS} 565 565 $(call detected,CONFIG_DWARF)
+2 -2
tools/perf/arch/powerpc/annotate/instructions.c
··· 255 255 * is moved to r31. update_insn_state_powerpc tracks these state 256 256 * changes 257 257 */ 258 - #ifdef HAVE_DWARF_SUPPORT 258 + #ifdef HAVE_LIBDW_SUPPORT 259 259 static void update_insn_state_powerpc(struct type_state *state, 260 260 struct data_loc_info *dloc, Dwarf_Die * cu_die __maybe_unused, 261 261 struct disasm_line *dl) ··· 300 300 insn_offset, src->reg1, dst->reg1); 301 301 pr_debug_type_name(&tsr->type, tsr->kind); 302 302 } 303 - #endif /* HAVE_DWARF_SUPPORT */ 303 + #endif /* HAVE_LIBDW_SUPPORT */ 304 304 305 305 static int powerpc__annotate_init(struct arch *arch, char *cpuid __maybe_unused) 306 306 {
+1 -1
tools/perf/arch/x86/annotate/instructions.c
··· 207 207 return err; 208 208 } 209 209 210 - #ifdef HAVE_DWARF_SUPPORT 210 + #ifdef HAVE_LIBDW_SUPPORT 211 211 static void update_insn_state_x86(struct type_state *state, 212 212 struct data_loc_info *dloc, Dwarf_Die *cu_die, 213 213 struct disasm_line *dl)
+1 -1
tools/perf/builtin-annotate.c
··· 840 840 } 841 841 #endif 842 842 843 - #ifndef HAVE_DWARF_SUPPORT 843 + #ifndef HAVE_LIBDW_SUPPORT 844 844 if (annotate.data_type) { 845 845 pr_err("Error: Data type profiling is disabled due to missing DWARF support\n"); 846 846 return -ENOTSUP;
+3 -3
tools/perf/builtin-check.c
··· 27 27 FEATURE_STATUS("bpf", HAVE_LIBBPF_SUPPORT), 28 28 FEATURE_STATUS("bpf_skeletons", HAVE_BPF_SKEL), 29 29 FEATURE_STATUS("debuginfod", HAVE_DEBUGINFOD_SUPPORT), 30 - FEATURE_STATUS("dwarf", HAVE_DWARF_SUPPORT), 31 - FEATURE_STATUS("dwarf_getlocations", HAVE_DWARF_SUPPORT), 30 + FEATURE_STATUS("dwarf", HAVE_LIBDW_SUPPORT), 31 + FEATURE_STATUS("dwarf_getlocations", HAVE_LIBDW_SUPPORT), 32 32 FEATURE_STATUS("dwarf-unwind", HAVE_DWARF_UNWIND_SUPPORT), 33 33 FEATURE_STATUS("auxtrace", HAVE_AUXTRACE_SUPPORT), 34 34 FEATURE_STATUS("libaudit", HAVE_LIBAUDIT_SUPPORT), 35 35 FEATURE_STATUS("libbfd", HAVE_LIBBFD_SUPPORT), 36 36 FEATURE_STATUS("libcapstone", HAVE_LIBCAPSTONE_SUPPORT), 37 37 FEATURE_STATUS("libcrypto", HAVE_LIBCRYPTO_SUPPORT), 38 - FEATURE_STATUS("libdw-dwarf-unwind", HAVE_DWARF_SUPPORT), 38 + FEATURE_STATUS("libdw-dwarf-unwind", HAVE_LIBDW_SUPPORT), 39 39 FEATURE_STATUS("libelf", HAVE_LIBELF_SUPPORT), 40 40 FEATURE_STATUS("libnuma", HAVE_LIBNUMA_SUPPORT), 41 41 FEATURE_STATUS("libopencsd", HAVE_CSTRACE_SUPPORT),
+6 -6
tools/perf/builtin-probe.c
··· 229 229 230 230 /* Command option callbacks */ 231 231 232 - #ifdef HAVE_DWARF_SUPPORT 232 + #ifdef HAVE_LIBDW_SUPPORT 233 233 static int opt_show_lines(const struct option *opt, 234 234 const char *str, int unset __maybe_unused) 235 235 { ··· 505 505 return ret; 506 506 } 507 507 508 - #ifdef HAVE_DWARF_SUPPORT 508 + #ifdef HAVE_LIBDW_SUPPORT 509 509 #define PROBEDEF_STR \ 510 510 "[EVENT=]FUNC[@SRC][+OFF|%return|:RL|;PT]|SRC:AL|SRC;PT [[NAME=]ARG ...]" 511 511 #else ··· 521 521 "perf probe [<options>] --add 'PROBEDEF' [--add 'PROBEDEF' ...]", 522 522 "perf probe [<options>] --del '[GROUP:]EVENT' ...", 523 523 "perf probe --list [GROUP:]EVENT ...", 524 - #ifdef HAVE_DWARF_SUPPORT 524 + #ifdef HAVE_LIBDW_SUPPORT 525 525 "perf probe [<options>] --line 'LINEDESC'", 526 526 "perf probe [<options>] --vars 'PROBEPOINT'", 527 527 #endif ··· 545 545 "\t\tFUNC:\tFunction name\n" 546 546 "\t\tOFF:\tOffset from function entry (in byte)\n" 547 547 "\t\t%return:\tPut the probe at function return\n" 548 - #ifdef HAVE_DWARF_SUPPORT 548 + #ifdef HAVE_LIBDW_SUPPORT 549 549 "\t\tSRC:\tSource code path\n" 550 550 "\t\tRL:\tRelative line number from function entry.\n" 551 551 "\t\tAL:\tAbsolute line number in file.\n" ··· 612 612 set_option_flag(options, 'd', "del", PARSE_OPT_EXCLUSIVE); 613 613 set_option_flag(options, 'D', "definition", PARSE_OPT_EXCLUSIVE); 614 614 set_option_flag(options, 'l', "list", PARSE_OPT_EXCLUSIVE); 615 - #ifdef HAVE_DWARF_SUPPORT 615 + #ifdef HAVE_LIBDW_SUPPORT 616 616 set_option_flag(options, 'L', "line", PARSE_OPT_EXCLUSIVE); 617 617 set_option_flag(options, 'V', "vars", PARSE_OPT_EXCLUSIVE); 618 618 #else ··· 694 694 if (ret < 0) 695 695 pr_err_with_code(" Error: Failed to show functions.", ret); 696 696 return ret; 697 - #ifdef HAVE_DWARF_SUPPORT 697 + #ifdef HAVE_LIBDW_SUPPORT 698 698 case 'L': 699 699 ret = show_line_range(&params->line_range, params->target, 700 700 params->nsi, params->uprobes);
+2 -2
tools/perf/builtin-report.c
··· 455 455 if (!(evlist__combined_branch_type(session->evlist) & PERF_SAMPLE_BRANCH_ANY)) 456 456 rep->nonany_branch_mode = true; 457 457 458 - #if !defined(HAVE_LIBUNWIND_SUPPORT) && !defined(HAVE_DWARF_SUPPORT) 458 + #if !defined(HAVE_LIBUNWIND_SUPPORT) && !defined(HAVE_LIBDW_SUPPORT) 459 459 if (dwarf_callchain_users) { 460 460 ui__warning("Please install libunwind or libdw " 461 461 "development packages during the perf build.\n"); ··· 1705 1705 report.data_type = true; 1706 1706 annotate_opts.annotate_src = false; 1707 1707 1708 - #ifndef HAVE_DWARF_SUPPORT 1708 + #ifndef HAVE_LIBDW_SUPPORT 1709 1709 pr_err("Error: Data type profiling is disabled due to missing DWARF support\n"); 1710 1710 goto error; 1711 1711 #endif
+4 -4
tools/perf/util/annotate-data.h
··· 9 9 #include "dwarf-regs.h" 10 10 #include "annotate.h" 11 11 12 - #ifdef HAVE_DWARF_SUPPORT 12 + #ifdef HAVE_LIBDW_SUPPORT 13 13 #include "debuginfo.h" 14 14 #endif 15 15 ··· 165 165 }; 166 166 extern struct annotated_data_stat ann_data_stat; 167 167 168 - #ifdef HAVE_DWARF_SUPPORT 168 + #ifdef HAVE_LIBDW_SUPPORT 169 169 /* 170 170 * Type information in a register, valid when @ok is true. 171 171 * The @caller_saved registers are invalidated after a function call. ··· 244 244 const char **var_name, int *var_offset); 245 245 void pr_debug_type_name(Dwarf_Die *die, enum type_state_kind kind); 246 246 247 - #else /* HAVE_DWARF_SUPPORT */ 247 + #else /* HAVE_LIBDW_SUPPORT */ 248 248 249 249 static inline struct annotated_data_type * 250 250 find_data_type(struct data_loc_info *dloc __maybe_unused) ··· 276 276 return -1; 277 277 } 278 278 279 - #endif /* HAVE_DWARF_SUPPORT */ 279 + #endif /* HAVE_LIBDW_SUPPORT */ 280 280 281 281 #ifdef HAVE_SLANG_SUPPORT 282 282 int hist_entry__annotate_data_tui(struct hist_entry *he, struct evsel *evsel,
+3 -3
tools/perf/util/debuginfo.h
··· 5 5 #include <errno.h> 6 6 #include <linux/compiler.h> 7 7 8 - #ifdef HAVE_DWARF_SUPPORT 8 + #ifdef HAVE_LIBDW_SUPPORT 9 9 10 10 #include "dwarf-aux.h" 11 11 ··· 25 25 int debuginfo__get_text_offset(struct debuginfo *dbg, Dwarf_Addr *offs, 26 26 bool adjust_offset); 27 27 28 - #else /* HAVE_DWARF_SUPPORT */ 28 + #else /* HAVE_LIBDW_SUPPORT */ 29 29 30 30 /* dummy debug information structure */ 31 31 struct debuginfo { ··· 49 49 return -EINVAL; 50 50 } 51 51 52 - #endif /* HAVE_DWARF_SUPPORT */ 52 + #endif /* HAVE_LIBDW_SUPPORT */ 53 53 54 54 #ifdef HAVE_DEBUGINFOD_SUPPORT 55 55 int get_source_from_debuginfod(const char *raw_path, const char *sbuild_id,
+2 -2
tools/perf/util/disasm.c
··· 151 151 .memory_ref_char = '(', 152 152 .imm_char = '$', 153 153 }, 154 - #ifdef HAVE_DWARF_SUPPORT 154 + #ifdef HAVE_LIBDW_SUPPORT 155 155 .update_insn_state = update_insn_state_x86, 156 156 #endif 157 157 }, 158 158 { 159 159 .name = "powerpc", 160 160 .init = powerpc__annotate_init, 161 - #ifdef HAVE_DWARF_SUPPORT 161 + #ifdef HAVE_LIBDW_SUPPORT 162 162 .update_insn_state = update_insn_state_powerpc, 163 163 #endif 164 164 },
+2 -2
tools/perf/util/disasm.h
··· 4 4 5 5 #include "map_symbol.h" 6 6 7 - #ifdef HAVE_DWARF_SUPPORT 7 + #ifdef HAVE_LIBDW_SUPPORT 8 8 #include "dwarf-aux.h" 9 9 #endif 10 10 ··· 39 39 char memory_ref_char; 40 40 char imm_char; 41 41 } objdump; 42 - #ifdef HAVE_DWARF_SUPPORT 42 + #ifdef HAVE_LIBDW_SUPPORT 43 43 void (*update_insn_state)(struct type_state *state, 44 44 struct data_loc_info *dloc, Dwarf_Die *cu_die, 45 45 struct disasm_line *dl);
+2 -2
tools/perf/util/genelf.c
··· 16 16 #include <inttypes.h> 17 17 #include <fcntl.h> 18 18 #include <err.h> 19 - #ifdef HAVE_DWARF_SUPPORT 19 + #ifdef HAVE_LIBDW_SUPPORT 20 20 #include <dwarf.h> 21 21 #endif 22 22 ··· 499 499 shdr->sh_size = sizeof(bnote); 500 500 shdr->sh_entsize = 0; 501 501 502 - #ifdef HAVE_DWARF_SUPPORT 502 + #ifdef HAVE_LIBDW_SUPPORT 503 503 if (debug && nr_debug_entries) { 504 504 retval = jit_add_debug_info(e, load_addr, debug, nr_debug_entries); 505 505 if (retval)
+1 -1
tools/perf/util/genelf.h
··· 8 8 int jit_write_elf(int fd, uint64_t code_addr, const char *sym, 9 9 const void *code, int csize, void *debug, int nr_debug_entries, 10 10 void *unwinding, uint64_t unwinding_header_size, uint64_t unwinding_size); 11 - #ifdef HAVE_DWARF_SUPPORT 11 + #ifdef HAVE_LIBDW_SUPPORT 12 12 /* genelf_debug.c */ 13 13 int jit_add_debug_info(Elf *e, uint64_t code_addr, void *debug, int nr_debug_entries); 14 14 #endif
+3 -3
tools/perf/util/include/dwarf-regs.h
··· 6 6 #define DWARF_REG_PC 0xd3af9c /* random number */ 7 7 #define DWARF_REG_FB 0xd3affb /* random number */ 8 8 9 - #ifdef HAVE_DWARF_SUPPORT 9 + #ifdef HAVE_LIBDW_SUPPORT 10 10 const char *get_arch_regstr(unsigned int n); 11 11 /* 12 12 * get_dwarf_regstr - Returns ftrace register string from DWARF regnum ··· 23 23 */ 24 24 int get_dwarf_regnum(const char *name, unsigned int machine); 25 25 26 - #else /* HAVE_DWARF_SUPPORT */ 26 + #else /* HAVE_LIBDW_SUPPORT */ 27 27 28 28 static inline int get_dwarf_regnum(const char *name __maybe_unused, 29 29 unsigned int machine __maybe_unused) ··· 32 32 } 33 33 #endif 34 34 35 - #if !defined(__powerpc__) || !defined(HAVE_DWARF_SUPPORT) 35 + #if !defined(__powerpc__) || !defined(HAVE_LIBDW_SUPPORT) 36 36 static inline void get_powerpc_regs(u32 raw_insn __maybe_unused, int is_source __maybe_unused, 37 37 struct annotated_op_loc *op_loc __maybe_unused) 38 38 {
+2 -2
tools/perf/util/probe-event.c
··· 345 345 return mod_name; 346 346 } 347 347 348 - #ifdef HAVE_DWARF_SUPPORT 348 + #ifdef HAVE_LIBDW_SUPPORT 349 349 350 350 static int kernel_get_module_dso(const char *module, struct dso **pdso) 351 351 { ··· 1253 1253 return ret; 1254 1254 } 1255 1255 1256 - #else /* !HAVE_DWARF_SUPPORT */ 1256 + #else /* !HAVE_LIBDW_SUPPORT */ 1257 1257 1258 1258 static void debuginfo_cache__exit(void) 1259 1259 {
+2 -2
tools/perf/util/probe-finder.h
··· 21 21 return isalpha(name[0]) || name[0] == '_'; 22 22 } 23 23 24 - #ifdef HAVE_DWARF_SUPPORT 24 + #ifdef HAVE_LIBDW_SUPPORT 25 25 26 26 #include "dwarf-aux.h" 27 27 #include "debuginfo.h" ··· 102 102 int found; 103 103 }; 104 104 105 - #endif /* HAVE_DWARF_SUPPORT */ 105 + #endif /* HAVE_LIBDW_SUPPORT */ 106 106 107 107 #endif /*_PROBE_FINDER_H */