Merge tag 'powerpc-5.11-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc...
[linux/fpc-iii.git] / tools / objtool / check.h
blob5ec00a4b891b6a355fbdf7859dfe55de26363694
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3 * Copyright (C) 2017 Josh Poimboeuf <jpoimboe@redhat.com>
4 */
6 #ifndef _CHECK_H
7 #define _CHECK_H
9 #include <stdbool.h>
10 #include "cfi.h"
11 #include "arch.h"
13 struct insn_state {
14 struct cfi_state cfi;
15 unsigned int uaccess_stack;
16 bool uaccess;
17 bool df;
18 bool noinstr;
19 s8 instr;
22 struct instruction {
23 struct list_head list;
24 struct hlist_node hash;
25 struct list_head static_call_node;
26 struct section *sec;
27 unsigned long offset;
28 unsigned int len;
29 enum insn_type type;
30 unsigned long immediate;
31 bool dead_end, ignore, ignore_alts;
32 bool hint;
33 bool retpoline_safe;
34 s8 instr;
35 u8 visited;
36 u8 ret_offset;
37 int alt_group;
38 struct symbol *call_dest;
39 struct instruction *jump_dest;
40 struct instruction *first_jump_src;
41 struct reloc *jump_table;
42 struct list_head alts;
43 struct symbol *func;
44 struct list_head stack_ops;
45 struct cfi_state cfi;
46 #ifdef INSN_USE_ORC
47 struct orc_entry orc;
48 #endif
51 static inline bool is_static_jump(struct instruction *insn)
53 return insn->type == INSN_JUMP_CONDITIONAL ||
54 insn->type == INSN_JUMP_UNCONDITIONAL;
57 struct instruction *find_insn(struct objtool_file *file,
58 struct section *sec, unsigned long offset);
60 #define for_each_insn(file, insn) \
61 list_for_each_entry(insn, &file->insn_list, list)
63 #define sec_for_each_insn(file, sec, insn) \
64 for (insn = find_insn(file, sec, 0); \
65 insn && &insn->list != &file->insn_list && \
66 insn->sec == sec; \
67 insn = list_next_entry(insn, list))
69 #endif /* _CHECK_H */