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 
23 	struct section *orig_sec;
24 	unsigned long orig_off;
25 
26 	struct section *new_sec;
27 	unsigned long new_off;
28 
29 	unsigned int orig_len, new_len; /* group only */
30 };
31 
32 int special_get_alts(struct elf *elf, struct list_head *alts);
33 
34 void arch_handle_alternative(unsigned short feature, struct special_alt *alt);
35 
36 bool arch_support_alt_relocation(struct special_alt *special_alt,
37 				 struct instruction *insn,
38 				 struct reloc *reloc);
39 struct reloc *arch_find_switch_table(struct objtool_file *file,
40 				    struct instruction *insn);
41 #endif /* _SPECIAL_H */
42