2024-03-02 00:18:20 +08:00
|
|
|
From 62a94545d2cc442f431eb9e49dc8ca674ffa0e23 Mon Sep 17 00:00:00 2001
|
2022-10-09 10:50:14 +08:00
|
|
|
From: hubin <hubin73@huawei.com>
|
|
|
|
|
Date: Sun, 9 Oct 2022 10:34:52 +0800
|
2024-03-02 00:18:20 +08:00
|
|
|
Subject: [PATCH 35/38] lookup: skip finding local symbols for object with no
|
2023-01-30 16:10:43 +08:00
|
|
|
local symbols
|
2022-10-09 10:50:14 +08:00
|
|
|
|
|
|
|
|
Signed-off-by: hubin <hubin73@huawei.com>
|
|
|
|
|
---
|
|
|
|
|
kpatch-build/lookup.c | 19 +++++++++++++++++++
|
|
|
|
|
1 file changed, 19 insertions(+)
|
|
|
|
|
|
|
|
|
|
diff --git a/kpatch-build/lookup.c b/kpatch-build/lookup.c
|
2024-03-02 00:18:20 +08:00
|
|
|
index 87f315a..34b3602 100644
|
2022-10-09 10:50:14 +08:00
|
|
|
--- a/kpatch-build/lookup.c
|
|
|
|
|
+++ b/kpatch-build/lookup.c
|
2024-03-02 00:18:20 +08:00
|
|
|
@@ -186,6 +186,22 @@ static bool file_has_locals(struct symbol *file_sym, struct list_head *sym_list)
|
|
|
|
|
return false;
|
2022-10-09 10:50:14 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
+static int count_local_symbol(struct list_head *sym_list)
|
|
|
|
|
+{
|
|
|
|
|
+ struct symbol *sym;
|
|
|
|
|
+ int sym_num = 0;
|
|
|
|
|
+
|
|
|
|
|
+ list_for_each_entry(sym, sym_list, list) {
|
|
|
|
|
+ if (sym->bind != STB_LOCAL)
|
|
|
|
|
+ continue;
|
|
|
|
|
+ if (sym->type != STT_FUNC && sym->type != STT_OBJECT)
|
|
|
|
|
+ continue;
|
|
|
|
|
+ sym_num++;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return sym_num;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
static void find_local_syms(struct lookup_table *table, struct symbol *file_sym,
|
|
|
|
|
struct list_head *sym_list)
|
|
|
|
|
{
|
2024-03-02 00:18:20 +08:00
|
|
|
@@ -193,6 +209,9 @@ static void find_local_syms(struct lookup_table *table, struct symbol *file_sym,
|
2022-10-09 10:50:14 +08:00
|
|
|
struct object_symbol *lookup_table_file_sym = NULL;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
+ if (count_local_symbol(sym_list) == 0)
|
|
|
|
|
+ return;
|
|
|
|
|
+
|
|
|
|
|
for_each_obj_symbol(i, sym, table) {
|
|
|
|
|
if (sym->type != STT_FILE)
|
|
|
|
|
continue;
|
|
|
|
|
--
|
2023-01-30 16:10:43 +08:00
|
|
|
2.33.0
|
2022-10-09 10:50:14 +08:00
|
|
|
|