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

perf build: Combine test-dwarf-getcfi into test-libdw

dwarf_getcfi support in libdw is 15 years old. Make libdw imply
dwarf_getcfi support and simplify build logic.

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-8-irogers@google.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>

authored by

Ian Rogers and committed by
Namhyung Kim
26385fd2 23580d7b

+10 -22
-1
tools/build/Makefile.feature
··· 31 31 FEATURE_TESTS_BASIC := \ 32 32 backtrace \ 33 33 libdw \ 34 - dwarf_getcfi \ 35 34 eventfd \ 36 35 fortify-source \ 37 36 get_current_dir_name \
-4
tools/build/feature/Makefile
··· 6 6 test-backtrace.bin \ 7 7 test-bionic.bin \ 8 8 test-libdw.bin \ 9 - test-dwarf_getcfi.bin \ 10 9 test-eventfd.bin \ 11 10 test-fortify-source.bin \ 12 11 test-get_current_dir_name.bin \ ··· 184 185 endif 185 186 186 187 $(OUTPUT)test-libdw.bin: 187 - $(BUILD) $(DWLIBS) 188 - 189 - $(OUTPUT)test-dwarf_getcfi.bin: 190 188 $(BUILD) $(DWLIBS) 191 189 192 190 $(OUTPUT)test-libelf-getphdrnum.bin:
-9
tools/build/feature/test-dwarf_getcfi.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - #include <stdio.h> 3 - #include <elfutils/libdw.h> 4 - 5 - int main(void) 6 - { 7 - Dwarf *dwarf = NULL; 8 - return dwarf_getcfi(dwarf) == NULL; 9 - }
+9 -1
tools/build/feature/test-libdw.c
··· 34 34 return (int)dwarf_getlocations(&attr, offset, &base, &start, &end, &op, &nops); 35 35 } 36 36 37 + int test_libdw_getcfi(void) 38 + { 39 + Dwarf *dwarf = NULL; 40 + 41 + return dwarf_getcfi(dwarf) == NULL; 42 + } 43 + 37 44 int main(void) 38 45 { 39 - return test_libdw() + test_libdw_unwind() + test_libdw_getlocations(); 46 + return test_libdw() + test_libdw_unwind() + test_libdw_getlocations() + 47 + test_libdw_getcfi(); 40 48 }
+1 -7
tools/perf/Makefile.config
··· 164 164 endif 165 165 FEATURE_CHECK_CFLAGS-libdw := $(LIBDW_CFLAGS) 166 166 FEATURE_CHECK_LDFLAGS-libdw := $(LIBDW_LDFLAGS) $(DWARFLIBS) 167 - FEATURE_CHECK_CFLAGS-dwarf_getcfi := $(LIBDW_CFLAGS) 168 - FEATURE_CHECK_LDFLAGS-dwarf_getcfi := $(LIBDW_LDFLAGS) $(DWARFLIBS) 169 167 170 168 # for linking with debug library, run like: 171 169 # make DEBUG=1 LIBBABELTRACE_DIR=/opt/libbabeltrace/ ··· 468 470 endif 469 471 else 470 472 CFLAGS += -DHAVE_DWARF_GETLOCATIONS_SUPPORT 471 - ifneq ($(feature-dwarf_getcfi), 1) 472 - $(warning Old libdw.h, finding variables at given 'perf probe' point will not work, install elfutils-devel/libdw-dev >= 0.142) 473 - else 474 - CFLAGS += -DHAVE_DWARF_CFI_SUPPORT 475 - endif # dwarf_getcfi 473 + CFLAGS += -DHAVE_DWARF_CFI_SUPPORT 476 474 endif # Dwarf support 477 475 endif # libelf support 478 476 endif # NO_LIBELF