From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-188.mta0.migadu.com (out-188.mta0.migadu.com [91.218.175.188]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DA47C2773D8 for ; Thu, 18 Jun 2026 00:57:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.188 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781744281; cv=none; b=UlnP4qr+DFu7dQSK6c9JZKP8rKQ69iCnwNmCtvxoQYAXFE/scG4LT74NeGHjIrawlGTX/RafT0rhqfEO5V6tPbDrlvdbCjkb3XmfgT2tAfzoKBc2MuAi01oWni8divv1UDqvTNoSIs+ZwFqeJCaQ9MJg/RTCKovFSdXoEe8FcFc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781744281; c=relaxed/simple; bh=79X7oL8cSGpC56pkaUi08p44ZXuXafiLYys4SFI3mFU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NQmdCKLX6F+rUW+YA4CaG3P+DMPQG/gD2PNprLMVXoUiqUcoiTAjoj+tWzdzaIuuwh6QjQcC8OOAuMy9mk9QPLW9BvjnjsayMXtAnXzYUw2Mfv4rCgWxiuRezvwsoS1IIIfFykXPo1MkhbNmrqzSXfQ44iGXuenrpZQwHdw8fI8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=a0n2is3H; arc=none smtp.client-ip=91.218.175.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="a0n2is3H" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1781744277; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+q5gxFpxEXhfT4wn2QqKMnqkXXHptiKiynM11bTUGW0=; b=a0n2is3HYy3U6KY0D6PdWym5idtT+RkWuZDbYDtuX9KURYLECgaHMR5FVWtp+JPmuBAUrj YJYqO7le5e2sTYroRERH9lavKE2tVi2hm+nJKL+Z23sb2ijohA5LRXER3xVa+T/slPowUD H6JAlY3PGhNILxH3vIb6u/cBv5eRmh8= From: Vineet Gupta To: dwarves@vger.kernel.org Cc: bpf@vger.kernel.org, Andrii Nakryiko , acme@kernel.org, Alan Maguire , Emil Tsalapatis , jose.marchesi@oracle.com, David Faust , Yonghong Song , Vineet Gupta Subject: [PAHOLE v5 4/5] tests: Support GCC in pfunct-btf-decl-tags test Date: Wed, 17 Jun 2026 17:57:30 -0700 Message-ID: <20260618005731.273181-5-vineet.gupta@linux.dev> In-Reply-To: <20260618005731.273181-1-vineet.gupta@linux.dev> References: <20260618005731.273181-1-vineet.gupta@linux.dev> Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT GCC 16+ supports btf_decl_tag via DW_TAG_GNU_annotation. Update the test to run with both GCC (>= 16) and clang when available, instead of requiring clang only. Compile the clang case natively and encode BTF with "pahole -J" (like the GCC case) rather than emitting BPF-target BTF directly, so both compilers exercise the same DWARF -> BTF path. Add a function with a parameter decl tag (qux) to cover decl tags that carry a component_idx, and make the awk post-processing pass through lines that have no leading tags. Signed-off-by: Vineet Gupta Acked-by: Yonghong Song Reviewed-by: Emil Tsalapatis --- Changes since v4 [4] - Test function param decl tag [Alan] - Missing "pahole -j" for clang [Yonghong] - Collected the review tags [Emil, Yonghong] [4] https://lore.kernel.org/bpf/20260602195512.1511013-3-vineet.gupta@linux.dev/ --- tests/pfunct-btf-decl-tags.sh | 93 ++++++++++++++++++++++++++--------- 1 file changed, 70 insertions(+), 23 deletions(-) diff --git a/tests/pfunct-btf-decl-tags.sh b/tests/pfunct-btf-decl-tags.sh index 35884b4e8687..520148b2ccef 100755 --- a/tests/pfunct-btf-decl-tags.sh +++ b/tests/pfunct-btf-decl-tags.sh @@ -6,43 +6,60 @@ source test_lib.sh outdir=$(make_tmpdir) -tmpobj=$(make_tmpobj) # Comment this out to save test data. trap cleanup EXIT title_log "Check that pfunct can print btf_decl_tags read from BTF." -# gcc now also supports decl tags as of gcc commit 43dcea48b8c, -# in upstream version 16. -# UPTODO: add a check here for that. +# gcc 16+ supports decl tags via DW_TAG_GNU_annotation (gcc commit ac7027f180b). +GCC=${GCC:-gcc} CLANG=${CLANG:-clang} -if ! command -v $CLANG > /dev/null; then - error_log "Need clang for test $0" + +use_gcc=0 +if command -v $GCC > /dev/null; then + gcc_ver=$($GCC -dumpversion 2>/dev/null | cut -d. -f1) + if [ "$gcc_ver" -ge 16 ] 2>/dev/null; then + use_gcc=1 + fi +fi + +use_clang=0 +if command -v $CLANG > /dev/null; then + use_clang=1 +fi + +if [ "$use_gcc" -eq 0 ] && [ "$use_clang" -eq 0 ]; then + error_log "Need gcc >= 16 or clang for test $0" test_fail fi -(cat </dev/null + pahole -J $tmpobj 2>/dev/null + run_test "$GCC (version $gcc_ver)" "$tmpobj" || failed=1 +fi + +if [ "$use_clang" -eq 1 ]; then + tmpobj=$(make_tmpobj) + echo "$src" | $CLANG -c -g -x c -o $tmpobj - + pahole -J $tmpobj 2>/dev/null + run_test "$CLANG" "$tmpobj" || failed=1 +fi -if [[ "$d" == "" ]]; then +if [ "$failed" -eq 0 ]; then test_pass else - error_log "pfunct output does not match expected:" - info_log "$d" - info_log - info_log "Complete output:" - info_log "$out" test_fail fi -- 2.54.0