121 lines
No EOL
3.9 KiB
Diff
Executable file
121 lines
No EOL
3.9 KiB
Diff
Executable file
diff --git a/Makefile b/Makefile
|
|
index 6bbc15bea0..83a36383d7 100644
|
|
--- a/Makefile
|
|
+++ b/Makefile
|
|
@@ -759,6 +759,12 @@ KBUILD_CFLAGS += $(call cc-disable-warning,frame-address,)
|
|
KBUILD_CFLAGS += $(call cc-disable-warning, format-truncation)
|
|
KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow)
|
|
KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member)
|
|
+KBUILD_CFLAGS += $(call cc-disable-warning, misleading-indentation)
|
|
+KBUILD_CFLAGS += $(call cc-disable-warning, array-compare)
|
|
+KBUILD_CFLAGS += $(call cc-disable-warning, stringop-overread)
|
|
+KBUILD_CFLAGS += $(call cc-disable-warning, dangling-pointer)
|
|
+KBUILD_CFLAGS += $(call cc-disable-warning, address)
|
|
+
|
|
|
|
ifdef CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE
|
|
KBUILD_CFLAGS += -O2
|
|
diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
|
|
index e1d2c25566..a789ccbad9 100644
|
|
--- a/tools/build/Makefile.feature
|
|
+++ b/tools/build/Makefile.feature
|
|
@@ -69,6 +69,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 22ea350dab..accf10542c 100644
|
|
--- a/tools/build/feature/Makefile
|
|
+++ b/tools/build/feature/Makefile
|
|
@@ -17,6 +17,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 \
|
|
@@ -228,6 +229,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 09517ff2fa..0cfbdc83ff 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
|
|
|
|
+#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 00000000000000..f1ce0ec3bee9d3
|
|
--- /dev/null
|
|
+++ b/tools/build/feature/test-disassembler-init-styled.c
|
|
@@ -0,0 +1,13 @@
|
|
+// SPDX-License-Identifier: GPL-2.0
|
|
+#include <stdio.h>
|
|
+#include <dis-asm.h>
|
|
+
|
|
+int main(void)
|
|
+{
|
|
+ struct disassemble_info info;
|
|
+
|
|
+ init_disassemble_info(&info, stdout,
|
|
+ NULL, NULL);
|
|
+
|
|
+ return 0;
|
|
+}
|
|
|
|
|
|
|
|
diff --git i/tools/perf/util/annotate.c w/tools/perf/util/annotate.c
|
|
index 82cc396ef516..b0e364d235b4 100644
|
|
--- i/tools/perf/util/annotate.c
|
|
+++ w/tools/perf/util/annotate.c
|
|
@@ -1721,6 +1721,18 @@ static int dso__disassemble_filename(struct dso *dso, char *filename, size_t fil
|
|
#include <bpf/libbpf.h>
|
|
#include <linux/btf.h>
|
|
|
|
+static int fprintf_styled(void *, enum disassembler_style, const char* fmt, ...)
|
|
+{
|
|
+ va_list args;
|
|
+ int r;
|
|
+
|
|
+ va_start(args, fmt);
|
|
+ r = vprintf(fmt, args);
|
|
+ va_end(args);
|
|
+
|
|
+ return r;
|
|
+}
|
|
+
|
|
static int symbol__disassemble_bpf(struct symbol *sym,
|
|
struct annotate_args *args)
|
|
{
|
|
@@ -1763,7 +1775,8 @@ static int symbol__disassemble_bpf(struct symbol *sym,
|
|
goto out;
|
|
}
|
|
init_disassemble_info(&info, s,
|
|
- (fprintf_ftype) fprintf);
|
|
+ (fprintf_ftype) fprintf,
|
|
+ fprintf_styled);
|
|
|
|
info.arch = bfd_get_arch(bfdf);
|
|
info.mach = bfd_get_mach(bfdf);
|