Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

objtool: Move x86 insn decoder to a common location

The kernel tree has three identical copies of the x86 instruction
decoder. Two of them are in the tools subdir.

The tools subdir is supposed to be completely standalone and separate
from the kernel. So having at least one copy of the kernel decoder in
the tools subdir is unavoidable. However, we don't need *two* of them.

Move objtool's copy of the decoder to a shared location, so that perf
will also be able to use it.

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Reviewed-by: Masami Hiramatsu <mhiramat@kernel.org>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: x86@kernel.org
Link: http://lore.kernel.org/lkml/55b486b88f6bcd0c9a2a04b34f964860c8390ca8.1567118001.git.jpoimboe@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Josh Poimboeuf and committed by
Arnaldo Carvalho de Melo
d046b725 f01642e4

+12 -12
+2 -2
tools/objtool/Makefile
··· 33 33 34 34 INCLUDES := -I$(srctree)/tools/include \ 35 35 -I$(srctree)/tools/arch/$(HOSTARCH)/include/uapi \ 36 - -I$(srctree)/tools/objtool/arch/$(ARCH)/include 36 + -I$(srctree)/tools/arch/$(ARCH)/include 37 37 WARNINGS := $(EXTRA_WARNINGS) -Wno-switch-default -Wno-switch-enum -Wno-packed 38 38 CFLAGS += -Werror $(WARNINGS) $(KBUILD_HOSTCFLAGS) -g $(INCLUDES) $(LIBELF_FLAGS) 39 39 LDFLAGS += $(LIBELF_LIBS) $(LIBSUBCMD) $(KBUILD_HOSTLDFLAGS) ··· 60 60 clean: 61 61 $(call QUIET_CLEAN, objtool) $(RM) $(OBJTOOL) 62 62 $(Q)find $(OUTPUT) -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete 63 - $(Q)$(RM) $(OUTPUT)arch/x86/lib/inat-tables.c $(OUTPUT)fixdep 63 + $(Q)$(RM) $(OUTPUT)arch/x86/inat-tables.c $(OUTPUT)fixdep 64 64 65 65 FORCE: 66 66
+2 -2
tools/objtool/arch/x86/Build
··· 1 1 objtool-y += decode.o 2 2 3 - inat_tables_script = arch/x86/tools/gen-insn-attr-x86.awk 4 - inat_tables_maps = arch/x86/lib/x86-opcode-map.txt 3 + inat_tables_script = ../arch/x86/tools/gen-insn-attr-x86.awk 4 + inat_tables_maps = ../arch/x86/lib/x86-opcode-map.txt 5 5 6 6 $(OUTPUT)arch/x86/lib/inat-tables.c: $(inat_tables_script) $(inat_tables_maps) 7 7 $(call rule_mkdir)
+2 -2
tools/objtool/arch/x86/decode.c
··· 8 8 9 9 #define unlikely(cond) (cond) 10 10 #include <asm/insn.h> 11 - #include "lib/inat.c" 12 - #include "lib/insn.c" 11 + #include "../../../arch/x86/lib/inat.c" 12 + #include "../../../arch/x86/lib/insn.c" 13 13 14 14 #include "../../elf.h" 15 15 #include "../../arch.h"
tools/objtool/arch/x86/include/asm/inat.h tools/arch/x86/include/asm/inat.h
tools/objtool/arch/x86/include/asm/inat_types.h tools/arch/x86/include/asm/inat_types.h
tools/objtool/arch/x86/include/asm/insn.h tools/arch/x86/include/asm/insn.h
tools/objtool/arch/x86/include/asm/orc_types.h tools/arch/x86/include/asm/orc_types.h
tools/objtool/arch/x86/lib/inat.c tools/arch/x86/lib/inat.c
tools/objtool/arch/x86/lib/insn.c tools/arch/x86/lib/insn.c
tools/objtool/arch/x86/lib/x86-opcode-map.txt tools/arch/x86/lib/x86-opcode-map.txt
tools/objtool/arch/x86/tools/gen-insn-attr-x86.awk tools/arch/x86/tools/gen-insn-attr-x86.awk
+6 -6
tools/objtool/sync-check.sh
··· 2 2 # SPDX-License-Identifier: GPL-2.0 3 3 4 4 FILES=' 5 - arch/x86/lib/insn.c 6 - arch/x86/lib/inat.c 7 - arch/x86/lib/x86-opcode-map.txt 8 - arch/x86/tools/gen-insn-attr-x86.awk 9 - arch/x86/include/asm/insn.h 10 5 arch/x86/include/asm/inat.h 11 6 arch/x86/include/asm/inat_types.h 7 + arch/x86/include/asm/insn.h 12 8 arch/x86/include/asm/orc_types.h 9 + arch/x86/lib/inat.c 10 + arch/x86/lib/insn.c 11 + arch/x86/lib/x86-opcode-map.txt 12 + arch/x86/tools/gen-insn-attr-x86.awk 13 13 ' 14 14 15 15 check() 16 16 { 17 17 local file=$1 18 18 19 - diff $file ../../$file > /dev/null || 19 + diff ../$file ../../$file > /dev/null || 20 20 echo "Warning: synced file at 'tools/objtool/$file' differs from latest kernel version at '$file'" 21 21 } 22 22