On Mon 2023-11-06 17:25:10, Lukas Hruska wrote:
quoted hunk ↗ jump to hunk
Livepatches need to access external symbols which can't be handled
by the normal relocation mechanism. It is needed for two types
of symbols:
--- /dev/null
+++ b/scripts/livepatch/klp-convert.c
[...]
quoted hunk ↗ jump to hunk
+/*
+ * Formats name of klp rela symbol based on another given section (@oldsec)
+ * and object (@obj_name) name, then returns it
+ */
+static char *alloc_klp_rela_name(struct section *oldsec,
+ char *target_objname, struct elf *klp_elf)
+{
Nit: Please, use @lp_obj_name instead of @target_objname.
It would make it consistent with the caller:
klp_rela_name = alloc_klp_rela_name(oldsec, lp_obj_name, klp_elf);
and also with
#define KLP_RELOC_SYMBOL_POS(LP_OBJ_NAME, SYM_OBJ_NAME, SYM_NAME, SYM_POS)
quoted hunk ↗ jump to hunk
+ char *klp_rela_name;
+ unsigned int length;
+ int err;
Just for record. The name "lp_obj_name" came from a discussion between
me and Lukas about the KLP_RELOC_SYMBOL_POS() parameter names.
The macro has two object name parameters. And LP_OBJ_NAME aka
LivePatched_OBJ_NAME looked better than TARGET_OBJ_NAME.
The name "TARGET" is too ambiguous to me.
Best Regards,
Petr