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