lookup: skip finding local symbols for object with no local symbols
Signed-off-by: hubin <hubin73@huawei.com>
This commit is contained in:
parent
4cc3ecc1ac
commit
1acd737392
@ -0,0 +1,51 @@
|
|||||||
|
From 6b79df49055abbccd3033fbec52085b8a9d7b250 Mon Sep 17 00:00:00 2001
|
||||||
|
From: hubin <hubin73@huawei.com>
|
||||||
|
Date: Sun, 9 Oct 2022 10:34:52 +0800
|
||||||
|
Subject: [PATCH] lookup: skip finding local symbols for object with no local
|
||||||
|
symbols
|
||||||
|
|
||||||
|
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
|
||||||
|
index b77d7a8..875605d 100644
|
||||||
|
--- a/kpatch-build/lookup.c
|
||||||
|
+++ b/kpatch-build/lookup.c
|
||||||
|
@@ -166,6 +166,22 @@ static bool locals_match(struct lookup_table *table, int idx,
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
+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)
|
||||||
|
{
|
||||||
|
@@ -173,6 +189,9 @@ static void find_local_syms(struct lookup_table *table, struct symbol *file_sym,
|
||||||
|
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;
|
||||||
|
--
|
||||||
|
2.27.0
|
||||||
|
|
||||||
@ -1,7 +1,7 @@
|
|||||||
Name: kpatch
|
Name: kpatch
|
||||||
Epoch: 1
|
Epoch: 1
|
||||||
Version: 0.9.5
|
Version: 0.9.5
|
||||||
Release: 13
|
Release: 14
|
||||||
Summary: A Linux dynamic kernel patching infrastructure
|
Summary: A Linux dynamic kernel patching infrastructure
|
||||||
|
|
||||||
License: GPLv2
|
License: GPLv2
|
||||||
@ -56,6 +56,7 @@ Patch0040:0040-create-diff-object-allow-__jump_table-section.patch
|
|||||||
Patch0041:0041-livepatch-patch-hook-fix-kpatch-build-error-which-do.patch
|
Patch0041:0041-livepatch-patch-hook-fix-kpatch-build-error-which-do.patch
|
||||||
Patch0042:0042-kpatch-build-fix-loading-error-in-aarch64.patch
|
Patch0042:0042-kpatch-build-fix-loading-error-in-aarch64.patch
|
||||||
Patch0043:0043-kpatch-build-Remove-duplicate-functions.patch
|
Patch0043:0043-kpatch-build-Remove-duplicate-functions.patch
|
||||||
|
Patch0044:0044-lookup-skip-finding-local-symbols-for-object-with-no.patch
|
||||||
|
|
||||||
BuildRequires: gcc elfutils-libelf-devel kernel-devel git
|
BuildRequires: gcc elfutils-libelf-devel kernel-devel git
|
||||||
Requires: bc make gcc patch bison flex openssl-devel
|
Requires: bc make gcc patch bison flex openssl-devel
|
||||||
@ -116,6 +117,12 @@ popd
|
|||||||
%{_mandir}/man1/*.1.gz
|
%{_mandir}/man1/*.1.gz
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Sun Oct 9 2022 Bin Hu <hubin73@huawei.com> -1:0.9.5-14
|
||||||
|
- Type:bugfix
|
||||||
|
- ID:NA
|
||||||
|
- SUG:NA
|
||||||
|
- DESC:lookup: skip finding local symbols for object with no local symbols
|
||||||
|
|
||||||
* Tue Sep 6 2022 Tang Bin <tangbin_yewu@cmss.chinamobile.com> -1:0.9.5-13
|
* Tue Sep 6 2022 Tang Bin <tangbin_yewu@cmss.chinamobile.com> -1:0.9.5-13
|
||||||
- Type:clean code
|
- Type:clean code
|
||||||
- ID:NA
|
- ID:NA
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user