From patchwork Sat Oct 5 19:55:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13823473 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 768E0CFB42C for ; Sat, 5 Oct 2024 20:02:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:From:Subject:References:Mime-Version :Message-Id:In-Reply-To:Date:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=3eMLlb82QugHlGY/26yYBL5ZYBqJK5cMefX4CIwQ2J8=; b=vHPNjhRtEdCaGx UJhvKEhtz3G/xDRy8Id+sMoNdNWSlKH5PHB5ff0ERshHyhRtBtmNJM6LJB6Y75K/RyiVbyEJDJxpN ubTKqqym2HFSJAQgkOchMxy0xMa+qk5oEPY20b+uBkp6wYvngY4vjTadGyaJVPcT6wHYLYJUiHd0f TXgfhSYNocroK5ojU2q+zis1NYjmNIhMP6TZ+MIRy7gU/++LOQfwWkKSRk5WnDzodGVLxri7THnip x1x9B+Z7eYmYU98YnFjMYYa6aqMQwTd3vju5/2TXSu75Qo9KlQCWHi3pBxZalgLshMI2tyDoLxNri hCC2utL7rl1Oz/uRxjHg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sxAzM-0000000FrxQ-1jIW; Sat, 05 Oct 2024 20:02:52 +0000 Received: from mail-yw1-x114a.google.com ([2607:f8b0:4864:20::114a]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sxAst-0000000FptD-03kH for linux-riscv@lists.infradead.org; Sat, 05 Oct 2024 19:56:12 +0000 Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-6e22f8dc491so58944107b3.1 for ; Sat, 05 Oct 2024 12:56:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1728158170; x=1728762970; darn=lists.infradead.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=HHCrs5RpxQhB9H4vvM4MCWIjboq5jYaTqx9B2UPb0W4=; b=lx+2OFvd/T44MXIVR6n6CVA9bIZbqHZLU3QyalKERNAH8zZ9MIMESJKjYEnjv1AL5X rU+sz8FBysp1zCTT65Lf4oBjpFrPHA7pnpeuC/WdjbeqxWXapEO07SNicK/fNiys7rLQ zdkTc1AmWNhMm0dQzoKQsRbiQEIazsVHDdkz7BAPdK93M+0PeFx2w3byG4EAEFzxzFZf VXCtmeJ7EsAGKJleMrFsaT8SGbr9kPnJeZ2nB7A7/6BhspaULSux/V7qi5OgNGMY4elH ZtWcw+jzZfdT+A4ET1xMDsBqzpKY+lQdql8AwVNI+rZawt1jwHra1riZEp8coQyrDcUf 34+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158170; x=1728762970; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=HHCrs5RpxQhB9H4vvM4MCWIjboq5jYaTqx9B2UPb0W4=; b=bGkvXkw2A5r/DULWmt3plMUEDxXXCE0YHsBQDOm46PGpnTOpms0y5u/jsoVCj1Q90A DSq6HsNWqDh8jz+CXh/3JT3Q5W278hBj3JWR3zrXMYmGblghL8SS+ChApa57wVH7ayoo B+D+RawYWkz7UqOucDkbwMpja+lo9Wr1V4Z/GL9CvGukprKsn1Xm9BusXLjhnjTGEh65 7DiEL7pc7DoMTYHhFpqF9UN8SO/Oo5pQdKTvW/0381NP+zUAMiZU3DwmDNG90voWtrBg XQ4rSF94mHhJjrTOWvbJ1aZAd1DgFZv87bQvg2PwG7f9sJiDHk/Crz3Lfuvl7hfu+ccu UZUg== X-Forwarded-Encrypted: i=1; AJvYcCX7BccwFTl+qIfXgdPuAqp6PbK75JUfQ9GZGvJqurkdgQu2UebTdLAzLdFTtJp9ZN6KcNftwICbwTBx9Q==@lists.infradead.org X-Gm-Message-State: AOJu0YzD42vvlHsul+MoFX4Y+LvjGQ+XkrUUATRQ77mTxE87fEHjO2Ad Kx7Oy9DwcMBdqJgQjGQWa7u7bDFeXCB86iZRVeuMxFVTt7s5K2LPc/csURaJHgWTKXxVH/BF0o8 eMJ3fIA== X-Google-Smtp-Source: AGHT+IEhekuG7RUOfycyDG27OWqeWfPbamRuutC2Jb29fG/nD/NbI3iivYWnvTJB6Fr1oIlRUAUSSAQRUKkv X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:4c2:5b4d:8797:7249]) (user=irogers job=sendgmr) by 2002:a05:690c:6e13:b0:6e2:120b:be57 with SMTP id 00721157ae682-6e2c7292042mr1661887b3.5.1728158169620; Sat, 05 Oct 2024 12:56:09 -0700 (PDT) Date: Sat, 5 Oct 2024 12:55:15 -0700 In-Reply-To: <20241005195541.380070-1-irogers@google.com> Message-Id: <20241005195541.380070-6-irogers@google.com> Mime-Version: 1.0 References: <20241005195541.380070-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.rc0.187.ge670bccf7e-goog Subject: [PATCH v2 05/31] perf build: Combine libdw-dwarf-unwind into libdw feature tests From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Nick Terrell , "Steven Rostedt (Google)" , "Masami Hiramatsu (Google)" , Guilherme Amadio , Changbin Du , Daniel Bristot de Oliveira , Daniel Wagner , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Kajol Jain , Huacai Chen , Bibo Mao , Anup Patel , Atish Patra , Shenlin Liang , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Yury Norov , Alexander Lobakin , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-riscv@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241005_125611_170761_4B1B64EC X-CRM114-Status: GOOD ( 15.84 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Support in libdw has been present for 10 years so let's simplify the build logic with a single feature test. Signed-off-by: Ian Rogers --- tools/build/Makefile.feature | 2 -- tools/build/feature/Makefile | 4 ---- tools/build/feature/test-all.c | 5 ----- tools/build/feature/test-libdw-dwarf-unwind.c | 14 -------------- tools/build/feature/test-libdw.c | 19 ++++++++++++++++++- tools/perf/Makefile.config | 8 -------- 6 files changed, 18 insertions(+), 34 deletions(-) delete mode 100644 tools/build/feature/test-libdw-dwarf-unwind.c diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature index 6025810cc346..db3695ec5f83 100644 --- a/tools/build/Makefile.feature +++ b/tools/build/Makefile.feature @@ -60,7 +60,6 @@ FEATURE_TESTS_BASIC := \ reallocarray \ stackprotector-all \ timerfd \ - libdw-dwarf-unwind \ zlib \ lzma \ get_cpuid \ @@ -133,7 +132,6 @@ FEATURE_DISPLAY ?= \ libpython \ libcrypto \ libunwind \ - libdw-dwarf-unwind \ libcapstone \ llvm-perf \ zlib \ diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile index bece326ac93b..7bb409c1f7e6 100644 --- a/tools/build/feature/Makefile +++ b/tools/build/feature/Makefile @@ -52,7 +52,6 @@ FILES= \ test-pthread-barrier.bin \ test-stackprotector-all.bin \ test-timerfd.bin \ - test-libdw-dwarf-unwind.bin \ test-libbabeltrace.bin \ test-libcapstone.bin \ test-compile-32.bin \ @@ -314,9 +313,6 @@ $(OUTPUT)test-backtrace.bin: $(OUTPUT)test-timerfd.bin: $(BUILD) -$(OUTPUT)test-libdw-dwarf-unwind.bin: - $(BUILD) # -ldw provided by $(FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind) - $(OUTPUT)test-libbabeltrace.bin: $(BUILD) # -lbabeltrace provided by $(FEATURE_CHECK_LDFLAGS-libbabeltrace) diff --git a/tools/build/feature/test-all.c b/tools/build/feature/test-all.c index d60e072b6eca..863c82516433 100644 --- a/tools/build/feature/test-all.c +++ b/tools/build/feature/test-all.c @@ -98,10 +98,6 @@ # include "test-stackprotector-all.c" #undef main -#define main main_test_libdw_dwarf_unwind -# include "test-libdw-dwarf-unwind.c" -#undef main - #define main main_test_zlib # include "test-zlib.c" #undef main @@ -202,7 +198,6 @@ int main(int argc, char *argv[]) main_test_numa_num_possible_cpus(); main_test_timerfd(); main_test_stackprotector_all(); - main_test_libdw_dwarf_unwind(); main_test_zlib(); main_test_pthread_attr_setaffinity_np(); main_test_pthread_barrier(); diff --git a/tools/build/feature/test-libdw-dwarf-unwind.c b/tools/build/feature/test-libdw-dwarf-unwind.c deleted file mode 100644 index ed03d9505609..000000000000 --- a/tools/build/feature/test-libdw-dwarf-unwind.c +++ /dev/null @@ -1,14 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 - -#include - -int main(void) -{ - /* - * This function is guarded via: __nonnull_attribute__ (1, 2). - * Passing '1' as arguments value. This code is never executed, - * only compiled. - */ - dwfl_thread_getframes((void *) 1, (void *) 1, NULL); - return 0; -} diff --git a/tools/build/feature/test-libdw.c b/tools/build/feature/test-libdw.c index 8d474bd7371b..793f4ac49514 100644 --- a/tools/build/feature/test-libdw.c +++ b/tools/build/feature/test-libdw.c @@ -1,11 +1,28 @@ // SPDX-License-Identifier: GPL-2.0 #include #include +#include #include -int main(void) +int test_libdw(void) { Dwarf *dbg = dwarf_begin(0, DWARF_C_READ); return (long)dbg; } + +int test_libdw_unwind(void) +{ + /* + * This function is guarded via: __nonnull_attribute__ (1, 2). + * Passing '1' as arguments value. This code is never executed, + * only compiled. + */ + dwfl_thread_getframes((void *) 1, (void *) 1, NULL); + return 0; +} + +int main(void) +{ + return test_libdw() + test_libdw_unwind(); +} diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index c8e157cc0c5e..93fd6bd74d20 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -161,8 +161,6 @@ ifeq ($(findstring -static,${LDFLAGS}),-static) endif FEATURE_CHECK_CFLAGS-libdw := $(LIBDW_CFLAGS) FEATURE_CHECK_LDFLAGS-libdw := $(LIBDW_LDFLAGS) $(DWARFLIBS) -FEATURE_CHECK_CFLAGS-libdw-dwarf-unwind := $(LIBDW_CFLAGS) -FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) $(DWARFLIBS) FEATURE_CHECK_CFLAGS-dwarf_getlocations := $(LIBDW_CFLAGS) FEATURE_CHECK_LDFLAGS-dwarf_getlocations := $(LIBDW_LDFLAGS) $(DWARFLIBS) FEATURE_CHECK_CFLAGS-dwarf_getcfi := $(LIBDW_CFLAGS) @@ -464,12 +462,6 @@ else endif endif else - ifndef NO_LIBDW_DWARF_UNWIND - ifneq ($(feature-libdw-dwarf-unwind),1) - NO_LIBDW_DWARF_UNWIND := 1 - $(warning No libdw DWARF unwind found, Please install elfutils-devel/libdw-dev >= 0.158 and/or set LIBDW_DIR) - endif - endif ifneq ($(feature-libdw), 1) ifndef NO_LIBDW $(warning No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev)