xref: /linux/tools/objtool/include/objtool/special.h (revision 9a87ffc99ec8eb8d35eed7c4f816d75f5cc9662e)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  * Copyright (C) 2015 Josh Poimboeuf <jpoimboe@redhat.com>
4  */
5 
6 #ifndef _SPECIAL_H
7 #define _SPECIAL_H
8 
9 #include <stdbool.h>
10 #include <objtool/check.h>
11 #include <objtool/elf.h>
12 
13 #define C_JUMP_TABLE_SECTION ".rodata..c_jump_table"
14 
15 struct special_alt {
16 	struct list_head list;
17 
18 	bool group;
19 	bool skip_orig;
20 	bool skip_alt;
21 	bool jump_or_nop;
22 	u8 key_addend;
23 
24 	struct section *orig_sec;
25 	unsigned long orig_off;
26 
27 	struct section *new_sec;
28 	unsigned long new_off;
29 
30 	unsigned int orig_len, new_len; /* group only */
31 };
32 
33 int special_get_alts(struct elf *elf, struct list_head *alts);
34 
35 void arch_handle_alternative(unsigned short feature, struct special_alt *alt);
36 
37 bool arch_support_alt_relocation(struct special_alt *special_alt,
38 				 struct instruction *insn,
39 				 struct reloc *reloc);
40 struct reloc *arch_find_switch_table(struct objtool_file *file,
41 				    struct instruction *insn);
42 #endif /* _SPECIAL_H */
43