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 ".data.rel.ro.c_jump_table" 14 15 struct special_alt { 16 struct list_head list; 17 18 bool group; 19 bool jump_or_nop; 20 u8 key_addend; 21 22 struct section *orig_sec; 23 unsigned long orig_off; 24 25 struct section *new_sec; 26 unsigned long new_off; 27 28 unsigned int orig_len, new_len; /* group only */ 29 }; 30 31 int special_get_alts(struct elf *elf, struct list_head *alts); 32 33 void arch_handle_alternative(struct special_alt *alt); 34 35 bool arch_support_alt_relocation(struct special_alt *special_alt, 36 struct instruction *insn, 37 struct reloc *reloc); 38 struct reloc *arch_find_switch_table(struct objtool_file *file, 39 struct instruction *insn, 40 unsigned long *table_size); 41 #endif /* _SPECIAL_H */ 42