From nobody Wed Dec 17 20:55:53 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C11BC77B72 for ; Mon, 17 Apr 2023 12:30:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231168AbjDQMaZ (ORCPT ); Mon, 17 Apr 2023 08:30:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230385AbjDQMaT (ORCPT ); Mon, 17 Apr 2023 08:30:19 -0400 Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [IPv6:2a00:1450:4864:20::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DBB43468D for ; Mon, 17 Apr 2023 05:30:14 -0700 (PDT) Received: by mail-lj1-x229.google.com with SMTP id by8so26068219ljb.13 for ; Mon, 17 Apr 2023 05:30:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1681734613; x=1684326613; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=H9SW4BaZ1bnKVP1weVI2e85RynWnU48bLznC9wO1o9M=; b=n3zPin0s6G1kVf80R6NptUIL4S3g+P69ADkrw+7CjbBdWnHZAogR6n8d7yvle5PpkC N2qD3f66q4c1WuJJH3FC7IEyu49Ue0xXjqtxY5tz+Yd2eWdFli+V0m02Vs2vkkgobOb6 /EEatrtb5D817UZRcI4zZUpNKlarszn2yTNKMc633kSVLPqSxgDv+hIl6fQRW0Th5rud 5oJKMxbsSAn2FYb5E9GmEQTFxIKKSETJgwQToXiuD6bixtmU6h5/FXEYcmaysX9KpzuB kaQA2hMmfpEFr2V5bYiHWmVt/p17AW/+J57BCjvw7aP1yPVqYWnC7e6oHnl2kWsTAJJ3 6DaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681734613; x=1684326613; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=H9SW4BaZ1bnKVP1weVI2e85RynWnU48bLznC9wO1o9M=; b=ZHJ4KVowJvo4HknO6ZixxpN87AOrBXIcut533wXIsbatQlICfXd4Lav3DCrGZDAk7H 0NkvT7snSgeCaT/S3z/5RTWh6Yum81GOY0u1jIUjpVa5YTuzx79hbHzGAlIdwzIR9zDC GqzjAD2HT2OKNVXIwG4BP3OdISc8+SlIn7SUWwUwOT9wRp6QtIHtaQsqsFtyJR7cgvU4 /ahU6rdBM1n1h32Px83VMJfwFR5jwsiXddEw9+JmYbmIyruFyLJ0HZiEM55m6WIn+bIj +dRBtSa2xDEifYjxqJTjDAdrGHQpdgyyYj/s2/3bBB354lIQEUkx1WolaMwB915/2j1Z ktjQ== X-Gm-Message-State: AAQBX9fPSvS7t/EmFrZb3Kw1XU+LS1XVTwOH32DCUUpTNZ9Fm4/yp3Ov fxuqlgoNFZRadMqATn64ZTgySw== X-Google-Smtp-Source: AKy350bwGJE2C7V8hazROuRDBDgzLMhkcDD17prRT/qHi9ZNYNGhNGiMjSfhomMSdAYr9UncH37eIQ== X-Received: by 2002:a2e:9857:0:b0:2a8:c82f:2996 with SMTP id e23-20020a2e9857000000b002a8c82f2996mr759543ljj.43.1681734612901; Mon, 17 Apr 2023 05:30:12 -0700 (PDT) Received: from localhost (c-9b0ee555.07-21-73746f28.bbcust.telenor.se. [85.229.14.155]) by smtp.gmail.com with ESMTPSA id l20-20020a19c214000000b004ed149acc08sm1889569lfc.93.2023.04.17.05.30.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 05:30:12 -0700 (PDT) From: Anders Roxell To: stable@vger.kernel.org Cc: acme@redhat.com, andres@anarazel.de, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Quentin Monnet , Alexei Starovoitov , Ben Hutchings , Jiri Olsa , Sedat Dilek , bpf@vger.kernel.org, Anders Roxell Subject: [backport PATCH 1/2] tools perf: Fix compilation error with new binutils Date: Mon, 17 Apr 2023 14:29:42 +0200 Message-Id: <20230417122943.2155502-2-anders.roxell@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230417122943.2155502-1-anders.roxell@linaro.org> References: <20230417122943.2155502-1-anders.roxell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andres Freund binutils changed the signature of init_disassemble_info(), which now causes compilation failures for tools/perf/util/annotate.c, e.g. on debian unstable. Relevant binutils commit: https://sourceware.org/git/?p=3Dbinutils-gdb.git;a=3Dcommit;h=3D60a3da00b= d5407f07 Wire up the feature test and switch to init_disassemble_info_compat(), which were introduced in prior commits, fixing the compilation failure. I verified that perf can still disassemble bpf programs by using bpftrace under load, recording a perf trace, and then annotating the bpf "function" with and without the changes. With old binutils there's no change in output before/after this patch. When comparing the output from old binutils (2.35) to new bintuils with the patch (upstream snapshot) there are a few output differences, but they are unrelated to this patch. An example hunk is: 1.15 : 55:mov %rbp,%rdx 0.00 : 58:add $0xfffffffffffffff8,%rdx 0.00 : 5c:xor %ecx,%ecx - 1.03 : 5e:callq 0xffffffffe12aca3c + 1.03 : 5e:call 0xffffffffe12aca3c 0.00 : 63:xor %eax,%eax - 2.18 : 65:leaveq - 2.82 : 66:retq + 2.18 : 65:leave + 2.82 : 66:ret Signed-off-by: Andres Freund Acked-by: Quentin Monnet Cc: Alexei Starovoitov Cc: Ben Hutchings Cc: Jiri Olsa Cc: Sedat Dilek Cc: bpf@vger.kernel.org Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.ana= razel.de Link: https://lore.kernel.org/r/20220801013834.156015-5-andres@anarazel.de Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Anders Roxell --- tools/perf/Makefile.config | 8 ++++++++ tools/perf/util/annotate.c | 7 ++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index 3e7706c251e9..55905571f87b 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -281,6 +281,7 @@ FEATURE_CHECK_LDFLAGS-libpython :=3D $(PYTHON_EMBED_LDO= PTS) FEATURE_CHECK_LDFLAGS-libaio =3D -lrt =20 FEATURE_CHECK_LDFLAGS-disassembler-four-args =3D -lbfd -lopcodes -ldl +FEATURE_CHECK_LDFLAGS-disassembler-init-styled =3D -lbfd -lopcodes -ldl =20 CORE_CFLAGS +=3D -fno-omit-frame-pointer CORE_CFLAGS +=3D -ggdb3 @@ -838,13 +839,16 @@ else ifeq ($(feature-libbfd-liberty), 1) EXTLIBS +=3D -lbfd -lopcodes -liberty FEATURE_CHECK_LDFLAGS-disassembler-four-args +=3D -liberty -ldl + FEATURE_CHECK_LDFLAGS-disassembler-init-styled +=3D -liberty -ldl else ifeq ($(feature-libbfd-liberty-z), 1) EXTLIBS +=3D -lbfd -lopcodes -liberty -lz FEATURE_CHECK_LDFLAGS-disassembler-four-args +=3D -liberty -lz -ldl + FEATURE_CHECK_LDFLAGS-disassembler-init-styled +=3D -liberty -ldl endif endif $(call feature_check,disassembler-four-args) + $(call feature_check,disassembler-init-styled) endif =20 ifeq ($(feature-libbfd-buildid), 1) @@ -957,6 +961,10 @@ ifeq ($(feature-disassembler-four-args), 1) CFLAGS +=3D -DDISASM_FOUR_ARGS_SIGNATURE endif =20 +ifeq ($(feature-disassembler-init-styled), 1) + CFLAGS +=3D -DDISASM_INIT_STYLED +endif + ifeq (${IS_64_BIT}, 1) ifndef NO_PERF_READ_VDSO32 $(call feature_check,compile-32) diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index 308189454788..f2d1741b7610 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c @@ -1684,6 +1684,7 @@ static int dso__disassemble_filename(struct dso *dso,= char *filename, size_t fil #define PACKAGE "perf" #include #include +#include =20 static int symbol__disassemble_bpf(struct symbol *sym, struct annotate_args *args) @@ -1726,9 +1727,9 @@ static int symbol__disassemble_bpf(struct symbol *sym, ret =3D errno; goto out; } - init_disassemble_info(&info, s, - (fprintf_ftype) fprintf); - + init_disassemble_info_compat(&info, s, + (fprintf_ftype) fprintf, + fprintf_styled); info.arch =3D bfd_get_arch(bfdf); info.mach =3D bfd_get_mach(bfdf); =20 --=20 2.39.2 From nobody Wed Dec 17 20:55:53 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A935C77B76 for ; Mon, 17 Apr 2023 12:30:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231150AbjDQMad (ORCPT ); Mon, 17 Apr 2023 08:30:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231144AbjDQMaX (ORCPT ); Mon, 17 Apr 2023 08:30:23 -0400 Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [IPv6:2a00:1450:4864:20::22e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 087225251 for ; Mon, 17 Apr 2023 05:30:15 -0700 (PDT) Received: by mail-lj1-x22e.google.com with SMTP id 38308e7fff4ca-2a776fb84a3so12868881fa.1 for ; Mon, 17 Apr 2023 05:30:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1681734614; x=1684326614; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=75hX5LgqItGx5RLX1YQ5Q6RKXg/GRTXjzOrDItgmVU8=; b=bT94vu0Q6QRHgkHMEux4pflaaEqrFFc9jX1D805hEY084GlZmJv+1LygxuvQew1edM hctSDM0hY+ODTMcO7zHmtX8MLfqUUeP5ImlX+GX6vSDzXx2oH5mueGc2ohwmreBqIgDI 5aBsWScygu9ggPb8ghX65lq+WFo54ITKOCDAQn5scP9waolP2+7UiCySk6p7FBWvJdOW +z9f3UsEORF2MNFIg4B7w0dVKtjBSwguQWZHQCRalTPBX4QZUSt6y09W8QfxqdaHDFPH i5QAfqKyUX1gTkREQBbNGvOqdmf4h1oXoeeCUgF7QJ8G2tNiG8DbvOcpPn+cMU3vRdaN iGKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681734614; x=1684326614; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=75hX5LgqItGx5RLX1YQ5Q6RKXg/GRTXjzOrDItgmVU8=; b=YldHogZSEePESd9+abDIEB7Jn/UT1bZfdiC3OJUm+jhJA+HlexnPbosF/9HfFauLSD 5ZCZ4d0H2hZ9HxeNSWzRKvlFHs4C5w6VChX/PjcMVSiCBMQAvfKiXjypCOhkp0PsgWNR aUUuQiC03BhCj3ptIxqhZtErvCSSHK7vbR9dMXaMY8Y67CcFxKlzSuo8HKIbzQmkvEFu +QcOCwHe3iQU5m87r59QvggEt/GMdAUPb5CMJ0PwaueNJgfRbHogilcim6TZOVKXOf/Q rgpLnDjb90riM5EG3k5O+Xgm4jUMxOv8s6+3V4fT3VXof0ElUv/IWBieWvgN1Eoh9us+ RtEA== X-Gm-Message-State: AAQBX9fJNAyflbZsMlcf/ZFyRNHrybK1ZcyQYJYO+L3kH4eVVW1z1DXF Py9IIldBibDtg/XbBfvXyDvV9A7Lwo+rkwCl3BtngQ== X-Google-Smtp-Source: AKy350alT7HiO9MfMmbe+E0WP+k1zFnMqspxl3ZlYTgElWMD/Xir4oBFbijc65PEYJil5tk+XpmFfw== X-Received: by 2002:ac2:5a50:0:b0:4b3:d6e1:26bb with SMTP id r16-20020ac25a50000000b004b3d6e126bbmr1783540lfn.29.1681734613986; Mon, 17 Apr 2023 05:30:13 -0700 (PDT) Received: from localhost (c-9b0ee555.07-21-73746f28.bbcust.telenor.se. [85.229.14.155]) by smtp.gmail.com with ESMTPSA id d6-20020ac244c6000000b004eca2b8b6bdsm2027412lfm.4.2023.04.17.05.30.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 05:30:13 -0700 (PDT) From: Anders Roxell To: stable@vger.kernel.org Cc: acme@redhat.com, andres@anarazel.de, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Quentin Monnet , Alexei Starovoitov , Ben Hutchings , Jiri Olsa , Sedat Dilek , bpf@vger.kernel.org, Anders Roxell Subject: [backport PATCH 2/2] tools build: Add feature test for init_disassemble_info API changes Date: Mon, 17 Apr 2023 14:29:43 +0200 Message-Id: <20230417122943.2155502-3-anders.roxell@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230417122943.2155502-1-anders.roxell@linaro.org> References: <20230417122943.2155502-1-anders.roxell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andres Freund binutils changed the signature of init_disassemble_info(), which now causes compilation failures for tools/{perf,bpf}, e.g. on debian unstable. Relevant binutils commit: https://sourceware.org/git/?p=3Dbinutils-gdb.git;a=3Dcommit;h=3D60a3da00b= d5407f07 This commit adds a feature test to detect the new signature. Subsequent commits will use it to fix the build failures. Signed-off-by: Andres Freund Acked-by: Quentin Monnet Cc: Alexei Starovoitov Cc: Ben Hutchings Cc: Jiri Olsa Cc: Quentin Monnet Cc: Sedat Dilek Cc: bpf@vger.kernel.org Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.ana= razel.de Link: https://lore.kernel.org/r/20220801013834.156015-2-andres@anarazel.de Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Anders Roxell --- tools/build/Makefile.feature | 1 + tools/build/feature/Makefile | 4 ++++ tools/build/feature/test-all.c | 4 ++++ tools/build/feature/test-disassembler-init-styled.c | 13 +++++++++++++ 4 files changed, 22 insertions(+) create mode 100644 tools/build/feature/test-disassembler-init-styled.c diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature index e1d2c255669e..a789ccbad93a 100644 --- a/tools/build/Makefile.feature +++ b/tools/build/Makefile.feature @@ -69,6 +69,7 @@ FEATURE_TESTS_BASIC :=3D \ libaio \ libzstd \ disassembler-four-args \ + disassembler-init-styled \ file-handle =20 # FEATURE_TESTS_BASIC + FEATURE_TESTS_EXTRA is the complete list diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile index 221250973d07..33ab9823ad0d 100644 --- a/tools/build/feature/Makefile +++ b/tools/build/feature/Makefile @@ -17,6 +17,7 @@ FILES=3D \ test-libbfd.bin \ test-libbfd-buildid.bin \ test-disassembler-four-args.bin \ + test-disassembler-init-styled.bin \ test-reallocarray.bin \ test-libbfd-liberty.bin \ test-libbfd-liberty-z.bin \ @@ -235,6 +236,9 @@ $(OUTPUT)test-libbfd-buildid.bin: $(OUTPUT)test-disassembler-four-args.bin: $(BUILD) -DPACKAGE=3D'"perf"' -lbfd -lopcodes =20 +$(OUTPUT)test-disassembler-init-styled.bin: + $(BUILD) -DPACKAGE=3D'"perf"' -lbfd -lopcodes + $(OUTPUT)test-reallocarray.bin: $(BUILD) =20 diff --git a/tools/build/feature/test-all.c b/tools/build/feature/test-all.c index 09517ff2fad5..0cfbdc83ffbc 100644 --- a/tools/build/feature/test-all.c +++ b/tools/build/feature/test-all.c @@ -170,6 +170,10 @@ # include "test-disassembler-four-args.c" #undef main =20 +#define main main_test_disassembler_init_styled +# include "test-disassembler-init-styled.c" +#undef main + #define main main_test_libzstd # include "test-libzstd.c" #undef main diff --git a/tools/build/feature/test-disassembler-init-styled.c b/tools/bu= ild/feature/test-disassembler-init-styled.c new file mode 100644 index 000000000000..f1ce0ec3bee9 --- /dev/null +++ b/tools/build/feature/test-disassembler-init-styled.c @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: GPL-2.0 +#include +#include + +int main(void) +{ + struct disassemble_info info; + + init_disassemble_info(&info, stdout, + NULL, NULL); + + return 0; +} --=20 2.39.2