From nobody Fri Sep 25 06:03:31 2026 Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 388603E6DD0 for ; Wed, 16 Sep 2026 06:13:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.199 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789539196; cv=none; b=fOAXGqyFPRaX61kQaXPaCHf0zsv1D9olFFHnoaLuKHz8iEYV4uUYJ/dA01CiIRvUohvh8BPoV0w22lY2jijVV6Uobspkg0wvJXB5TCcf2jT0LM/jop+kbv6YxWdHWKjRMT+jTsdVJJd1BJGfIuFvvwXa3iuqulnTJh+lGuT+LpQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789539196; c=relaxed/simple; bh=hNWirlQjs7zzyx6axdyrOn6luGlogerhrckrgySM31E=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Content-Type; b=CnSL1wzJIw47tspJKC4ClKpz4Nr6eQ71TMXDVrhj8I+/xViRtrSzEXcNle3OFPDIT7xwwGMSb8jGkvROPf1u7XGRXJkySwBZ6dEsRBV/rM7MHyA/eOfaywdm/kLoFvdJ4FZW6hYUaYlcLCTa3lPdBKikuNUKroQaZc3CYH0c0Uo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=aQ37ou04; arc=none smtp.client-ip=209.85.215.199 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="aQ37ou04" Received: by mail-pg1-f199.google.com with SMTP id 41be03b00d2f7-cc11b5dd54dso11272814a12.3 for ; Tue, 15 Sep 2026 23:13:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1789539194; x=1790143994; darn=vger.kernel.org; h=content-type:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=ZtP2IcMlbfSjyfjMZ1e0vnZ72bPs3Qn3Gup/k917MuM=; b=aQ37ou04p1jA0Ce19hDvU5lR/jXsovQrVorpnaeDzKnbvHXXXaIibvDlLb41uyxuuW we4fKNcXUZVPmWj01ZsSOHqV7nbGSBs7nW7XahJ5m5CVcN+UVet/Vp3OqlV7LX99648U CZNBEnlWNn8w0TmudgF7f/Yna5tcCRbNJsyuQQnQpiylaqO//GgZAgLPYK2l4gMXLdSp TV8fG9t0+Yta5mpEqZOotTAwqxcFTAAJ7U1fj1XRF/kw52lYNiNcnQ+3hXAdp99Sm+tK v/e/nYxFvIRKIHYRFEzEDlCmn/0Pf1OKvYSt8bmMG33UeNz70UQZW6E2VMZtngCOu0lI rFzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789539194; x=1790143994; h=content-type:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=ZtP2IcMlbfSjyfjMZ1e0vnZ72bPs3Qn3Gup/k917MuM=; b=pqhGBt5jySI+pHoFG6DYATb3pPPe/QVoK57xbIfxVUwzhXRURG/+47sKa15wps0lE6 jLPLXVk0q/XHwwtNzpqKbUOI0/CulKM8HP/c+dWn6aAXkouNi6jifrG2YKasvCfDvSGw Z3btAdUtRR3nof4kX6OtNqwr6d/GFgwgDgekncI23P5vGtzcxV1YD93sstloYKpYJTBF G/21BkWHjIrKZNFnwFHGnNoCnQTsdFRdZIqsydH3zDKzg3ZFe1q71+3AefgYyrHQqYZQ U4wmrfvkyrsMTP058gv5H/loBV9atXPype0z/lW8C9254ZbMVaN6/T613Jr6qu0gv2qC UIKQ== X-Forwarded-Encrypted: i=1; AKwUvByvSBXwIBpz6sH0485ke2jlW0mEvG0dTHc2vrTsDRZYxNox5V6OuMbEywuyc+zPaCiJvOsLskEN5PSR2jg=@vger.kernel.org X-Gm-Message-State: AFuF++lrnL/5n89wla1SQdmLp4F1tHYyfaZEAsjAcO0hbQHuTGrFyaSh yWKHDHDq3WiNTTtBSi9HLcWNAUVsFeI9wS1XAzlGHJ/xNrGf0e506VexGULTx+p0Mhit/kScWu/ yRnjxfWRlBg== X-Received: from dlep8-n2.prod.google.com ([2002:a05:701b:4588:20b0:143:7f78:e839]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a20:72a1:b0:3da:f969:b077 with SMTP id adf61e73a8af0-3dd5f495c5amr3407933637.11.1789539194276; Tue, 15 Sep 2026 23:13:14 -0700 (PDT) Date: Tue, 15 Sep 2026 23:12:10 -0700 In-Reply-To: <20260916061218.3061216-1-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260916061218.3061216-1-irogers@google.com> X-Mailer: git-send-email 2.55.0.1032.g73a4cd73de-goog Message-ID: <20260916061218.3061216-2-irogers@google.com> Subject: [PATCH 1/9] perf libbfd: Fix the clang -Wthread-safety build failure From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Jiri Olsa , Ian Rogers , Adrian Hunter , James Clark , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Thomas Richter , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" perf_bfd_lock() and perf_bfd_unlock() are the callbacks given to bfd_thread_init(), so by design they acquire and release the lock on libbfd's behalf and the lock state differs between entry and exit. clang's thread safety analysis, which perf builds with as an error, flags both: util/libbfd.c:56:1: error: mutex 'bfd_mutex' is still held at the end of = function [-Werror,-Wthread-safety-analysis] util/libbfd.c:60:2: error: releasing mutex 'bfd_mutex' that was not held = [-Werror,-Wthread-safety-analysis] Mark both functions NO_THREAD_SAFETY_ANALYSIS so that libbfd.c compiles with "make CC=3Dclang BUILD_NONDISTRO=3D1". Fixes: b72b8132d8fd ("perf libbfd: Ensure libbfd is initialized prior to us= e") Signed-off-by: Ian Rogers Assisted-by: Antigravity:gemini-3.1-pro Acked-by: Namhyung Kim --- tools/perf/util/libbfd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/libbfd.c b/tools/perf/util/libbfd.c index 33dc6158b2b1..8ac6670a39aa 100644 --- a/tools/perf/util/libbfd.c +++ b/tools/perf/util/libbfd.c @@ -39,13 +39,13 @@ struct a2l_data { asymbol **syms; }; =20 -static bool perf_bfd_lock(void *bfd_mutex) +static bool perf_bfd_lock(void *bfd_mutex) NO_THREAD_SAFETY_ANALYSIS { mutex_lock(bfd_mutex); return true; } =20 -static bool perf_bfd_unlock(void *bfd_mutex) +static bool perf_bfd_unlock(void *bfd_mutex) NO_THREAD_SAFETY_ANALYSIS { mutex_unlock(bfd_mutex); return true; --=20 2.55.0.1032.g73a4cd73de-goog From nobody Fri Sep 25 06:03:31 2026 Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1FE3C3E92BD for ; Wed, 16 Sep 2026 06:13:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.197 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789539199; cv=none; b=aIKuhgPwfelykgzDdxp/cGo8vFwidGrF2NNkeAbc22N2ob+vkLpkoXnhUt8IlyWyW4k697F4pqMsidOIe/vkD740ZfZxZOwHdcBoEAfwdjzhJtJwTAUNuTicv6XLzzeK5JvyukaB+2FKYOU1hamZRV9SVxlmS5Hetb6fYPjMAhw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789539199; c=relaxed/simple; bh=aSRn2a84aJ5XKChOsQsFTIditSg7lvW/7uN1eZsfU6g=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Content-Type; b=GHAlVQ1Dcn5nQMSjTpUPGDJXVqlr1oaeYWsyU6Pk/EYv22lN6fd2xobvKWvU+xp3kgKWOyWIO9hWe+UWso5aM+mvJwxar4stPt7LYV8/PW7n+9i8EKpjPRtiShO94V7KhI9Gp9WPj3qrF16XfvmN51Z6wbXYMDohdiLrNH6tBis= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=ZEc1o/n5; arc=none smtp.client-ip=209.85.215.197 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="ZEc1o/n5" Received: by mail-pg1-f197.google.com with SMTP id 41be03b00d2f7-cc11b5dd54dso11272863a12.3 for ; Tue, 15 Sep 2026 23:13:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1789539196; x=1790143996; darn=vger.kernel.org; h=content-type:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=VCHS0z59fUPYMY565s32kon+1X6H9/iNUQvbm+yc4VA=; b=ZEc1o/n5e6iAsJK9kcJnGXfBUDS/rPSU4fMi01KEvechY7NFKX4bu1cSHCFiulyiNO 8J5fwOUsrJW66cYBBtsL3EEhtgV6trQ7UIUvIVF5Ej3lZYmUaq6My1CBrsNnIu0c82lm al/8IiI0KUbNCW/6NWXM9vQ5bkT33AZzZJN/mwL+SdX4hTR5ThokDRyvH8lP/3YTBqOx y2NtfN92j/k9TnZFT/2EJageiSVHx8A6s6V7G7/IJ2YGFNTL/KG/o/lVVJP6sV1ie4sM PrztXLpqy1OdX8g04HBJyX9VKf7zPvuhG7R5jWpN1de4QQaV4y3GVthLBwcU0SVwZBz9 q35g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789539196; x=1790143996; h=content-type:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=VCHS0z59fUPYMY565s32kon+1X6H9/iNUQvbm+yc4VA=; b=yaXycRfKv/Nn/DJH9ut24g6wz+f6CC6e8S+dNNl73oO4i7cmICuWMVHaDU90y2HxBA Nl40ShnD9Quws8fzhgr1unjrebBCAy1LZWP+Gw4foFtCnrIl3dnEyoovMQdGlDy1wJdp tuWycIoMy6TZT76UfZs0xqVawYQVgtNj42rtpa+25TM/pvlx2M6KoIxIrKw6c1XUjCon zCerlVJ+DOZYC02aqz5xnKCk+3wMJFqLoJL8ct4/nVJSNV2X2CKsjN+Ecymfit5EKdwe MgEeiucBp9JCNNZBLShDFIvM7XIQFocSW1fXQSgXjmOhs1oe4TL8ik/LeqVDQJfRDa5f qj6Q== X-Forwarded-Encrypted: i=1; AKwUvByhnLoQxZmlt0+rPRF32BbtfiLK59u/jnrdMmaeNVQ1BTVtVGwI1lB1M+lLon6LdPL1STkqU4qs4cclAA4=@vger.kernel.org X-Gm-Message-State: AFuF++kv8l93+GyKkp2OmClyzXlGbQzorqn9V6AGfbNdiFCt+upscKK5 4HNer4pL3F+qyRf4MtgAXVEZl2VsCRg9G6XqJuJOdOHLc+Tmw6IFNqMNzy9iPhBox64mCvCzEtp J4m0TmnzgEw== X-Received: from dlea16-n1.prod.google.com ([2002:a05:701b:4210:10b0:144:bbd4:62e0]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a20:a11d:b0:3b3:216b:2743 with SMTP id adf61e73a8af0-3dd5f4038f0mr3242885637.4.1789539195928; Tue, 15 Sep 2026 23:13:15 -0700 (PDT) Date: Tue, 15 Sep 2026 23:12:11 -0700 In-Reply-To: <20260916061218.3061216-1-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260916061218.3061216-1-irogers@google.com> X-Mailer: git-send-email 2.55.0.1032.g73a4cd73de-goog Message-ID: <20260916061218.3061216-3-irogers@google.com> Subject: [PATCH 2/9] perf symbol: Fix the build when demangling with libbfd From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Jiri Olsa , Ian Rogers , Adrian Hunter , James Clark , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Thomas Richter , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" cxx_demangle_sym() calls bfd_demangle() with the DMGL_PARAMS and DMGL_ANSI flags, but nothing declares them. The "#define PACKAGE 'perf'", "#include " and the DMGL_ definitions were left behind in symbol-elf.c when the demangling code moved to symbol.c, and libiberty's demangle.h that defines the flags isn't installed by every binutils package. The cplus_demangle() variant is missing a declaration for the same reason. The code is only built when the C++ ABI's __cxa_demangle() is unavailable, so most builds never compile it: $ make BUILD_NONDISTRO=3D1 NO_DEMANGLE=3D1 util/symbol.c:2714: error: 'DMGL_PARAMS' undeclared util/symbol.c:2714: error: 'DMGL_ANSI' undeclared util/symbol.c:2716: error: implicit declaration of 'bfd_demangle' Move the libbfd demangling into libbfd.c, which already includes bfd.h, and declare in symbol.c the libiberty interfaces the cplus_demangle() variant needs. Fixes: 4d9b5146f0d9 ("perf symbol: Move demangling code out of symbol-elf.c= ") Signed-off-by: Ian Rogers Assisted-by: Antigravity:gemini-3.1-pro Acked-by: Namhyung Kim --- tools/perf/util/libbfd.c | 17 +++++++++++++++++ tools/perf/util/libbfd.h | 9 +++++++++ tools/perf/util/symbol.c | 18 +++++++++++++++--- 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/tools/perf/util/libbfd.c b/tools/perf/util/libbfd.c index 8ac6670a39aa..131bfedf48cd 100644 --- a/tools/perf/util/libbfd.c +++ b/tools/perf/util/libbfd.c @@ -72,6 +72,23 @@ static void ensure_bfd_init(void) pthread_once(&bfd_init_once, perf_bfd_init); } =20 +/* + * Flags from libiberty's demangle.h. bfd.h declares bfd_demangle but not = the + * flags to pass to it, and demangle.h isn't installed by every binutils + * package. + */ +#ifndef DMGL_PARAMS +#define DMGL_PARAMS (1 << 0) /* Include function arguments. */ +#define DMGL_ANSI (1 << 1) /* Include const, volatile, etc. */ +#endif + +char *libbfd__demangle_sym(const char *str, bool params, bool modifiers) +{ + int flags =3D (params ? DMGL_PARAMS : 0) | (modifiers ? DMGL_ANSI : 0); + + return bfd_demangle(/*abfd=3D*/NULL, str, flags); +} + static int bfd_error(const char *string) { const char *errmsg; diff --git a/tools/perf/util/libbfd.h b/tools/perf/util/libbfd.h index 953886f3d62f..14171db8b112 100644 --- a/tools/perf/util/libbfd.h +++ b/tools/perf/util/libbfd.h @@ -31,6 +31,8 @@ int libbfd_filename__read_debuglink(const char *filename,= char *debuglink, size_ =20 int symbol__disassemble_bpf_libbfd(struct symbol *sym, struct annotate_arg= s *args); =20 +char *libbfd__demangle_sym(const char *str, bool params, bool modifiers); + #else // !defined(HAVE_LIBBFD_SUPPORT) #include "annotate.h" =20 @@ -77,6 +79,13 @@ static inline int symbol__disassemble_bpf_libbfd(struct = symbol *sym __always_unu return SYMBOL_ANNOTATE_ERRNO__NO_LIBOPCODES_FOR_BPF; } =20 +static inline char *libbfd__demangle_sym(const char *str __always_unused, + bool params __always_unused, + bool modifiers __always_unused) +{ + return NULL; +} + #endif // defined(HAVE_LIBBFD_SUPPORT) =20 #endif /* __PERF_LIBBFD_H */ diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 3587ad243159..3206929473a2 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c @@ -27,6 +27,7 @@ #include "dso.h" #include "util.h" // lsdir() #include "event.h" +#include "libbfd.h" #include "machine.h" #include "map.h" #include "symbol.h" @@ -2707,13 +2708,24 @@ static bool want_demangle(bool is_kernel_sym) * version. */ #ifndef HAVE_CXA_DEMANGLE_SUPPORT +#ifdef HAVE_CPLUS_DEMANGLE_SUPPORT +/* + * Declarations from libiberty's demangle.h, the header isn't installed by + * every binutils package. + */ +#ifndef DMGL_PARAMS +#define DMGL_PARAMS (1 << 0) /* Include function arguments. */ +#define DMGL_ANSI (1 << 1) /* Include const, volatile, etc. */ +#endif + +char *cplus_demangle(const char *mangled, int options); +#endif + char *cxx_demangle_sym(const char *str __maybe_unused, bool params __maybe= _unused, bool modifiers __maybe_unused) { #ifdef HAVE_LIBBFD_SUPPORT - int flags =3D (params ? DMGL_PARAMS : 0) | (modifiers ? DMGL_ANSI : 0); - - return bfd_demangle(NULL, str, flags); + return libbfd__demangle_sym(str, params, modifiers); #elif defined(HAVE_CPLUS_DEMANGLE_SUPPORT) int flags =3D (params ? DMGL_PARAMS : 0) | (modifiers ? DMGL_ANSI : 0); =20 --=20 2.55.0.1032.g73a4cd73de-goog From nobody Fri Sep 25 06:03:31 2026 Received: from mail-pj1-f70.google.com (mail-pj1-f70.google.com [209.85.216.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9D5A53EBF0F for ; Wed, 16 Sep 2026 06:13:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.70 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789539200; cv=none; b=EeuEcw43mS1X6MeVM/FqoER26ukjeOUjiLlx24OoXD5RtxOtDEre1lUJPtMsbKvUcxWkzyTMwp3fxZpI/7+DhSiUqXdQXu2eTHjSXr6eeJmfhH1sBtQqWdpsQttm6QtfmapaUxUZtD1vavs9aPWdyeyGV6Fo6e3JpLYPFr2Csy0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789539200; c=relaxed/simple; bh=EkUSg3SW+p/sIj8byFhIiyPtAE+kzl5s7N8WhAJ4buA=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Content-Type; b=S0pGZ5BfBAlrApcodj5UNbKd1DjH02R1pMXjzuJGbDkDujBWjb9WEgIYs+N4dgALEXkKetO01FjDlj2XFFpbsIDh4sRXqCj4lw5M6Ma5PBEWrw8LnsiF++Q/KtiF2HrrkRASr/+qt9rAvTNiMIVFHeVE6Ub5CMrG10crT4INWxE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=ZJAdeROF; arc=none smtp.client-ip=209.85.216.70 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="ZJAdeROF" Received: by mail-pj1-f70.google.com with SMTP id 98e67ed59e1d1-396901263b6so10021311a91.2 for ; Tue, 15 Sep 2026 23:13:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1789539198; x=1790143998; darn=vger.kernel.org; h=content-type:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=SntUi1xPjgoMQfW2YYfU5u+fl62gD37oiHiuv4x3AKU=; b=ZJAdeROF+Nwmxe6QuFtwFHvaNcw3MovTWiCKQ5TilmD7Tueokin1grGL2jsNV7lnWg 716igmu1Qu6ixK9frZQw45Dv6RDR/Lt771Yymg91cdhVgvkyXBsIj3xj/jyJDZ0SVHPi VGm6pvcOLJvFVgdJO7lfVKbwU7APpl8omzHv0/KEG3zv58Sl8EMU6Hh8ibPkGmbP/xrp VTFv8v8F97Ri95z+WrZs8FO3vhID8hg8nRDK5Yj1r+aYUQPoo8kuK9q7tcR8huNjUQmo WRMLUnNRSU/XPn/NobKq8q8GMmVqTpG6fciifM1xjGfHectxpKlEGLnLJiXr9KfT4rgM Simg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789539198; x=1790143998; h=content-type:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=SntUi1xPjgoMQfW2YYfU5u+fl62gD37oiHiuv4x3AKU=; b=Ndv17CVJMbxInwMbYma+hSs182BJp7fMSuPdDHdey+93mPEb5zBbBgTf2xlbCLyZbK QYsIDcRIXtyZtXjGcwV9x6cVvQ6L90W+UwtAenHxXY8rPpoTIilhCS9Pt42M08QWKh40 4AZVRhOd9ojJCtqDiJGo5VAO8Ds6G1k+jXBqfDUjFdS45A66G/A5duOP6ASqGIuqwqj/ BvFpZKDQL+WOOmKsTHfae0V47vrYzg64kCKDfm85gpT6f8oQIVsgYc4wDPaoYh26r2g3 OHJmB/jNOlbJgpbEAZhnZNfDThpxOWRrDl+oDLpiGPvGbHwYpSr6NO2YweJ7+m/rb5Q/ VJEQ== X-Forwarded-Encrypted: i=1; AKwUvBz1ZQwUN4UZ4sCrQ0DUDdOhHhG9tk/GkTInHH/uDNdqhKC+TIm7e9ePtVYEK2jYRf7+2/M0DMOEiB+pS4k=@vger.kernel.org X-Gm-Message-State: AFuF++khllqB4tH+LjZvB1edp/8NbTN8N/Mz4XZrCjpi8JG4wPadL/mj kq0HIrKhCnqX5FFs4MsDf0E/cfpYI7wbsCr3DZFl9RXZuTLMTTKjQ37jLpAJTxzXy6DRNuPvfgr Flp5Cymic4Q== X-Received: from dleb6-n1.prod.google.com ([2002:a05:701b:4246:10b0:144:bc91:18ab]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:4d0e:b0:39d:f5b6:ca47 with SMTP id 98e67ed59e1d1-39e1e47abbbmr3117561a91.12.1789539197679; Tue, 15 Sep 2026 23:13:17 -0700 (PDT) Date: Tue, 15 Sep 2026 23:12:12 -0700 In-Reply-To: <20260916061218.3061216-1-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260916061218.3061216-1-irogers@google.com> X-Mailer: git-send-email 2.55.0.1032.g73a4cd73de-goog Message-ID: <20260916061218.3061216-4-irogers@google.com> Subject: [PATCH 3/9] perf libbfd: Include the headers that are used From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Jiri Olsa , Ian Rogers , Adrian Hunter , James Clark , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Thomas Richter , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" libbfd.c uses errno, PATH_MAX, strdup(), strlen(), strcmp(), memcpy() and pthread_once() but relies on other headers to drag in , , and . The BPF disassembly code needs for PRIx64 and for uintptr_t for the same reason. Include them directly and group the includes so that the system ones come before perf's own. No functional change. Signed-off-by: Ian Rogers Assisted-by: Antigravity:gemini-3.1-pro Acked-by: Namhyung Kim --- tools/perf/util/libbfd.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/tools/perf/util/libbfd.c b/tools/perf/util/libbfd.c index 131bfedf48cd..1b23a261a9ce 100644 --- a/tools/perf/util/libbfd.c +++ b/tools/perf/util/libbfd.c @@ -1,5 +1,19 @@ // SPDX-License-Identifier: GPL-2.0 #include "libbfd.h" + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + #include "annotate.h" #include "bpf-event.h" #include "bpf-utils.h" @@ -11,15 +25,13 @@ #include "symbol.h" #include "symbol_conf.h" #include "util.h" -#include + #ifdef HAVE_LIBBPF_SUPPORT #include #include #include #endif -#include -#include -#include + #define PACKAGE "perf" #include =20 --=20 2.55.0.1032.g73a4cd73de-goog From nobody Fri Sep 25 06:03:31 2026 Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0C60E3EAC8D for ; Wed, 16 Sep 2026 06:13:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.71 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789539201; cv=none; b=RRGXVpmzbwWffF8keaSmcgU5WYxsahayKVivmJfE+MWyobl22RMka9TE1uRC0gpAbsdEAgVQz+o3HW/um0uym7xMB20hTclfUYHD7rtPmfHaEBfHmL9jBQS5YSRG540PQVy/zHmqMp4QqJ1fK2eGF0cBQAas39qyxTR8w+ugUMA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789539201; c=relaxed/simple; bh=468xVfbn+0XdK7xEFVTNW5kercEQE4h92XSg5yNP3F8=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Content-Type; b=SWO8vNrGnYhDA+vd0QJYYgJcoiI+ctmEDYOdNQj+AjIlqtcjMd0qyau/8g978IjzHCGqEukWnUI4rHx2E68ABF62VukzgIgUVfe0jOiyDbCNhiXt2xl3maKPvpjIw9HmTYsznTfKXhHn9ag/+uphN9iMDJlI3zSkZD3MjZIJly0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=kxEUuyYO; arc=none smtp.client-ip=209.85.216.71 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="kxEUuyYO" Received: by mail-pj1-f71.google.com with SMTP id 98e67ed59e1d1-39de4a68f7cso5049711a91.1 for ; Tue, 15 Sep 2026 23:13:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1789539199; x=1790143999; darn=vger.kernel.org; h=content-type:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=vR5Z3qVkhKQF/LqVThiaZx4q5xKuQTz4oWFML5HFRTo=; b=kxEUuyYOvn/+Y6n7q0Nz2BcJKLM54rn+mBsUYj4K0k6phwoV2BgGbxwRLBCXvicYzQ T+kTVH3pdG93ff9PE3roaKHhOwcEpt9TtUcbbYPxlnp+tVz7qZ4MOFIF296gM0NItF7h 7vdHRYSm2C7A0ANlnjcduJ7G9GVlymPOZX9AaLYESZwHgcSSZ2RhaicacpbjukqFy0OG bBCNpzpoO+pr+U39shCMpj6zimTvOgQWLKA+V5Igpcr6on9RM3/8g56dqKVH0WyLii/Y aZnnniYtE/QTMRx13lJcqCqxokGBkxHAnshpnj0M5nJ+NPxrtCA7lobUPDgFW0FP+v8B EqWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789539199; x=1790143999; h=content-type:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=vR5Z3qVkhKQF/LqVThiaZx4q5xKuQTz4oWFML5HFRTo=; b=1FAGnq8BhJWpqf/wGvr80TqeXXMfoTDBPEzhlbzo4wfRNSDG4JiOQs7uabMonKBYUV aXt0I1puw+UNfFwH3BAe70Kht+QPe7DFj93LdHwH7NHa25govOzT7mkf9ucj494mS8bd l8D75j+BeV4vfcU92u68MnsDG+ggNovlMk67ZmDKQG3rg9+UZXiJXYtJe44NXdRucz3F 26e7s/KsoayGndUKuenzu4i31vFtaXqehaLREJxNmMtpqWQ4wh5qXIoqWYmhj5ZUplWQ tisplSA4mN6I83sZ1POP85btU42aXihTrV38INgOOBe1etRIF5RRrEGco0UoSSaCNNGr +AHQ== X-Forwarded-Encrypted: i=1; AKwUvBw+0qKiASepMFdN4ser0AjGYpH1b4A7+C1wM879OgZ9yGVY4RxN/Pyh5IZrmKl4eLsFsr9GEVFLHS36EW4=@vger.kernel.org X-Gm-Message-State: AFuF++m6pW5fHv31YfXYGQqbjhcyViwgrCC6clBItZ4pFjUAnO8wV6wA 9VEzIdhUp6mTgS2J2Q8vWvLQFuX3MNbtBjNOc8cgI1ZIb0QRE47v4f4Qth6cn2QSNgH0ymhSTGV W0zfSfMQgbg== X-Received: from dyay26.prod.google.com ([2002:a05:693c:62da:b0:339:7600:c341]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:3c41:b0:39d:fe64:5733 with SMTP id 98e67ed59e1d1-39e1e5612demr4059471a91.24.1789539199252; Tue, 15 Sep 2026 23:13:19 -0700 (PDT) Date: Tue, 15 Sep 2026 23:12:13 -0700 In-Reply-To: <20260916061218.3061216-1-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260916061218.3061216-1-irogers@google.com> X-Mailer: git-send-email 2.55.0.1032.g73a4cd73de-goog Message-ID: <20260916061218.3061216-5-irogers@google.com> Subject: [PATCH 4/9] perf pmu: Include the headers that are used From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Jiri Olsa , Ian Rogers , Adrian Hunter , James Clark , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Thomas Richter , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" pmu.c uses errno, free() and the str*() functions but declares none of them directly. arrives by way of , and and come from whatever the other headers happen to drag in, which is fragile and breaks on C libraries that don't nest their headers the same way. Include the three directly. is deliberately not added. The isdigit(), tolower() and toupper() used here are the macros from , which is included on purpose and documents that it doesn't handle EOF the way the standard C library does, so pulling in would change which implementation is used. size_t is left alone too, as is already included directly and declares it. No functional change. Signed-off-by: Ian Rogers Assisted-by: Antigravity:gemini-3.1-pro Acked-by: Namhyung Kim --- tools/perf/util/pmu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c index 836e3b5615cd..744e253e851f 100644 --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c @@ -8,8 +8,11 @@ #include #include #include -#include +#include #include +#include +#include +#include #include #include #include --=20 2.55.0.1032.g73a4cd73de-goog From nobody Fri Sep 25 06:03:31 2026 Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 20CC93ED3CA for ; Wed, 16 Sep 2026 06:13:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.197 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789539203; cv=none; b=TKFZ2Swpr2tP4kKNEBvGaScw8CzonBB2qZV2lxhex4fJNO2x0P64ZufXeD/EXSuUXhz0Z8Yt+fiNIzfaptMi/BFsjhbuXv6U89U2x1dobyUw87sch5LjSTNbVJD4fj64SmkvG09sNQADoiEND1WjtggZOcELsUaToIe4f1U4VkE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789539203; c=relaxed/simple; bh=MTfU2kBykGvEc78KQu6zbFfBgjtLSKZO3O+KoOcIBeQ=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Content-Type; b=BmGQwNIgNg34/zcIiCSD91KHpfDeI9amkgTfSSM213jj0Pbnsh4sGVSOIm5y8I0ObodCX4t1ujvr4VOd+c1Fuca+r6QRGkdnJOWPo4DCjN7um6tushPSue/fAv9D+6nUdJKo43pxRKJYVA5ZXW1PTNopu5sh8Wxpa1RXnIykvC0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=Zs3K26EY; arc=none smtp.client-ip=209.85.215.197 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Zs3K26EY" Received: by mail-pg1-f197.google.com with SMTP id 41be03b00d2f7-cc4fc935a11so1729251a12.0 for ; Tue, 15 Sep 2026 23:13:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1789539201; x=1790144001; darn=vger.kernel.org; h=content-type:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=upDmXP3yIXwPcisrFXwSlmDbZrrJ3hkk6zyR7leCdIo=; b=Zs3K26EYYnHU8VNOL1UNiKx1Wg3Rvf5T5UAGqVCNI0CSRX8jxDfkB12Yq7WYsKugah 7qI9Ng1r/L8OxZyP8yaa+Eh+/xW7nuC746cWTy+Tn6j66BKN20Ze191cKItXQVACl+CS KgDDR+w6jCw4fr38rt/TJ7v6tHu7XvXhhduQVIlPLDp9EcEAm9m/QGFQ0LVCQWVqXO1t 7ybgyIoMvkf1065zGMyKf8MPkqEpbMuPtZei/xtNGgD2BdRcmf/becLaCG7A37xzd6MZ 0eDZDmlGu9cVHVdCDkWxRB/T5FTk08x2D17hzXZfTBQd4Y/0l/HmlI/0kTUZzBlR94QY vVwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789539201; x=1790144001; h=content-type:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=upDmXP3yIXwPcisrFXwSlmDbZrrJ3hkk6zyR7leCdIo=; b=k7Z85887udaAsC+OTij5nWenWQ/RM35ZIyjLqCtU3X+/SWn+7b/WBLii3faPibgdBC u1IbzKVjFJxCdAECrgagJt1nEMEwll9oq+nRmkr+3lmOVCGaIX898ap2eYF+OtXhVk2J SusSxwjEhLfOsB8K6MOdRAE9LETUB0NTH1ncuRBCQ/o2pRV+w4VQyNIfegD70WUa8sFc Mgy3GeHmmIlB26hVbVh4madXjLLcWKkE1yHCEBX+AKrlA3i3ZdAPwTInkK9XDqib+Xbv VPXQ67Ezs4W7h9mxwe69lUnw0j6Ii6O0/nZlnuq40OruwxT80wwfEgC+K+tmCas6EGhv XEJA== X-Forwarded-Encrypted: i=1; AKwUvByUy5l/fYnvWRwXd+o/yYooaiYWX3WjvM8akWGBjCctOmtOQFgMz+VELTHIeA62AdY7k/p1DEYLUW+6UUA=@vger.kernel.org X-Gm-Message-State: AFuF++mY4ZQswoUkdqG29mchS3HmS8wO4Xqee2ssYch6maGq2Dh424Nz WLQHk45v0fEWIY/Z35mbIcU8xXeaU7fn9CtHqJ5u7VhDJ/2rYKB5E2BvoHkl9NzhL6/TScWkMru fmtNMvxHuVg== X-Received: from dlep8-n2.prod.google.com ([2002:a05:701b:4588:20b0:143:6b62:db2]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:1845:b0:39d:f259:3363 with SMTP id 98e67ed59e1d1-39e1e491d27mr3698619a91.12.1789539201213; Tue, 15 Sep 2026 23:13:21 -0700 (PDT) Date: Tue, 15 Sep 2026 23:12:14 -0700 In-Reply-To: <20260916061218.3061216-1-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260916061218.3061216-1-irogers@google.com> X-Mailer: git-send-email 2.55.0.1032.g73a4cd73de-goog Message-ID: <20260916061218.3061216-6-irogers@google.com> Subject: [PATCH 5/9] perf build: Only pass clang flags to CXX when CXX is clang From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Jiri Olsa , Ian Rogers , Adrian Hunter , James Clark , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Thomas Richter , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Building with "make CC=3Dclang" appends clang's --target=3D and -fintegrated-as to CXX, but CXX is only set to clang++ by "make LLVM=3D1". With just CC=3Dclang, CXX is still g++ and every C++ feature test dies: g++: error: unrecognized command-line option '--target=3D...' g++: error: unrecognized command-line option '-fintegrated-as' The failures are silent, as feature tests are allowed to fail, so the build quietly loses libllvm and C++ demangling support: $ make CC=3Dclang && grep LIBLLVM .config-detected (nothing, whereas a gcc build reports CONFIG_LIBLLVM=3Dy) The block is entered when CC_NO_CLANG says CC is clang, which says nothing about CXX. Probe CXX the same way tools/scripts/Makefile.include probes CC, and only add the flags when CXX really is clang++. Mixing a clang-built C with a g++-built C++ is fine here, the C++ code is linked with -lstdc++ already. Fixes: 4772e66cb45e ("perf build: Support build with clang") Signed-off-by: Ian Rogers Assisted-by: Antigravity:gemini-3.1-pro Acked-by: Namhyung Kim --- tools/perf/Makefile.config | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index 4ee7393a39f9..31e4cbe192b9 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -54,7 +54,14 @@ ifeq ($(CC_NO_CLANG), 0) endif # CROSS_COMPILE =20 CC :=3D $(CLANG) $(CLANG_FLAGS) -fintegrated-as - CXX :=3D $(CXX) $(CLANG_FLAGS) -fintegrated-as + + # CC being clang says nothing about CXX: "make LLVM=3D1" overrides both,= but + # "make CC=3Dclang" leaves CXX as g++. Probe CXX the way Makefile.include + # probes CC rather than assuming the two match. + CXX_NO_CLANG :=3D $(shell if command -v $(firstword $(CXX)) >/dev/null 2= >&1; then $(CXX) -dM -E -x c++ /dev/null; fi | grep -Fq "__clang__"; echo $= $?) + ifeq ($(CXX_NO_CLANG), 0) + CXX :=3D $(CXX) $(CLANG_FLAGS) -fintegrated-as + endif =20 # Enabled Wthread-safety analysis for clang builds. CFLAGS +=3D -Wthread-safety --=20 2.55.0.1032.g73a4cd73de-goog From nobody Fri Sep 25 06:03:31 2026 Received: from mail-pj1-f70.google.com (mail-pj1-f70.google.com [209.85.216.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C67D23EC687 for ; Wed, 16 Sep 2026 06:13:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.70 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789539205; cv=none; b=R2NlJebOYScyJRI9jQLIga0XrrRP/ZL+1kOpPQPSXHt/XITXMiaC8vIi74A/1zInEduZ/p/lVe+I4JbaLlDTICdxgwwltYUgp78cuNH6BKMW5sq+v7xZXlKmbjchknTr7wRcZBnDk4n2bCYNhhh60uu4cPyC112k+GDm/TIkj/c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789539205; c=relaxed/simple; bh=BzLrWrhofRN6OPfyQk81Dwa6JQsFLbb5DwXqPENoCWs=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Content-Type; b=GqRPK2TxtCBbzEBe3w8EDWgRc8iNVprOGEfO1tCiw4JTw+zJslGU27MmKpF8Yyd7mjC2gRdumgg4BBMUsbmB976g1p11yvocNOVVtkyq8MyYoHOiDjuE2ATdVdFciOF85ORl+Ya2cyuTt199DUNN37r8JJk/jhifX6JFmeR/Rgc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=S6X9gAap; arc=none smtp.client-ip=209.85.216.70 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="S6X9gAap" Received: by mail-pj1-f70.google.com with SMTP id 98e67ed59e1d1-39aee9b4cf2so9347267a91.0 for ; Tue, 15 Sep 2026 23:13:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1789539203; x=1790144003; darn=vger.kernel.org; h=content-type:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=WC+4bBJmOMaCFD9dsEEm3t/QrUZlzEYn1326Syti9Po=; b=S6X9gAapJSzXaUO+arbY6BSkcJysOnofMt4+X31HkL1ZCtOMd8Ahy38BoKX5LM9Uzq BtW4pohJGZLAatiWBP0ITc88nF46WpLRjsVbKu5bQZJ+CqoMfZ+P3o+QuIhcxf8dE3WF Am5MGWKpMqY4HMmDOQ5IrGevxiE9LdlAQ8ykaTdcXDXrV9G2OScCZVPdC5doT5Iqmhpw CLXZbab+NF3PZoVqcvkmAw49sjvSKbbD6CnLPSAaH2KrW171XlQpfeRdN6Fc0lUo30Aq 5RpjgNZvxBan+T38ZD3taS77p6EqL8w1L+QD/dT5irhovPAI+SLrmK/ZdjnS2qv6W4Xo fnMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789539203; x=1790144003; h=content-type:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=WC+4bBJmOMaCFD9dsEEm3t/QrUZlzEYn1326Syti9Po=; b=FWrz9O6EQ7jxwLgLGYz96SrSAMrx8rERz7f/tLraCH1pps0xhuJaWL6CSSLkUTbGFS jgBq9wuHztESID+M6uxRaWtHFoZhSbNshXUGiGKMmLFkXtEtMGfM7XAgvi23yW4p8nrb DfPUw4aT8/r8/SriN2k+CowO/L3TNzqUarv2xsEGGxb7HaushfjwACfm4Wv7muE/v7gW gZDdKQT1byEhwO/62x1dS1NsuFypdE6ZW9UCPpOe5JEusVGyqhvDYxLALO/CaaC4UAKD hQJpKk+x/f2yYCYvgTeFLVUQw/QTnOXYvryebS0Q2mgmrNdijWDLiBw8diT2kz4l0vEN UKOg== X-Forwarded-Encrypted: i=1; AKwUvBw6sgkWYjePk+pwMg71rjwNkZgIUCcBO3Q6cZowu1p7KPZJkdmDrGeXz1NJ81OwSf4rFozz3xLDefqahW8=@vger.kernel.org X-Gm-Message-State: AFuF++lM8aqJG/O/86MEScisUHFEqU7dNMBjVXj3IR7gOqquT66V6uDR OIODun1Zqq6QFhrTJAjVj4/kLYKoBP067w0kGG0+SemUV2LOXwvLDawnQToTxwpcrm7Xe06ZwGl DWJrEiQ4rSg== X-Received: from dlbvg14.prod.google.com ([2002:a05:7022:7f0e:b0:143:7cf0:d45a]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:2744:b0:39d:efa9:cd20 with SMTP id 98e67ed59e1d1-39e1e28501bmr3351234a91.7.1789539202967; Tue, 15 Sep 2026 23:13:22 -0700 (PDT) Date: Tue, 15 Sep 2026 23:12:15 -0700 In-Reply-To: <20260916061218.3061216-1-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260916061218.3061216-1-irogers@google.com> X-Mailer: git-send-email 2.55.0.1032.g73a4cd73de-goog Message-ID: <20260916061218.3061216-7-irogers@google.com> Subject: [PATCH 6/9] perf build: Use the given CC rather than clang in clang builds From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Jiri Olsa , Ian Rogers , Adrian Hunter , James Clark , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Thomas Richter , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The clang block is entered when CC_NO_CLANG has determined that CC is clang, but it then ignores CC and hard codes $(CLANG), which defaults to plain "clang". Building with a versioned compiler silently switches compiler: $ make CC=3Dclang-19 # actually builds with "clang" Worse, the target triple is probed with $(CLANG) too, so on a machine that only has versioned binaries installed the probe produces nothing and the build stops: $ make CC=3Dclang-19 *** Specify CROSS_COMPILE or add CLANG_TARGET_FLAGS for x86_64 Use $(CC) in both places. Within the block CC is known to be clang, and for "make LLVM=3D1" CC is already $(CLANG), so nothing changes there. $(CLANG) is left as it is for BPF skeletons, as bpf_skel.mak builds those with "$(CLANG) --target=3Dbpf" whatever CC happens to be. Fixes: 4772e66cb45e ("perf build: Support build with clang") Signed-off-by: Ian Rogers Assisted-by: Antigravity:gemini-3.1-pro Acked-by: Namhyung Kim --- tools/perf/Makefile.config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index 31e4cbe192b9..dca62e155fb5 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -38,7 +38,7 @@ ifeq ($(CC_NO_CLANG), 0) =20 # Default to host architecture if ARCH is not explicitly given. ifeq ($(ARCH), $(HOSTARCH)) - CLANG_TARGET_FLAGS :=3D $(shell $(CLANG) -print-target-triple) + CLANG_TARGET_FLAGS :=3D $(shell $(CC) -print-target-triple) else CLANG_TARGET_FLAGS :=3D $(CLANG_TARGET_FLAGS_$(ARCH)) endif @@ -53,7 +53,7 @@ ifeq ($(CC_NO_CLANG), 0) CLANG_FLAGS +=3D --target=3D$(notdir $(CROSS_COMPILE:%-=3D%)) endif # CROSS_COMPILE =20 - CC :=3D $(CLANG) $(CLANG_FLAGS) -fintegrated-as + CC :=3D $(CC) $(CLANG_FLAGS) -fintegrated-as =20 # CC being clang says nothing about CXX: "make LLVM=3D1" overrides both,= but # "make CC=3Dclang" leaves CXX as g++. Probe CXX the way Makefile.include --=20 2.55.0.1032.g73a4cd73de-goog From nobody Fri Sep 25 06:03:31 2026 Received: from mail-pg1-f200.google.com (mail-pg1-f200.google.com [209.85.215.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 96CE03F0A86 for ; Wed, 16 Sep 2026 06:13:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.200 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789539207; cv=none; b=Y5Nc6JBRMEyMBxI4BhFTaGX6BOW1VEz0Z3wG/ts2oIUbkXLfFItxDcQUM8sCBoMTjcC5TDbCtkKSFMjbNTUyjkeAdm8z5c37Cy3u6DlG2QQ8RNRDTzhPZPO+ct83ZzW6zqNf38c5/Wk0uuSlrUKzLEGrGjJuu5sBmKSa1/zq0nM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789539207; c=relaxed/simple; bh=9AQBOX7WHaFtXKrai6q48Xl/HvE+e0N8DcJlpSobYXI=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Content-Type; b=uWefjo/mORj/9Pynj9WaZogyJU6jaQfbkZtd1JGpGduwhJkdXULwrlcFO02GEiPo140fU4nlBAkDC3nhhjwMFKAar2685hKrTaN0jbKvzrVqCe9ENS8pPcFv+Dw8pn7hVVRo+AQMdNtGww3zTMMVNAnYCX5CLpmquGHy38fZJA0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=rcr2L7sD; arc=none smtp.client-ip=209.85.215.200 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="rcr2L7sD" Received: by mail-pg1-f200.google.com with SMTP id 41be03b00d2f7-cc4afc810bfso1700526a12.0 for ; Tue, 15 Sep 2026 23:13:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1789539205; x=1790144005; darn=vger.kernel.org; h=content-type:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=icwakIRxoRygxUn8RuGulJXMD/67KQ1hy2QcRu7qTfU=; b=rcr2L7sDxZVTco3JJcBMrGiBH2FJI4pOWDgpEz+WDX8TE7SVe15tzeYAHFqLhLFoBD WygyNCbivXUQWA8oiw2jNTk2U5g/wg5vniZV6zh1OXIXpihls5NTNEATd/AH9xGB0rGW 473FX/a5mzKlQ/v1t6KvdYy30Vuy0d7HRp/Zuo6aYWxlDH1b2Tw4sGkGvXastJilb+EG 6w5TGVDFgYlJ+UYYfHKdyVEzNqP5mXwUXN6CXob+NmVeACXFvtJN5V9dtcwJ2mBtkX+q cTPws6PUj8E3xlub0B8AE0TvIX08Fby9O+09cBGwlQLQJ8uR6PWUVRh7gXcbgNQ0gXuX G0OA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789539205; x=1790144005; h=content-type:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=icwakIRxoRygxUn8RuGulJXMD/67KQ1hy2QcRu7qTfU=; b=RjTNSsekFcqJy8/wfSHiRYBFEZUNy6sSxD/NwCMEUCJCTEwxOEBbuzT6Ow7CvIrvyr 7EzcFaz508ymuDLnSNBD7XoWMeDSK+G3iB8EPwQAAZHaaQEzL4N18qgsPzM7fhO6tXQC SVHi/J606lwFqHXu3Dic7cxRaJV0ZKx3j6yfam6vT9OOyqtWDmwEx+hq7RKKskNMBtmd kKVATVxCHnV/OnxKM/IbQ9Mq5KycvKCgWymTjywhIVnUqJDK5Bht6SX/i7Zei5vcI/kQ LSED8STnHJQdNcuVVGRIkWedr9gmeJm+yKaH3GKU/t0VH+H7SDHnn5ouCTWvAq58uOoU H/gw== X-Forwarded-Encrypted: i=1; AKwUvBwcwWyl+zucUOjBZSCoHVZc9ObydYYfMZ91I2aIz3h/HD7smQAShfzXYU/APm697+3+RZ9N7aIG3ph4pYk=@vger.kernel.org X-Gm-Message-State: AFuF++kov6XzZSFSxQJa047s4+TpY7yxMmYDmKy+okuLkL1J3NEQ4+ao p6DDNOTl9JUWud/VcALtx9YodxqT9zRj3+PTdV8JTbda9LMfmo7u5cS4HvYZ+v0MMJ697bz4I8w /G7MDmsTA+A== X-Received: from dyhb21.prod.google.com ([2002:a05:7300:1495:b0:32b:7182:c3b7]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a17:903:2446:b0:2d8:d4d2:d13a with SMTP id d9443c01a7336-2dd7655b5f3mr91909395ad.22.1789539204632; Tue, 15 Sep 2026 23:13:24 -0700 (PDT) Date: Tue, 15 Sep 2026 23:12:16 -0700 In-Reply-To: <20260916061218.3061216-1-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260916061218.3061216-1-irogers@google.com> X-Mailer: git-send-email 2.55.0.1032.g73a4cd73de-goog Message-ID: <20260916061218.3061216-8-irogers@google.com> Subject: [PATCH 7/9] perf build: Check the version of the compiler that is used From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Jiri Olsa , Ian Rogers , Adrian Hunter , James Clark , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Thomas Richter , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The flex and bison flags are adjusted for clang older than 13.0.0, which doesn't grok -Wno-unused-but-set-variable. The test is reached because CC_NO_CLANG says CC is clang, but the version comes from $(CLANG), which defaults to plain "clang" and needn't be the compiler in use: $ make CC=3Dclang-19 CLANG=3Dclang-12 version from $(CLANG) -> 12.0.0, flag stripped version from $(CC) -> 19.1.7, flag kept Dropping the flag lets the warnings it suppresses in the generated flex and bison code through, and those are errors under -Werror. Ask $(CC) instead, as that is what compiles the code. Fixes: 878460e8d0ff ("perf build: Remove -Wno-unused-but-set-variable from = the flex flags when building with clang < 13.0.0") Signed-off-by: Ian Rogers Assisted-by: Antigravity:gemini-3.1-pro Acked-by: Namhyung Kim --- tools/perf/util/Build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/Build b/tools/perf/util/Build index d08f2af7d970..a4618e4e4848 100644 --- a/tools/perf/util/Build +++ b/tools/perf/util/Build @@ -339,7 +339,7 @@ bison_flags :=3D -DYYENABLE_NLS=3D0 -Wno-unused-but-set= -variable =20 # Old clangs don't grok -Wno-unused-but-set-variable, remove it ifeq ($(CC_NO_CLANG), 0) - CLANG_VERSION :=3D $(shell $(CLANG) --version | head -1 | sed 's/.*clang= version \([[:digit:]]\+.[[:digit:]]\+.[[:digit:]]\+\).*/\1/g') + CLANG_VERSION :=3D $(shell $(CC) --version | head -1 | sed 's/.*clang ve= rsion \([[:digit:]]\+.[[:digit:]]\+.[[:digit:]]\+\).*/\1/g') ifeq ($(call version-lt3,$(CLANG_VERSION),13.0.0),1) bison_flags :=3D $(subst -Wno-unused-but-set-variable,,$(bison_flags)) flex_flags :=3D $(subst -Wno-unused-but-set-variable,,$(flex_flags)) --=20 2.55.0.1032.g73a4cd73de-goog From nobody Fri Sep 25 06:03:31 2026 Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7B2363F105F for ; Wed, 16 Sep 2026 06:13:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.71 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789539210; cv=none; b=FCZVu5OtwZ/MQPQo2eCvePXQMK44dIAx8GExN8zbAEGVG3Q4NXETdV30/EvVvvUyegZd2xDeYJRRdxgn5dn+ME6WzK4+gW4dy8z0Bxk0k+tAjSsWnbwNqTSapWDAoV4lN223XvhDMjmX+plNRQAk9Xu6lACn/fSUGYhoq/YCgMw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789539210; c=relaxed/simple; bh=/UxG/z8oqDwP9CIwjcJWyPbDAUY4rJGItVrJwkdYtcs=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Content-Type; b=K63yPveu/6BwJ8kI0Exhf6gqLk5fbLkz8b4ff1yG6+aLPn3JkxAwtAtfs/7Al2YLGDZKPxfB7yvUSV7Gnj5baxnwqVsAzOTyvIQWGs/fqYRh62/5OQTRZzLGRGCOBnaGPH6ogO0LYQUbNrMzF23NVdYdigbKLqms8n4cbslKgpo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=S5X1sQhf; arc=none smtp.client-ip=209.85.216.71 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="S5X1sQhf" Received: by mail-pj1-f71.google.com with SMTP id 98e67ed59e1d1-398dc3d8f0fso1894506a91.0 for ; Tue, 15 Sep 2026 23:13:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1789539207; x=1790144007; darn=vger.kernel.org; h=content-type:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=mE+VIvBqxJWeI7GLiq81u6doV2s7RHiOZIS5UCF0zbk=; b=S5X1sQhf8PRD27TmBaTV9nyWZgFb4WxZheW59NQRHqiF4qGeGbjdZTBNjuf+5LTGoW k7iRZHKHjfGiM3DGjU0Jk/HtYkqa5BxBfUCfxyWnADN4nQY45mZtG+Jaughht4oZ3ZAy X8zTcTs9XhzYHOuk5jvxc+sgT5QsWd4F5ARVugsbdnuxtPlULrc0A9ZTVUscGSKtj5IM ubV9HCiHt7sXGUCCb9bWtEOw3/Muaomv3OkoWskb0NoGYyU2GM/74lCGMFv8UWWyr1YD ghOzHzmt6RdICW8tLOG79O3xfRLmS03tc8vBT9UrTbxoXS6essbUwVzhUzt1WrPlS9rV /Kkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789539207; x=1790144007; h=content-type:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=mE+VIvBqxJWeI7GLiq81u6doV2s7RHiOZIS5UCF0zbk=; b=tqZHXHoCUcfnelTfVrCcHa37tykqiz9cUQjkkpwdA+iI2cSJBp8dnhFHZh1GaxRFqX 4M5GxY3d/ga3vVlZlVZUsSEyrF2zw6DNPH4BFhb89ojE5iOzi/N1BPJc8Agu8y6QBLVU LzDuB0iu23xH5H4uZL0YXeBh9Mnu+k2eF84r0/EQCgXSc5NG8mcYfC3FduEitrZza0eQ EUzR0GbhK+J0pYFgiIjD4vhjXnRRfky58OEmHETT/f+wWBNXcFzieTgIcK+ojKdTxwWX JTG9BtYTEJ3qnhqjwsQNobam64UujOCZoxn3xzNCeuYIDw9OFnbtLaGhPkF/rXL2k0P1 mK/Q== X-Forwarded-Encrypted: i=1; AKwUvBxCYg3u9yTsYOFa6Yn641QVvLaNbfeuhbzloW1V53NB0zNekW7rC0+I745Grb+6/ke2YCzuKHLDU64BH6A=@vger.kernel.org X-Gm-Message-State: AFuF++kzv6NDSsxbneHtOoZfQxjJ8iTjI9ln4goM4JP89ILKKGi1abcx zHbFnwqbuB8XL0QnwH3jWJaLORiz67Ko+WyNwlbDZkYkZQaN7PKbCpodhqCsYLxA0+eKdE3IjSF 46EHkXUDtXQ== X-Received: from dlep14-n2.prod.google.com ([2002:a05:701b:458e:20b0:143:9704:de05]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:3941:b0:39e:237c:50de with SMTP id 98e67ed59e1d1-39e237c518amr1393784a91.3.1789539206454; Tue, 15 Sep 2026 23:13:26 -0700 (PDT) Date: Tue, 15 Sep 2026 23:12:17 -0700 In-Reply-To: <20260916061218.3061216-1-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260916061218.3061216-1-irogers@google.com> X-Mailer: git-send-email 2.55.0.1032.g73a4cd73de-goog Message-ID: <20260916061218.3061216-9-irogers@google.com> Subject: [PATCH 8/9] perf build: Remove leftovers of removed build options From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Jiri Olsa , Ian Rogers , Adrian Hunter , James Clark , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Thomas Richter , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" NO_LIBDW_DWARF_UNWIND, NO_SYSCALL_TABLE and the embedded clang/LLVM support were all removed, but each removal left the matching entry in the build test suite behind: run +=3D make_no_libdw_dwarf_unwind run +=3D make_no_syscall_tbl run +=3D make_with_clangllvm None of these have a make_* variable defining what to build, so $($@) expands to nothing and each one silently repeats the plain "make_pure" build. The suite therefore spends six builds, as every test is also run with O=3D, appearing to cover options that no longer exist. Remove them, along with the NO_LIBDW_DWARF_UNWIND comment that is still in Makefile.perf. Fixes: 2e9191573a69 ("perf build: Remove NO_LIBDW_DWARF_UNWIND option") Fixes: 3cc550f5bbcf ("perf tools: Remove dependency on libaudit") Fixes: 56b11a2126bf ("perf bpf: Remove support for embedding clang for comp= iling BPF events (-e foo.c)") Signed-off-by: Ian Rogers Assisted-by: Antigravity:gemini-3.1-pro Acked-by: Namhyung Kim --- tools/perf/Makefile.perf | 3 --- tools/perf/tests/make | 3 --- 2 files changed, 6 deletions(-) diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index 2438b40eaaec..53f538cc8e1a 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf @@ -64,9 +64,6 @@ include ../scripts/utilities.mak # # Define NO_LIBBIONIC if you do not want bionic support # -# Define NO_LIBDW_DWARF_UNWIND if you do not want libdw support -# for dwarf backtrace post unwind. -# # Define NO_LIBTRACEEVENT=3D1 if you don't want libtraceevent to be linked, # this will remove multiple features and tools, such as 'perf trace', # that need it to read tracefs event format files, etc. diff --git a/tools/perf/tests/make b/tools/perf/tests/make index f879f8109072..608470ff9c10 100644 --- a/tools/perf/tests/make +++ b/tools/perf/tests/make @@ -157,7 +157,6 @@ run +=3D make_no_demangle run +=3D make_no_libelf run +=3D make_no_libdw run +=3D make_libunwind -run +=3D make_no_libdw_dwarf_unwind run +=3D make_no_backtrace run +=3D make_no_libcapstone run +=3D make_libcapstone_dlopen @@ -167,10 +166,8 @@ run +=3D make_no_libbpf run +=3D make_no_libbpf_DEBUG run +=3D make_no_libllvm run +=3D make_no_sdt -run +=3D make_no_syscall_tbl run +=3D make_no_babeltrace2 run +=3D make_with_coresight -run +=3D make_with_clangllvm run +=3D make_no_libpfm4 run +=3D make_refcnt_check run +=3D make_help --=20 2.55.0.1032.g73a4cd73de-goog From nobody Fri Sep 25 06:03:31 2026 Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4A0463F1043 for ; Wed, 16 Sep 2026 06:13:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.200 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789539211; cv=none; b=pwiIYqtCZScAI2nMHK4+Wdshsk+68Wc0/061riu9Zk2W9ReBuyM1fYTnyq0ezwKFQUpI0OJB2tJYpPCrcTMegRY0YjkfQeO+mWuln4X8WTbqCBRetx6XaAd0nA1pxIRTAObksllWyWSpNWDB6zTA9WlXXLOY5w6reSmuZGDCuOk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789539211; c=relaxed/simple; bh=9dORH0oEqVFA847HKvzWRovoEjk2gC7h5N3Vm9y/hYo=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Content-Type; b=YfAYRf00BMj2ZhIpztXZt1fXeiaYyfzl6CAdze4Y4K4wtX2EtQNaPz6/+uy6DwZATg6OV8YdjSXbs/pga7p72cyujoS0TharLJCZjN36yO0r9+o1BAsxgfl0+vol0lgU6lu3kTU62TQ5fi4RyjJ3NgNbMJ98jBJwwnk49vX7RfM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=kNgHdUy8; arc=none smtp.client-ip=209.85.210.200 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="kNgHdUy8" Received: by mail-pf1-f200.google.com with SMTP id d2e1a72fcca58-86261e66700so4880535b3a.3 for ; Tue, 15 Sep 2026 23:13:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1789539208; x=1790144008; darn=vger.kernel.org; h=content-transfer-encoding:content-type:to:from:subject:message-id :references:mime-version:in-reply-to:date:from:to:cc:subject:date :message-id:reply-to:content-type; bh=TcdV1sgmtR2CtW3eQG4Xq1/J2URo6ZShBMv2CnVeVxw=; b=kNgHdUy8cn44zPRy/FLBm7qgrUMJsPuq4Cwy4eC2eSvJ9vtv73Fg4vskVyOX34nN4M nDP27AXkCgMzrNMaUNqxDztVJAWH+haFw8v1azbW7y2pEwjEBhYOHJAKk9yewpdce6fp wxhiPxiNdB8xlXxnyEn4xvvpzqLw72ml6poqBckqC6afJfnaAa8wu2XHH0dVmu+HFXiZ RLTDSY20gZe36AaXdiU5d6stj5kTJ9dhJZ0e+vxyAmUYyUWOOcv3/Pe7WGQA/QGsKuKU vAIvbQvOw7vR07VwlwTaQyr3cK+W/7ee9juuK2NbPPXhG1bbdyBvvDTwpcA6PzUNkDtA +nlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789539208; x=1790144008; h=content-transfer-encoding:content-type:to:from:subject:message-id :references:mime-version:in-reply-to:date:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=TcdV1sgmtR2CtW3eQG4Xq1/J2URo6ZShBMv2CnVeVxw=; b=QkyNK9QPOyH2xMlEEaASVPZsaCmX0oAQQ8XBzpQFML0qHOlidkmfyec5PZ152xF6Bc bzxhpZQxur1Xo4yabHU46fRW8hJ90fQQj6RpfEeHv/fmiNC5gd/0l6uSHEufJTZKY28y eoSa046RRej3VUAmNLhULu3La4IY83z0BZtUleltt3ZJFDypxtyEzpapCuyU+ETO3Rba f7uimrB+/QoxqcpIxszvSdA/wTElcsldI6H2GeMVki3nQDD3pVlXBpEMGWdLJTklzUzC W+MgoLSV0rotL30p/sdA0tDPZuyethsrEJwyoa8z4ohPtPlQteBeMKOXJCEUoBSVQ1QU zmKg== X-Forwarded-Encrypted: i=1; AKwUvByTLZhL/h/GBK6dBEYLRovXzAzPuZQmgpMexT5qRYX6fQWMOQLtQtCkCEQy1cfxrL7aLBBaiJ4TGW/gKWA=@vger.kernel.org X-Gm-Message-State: AFuF++lfHg39YhO8DgpqsWCSOCBJik4z6ansdsFRQHdN48ArwC7nsO2B IdkLWSd/HYcLc1c0YLPxdTm8bI45pZ5MXjhvM2U1Jd+PKOTOYAZf5xukk2CbKAH4JFo7W8ss9yN 9BCOA7FK4Uw== X-Received: from dyau26.prod.google.com ([2002:a05:7300:601a:b0:335:65c3:a0a9]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a21:7703:b0:3cc:917f:f302 with SMTP id adf61e73a8af0-3dd5f455cd6mr3886426637.9.1789539208331; Tue, 15 Sep 2026 23:13:28 -0700 (PDT) Date: Tue, 15 Sep 2026 23:12:18 -0700 In-Reply-To: <20260916061218.3061216-1-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260916061218.3061216-1-irogers@google.com> X-Mailer: git-send-email 2.55.0.1032.g73a4cd73de-goog Message-ID: <20260916061218.3061216-10-irogers@google.com> Subject: [PATCH 9/9] perf test: Add build tests for clang and libbfd demangling From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Jiri Olsa , Ian Rogers , Adrian Hunter , James Clark , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Thomas Richter , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Three build configurations broke recently without the build test suite noticing, as none of them were covered: - "CC=3Dclang" on its own. CXX is only set to clang++ by "make LLVM=3D1", so CXX stays as g++ and used to be passed clang's flags. - "CC=3Dclang BUILD_NONDISTRO=3D1", where libbfd.c failed clang's -Wthread-safety analysis. - "BUILD_NONDISTRO=3D1 NO_DEMANGLE=3D1", the only combination that compiles the libbfd demangling in symbol.c, which referred to identifiers nothing declared. Add the three. The clang ones need clang installed, and the libbfd ones reuse the existing binutils check. Testing that perf was built isn't enough for the first one. Feature tests are allowed to fail, so a broken C++ compiler command line doesn't fail the build, it silently turns off every feature needing a C++ compiler and the build still produces a working perf. Check that libLLVM is still built in, which is the C++ dependent feature perf can report on, so the test fails instead of quietly producing a perf with less in it than the default build has. Only make that check when libLLVM can be built in the first place. The llvm-perf feature test compiles and links against the llvm-devel/llvm-dev headers and libraries and needs version 13 or newer, so the presence of llvm-config on its own says nothing. Probe the same way the feature test does and fall back to only testing that perf was built when the probe fails, rather than turning a machine without the LLVM development files into a spurious failure. For the same reason the clang tests must not reuse a feature dump made with the default compiler, so exclude them from REUSE_FEATURES_DUMP. Signed-off-by: Ian Rogers Assisted-by: Antigravity:gemini-3.1-pro Acked-by: Namhyung Kim --- tools/perf/tests/make | 47 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/tools/perf/tests/make b/tools/perf/tests/make index 608470ff9c10..8e55ff1aecbd 100644 --- a/tools/perf/tests/make +++ b/tools/perf/tests/make @@ -71,6 +71,9 @@ make_clean_all :=3D clean all make_python_perf_so :=3D $(python_perf_so) make_debug :=3D DEBUG=3D1 make_nondistro :=3D BUILD_NONDISTRO=3D1 +make_nondistro_no_demangle :=3D BUILD_NONDISTRO=3D1 NO_DEMANGLE=3D1 +make_clang :=3D CC=3Dclang +make_clang_nondistro :=3D CC=3Dclang BUILD_NONDISTRO=3D1 make_extra_tests :=3D EXTRA_TESTS=3D1 make_no_jevents :=3D NO_JEVENTS=3D1 make_jevents_all :=3D JEVENTS_ARCH=3Dall @@ -128,6 +131,18 @@ make_minimal +=3D NO_CAPSTONE=3D1 # binutils 2_42 and newer have bfd_thread_init() new_libbfd :=3D $(shell echo '#include ' | $(CC) -E -x c - | grep b= fd_thread_init) =20 +# Whether libLLVM can be built, which needs the llvm-devel/llvm-dev header= s and +# libraries of version 13 or newer, not just llvm-config. This mirrors the +# llvm-perf feature test in tools/build/feature/test-llvm-perf.cpp so that +# libLLVM is only asserted below when the default compiler can really buil= d it. +ifneq ($(call has,$(LLVM_CONFIG)),) +have_libllvm :=3D $(shell printf '#include \= n#include \n#if LLVM_VERSION_MAJOR < 13\n#error= "llvm-devel/llvm-dev version 13 or greater is required"\n#endif\nint main(= ){llvm::errs()<<"";llvm::llvm_shutdown();return 0;}\n' | \ + $(CXX) -x c++ -std=3Dgnu++17 -I$(shell $(LLVM_CONFIG) --includedir 2>/dev= /null) - -o /dev/null \ + -L$(shell $(LLVM_CONFIG) --libdir 2>/dev/null) \ + $(shell $(LLVM_CONFIG) --libs Core BPF 2>/dev/null) \ + $(shell $(LLVM_CONFIG) --system-libs 2>/dev/null) >/dev/null 2>&1 && ech= o y) +endif + # $(run) contains all available tests run :=3D make_pure # Targets 'clean all' can be run together only through top level @@ -143,6 +158,17 @@ run +=3D make_python_perf_so run +=3D make_debug ifneq ($(new_libbfd),) run +=3D make_nondistro +# Demangling with libbfd is only built when the C++ ABI's __cxa_demangle +# isn't available, so it needs a build of its own to be compiled at all. +run +=3D make_nondistro_no_demangle +endif +# CXX is only set to clang++ by LLVM=3D1, so a CC=3Dclang build has to cop= e with +# a C compiler and a C++ compiler that don't match. +ifneq ($(call has,clang),) +run +=3D make_clang +ifneq ($(new_libbfd),) +run +=3D make_clang_nondistro +endif endif run +=3D make_extra_tests run +=3D make_no_jevents @@ -278,6 +304,17 @@ test_make_install_pdf_O :=3D $(test_ok) test_make_libbpf_dynamic :=3D ldd $(PERF_O)/perf | grep -q libbpf test_make_libbpf_dynamic_O :=3D ldd $$TMP_O/perf | grep -q libbpf =20 +# Feature tests are allowed to fail, so a broken C++ compiler command line +# doesn't fail the build, it just quietly turns off everything that needs a +# C++ compiler. Check a feature that does, otherwise these tests would pass +# while producing a perf with less in it than the default build has. +ifneq ($(have_libllvm),) +test_make_clang :=3D test -x $(PERF_O)/perf && $(PERF_O)/per= f check -q feature libLLVM +test_make_clang_O :=3D test -x $$TMP_O/perf && $$TMP_O/perf ch= eck -q feature libLLVM +test_make_clang_nondistro :=3D $(test_make_clang) +test_make_clang_nondistro_O :=3D $(test_make_clang_O) +endif + test_make_python_perf_so_O :=3D test -f $$TMP_O/python/perf.so test_make_perf_o_O :=3D test -f $$TMP_O/perf.o test_make_util_map_o_O :=3D test -f $$TMP_O/util/map.o @@ -407,8 +444,14 @@ $(FEATURES_DUMP_FILE_STATIC): echo "- $@: $$cmd" && echo $$cmd && \ ( eval $$cmd ) > /dev/null 2>&1 =20 +# The clang tests exist to run feature detection with a compiler other than +# the default one, so they have to do their own and are left out of both t= he +# dependency and the 'FEATURES_DUMP=3D' append below. +no_features_dump :=3D make_clang make_clang_nondistro +no_features_dump +=3D $(addsuffix _O,$(no_features_dump)) + # Add feature dump dependency for run/run_O targets -$(foreach t,$(run) $(run_O),$(eval \ +$(foreach t,$(filter-out $(no_features_dump),$(run) $(run_O)),$(eval \ $(t): $(if $(findstring make_static,$(t)),\ $(FEATURES_DUMP_FILE_STATIC),\ $(FEATURES_DUMP_FILE)))) @@ -416,7 +459,7 @@ $(foreach t,$(run) $(run_O),$(eval \ # Append 'FEATURES_DUMP=3D' option to all test cases. For example: # make_no_libbpf: NO_LIBBPF=3D1 --> NO_LIBBPF=3D1 FEATURES_DUMP=3D/a/b/BU= ILD_TEST_FEATURE_DUMP # make_static: LDFLAGS=3D-static --> LDFLAGS=3D-static FEATURES_DUMP=3D/a/= b/BUILD_TEST_FEATURE_DUMP_STATIC -$(foreach t,$(run),$(if $(findstring make_static,$(t)),\ +$(foreach t,$(filter-out $(no_features_dump),$(run)),$(if $(findstring mak= e_static,$(t)),\ $(eval $(t) :=3D $($(t)) FEATURES_DUMP=3D$(FEATURES_DUMP_FILE_STATIC)),\ $(eval $(t) :=3D $($(t)) FEATURES_DUMP=3D$(FEATURES_DUMP_FILE)))) endif --=20 2.55.0.1032.g73a4cd73de-goog