aboutsummaryrefslogtreecommitdiffstats
path: root/tools/objtool/check.h
diff options
context:
space:
mode:
authorJosh Poimboeuf <jpoimboe@redhat.com>2017-07-11 11:33:42 -0400
committerIngo Molnar <mingo@kernel.org>2017-07-18 04:57:43 -0400
commit627fce14809ba5610b0cb476cd0186d3fcedecfc (patch)
tree88b2dec0ddbd243b1f9143ebec36948bb1042677 /tools/objtool/check.h
parent5a3cf86978a1ac433407704ec280919751aa2699 (diff)
objtool: Add ORC unwind table generation
Now that objtool knows the states of all registers on the stack for each instruction, it's straightforward to generate debuginfo for an unwinder to use. Instead of generating DWARF, generate a new format called ORC, which is more suitable for an in-kernel unwinder. See Documentation/x86/orc-unwinder.txt for a more detailed description of this new debuginfo format and why it's preferable to DWARF. Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com> Cc: Andy Lutomirski <luto@kernel.org> Cc: Borislav Petkov <bp@alien8.de> Cc: Brian Gerst <brgerst@gmail.com> Cc: Denys Vlasenko <dvlasenk@redhat.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Jiri Slaby <jslaby@suse.cz> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Mike Galbraith <efault@gmx.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: live-patching@vger.kernel.org Link: http://lkml.kernel.org/r/c9b9f01ba6c5ed2bdc9bb0957b78167fdbf9632e.1499786555.git.jpoimboe@redhat.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/objtool/check.h')
-rw-r--r--tools/objtool/check.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/tools/objtool/check.h b/tools/objtool/check.h
index da85f5b00ec6..046874bbe226 100644
--- a/tools/objtool/check.h
+++ b/tools/objtool/check.h
@@ -22,12 +22,14 @@
22#include "elf.h" 22#include "elf.h"
23#include "cfi.h" 23#include "cfi.h"
24#include "arch.h" 24#include "arch.h"
25#include "orc.h"
25#include <linux/hashtable.h> 26#include <linux/hashtable.h>
26 27
27struct insn_state { 28struct insn_state {
28 struct cfi_reg cfa; 29 struct cfi_reg cfa;
29 struct cfi_reg regs[CFI_NUM_REGS]; 30 struct cfi_reg regs[CFI_NUM_REGS];
30 int stack_size; 31 int stack_size;
32 unsigned char type;
31 bool bp_scratch; 33 bool bp_scratch;
32 bool drap; 34 bool drap;
33 int drap_reg; 35 int drap_reg;
@@ -48,6 +50,7 @@ struct instruction {
48 struct symbol *func; 50 struct symbol *func;
49 struct stack_op stack_op; 51 struct stack_op stack_op;
50 struct insn_state state; 52 struct insn_state state;
53 struct orc_entry orc;
51}; 54};
52 55
53struct objtool_file { 56struct objtool_file {
@@ -58,9 +61,19 @@ struct objtool_file {
58 bool ignore_unreachables, c_file; 61 bool ignore_unreachables, c_file;
59}; 62};
60 63
61int check(const char *objname, bool nofp); 64int check(const char *objname, bool nofp, bool orc);
65
66struct instruction *find_insn(struct objtool_file *file,
67 struct section *sec, unsigned long offset);
62 68
63#define for_each_insn(file, insn) \ 69#define for_each_insn(file, insn) \
64 list_for_each_entry(insn, &file->insn_list, list) 70 list_for_each_entry(insn, &file->insn_list, list)
65 71
72#define sec_for_each_insn(file, sec, insn) \
73 for (insn = find_insn(file, sec, 0); \
74 insn && &insn->list != &file->insn_list && \
75 insn->sec == sec; \
76 insn = list_next_entry(insn, list))
77
78
66#endif /* _CHECK_H */ 79#endif /* _CHECK_H */