From patchwork Wed Jan 22 02:53:25 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ihor Solodrai X-Patchwork-Id: 13946805 X-Patchwork-Delegate: bpf@iogearbox.net Received: from mail-40134.protonmail.ch (mail-40134.protonmail.ch [185.70.40.134]) (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 7325C14F125 for ; Wed, 22 Jan 2025 02:53:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.70.40.134 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737514420; cv=none; b=QAONvsQwoEnlS/MBQe6/sv9N+slEBI0vRoRTdNr9AkqaOrCyXMYSWl1V5YMHuQJ2APHuj5AndVB25OPK9uu8vi7vbBbBIDvrvj8dsacfoUKltLPdoVQi5cR032W4WyrdxPY1bhRWmqdb16I42urzUxEb6KH2x+VKZ2gglNCW2cU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737514420; c=relaxed/simple; bh=RuhFxQ+NTeF6mB6P04+lHasNUIWGScBCvEOukRBbmPg=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=f9aETSRJRm5AHoR3wBeCVK1fYX2mWo7DtBfHjdSh68BesyvQrsqgAYaEcucB1ToNWufc3Mz6PbEXwf0MCoXcP69WCoinWeihpJy9tXMBcjvsrVe3h20nR5c83jYuMGeSVGf18lakMSAy1skRY+dF8jP4nGkAauMdcawfgtemlME= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=pm.me; spf=pass smtp.mailfrom=pm.me; dkim=pass (2048-bit key) header.d=pm.me header.i=@pm.me header.b=BlydKpL/; arc=none smtp.client-ip=185.70.40.134 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=pm.me Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pm.me Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pm.me header.i=@pm.me header.b="BlydKpL/" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail3; t=1737514410; x=1737773610; bh=RuhFxQ+NTeF6mB6P04+lHasNUIWGScBCvEOukRBbmPg=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector:List-Unsubscribe:List-Unsubscribe-Post; b=BlydKpL/DQCQyrdtg++VRLK+CXJMVmyMEuZZIzzfefucczSju5icVtl6dDxgIbJHP qxlARVShX1kjQ80t1QBrpKXRYyL8NKaMfD6D1V2LuM1xCheETNBeUkSTexj8V5B0hF Ta2nN4TYLn6sqXvaMXwvFMgdvoc5bT1XMyCvl6+CtvzzDW3nKbk6zvladtFCeM2YDl ZfdVZifnfBA+ZNh6FYsXeY47uDD4t1waV4sJNc9jMi74LcpytzGyFC0NbKw0SNP7B2 sWC5xUerzjrx1TajqhA08Suw/MhveD0OuktCCOHLj30shLuHvjc9IvgYD6NWuIIRnV D63dPAV4Ygyhg== Date: Wed, 22 Jan 2025 02:53:25 +0000 To: bpf@vger.kernel.org From: Ihor Solodrai Cc: andrii@kernel.org, ast@kernel.org, daniel@iogearbox.net, eddyz87@gmail.com, mykolal@fb.com, jose.marchesi@oracle.com Subject: [PATCH bpf-next 2/5] libbpf: check the kflag of type tags in btf_dump Message-ID: <20250122025308.2717553-3-ihor.solodrai@pm.me> In-Reply-To: <20250122025308.2717553-1-ihor.solodrai@pm.me> References: <20250122025308.2717553-1-ihor.solodrai@pm.me> Feedback-ID: 27520582:user:proton X-Pm-Message-ID: 5f3aa5a34393c5afc2e5de2e01a9c6561e796a5c Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: bpf@iogearbox.net If the kflag is set for a BTF type tag, then the tag represents an arbitrary __attribute__. Change btf_dump accordingly. Signed-off-by: Ihor Solodrai Reviewed-by: Alan Maguire --- tools/lib/bpf/btf_dump.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/lib/bpf/btf_dump.c b/tools/lib/bpf/btf_dump.c index a3fc6908f6c9..460c3e57fadb 100644 --- a/tools/lib/bpf/btf_dump.c +++ b/tools/lib/bpf/btf_dump.c @@ -1494,7 +1494,10 @@ static void btf_dump_emit_type_chain(struct btf_dump *d, case BTF_KIND_TYPE_TAG: btf_dump_emit_mods(d, decls); name = btf_name_of(d, t->name_off); - btf_dump_printf(d, " __attribute__((btf_type_tag(\"%s\")))", name); + if (btf_kflag(t)) + btf_dump_printf(d, " __attribute__((%s))", name); + else + btf_dump_printf(d, " __attribute__((btf_type_tag(\"%s\")))", name); break; case BTF_KIND_ARRAY: { const struct btf_array *a = btf_array(t);