Received: by 2002:ac0:de83:0:0:0:0:0 with SMTP id b3csp382149imk; Sat, 2 Jul 2022 21:51:06 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sY3/Gj65tqe9xsSB/utDGGvPNRVfHCj/KvMGivGzh/DYq2F/qjWCdrqbwxe0nyn9681vuD X-Received: by 2002:a17:906:6a25:b0:727:b02:4743 with SMTP id qw37-20020a1709066a2500b007270b024743mr21095858ejc.688.1656823865854; Sat, 02 Jul 2022 21:51:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656823865; cv=none; d=google.com; s=arc-20160816; b=MywK/GcUOb905TFi42bp/Jv7nc92aLArrqsdal6VnxwBr9Uo6Y4jivHL4vXP7TyqWq 2ccsbwZbpuY6d7zsrsBrkcCKNQhEdu7WOHpJ92gfXI6MFiQIePqMdwU0hHsCpiePdhPq mB14nz0+P1Drw4tf1Xgyc7bMKTpv320/32g9brNx4U52SW1fhMLOxy9vhkDdguYgoEV5 Nax6NymIdzFqZYzAD8QAHjhV2nHR1luVvfXmTdAy7iMDkIdusz+6+oGb6KF1lmn79/8D QSD/9bvDWK84MkCgh4nL3mySq0KmhlyDOaKSeEekxnHM1cejB9OLnhNSFIaQvr91xPPu jPVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from:feedback-id :dkim-signature:dkim-signature; bh=OYwocANUXn60/A2NoBeSFagq8/qEqoWs1FFCQ5dENPI=; b=g3fd7Id5r45kizJsc52JGYaknjmIFfpWeDVZjfXt4JLXXTf/rxfaKkes3AVg6FryHC d2iQfND2k9FUFHcTuUX174nxpUvLbTcDydRYX56H88Amo66LfVQ7AVtrOcUJCUYt9bZ7 jVb6xBYbbWGecMxWAxd9U83+/BEHqeUzzsRxbexHzUBnj4kdyHu17fTAvhlm1Sed+I8F bo0odA38QiZR/sney/E1JgnqNHtG1ZcXY2j1ku9YHN9y0swiizAFs8dfCHxon3BdtDyI xkyscBYM4+qaBlNHbaMQuF95NBOC4XQLB0ZrgqLyO88dfRKn44l2FabLGwzqF2NcSuKF yK8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@anarazel.de header.s=fm2 header.b=p98g3Gei; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b="w4Dv/eeS"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dm3-20020a05640222c300b00437a0492fa8si6064346edb.415.2022.07.02.21.50.41; Sat, 02 Jul 2022 21:51:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@anarazel.de header.s=fm2 header.b=p98g3Gei; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b="w4Dv/eeS"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231495AbiGCEsf (ORCPT + 99 others); Sun, 3 Jul 2022 00:48:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230464AbiGCEsU (ORCPT ); Sun, 3 Jul 2022 00:48:20 -0400 Received: from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com [64.147.123.19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A159D45 for ; Sat, 2 Jul 2022 21:48:17 -0700 (PDT) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id BF68A3200684 for ; Sun, 3 Jul 2022 00:48:15 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Sun, 03 Jul 2022 00:48:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm2; t=1656823695; x=1656910095; bh=OY wocANUXn60/A2NoBeSFagq8/qEqoWs1FFCQ5dENPI=; b=p98g3GeifKBPvTULvn A8a8E/S/4/aaSIWrlLAQpqOwVm1UEYhq5Y1SCAHEKCHFMSJ/OAMiputsC/+DDb3C hWqZ7WV8px6wH33L5KuKrqoA8RoI8M4qrehzvB39rXHVDo2+dcPt6v3ArW0FmLve 629bc907XUSULEopfTSP1aHI4NmBwPqx7wFBilJ6s2uRjDuYmepcw+FiLqFEtQ3e k9vNe9l6XjV33ktODibFWPSXwD3rspfGCauD+dlTKwDGtjWP2yQvHcrJ8DYRVoAi Viqj50UbeOFCUs+fwmH+ttwnrVWZQlieeUuH2JErtagwHQrqGAZu4/dTPKoOsS/k lAdQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1656823695; x=1656910095; bh=OYwocANUXn60/ A2NoBeSFagq8/qEqoWs1FFCQ5dENPI=; b=w4Dv/eeSd57ClVg5VrPTszlfYva/6 b2wjKbHtlkFmbJT9Is+hHxr6/0JHz6UgixKX/ByVHk/KZKdmeGIRTI1l/p6moSUX 1glJMcjTu5KdzrdAOoGtNk+gWkl4VXO8vi9pG3682KHmq6TgW4F8kMn7vrCUg4JF Ve+OlaYqa1g1f+CtHlUbKc+MeP0d/Uny9RpA42V+0AIAlZXZobzQj+qO6sgEYqs1 8AQoEtondgIWdNWGgVarUf14FgXHCSDukYcsDD9NBKfiHQFNQ6D3mF3J1H0oZZIw K0wdfPbhbBA47QaVbRgl+HwBdeCkWno8v4aiL9grqtPPx7MfosRCkxBcA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrudehiedgkeekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomheptehnughrvghsucfhrhgvuhhnugcuoegrnhgurhgvshesrghn rghrrgiivghlrdguvgeqnecuggftrfgrthhtvghrnhepiefgieduueeiudeugfevffeugf dvffevgfdufeeujeeuheelffdtffetteffjefhnecuffhomhgrihhnpehsohhurhgtvgif rghrvgdrohhrghdpkhgvrhhnvghlrdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenuc frrghrrghmpehmrghilhhfrhhomheprghnughrvghssegrnhgrrhgriigvlhdruggv X-ME-Proxy: Feedback-ID: id4a34324:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Sun, 3 Jul 2022 00:48:15 -0400 (EDT) From: Andres Freund To: linux-kernel@vger.kernel.org Subject: [PATCH v1 2/3] tools: introduce dis-asm.h wrapper to hide version differences Date: Sat, 2 Jul 2022 21:48:13 -0700 Message-Id: <20220703044814.892617-4-andres@anarazel.de> X-Mailer: git-send-email 2.35.1.677.gabf474a5dd In-Reply-To: <20220703044814.892617-1-andres@anarazel.de> References: <20220622231624.t63bkmkzphqvh3kx@alap3.anarazel.de> <20220703044814.892617-1-andres@anarazel.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org binutils changed the signature of init_disassemble_info(), which now causes perf and bpftool to fail to compile (e.g. on debian unstable). Relevant binutils commit: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07 This just wraps init_disassemble_info(), to avoid spreading #ifdef DISASM_INIT_STYLED to a bunch of places. It likely is worth adding a wrapper for disassember(), to avoid the already existing #ifdef DISASM_FOUR_ARGS_SIGNATURE. Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de Signed-off-by: Andres Freund --- tools/include/tools/dis-asm-compat.h | 53 ++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 tools/include/tools/dis-asm-compat.h diff --git a/tools/include/tools/dis-asm-compat.h b/tools/include/tools/dis-asm-compat.h new file mode 100644 index 000000000000..f44f7d9f053e --- /dev/null +++ b/tools/include/tools/dis-asm-compat.h @@ -0,0 +1,53 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _TOOLS_DIS_ASM_COMPAT_H +#define _TOOLS_DIS_ASM_COMPAT_H + +#include +#include + +/* define types for older binutils version, to centralize ifdef'ery a bit */ +#ifndef DISASM_INIT_STYLED +enum disassembler_style {DISASSEMBLER_STYLE_NOT_EMPTY}; +typedef int (*fprintf_styled_ftype) (void *, enum disassembler_style, const char*, ...); +#endif + +/* + * Trivial fprintf wrapper to be used as the fprintf_styled_func argument to + * init_disassemble_info_compat() when normal fprintf suffices. + */ +static inline int fprintf_styled(void *out, enum disassembler_style style, const char *fmt, ...) +{ + va_list args; + int r; + + (void)style; + + va_start(args, fmt); + r = vfprintf(out, fmt, args); + va_end(args); + + return r; +} + +/* + * Wrapper for init_disassemble_info() that hides version + * differences. Depending on binutils version and architecture either + * fprintf_func or fprintf_styled_func will be called. + */ +static inline void init_disassemble_info_compat(struct disassemble_info *info, + void *stream, + fprintf_ftype fprintf_func, + fprintf_styled_ftype fprintf_styled_func) +{ +#ifdef DISASM_INIT_STYLED + init_disassemble_info(info, stream, + fprintf_func, + fprintf_styled_func); +#else + (void)fprintf_styled_func; + init_disassemble_info(info, stream, + fprintf_func); +#endif +} + +#endif /* _TOOLS_DIS_ASM_COMPAT_H */ -- 2.35.1.677.gabf474a5dd