1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 #ifndef _OBJTOOL_KLP_H 3 #define _OBJTOOL_KLP_H 4 5 #define SHF_RELA_LIVEPATCH 0x00100000 6 #define SHN_LIVEPATCH 0xff20 7 8 /* 9 * .init.klp_objects and .init.klp_funcs are created by klp diff and used by the 10 * patch module init code to build the klp_patch, klp_object and klp_func 11 * structs needed by the livepatch API. 12 */ 13 #define KLP_OBJECTS_SEC ".init.klp_objects" 14 #define KLP_FUNCS_SEC ".init.klp_funcs" 15 16 /* 17 * __klp_relocs is an intermediate section which are created by klp diff and 18 * converted into KLP symbols/relas by "objtool klp post-link". This is needed 19 * to work around the linker, which doesn't preserve SHN_LIVEPATCH or 20 * SHF_RELA_LIVEPATCH, nor does it support having two RELA sections for a 21 * single PROGBITS section. 22 */ 23 #define KLP_RELOCS_SEC "__klp_relocs" 24 #define KLP_STRINGS_SEC ".rodata.klp.str1.1" 25 26 struct klp_reloc { 27 void *offset; 28 void *sym; 29 u32 type; 30 }; 31 32 int cmd_klp_diff(int argc, const char **argv); 33 int cmd_klp_post_link(int argc, const char **argv); 34 35 #endif /* _OBJTOOL_KLP_H */ 36