mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
tools/bpftool: fix bpftool build with bintutils >= 2.9
Bpftool build is broken with binutils version 2.29 and later.
The cause is commit 003ca0fd2286 ("Refactor disassembler selection")
in the binutils repo, which changed the disassembler() function
signature.
Fix this by adding a new "feature" to the tools/build/features
infrastructure and make it responsible for decision which
disassembler() function signature to use.
Signed-off-by: Roman Gushchin <[email protected]>
Cc: Jakub Kicinski <[email protected]>
Cc: Alexei Starovoitov <[email protected]>
Cc: Daniel Borkmann <[email protected]>
Acked-by: Jakub Kicinski <[email protected]>
Signed-off-by: Daniel Borkmann <[email protected]>
This commit is contained in:
parent
4bfe3bd3cc
commit
fb982666e3
6 changed files with 86 additions and 0 deletions
|
|
@ -9,6 +9,35 @@ MAKE = make
|
|||
CFLAGS += -Wall -O2
|
||||
CFLAGS += -D__EXPORTED_HEADERS__ -I../../include/uapi -I../../include
|
||||
|
||||
ifeq ($(srctree),)
|
||||
srctree := $(patsubst %/,%,$(dir $(CURDIR)))
|
||||
srctree := $(patsubst %/,%,$(dir $(srctree)))
|
||||
endif
|
||||
|
||||
FEATURE_USER = .bpf
|
||||
FEATURE_TESTS = libbfd disassembler-four-args
|
||||
FEATURE_DISPLAY = libbfd disassembler-four-args
|
||||
|
||||
check_feat := 1
|
||||
NON_CHECK_FEAT_TARGETS := clean bpftool_clean
|
||||
ifdef MAKECMDGOALS
|
||||
ifeq ($(filter-out $(NON_CHECK_FEAT_TARGETS),$(MAKECMDGOALS)),)
|
||||
check_feat := 0
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(check_feat),1)
|
||||
ifeq ($(FEATURES_DUMP),)
|
||||
include $(srctree)/tools/build/Makefile.feature
|
||||
else
|
||||
include $(FEATURES_DUMP)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(feature-disassembler-four-args), 1)
|
||||
CFLAGS += -DDISASM_FOUR_ARGS_SIGNATURE
|
||||
endif
|
||||
|
||||
%.yacc.c: %.y
|
||||
$(YACC) -o $@ -d $<
|
||||
|
||||
|
|
|
|||
|
|
@ -72,7 +72,14 @@ static void get_asm_insns(uint8_t *image, size_t len, int opcodes)
|
|||
|
||||
disassemble_init_for_target(&info);
|
||||
|
||||
#ifdef DISASM_FOUR_ARGS_SIGNATURE
|
||||
disassemble = disassembler(info.arch,
|
||||
bfd_big_endian(bfdf),
|
||||
info.mach,
|
||||
bfdf);
|
||||
#else
|
||||
disassemble = disassembler(bfdf);
|
||||
#endif
|
||||
assert(disassemble);
|
||||
|
||||
do {
|
||||
|
|
|
|||
|
|
@ -46,6 +46,30 @@ LIBS = -lelf -lbfd -lopcodes $(LIBBPF)
|
|||
INSTALL ?= install
|
||||
RM ?= rm -f
|
||||
|
||||
FEATURE_USER = .bpftool
|
||||
FEATURE_TESTS = libbfd disassembler-four-args
|
||||
FEATURE_DISPLAY = libbfd disassembler-four-args
|
||||
|
||||
check_feat := 1
|
||||
NON_CHECK_FEAT_TARGETS := clean uninstall doc doc-clean doc-install doc-uninstall
|
||||
ifdef MAKECMDGOALS
|
||||
ifeq ($(filter-out $(NON_CHECK_FEAT_TARGETS),$(MAKECMDGOALS)),)
|
||||
check_feat := 0
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(check_feat),1)
|
||||
ifeq ($(FEATURES_DUMP),)
|
||||
include $(srctree)/tools/build/Makefile.feature
|
||||
else
|
||||
include $(FEATURES_DUMP)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(feature-disassembler-four-args), 1)
|
||||
CFLAGS += -DDISASM_FOUR_ARGS_SIGNATURE
|
||||
endif
|
||||
|
||||
include $(wildcard *.d)
|
||||
|
||||
all: $(OUTPUT)bpftool
|
||||
|
|
|
|||
|
|
@ -107,7 +107,14 @@ void disasm_print_insn(unsigned char *image, ssize_t len, int opcodes)
|
|||
|
||||
disassemble_init_for_target(&info);
|
||||
|
||||
#ifdef DISASM_FOUR_ARGS_SIGNATURE
|
||||
disassemble = disassembler(info.arch,
|
||||
bfd_big_endian(bfdf),
|
||||
info.mach,
|
||||
bfdf);
|
||||
#else
|
||||
disassemble = disassembler(bfdf);
|
||||
#endif
|
||||
assert(disassemble);
|
||||
|
||||
if (json_output)
|
||||
|
|
|
|||
Loading…
Reference in a new issue