aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-11-26 16:11:18 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-11-26 16:11:18 -0500
commitfcbc38b1b296cd38214891fb1fc714d52937d062 (patch)
treecb10b3a1bb13fb1c6e84b743550d48eaf8bfd061 /tools
parent844056fd74ebdd826bd23a7d989597e15f478acb (diff)
parenta356d2ae50790f49858ebed35da9e206336fafee (diff)
Merge branch 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull objtool fixes from Ingo Molnar: "A handful of objtool fixes, most of them related to making the UAPI header-syncing warnings easier to read and easier to act upon" * 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: tools/headers: Sync objtool UAPI header objtool: Fix cross-build objtool: Move kernel headers/code sync check to a script objtool: Move synced files to their original relative locations objtool: Make unreachable annotation inline asms explicitly volatile objtool: Add a comment for the unreachable annotation macros
Diffstat (limited to 'tools')
-rw-r--r--tools/objtool/.gitignore2
-rw-r--r--tools/objtool/Makefile22
-rw-r--r--tools/objtool/arch/x86/Build10
-rw-r--r--tools/objtool/arch/x86/decode.c6
-rw-r--r--tools/objtool/arch/x86/include/asm/inat.h (renamed from tools/objtool/arch/x86/insn/inat.h)12
-rw-r--r--tools/objtool/arch/x86/include/asm/inat_types.h (renamed from tools/objtool/arch/x86/insn/inat_types.h)0
-rw-r--r--tools/objtool/arch/x86/include/asm/insn.h (renamed from tools/objtool/arch/x86/insn/insn.h)2
-rw-r--r--tools/objtool/arch/x86/include/asm/orc_types.h (renamed from tools/objtool/orc_types.h)0
-rw-r--r--tools/objtool/arch/x86/lib/inat.c (renamed from tools/objtool/arch/x86/insn/inat.c)2
-rw-r--r--tools/objtool/arch/x86/lib/insn.c (renamed from tools/objtool/arch/x86/insn/insn.c)4
-rw-r--r--tools/objtool/arch/x86/lib/x86-opcode-map.txt (renamed from tools/objtool/arch/x86/insn/x86-opcode-map.txt)0
-rw-r--r--tools/objtool/arch/x86/tools/gen-insn-attr-x86.awk (renamed from tools/objtool/arch/x86/insn/gen-insn-attr-x86.awk)0
-rw-r--r--tools/objtool/orc.h2
-rwxr-xr-xtools/objtool/sync-check.sh29
14 files changed, 59 insertions, 32 deletions
diff --git a/tools/objtool/.gitignore b/tools/objtool/.gitignore
index d3102c865a95..914cff12899b 100644
--- a/tools/objtool/.gitignore
+++ b/tools/objtool/.gitignore
@@ -1,3 +1,3 @@
1arch/x86/insn/inat-tables.c 1arch/x86/lib/inat-tables.c
2objtool 2objtool
3fixdep 3fixdep
diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile
index 424b1965d06f..0f94af3ccaaa 100644
--- a/tools/objtool/Makefile
+++ b/tools/objtool/Makefile
@@ -25,7 +25,9 @@ OBJTOOL_IN := $(OBJTOOL)-in.o
25 25
26all: $(OBJTOOL) 26all: $(OBJTOOL)
27 27
28INCLUDES := -I$(srctree)/tools/include -I$(srctree)/tools/arch/$(HOSTARCH)/include/uapi 28INCLUDES := -I$(srctree)/tools/include \
29 -I$(srctree)/tools/arch/$(HOSTARCH)/include/uapi \
30 -I$(srctree)/tools/objtool/arch/$(ARCH)/include
29WARNINGS := $(EXTRA_WARNINGS) -Wno-switch-default -Wno-switch-enum -Wno-packed 31WARNINGS := $(EXTRA_WARNINGS) -Wno-switch-default -Wno-switch-enum -Wno-packed
30CFLAGS += -Wall -Werror $(WARNINGS) -fomit-frame-pointer -O2 -g $(INCLUDES) 32CFLAGS += -Wall -Werror $(WARNINGS) -fomit-frame-pointer -O2 -g $(INCLUDES)
31LDFLAGS += -lelf $(LIBSUBCMD) 33LDFLAGS += -lelf $(LIBSUBCMD)
@@ -41,22 +43,8 @@ include $(srctree)/tools/build/Makefile.include
41$(OBJTOOL_IN): fixdep FORCE 43$(OBJTOOL_IN): fixdep FORCE
42 @$(MAKE) $(build)=objtool 44 @$(MAKE) $(build)=objtool
43 45
44# Busybox's diff doesn't have -I, avoid warning in that case
45#
46$(OBJTOOL): $(LIBSUBCMD) $(OBJTOOL_IN) 46$(OBJTOOL): $(LIBSUBCMD) $(OBJTOOL_IN)
47 @(diff -I 2>&1 | grep -q 'option requires an argument' && \ 47 @./sync-check.sh
48 test -d ../../kernel -a -d ../../tools -a -d ../objtool && (( \
49 diff -I'^#include' arch/x86/insn/insn.c ../../arch/x86/lib/insn.c >/dev/null && \
50 diff -I'^#include' arch/x86/insn/inat.c ../../arch/x86/lib/inat.c >/dev/null && \
51 diff arch/x86/insn/x86-opcode-map.txt ../../arch/x86/lib/x86-opcode-map.txt >/dev/null && \
52 diff arch/x86/insn/gen-insn-attr-x86.awk ../../arch/x86/tools/gen-insn-attr-x86.awk >/dev/null && \
53 diff -I'^#include' arch/x86/insn/insn.h ../../arch/x86/include/asm/insn.h >/dev/null && \
54 diff -I'^#include' arch/x86/insn/inat.h ../../arch/x86/include/asm/inat.h >/dev/null && \
55 diff -I'^#include' arch/x86/insn/inat_types.h ../../arch/x86/include/asm/inat_types.h >/dev/null) \
56 || echo "warning: objtool: x86 instruction decoder differs from kernel" >&2 )) || true
57 @(test -d ../../kernel -a -d ../../tools -a -d ../objtool && (( \
58 diff ../../arch/x86/include/asm/orc_types.h orc_types.h >/dev/null) \
59 || echo "warning: objtool: orc_types.h differs from kernel" >&2 )) || true
60 $(QUIET_LINK)$(CC) $(OBJTOOL_IN) $(LDFLAGS) -o $@ 48 $(QUIET_LINK)$(CC) $(OBJTOOL_IN) $(LDFLAGS) -o $@
61 49
62 50
@@ -66,7 +54,7 @@ $(LIBSUBCMD): fixdep FORCE
66clean: 54clean:
67 $(call QUIET_CLEAN, objtool) $(RM) $(OBJTOOL) 55 $(call QUIET_CLEAN, objtool) $(RM) $(OBJTOOL)
68 $(Q)find $(OUTPUT) -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete 56 $(Q)find $(OUTPUT) -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete
69 $(Q)$(RM) $(OUTPUT)arch/x86/insn/inat-tables.c $(OUTPUT)fixdep 57 $(Q)$(RM) $(OUTPUT)arch/x86/lib/inat-tables.c $(OUTPUT)fixdep
70 58
71FORCE: 59FORCE:
72 60
diff --git a/tools/objtool/arch/x86/Build b/tools/objtool/arch/x86/Build
index debbdb0b5c43..b998412c017d 100644
--- a/tools/objtool/arch/x86/Build
+++ b/tools/objtool/arch/x86/Build
@@ -1,12 +1,12 @@
1objtool-y += decode.o 1objtool-y += decode.o
2 2
3inat_tables_script = arch/x86/insn/gen-insn-attr-x86.awk 3inat_tables_script = arch/x86/tools/gen-insn-attr-x86.awk
4inat_tables_maps = arch/x86/insn/x86-opcode-map.txt 4inat_tables_maps = arch/x86/lib/x86-opcode-map.txt
5 5
6$(OUTPUT)arch/x86/insn/inat-tables.c: $(inat_tables_script) $(inat_tables_maps) 6$(OUTPUT)arch/x86/lib/inat-tables.c: $(inat_tables_script) $(inat_tables_maps)
7 $(call rule_mkdir) 7 $(call rule_mkdir)
8 $(Q)$(call echo-cmd,gen)$(AWK) -f $(inat_tables_script) $(inat_tables_maps) > $@ 8 $(Q)$(call echo-cmd,gen)$(AWK) -f $(inat_tables_script) $(inat_tables_maps) > $@
9 9
10$(OUTPUT)arch/x86/decode.o: $(OUTPUT)arch/x86/insn/inat-tables.c 10$(OUTPUT)arch/x86/decode.o: $(OUTPUT)arch/x86/lib/inat-tables.c
11 11
12CFLAGS_decode.o += -I$(OUTPUT)arch/x86/insn 12CFLAGS_decode.o += -I$(OUTPUT)arch/x86/lib
diff --git a/tools/objtool/arch/x86/decode.c b/tools/objtool/arch/x86/decode.c
index 34a579f806e3..8acfc47af70e 100644
--- a/tools/objtool/arch/x86/decode.c
+++ b/tools/objtool/arch/x86/decode.c
@@ -19,9 +19,9 @@
19#include <stdlib.h> 19#include <stdlib.h>
20 20
21#define unlikely(cond) (cond) 21#define unlikely(cond) (cond)
22#include "insn/insn.h" 22#include <asm/insn.h>
23#include "insn/inat.c" 23#include "lib/inat.c"
24#include "insn/insn.c" 24#include "lib/insn.c"
25 25
26#include "../../elf.h" 26#include "../../elf.h"
27#include "../../arch.h" 27#include "../../arch.h"
diff --git a/tools/objtool/arch/x86/insn/inat.h b/tools/objtool/arch/x86/include/asm/inat.h
index 125ecd2a300d..1c78580e58be 100644
--- a/tools/objtool/arch/x86/insn/inat.h
+++ b/tools/objtool/arch/x86/include/asm/inat.h
@@ -20,7 +20,7 @@
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 * 21 *
22 */ 22 */
23#include "inat_types.h" 23#include <asm/inat_types.h>
24 24
25/* 25/*
26 * Internal bits. Don't use bitmasks directly, because these bits are 26 * Internal bits. Don't use bitmasks directly, because these bits are
@@ -97,6 +97,16 @@
97#define INAT_MAKE_GROUP(grp) ((grp << INAT_GRP_OFFS) | INAT_MODRM) 97#define INAT_MAKE_GROUP(grp) ((grp << INAT_GRP_OFFS) | INAT_MODRM)
98#define INAT_MAKE_IMM(imm) (imm << INAT_IMM_OFFS) 98#define INAT_MAKE_IMM(imm) (imm << INAT_IMM_OFFS)
99 99
100/* Identifiers for segment registers */
101#define INAT_SEG_REG_IGNORE 0
102#define INAT_SEG_REG_DEFAULT 1
103#define INAT_SEG_REG_CS 2
104#define INAT_SEG_REG_SS 3
105#define INAT_SEG_REG_DS 4
106#define INAT_SEG_REG_ES 5
107#define INAT_SEG_REG_FS 6
108#define INAT_SEG_REG_GS 7
109
100/* Attribute search APIs */ 110/* Attribute search APIs */
101extern insn_attr_t inat_get_opcode_attribute(insn_byte_t opcode); 111extern insn_attr_t inat_get_opcode_attribute(insn_byte_t opcode);
102extern int inat_get_last_prefix_id(insn_byte_t last_pfx); 112extern int inat_get_last_prefix_id(insn_byte_t last_pfx);
diff --git a/tools/objtool/arch/x86/insn/inat_types.h b/tools/objtool/arch/x86/include/asm/inat_types.h
index cb3c20ce39cf..cb3c20ce39cf 100644
--- a/tools/objtool/arch/x86/insn/inat_types.h
+++ b/tools/objtool/arch/x86/include/asm/inat_types.h
diff --git a/tools/objtool/arch/x86/insn/insn.h b/tools/objtool/arch/x86/include/asm/insn.h
index e23578c7b1be..b3e32b010ab1 100644
--- a/tools/objtool/arch/x86/insn/insn.h
+++ b/tools/objtool/arch/x86/include/asm/insn.h
@@ -21,7 +21,7 @@
21 */ 21 */
22 22
23/* insn_attr_t is defined in inat.h */ 23/* insn_attr_t is defined in inat.h */
24#include "inat.h" 24#include <asm/inat.h>
25 25
26struct insn_field { 26struct insn_field {
27 union { 27 union {
diff --git a/tools/objtool/orc_types.h b/tools/objtool/arch/x86/include/asm/orc_types.h
index 9c9dc579bd7d..9c9dc579bd7d 100644
--- a/tools/objtool/orc_types.h
+++ b/tools/objtool/arch/x86/include/asm/orc_types.h
diff --git a/tools/objtool/arch/x86/insn/inat.c b/tools/objtool/arch/x86/lib/inat.c
index e4bf28e6f4c7..c1f01a8e9f65 100644
--- a/tools/objtool/arch/x86/insn/inat.c
+++ b/tools/objtool/arch/x86/lib/inat.c
@@ -18,7 +18,7 @@
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 * 19 *
20 */ 20 */
21#include "insn.h" 21#include <asm/insn.h>
22 22
23/* Attribute tables are generated from opcode map */ 23/* Attribute tables are generated from opcode map */
24#include "inat-tables.c" 24#include "inat-tables.c"
diff --git a/tools/objtool/arch/x86/insn/insn.c b/tools/objtool/arch/x86/lib/insn.c
index ca983e2bea8b..1088eb8f3a5f 100644
--- a/tools/objtool/arch/x86/insn/insn.c
+++ b/tools/objtool/arch/x86/lib/insn.c
@@ -23,8 +23,8 @@
23#else 23#else
24#include <string.h> 24#include <string.h>
25#endif 25#endif
26#include "inat.h" 26#include <asm/inat.h>
27#include "insn.h" 27#include <asm/insn.h>
28 28
29/* Verify next sizeof(t) bytes can be on the same instruction */ 29/* Verify next sizeof(t) bytes can be on the same instruction */
30#define validate_next(t, insn, n) \ 30#define validate_next(t, insn, n) \
diff --git a/tools/objtool/arch/x86/insn/x86-opcode-map.txt b/tools/objtool/arch/x86/lib/x86-opcode-map.txt
index 12e377184ee4..12e377184ee4 100644
--- a/tools/objtool/arch/x86/insn/x86-opcode-map.txt
+++ b/tools/objtool/arch/x86/lib/x86-opcode-map.txt
diff --git a/tools/objtool/arch/x86/insn/gen-insn-attr-x86.awk b/tools/objtool/arch/x86/tools/gen-insn-attr-x86.awk
index b02a36b2c14f..b02a36b2c14f 100644
--- a/tools/objtool/arch/x86/insn/gen-insn-attr-x86.awk
+++ b/tools/objtool/arch/x86/tools/gen-insn-attr-x86.awk
diff --git a/tools/objtool/orc.h b/tools/objtool/orc.h
index a4139e386ef3..b0e92a6d0903 100644
--- a/tools/objtool/orc.h
+++ b/tools/objtool/orc.h
@@ -18,7 +18,7 @@
18#ifndef _ORC_H 18#ifndef _ORC_H
19#define _ORC_H 19#define _ORC_H
20 20
21#include "orc_types.h" 21#include <asm/orc_types.h>
22 22
23struct objtool_file; 23struct objtool_file;
24 24
diff --git a/tools/objtool/sync-check.sh b/tools/objtool/sync-check.sh
new file mode 100755
index 000000000000..1470e74e9d66
--- /dev/null
+++ b/tools/objtool/sync-check.sh
@@ -0,0 +1,29 @@
1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0
3
4FILES='
5arch/x86/lib/insn.c
6arch/x86/lib/inat.c
7arch/x86/lib/x86-opcode-map.txt
8arch/x86/tools/gen-insn-attr-x86.awk
9arch/x86/include/asm/insn.h
10arch/x86/include/asm/inat.h
11arch/x86/include/asm/inat_types.h
12arch/x86/include/asm/orc_types.h
13'
14
15check()
16{
17 local file=$1
18
19 diff $file ../../$file > /dev/null ||
20 echo "Warning: synced file at 'tools/objtool/$file' differs from latest kernel version at '$file'"
21}
22
23if [ ! -d ../../kernel ] || [ ! -d ../../tools ] || [ ! -d ../objtool ]; then
24 exit 0
25fi
26
27for i in $FILES; do
28 check $i
29done