From fe81cdc5f7d2f35434dac80fefbfb918d0d43713 Mon Sep 17 00:00:00 2001 From: Rudi Heitbaum Date: Tue, 23 Aug 2022 22:28:54 +0000 Subject: [PATCH] linux (Samsung): drop upstream patches for 5.19.4-rc1 --- ...s-build-Add-feature-test-for-init_di.patch | 99 ------------- ...s-build-Don-t-display-disassembler-f.patch | 31 ----- ...s-include-add-dis-asm-compat.h-to-ha.patch | 89 ------------ ...s-perf-Fix-compilation-error-with-ne.patch | 106 -------------- ...s-bpf_jit_disasm-Fix-compilation-err.patch | 91 ------------ ...s-bpf_jit_disasm-Don-t-display-disas.patch | 43 ------ ...s-bpftool-Fix-compilation-error-with.patch | 130 ------------------ ...s-bpftool-Don-t-display-disassembler.patch | 30 ---- 8 files changed, 619 deletions(-) delete mode 100644 projects/Samsung/patches/linux/samsung-0014-FROMLIST-v3-tools-build-Add-feature-test-for-init_di.patch delete mode 100644 projects/Samsung/patches/linux/samsung-0015-FROMLIST-v3-tools-build-Don-t-display-disassembler-f.patch delete mode 100644 projects/Samsung/patches/linux/samsung-0016-FROMLIST-v3-tools-include-add-dis-asm-compat.h-to-ha.patch delete mode 100644 projects/Samsung/patches/linux/samsung-0017-FROMLIST-v3-tools-perf-Fix-compilation-error-with-ne.patch delete mode 100644 projects/Samsung/patches/linux/samsung-0018-FROMLIST-v3-tools-bpf_jit_disasm-Fix-compilation-err.patch delete mode 100644 projects/Samsung/patches/linux/samsung-0019-FROMLIST-v3-tools-bpf_jit_disasm-Don-t-display-disas.patch delete mode 100644 projects/Samsung/patches/linux/samsung-0020-FROMLIST-v3-tools-bpftool-Fix-compilation-error-with.patch delete mode 100644 projects/Samsung/patches/linux/samsung-0021-FROMLIST-v3-tools-bpftool-Don-t-display-disassembler.patch diff --git a/projects/Samsung/patches/linux/samsung-0014-FROMLIST-v3-tools-build-Add-feature-test-for-init_di.patch b/projects/Samsung/patches/linux/samsung-0014-FROMLIST-v3-tools-build-Add-feature-test-for-init_di.patch deleted file mode 100644 index 3937fd923f..0000000000 --- a/projects/Samsung/patches/linux/samsung-0014-FROMLIST-v3-tools-build-Add-feature-test-for-init_di.patch +++ /dev/null @@ -1,99 +0,0 @@ -From db4c420d468a14b244e1f19b6733088006a18e99 Mon Sep 17 00:00:00 2001 -From: Andres Freund -Date: Sat, 20 Aug 2022 02:15:54 +0000 -Subject: [PATCH 14/21] FROMLIST(v3): tools build: Add feature test for - init_disassemble_info API changes - -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=binutils-gdb.git;a=commit;h=60a3da00bd5407f07 - -This commit adds a feature test to detect the new signature. Subsequent -commits will use it to fix the build failures. - -Cc: Alexei Starovoitov -Cc: Arnaldo Carvalho de Melo -Cc: Sedat Dilek -Cc: Quentin Monnet -Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de -Signed-off-by: Andres Freund ---- - 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 888a0421d43b..8f6578e4d324 100644 ---- a/tools/build/Makefile.feature -+++ b/tools/build/Makefile.feature -@@ -70,6 +70,7 @@ FEATURE_TESTS_BASIC := \ - libaio \ - libzstd \ - disassembler-four-args \ -+ disassembler-init-styled \ - file-handle - - # FEATURE_TESTS_BASIC + FEATURE_TESTS_EXTRA is the complete list -diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile -index 7c2a17e23c30..c3059739318a 100644 ---- a/tools/build/feature/Makefile -+++ b/tools/build/feature/Makefile -@@ -18,6 +18,7 @@ FILES= \ - 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 \ -@@ -248,6 +249,9 @@ $(OUTPUT)test-libbfd-buildid.bin: - $(OUTPUT)test-disassembler-four-args.bin: - $(BUILD) -DPACKAGE='"perf"' -lbfd -lopcodes - -+$(OUTPUT)test-disassembler-init-styled.bin: -+ $(BUILD) -DPACKAGE='"perf"' -lbfd -lopcodes -+ - $(OUTPUT)test-reallocarray.bin: - $(BUILD) - -diff --git a/tools/build/feature/test-all.c b/tools/build/feature/test-all.c -index 5ffafb967b6e..957c02c7b163 100644 ---- a/tools/build/feature/test-all.c -+++ b/tools/build/feature/test-all.c -@@ -166,6 +166,10 @@ - # include "test-disassembler-four-args.c" - #undef main - -+#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/build/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; -+} --- -2.17.1 - diff --git a/projects/Samsung/patches/linux/samsung-0015-FROMLIST-v3-tools-build-Don-t-display-disassembler-f.patch b/projects/Samsung/patches/linux/samsung-0015-FROMLIST-v3-tools-build-Don-t-display-disassembler-f.patch deleted file mode 100644 index e85e5dc037..0000000000 --- a/projects/Samsung/patches/linux/samsung-0015-FROMLIST-v3-tools-build-Don-t-display-disassembler-f.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 72506043957ff415a2e609d9a245ecffb76dc674 Mon Sep 17 00:00:00 2001 -From: Andres Freund -Date: Sat, 20 Aug 2022 02:16:55 +0000 -Subject: [PATCH 15/21] FROMLIST(v3): tools build: Don't display - disassembler-four-args feature test - -The feature check does not seem important enough to display. - -Suggested-by: Jiri Olsa -Signed-off-by: Andres Freund ---- - tools/build/Makefile.feature | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature -index 8f6578e4d324..fc6ce0b2535a 100644 ---- a/tools/build/Makefile.feature -+++ b/tools/build/Makefile.feature -@@ -135,8 +135,7 @@ FEATURE_DISPLAY ?= \ - get_cpuid \ - bpf \ - libaio \ -- libzstd \ -- disassembler-four-args -+ libzstd - - # Set FEATURE_CHECK_(C|LD)FLAGS-all for all FEATURE_TESTS features. - # If in the future we need per-feature checks/flags for features not --- -2.17.1 - diff --git a/projects/Samsung/patches/linux/samsung-0016-FROMLIST-v3-tools-include-add-dis-asm-compat.h-to-ha.patch b/projects/Samsung/patches/linux/samsung-0016-FROMLIST-v3-tools-include-add-dis-asm-compat.h-to-ha.patch deleted file mode 100644 index 6d0e8ed4d3..0000000000 --- a/projects/Samsung/patches/linux/samsung-0016-FROMLIST-v3-tools-include-add-dis-asm-compat.h-to-ha.patch +++ /dev/null @@ -1,89 +0,0 @@ -From f46eae3e6a89b63375063915508e08ec23625849 Mon Sep 17 00:00:00 2001 -From: Andres Freund -Date: Sat, 20 Aug 2022 02:18:33 +0000 -Subject: [PATCH 16/21] FROMLIST(v3): tools include: add dis-asm-compat.h to - handle version differences - -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=binutils-gdb.git;a=commit;h=60a3da00bd5407f07 - -This commit introduces a wrapper for init_disassemble_info(), to avoid -spreading #ifdef DISASM_INIT_STYLED to a bunch of places. Subsequent -commits will use it to fix the build failures. - -It likely is worth adding a wrapper for disassember(), to avoid the already -existing DISASM_FOUR_ARGS_SIGNATURE ifdefery. - -Signed-off-by: Andres Freund -Signed-off-by: Ben Hutchings ---- - tools/include/tools/dis-asm-compat.h | 55 ++++++++++++++++++++++++++++ - 1 file changed, 55 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..70f331e23ed3 ---- /dev/null -+++ b/tools/include/tools/dis-asm-compat.h -@@ -0,0 +1,55 @@ -+/* SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause */ -+#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 unstyled_func, -+ fprintf_styled_ftype styled_func) -+{ -+#ifdef DISASM_INIT_STYLED -+ init_disassemble_info(info, stream, -+ unstyled_func, -+ styled_func); -+#else -+ (void)styled_func; -+ init_disassemble_info(info, stream, -+ unstyled_func); -+#endif -+} -+ -+#endif /* _TOOLS_DIS_ASM_COMPAT_H */ --- -2.17.1 - diff --git a/projects/Samsung/patches/linux/samsung-0017-FROMLIST-v3-tools-perf-Fix-compilation-error-with-ne.patch b/projects/Samsung/patches/linux/samsung-0017-FROMLIST-v3-tools-perf-Fix-compilation-error-with-ne.patch deleted file mode 100644 index 69286631a6..0000000000 --- a/projects/Samsung/patches/linux/samsung-0017-FROMLIST-v3-tools-perf-Fix-compilation-error-with-ne.patch +++ /dev/null @@ -1,106 +0,0 @@ -From df844504bc12ecc0a2c24f5f0e979b0855063d73 Mon Sep 17 00:00:00 2001 -From: Andres Freund -Date: Sat, 20 Aug 2022 02:19:55 +0000 -Subject: [PATCH 17/21] FROMLIST(v3): tools perf: Fix compilation error with - new binutils - -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=binutils-gdb.git;a=commit;h=60a3da00bd5407f07 - -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 ---- - 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 73e0762092fe..ee417c321adb 100644 ---- a/tools/perf/Makefile.config -+++ b/tools/perf/Makefile.config -@@ -298,6 +298,7 @@ FEATURE_CHECK_LDFLAGS-libpython := $(PYTHON_EMBED_LDOPTS) - FEATURE_CHECK_LDFLAGS-libaio = -lrt - - FEATURE_CHECK_LDFLAGS-disassembler-four-args = -lbfd -lopcodes -ldl -+FEATURE_CHECK_LDFLAGS-disassembler-init-styled = -lbfd -lopcodes -ldl - - CORE_CFLAGS += -fno-omit-frame-pointer - CORE_CFLAGS += -ggdb3 -@@ -905,13 +906,16 @@ ifndef NO_LIBBFD - ifeq ($(feature-libbfd-liberty), 1) - EXTLIBS += -lbfd -lopcodes -liberty - FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -ldl -+ FEATURE_CHECK_LDFLAGS-disassembler-init-styled += -liberty -ldl - else - ifeq ($(feature-libbfd-liberty-z), 1) - EXTLIBS += -lbfd -lopcodes -liberty -lz - FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -lz -ldl -+ FEATURE_CHECK_LDFLAGS-disassembler-init-styled += -liberty -lz -ldl - endif - endif - $(call feature_check,disassembler-four-args) -+ $(call feature_check,disassembler-init-styled) - endif - - ifeq ($(feature-libbfd-buildid), 1) -@@ -1025,6 +1029,10 @@ ifeq ($(feature-disassembler-four-args), 1) - CFLAGS += -DDISASM_FOUR_ARGS_SIGNATURE - endif - -+ifeq ($(feature-disassembler-init-styled), 1) -+ CFLAGS += -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 82cc396ef516..2c6a485c3de5 100644 ---- a/tools/perf/util/annotate.c -+++ b/tools/perf/util/annotate.c -@@ -1720,6 +1720,7 @@ static int dso__disassemble_filename(struct dso *dso, char *filename, size_t fil - #include - #include - #include -+#include - - static int symbol__disassemble_bpf(struct symbol *sym, - struct annotate_args *args) -@@ -1762,9 +1763,9 @@ static int symbol__disassemble_bpf(struct symbol *sym, - ret = errno; - goto out; - } -- init_disassemble_info(&info, s, -- (fprintf_ftype) fprintf); -- -+ init_disassemble_info_compat(&info, s, -+ (fprintf_ftype) fprintf, -+ fprintf_styled); - info.arch = bfd_get_arch(bfdf); - info.mach = bfd_get_mach(bfdf); - --- -2.17.1 - diff --git a/projects/Samsung/patches/linux/samsung-0018-FROMLIST-v3-tools-bpf_jit_disasm-Fix-compilation-err.patch b/projects/Samsung/patches/linux/samsung-0018-FROMLIST-v3-tools-bpf_jit_disasm-Fix-compilation-err.patch deleted file mode 100644 index be943e82fe..0000000000 --- a/projects/Samsung/patches/linux/samsung-0018-FROMLIST-v3-tools-bpf_jit_disasm-Fix-compilation-err.patch +++ /dev/null @@ -1,91 +0,0 @@ -From 890850659fdf3f00286843747182163f6d53a92a Mon Sep 17 00:00:00 2001 -From: Andres Freund -Date: Sat, 20 Aug 2022 02:20:52 +0000 -Subject: [PATCH 18/21] FROMLIST(v3): tools bpf_jit_disasm: Fix compilation - error with new binutils - -binutils changed the signature of init_disassemble_info(), which now causes -compilation to fail for tools/bpf/bpf_jit_disasm.c, e.g. on debian -unstable. Relevant binutils commit: -https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07 - -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 bpf_jit_disasm can still disassemble bpf programs, both -with the old and new dis-asm.h API. 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: - f4: mov %r14,%rsi - f7: mov %r15,%rdx - fa: mov $0x2a,%ecx -- ff: callq 0xffffffffea8c4988 -+ ff: call 0xffffffffea8c4988 - 104: test %rax,%rax - 107: jge 0x0000000000000110 - 109: xor %eax,%eax -- 10b: jmpq 0x0000000000000073 -+ 10b: jmp 0x0000000000000073 - 110: cmp $0x16,%rax - -However, I had to use an older kernel to generate the bpf_jit_enabled = 2 -output, as that has been broken since 5.18 / 1022a5498f6f: -https://lore.kernel.org/20220703030210.pmjft7qc2eajzi6c@alap3.anarazel.de - -Signed-off-by: Andres Freund ---- - tools/bpf/Makefile | 5 ++++- - tools/bpf/bpf_jit_disasm.c | 5 ++++- - 2 files changed, 8 insertions(+), 2 deletions(-) - -diff --git a/tools/bpf/Makefile b/tools/bpf/Makefile -index b11cfc86a3d0..664601ab1705 100644 ---- a/tools/bpf/Makefile -+++ b/tools/bpf/Makefile -@@ -34,7 +34,7 @@ else - endif - - FEATURE_USER = .bpf --FEATURE_TESTS = libbfd disassembler-four-args -+FEATURE_TESTS = libbfd disassembler-four-args disassembler-init-styled - FEATURE_DISPLAY = libbfd disassembler-four-args - - check_feat := 1 -@@ -56,6 +56,9 @@ endif - ifeq ($(feature-disassembler-four-args), 1) - CFLAGS += -DDISASM_FOUR_ARGS_SIGNATURE - endif -+ifeq ($(feature-disassembler-init-styled), 1) -+CFLAGS += -DDISASM_INIT_STYLED -+endif - - $(OUTPUT)%.yacc.c: $(srctree)/tools/bpf/%.y - $(QUIET_BISON)$(YACC) -o $@ -d $< -diff --git a/tools/bpf/bpf_jit_disasm.c b/tools/bpf/bpf_jit_disasm.c -index c8ae95804728..a90a5d110f92 100644 ---- a/tools/bpf/bpf_jit_disasm.c -+++ b/tools/bpf/bpf_jit_disasm.c -@@ -28,6 +28,7 @@ - #include - #include - #include -+#include - - #define CMD_ACTION_SIZE_BUFFER 10 - #define CMD_ACTION_READ_ALL 3 -@@ -64,7 +65,9 @@ static void get_asm_insns(uint8_t *image, size_t len, int opcodes) - assert(bfdf); - assert(bfd_check_format(bfdf, bfd_object)); - -- init_disassemble_info(&info, stdout, (fprintf_ftype) fprintf); -+ init_disassemble_info_compat(&info, stdout, -+ (fprintf_ftype) fprintf, -+ fprintf_styled); - info.arch = bfd_get_arch(bfdf); - info.mach = bfd_get_mach(bfdf); - info.buffer = image; --- -2.17.1 - diff --git a/projects/Samsung/patches/linux/samsung-0019-FROMLIST-v3-tools-bpf_jit_disasm-Don-t-display-disas.patch b/projects/Samsung/patches/linux/samsung-0019-FROMLIST-v3-tools-bpf_jit_disasm-Don-t-display-disas.patch deleted file mode 100644 index 7a93882b2a..0000000000 --- a/projects/Samsung/patches/linux/samsung-0019-FROMLIST-v3-tools-bpf_jit_disasm-Don-t-display-disas.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 8745189456e2d122eed4d8064ae5dd40af2ed207 Mon Sep 17 00:00:00 2001 -From: Andres Freund -Date: Sat, 20 Aug 2022 02:22:29 +0000 -Subject: [PATCH 19/21] FROMLIST(v3): tools bpf_jit_disasm: Don't display - disassembler-four-args feature test - -The feature check does not seem important enough to display. - -Signed-off-by: Andres Freund ---- - tools/bpf/Makefile | 2 +- - tools/bpf/bpftool/Makefile | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/tools/bpf/Makefile b/tools/bpf/Makefile -index 664601ab1705..243b79f2b451 100644 ---- a/tools/bpf/Makefile -+++ b/tools/bpf/Makefile -@@ -35,7 +35,7 @@ endif - - FEATURE_USER = .bpf - FEATURE_TESTS = libbfd disassembler-four-args disassembler-init-styled --FEATURE_DISPLAY = libbfd disassembler-four-args -+FEATURE_DISPLAY = libbfd - - check_feat := 1 - NON_CHECK_FEAT_TARGETS := clean bpftool_clean runqslower_clean resolve_btfids_clean -diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile -index c6d2c77d0252..a92fb4d312ec 100644 ---- a/tools/bpf/bpftool/Makefile -+++ b/tools/bpf/bpftool/Makefile -@@ -95,7 +95,7 @@ RM ?= rm -f - FEATURE_USER = .bpftool - FEATURE_TESTS = libbfd disassembler-four-args zlib libcap \ - clang-bpf-co-re --FEATURE_DISPLAY = libbfd disassembler-four-args zlib libcap \ -+FEATURE_DISPLAY = libbfd zlib libcap \ - clang-bpf-co-re - - check_feat := 1 --- -2.17.1 - diff --git a/projects/Samsung/patches/linux/samsung-0020-FROMLIST-v3-tools-bpftool-Fix-compilation-error-with.patch b/projects/Samsung/patches/linux/samsung-0020-FROMLIST-v3-tools-bpftool-Fix-compilation-error-with.patch deleted file mode 100644 index e55ce92a05..0000000000 --- a/projects/Samsung/patches/linux/samsung-0020-FROMLIST-v3-tools-bpftool-Fix-compilation-error-with.patch +++ /dev/null @@ -1,130 +0,0 @@ -From 2c09438adc3a54b9fde10467e8d6ac440b416857 Mon Sep 17 00:00:00 2001 -From: Andres Freund -Date: Sat, 20 Aug 2022 02:24:33 +0000 -Subject: [PATCH 20/21] FROMLIST(v3): tools bpftool: Fix compilation error with - new binutils - -binutils changed the signature of init_disassemble_info(), which now causes -compilation to fail for tools/bpf/bpftool/jit_disasm.c, e.g. on debian -unstable. Relevant binutils commit: -https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07 - -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 bpftool can still disassemble bpf programs, both with an -old and new dis-asm.h API. There are no output changes for plain and json -formats. 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: - 2f: pop %r14 - 31: pop %r13 - 33: pop %rbx -- 34: leaveq -- 35: retq -+ 34: leave -+ 35: ret - -Signed-off-by: Andres Freund ---- - tools/bpf/bpftool/Makefile | 3 +++ - tools/bpf/bpftool/jit_disasm.c | 42 +++++++++++++++++++++++++++------- - 2 files changed, 37 insertions(+), 8 deletions(-) - -diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile -index a92fb4d312ec..3e1a629b07f4 100644 ---- a/tools/bpf/bpftool/Makefile -+++ b/tools/bpf/bpftool/Makefile -@@ -117,6 +117,9 @@ endif - ifeq ($(feature-disassembler-four-args), 1) - CFLAGS += -DDISASM_FOUR_ARGS_SIGNATURE - endif -+ifeq ($(feature-disassembler-init-styled), 1) -+ CFLAGS += -DDISASM_INIT_STYLED -+endif - - LIBS = $(LIBBPF) -lelf -lz - LIBS_BOOTSTRAP = $(LIBBPF_BOOTSTRAP) -lelf -lz -diff --git a/tools/bpf/bpftool/jit_disasm.c b/tools/bpf/bpftool/jit_disasm.c -index 24734f2249d6..aaf99a0168c9 100644 ---- a/tools/bpf/bpftool/jit_disasm.c -+++ b/tools/bpf/bpftool/jit_disasm.c -@@ -24,6 +24,7 @@ - #include - #include - #include -+#include - - #include "json_writer.h" - #include "main.h" -@@ -39,15 +40,12 @@ static void get_exec_path(char *tpath, size_t size) - } - - static int oper_count; --static int fprintf_json(void *out, const char *fmt, ...) -+static int printf_json(void *out, const char *fmt, va_list ap) - { -- va_list ap; - char *s; - int err; - -- va_start(ap, fmt); - err = vasprintf(&s, fmt, ap); -- va_end(ap); - if (err < 0) - return -1; - -@@ -73,6 +71,32 @@ static int fprintf_json(void *out, const char *fmt, ...) - return 0; - } - -+static int fprintf_json(void *out, const char *fmt, ...) -+{ -+ va_list ap; -+ int r; -+ -+ va_start(ap, fmt); -+ r = printf_json(out, fmt, ap); -+ va_end(ap); -+ -+ return r; -+} -+ -+static int fprintf_json_styled(void *out, -+ enum disassembler_style style __maybe_unused, -+ const char *fmt, ...) -+{ -+ va_list ap; -+ int r; -+ -+ va_start(ap, fmt); -+ r = printf_json(out, fmt, ap); -+ va_end(ap); -+ -+ return r; -+} -+ - void disasm_print_insn(unsigned char *image, ssize_t len, int opcodes, - const char *arch, const char *disassembler_options, - const struct btf *btf, -@@ -99,11 +123,13 @@ void disasm_print_insn(unsigned char *image, ssize_t len, int opcodes, - assert(bfd_check_format(bfdf, bfd_object)); - - if (json_output) -- init_disassemble_info(&info, stdout, -- (fprintf_ftype) fprintf_json); -+ init_disassemble_info_compat(&info, stdout, -+ (fprintf_ftype) fprintf_json, -+ fprintf_json_styled); - else -- init_disassemble_info(&info, stdout, -- (fprintf_ftype) fprintf); -+ init_disassemble_info_compat(&info, stdout, -+ (fprintf_ftype) fprintf, -+ fprintf_styled); - - /* Update architecture info for offload. */ - if (arch) { --- -2.17.1 - diff --git a/projects/Samsung/patches/linux/samsung-0021-FROMLIST-v3-tools-bpftool-Don-t-display-disassembler.patch b/projects/Samsung/patches/linux/samsung-0021-FROMLIST-v3-tools-bpftool-Don-t-display-disassembler.patch deleted file mode 100644 index 7a32b474ef..0000000000 --- a/projects/Samsung/patches/linux/samsung-0021-FROMLIST-v3-tools-bpftool-Don-t-display-disassembler.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 56ff935d8bc173ce567cecdc8ed9ff98026826e0 Mon Sep 17 00:00:00 2001 -From: Andres Freund -Date: Sat, 20 Aug 2022 02:28:27 +0000 -Subject: [PATCH 21/21] FROMLIST(v3): tools bpftool: Don't display - disassembler-four-args feature test - -The feature check does not seem important enough to display. - -Signed-off-by: Andres Freund ---- - tools/bpf/bpftool/Makefile | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile -index 3e1a629b07f4..d405ce4e0348 100644 ---- a/tools/bpf/bpftool/Makefile -+++ b/tools/bpf/bpftool/Makefile -@@ -95,8 +95,7 @@ RM ?= rm -f - FEATURE_USER = .bpftool - FEATURE_TESTS = libbfd disassembler-four-args zlib libcap \ - clang-bpf-co-re --FEATURE_DISPLAY = libbfd zlib libcap \ -- clang-bpf-co-re -+FEATURE_DISPLAY = libbfd zlib libcap clang-bpf-co-re - - check_feat := 1 - NON_CHECK_FEAT_TARGETS := clean uninstall doc doc-clean doc-install doc-uninstall --- -2.17.1 -