diff mbox series

[5/9] create-diff-object: move kpatch_include_symbol()

Message ID 20240429145654.71669-6-roger.pau@citrix.com (mailing list archive)
State New, archived
Headers show
Series livepatch-build-tools: some bug fixes and improvements | expand

Commit Message

Roger Pau Monné April 29, 2024, 2:56 p.m. UTC
So it can be used by kpatch_process_special_sections() in further changes.

Non functional change.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
 create-diff-object.c | 74 ++++++++++++++++++++++----------------------
 1 file changed, 37 insertions(+), 37 deletions(-)
diff mbox series

Patch

diff --git a/create-diff-object.c b/create-diff-object.c
index 6a751bf3b789..7674d972e301 100644
--- a/create-diff-object.c
+++ b/create-diff-object.c
@@ -1198,6 +1198,43 @@  void kpatch_update_ex_table_addend(struct kpatch_elf *kelf,
 	}
 }
 
+#define inc_printf(fmt, ...) \
+	log_debug("%*s" fmt, recurselevel, "", ##__VA_ARGS__);
+
+static void kpatch_include_symbol(struct symbol *sym, int recurselevel)
+{
+	struct rela *rela;
+	struct section *sec;
+
+	inc_printf("start include_symbol(%s)\n", sym->name);
+	sym->include = 1;
+	inc_printf("symbol %s is included\n", sym->name);
+	/*
+	 * Check if sym is a non-local symbol (sym->sec is NULL) or
+	 * if an unchanged local symbol.  This a base case for the
+	 * inclusion recursion.
+	 */
+	if (!sym->sec || sym->sec->include ||
+	    (sym->type != STT_SECTION && sym->status == SAME))
+		goto out;
+	sec = sym->sec;
+	sec->include = 1;
+	inc_printf("section %s is included\n", sec->name);
+	if (sec->secsym && sec->secsym != sym) {
+		sec->secsym->include = 1;
+		inc_printf("section symbol %s is included\n", sec->secsym->name);
+	}
+	if (!sec->rela)
+		goto out;
+	sec->rela->include = 1;
+	inc_printf("section %s is included\n", sec->rela->name);
+	list_for_each_entry(rela, &sec->rela->relas, list)
+		kpatch_include_symbol(rela->sym, recurselevel+1);
+out:
+	inc_printf("end include_symbol(%s)\n", sym->name);
+	return;
+}
+
 static void kpatch_regenerate_special_section(struct kpatch_elf *kelf,
 				              struct special_section *special,
 				              struct section *sec)
@@ -1455,43 +1492,6 @@  static void kpatch_include_standard_string_elements(struct kpatch_elf *kelf)
 	}
 }
 
-#define inc_printf(fmt, ...) \
-	log_debug("%*s" fmt, recurselevel, "", ##__VA_ARGS__);
-
-static void kpatch_include_symbol(struct symbol *sym, int recurselevel)
-{
-	struct rela *rela;
-	struct section *sec;
-
-	inc_printf("start include_symbol(%s)\n", sym->name);
-	sym->include = 1;
-	inc_printf("symbol %s is included\n", sym->name);
-	/*
-	 * Check if sym is a non-local symbol (sym->sec is NULL) or
-	 * if an unchanged local symbol.  This a base case for the
-	 * inclusion recursion.
-	 */
-	if (!sym->sec || sym->sec->include ||
-	    (sym->type != STT_SECTION && sym->status == SAME))
-		goto out;
-	sec = sym->sec;
-	sec->include = 1;
-	inc_printf("section %s is included\n", sec->name);
-	if (sec->secsym && sec->secsym != sym) {
-		sec->secsym->include = 1;
-		inc_printf("section symbol %s is included\n", sec->secsym->name);
-	}
-	if (!sec->rela)
-		goto out;
-	sec->rela->include = 1;
-	inc_printf("section %s is included\n", sec->rela->name);
-	list_for_each_entry(rela, &sec->rela->relas, list)
-		kpatch_include_symbol(rela->sym, recurselevel+1);
-out:
-	inc_printf("end include_symbol(%s)\n", sym->name);
-	return;
-}
-
 static int kpatch_include_changed_functions(struct kpatch_elf *kelf)
 {
 	struct symbol *sym;