diff --git a/kpatch-build/create-diff-object.c b/kpatch-build/create-diff-object.c index 4462831..70cc105 100644 --- a/kpatch-build/create-diff-object.c +++ b/kpatch-build/create-diff-object.c @@ -990,6 +990,12 @@ int kpatch_include_changed_functions(struct kpatch_elf *kelf) kpatch_include_symbol(sym, 0); } + if (sym->status == NEW && + sym->type == STT_FUNC) { + log_normal("new function: %s\n", sym->name); + kpatch_include_symbol(sym, 0); + } + if (sym->type == STT_FILE) sym->include = 1; } diff --git a/test/integration/new-function.patch b/test/integration/new-function.patch new file mode 100644 index 0000000..89abd77 --- /dev/null +++ b/test/integration/new-function.patch @@ -0,0 +1,26 @@ +Index: src/drivers/tty/n_tty.c +=================================================================== +--- src.orig/drivers/tty/n_tty.c ++++ src/drivers/tty/n_tty.c +@@ -2304,7 +2304,7 @@ static ssize_t n_tty_read(struct tty_str + * lock themselves) + */ + +-static ssize_t n_tty_write(struct tty_struct *tty, struct file *file, ++static ssize_t noinline kpatch_n_tty_write(struct tty_struct *tty, struct file *file, + const unsigned char *buf, size_t nr) + { + const unsigned char *b = buf; +@@ -2393,6 +2393,12 @@ break_out: + return (b - buf) ? b - buf : retval; + } + ++static ssize_t n_tty_write(struct tty_struct *tty, struct file *file, ++ const unsigned char *buf, size_t nr) ++{ ++ return kpatch_n_tty_write(tty, file, buf, nr); ++} ++ + /** + * n_tty_poll - poll method for N_TTY + * @tty: terminal device