support for .cold functions with no id suffix

Signed-off-by: Wentao Fan <fanwentao@huawei.com>
This commit is contained in:
Wentao Fan 2021-05-29 05:47:11 -04:00
parent fdd62d8a70
commit 3a88b42a53
2 changed files with 50 additions and 1 deletions

View File

@ -0,0 +1,42 @@
From 55a2778284c088f4c383cf364bef18f1b5b88531 Mon Sep 17 00:00:00 2001
From: Artem Savkov <asavkov@redhat.com>
Date: Thu, 4 Mar 2021 12:47:43 +0100
Subject: [PATCH] create-build-diff: support for .cold functions with no id
suffix
create-build-diff expects .cold functions to be suffixed by an id, which
is not always the case. Drop the trailing '.' when searching for cold
functions.
Fixes: #1160
Signed-off-by: Artem Savkov <asavkov@redhat.com>
---
kpatch-build/create-diff-object.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kpatch-build/create-diff-object.c b/kpatch-build/create-diff-object.c
index 6b19e1e..d20f2f1 100644
--- a/kpatch-build/create-diff-object.c
+++ b/kpatch-build/create-diff-object.c
@@ -124,7 +124,7 @@ static int is_bundleable(struct symbol *sym)
if (sym->type == STT_FUNC &&
!strncmp(sym->sec->name, ".text.unlikely.",15) &&
(!strcmp(sym->sec->name + 15, sym->name) ||
- (strstr(sym->name, ".cold.") &&
+ (strstr(sym->name, ".cold") &&
!strncmp(sym->sec->name + 15, sym->name, strlen(sym->sec->name) - 15))))
return 1;
@@ -248,7 +248,7 @@ static void kpatch_detect_child_functions(struct kpatch_elf *kelf)
list_for_each_entry(sym, &kelf->symbols, list) {
char *coldstr;
- coldstr = strstr(sym->name, ".cold.");
+ coldstr = strstr(sym->name, ".cold");
if (coldstr != NULL) {
char *pname;
--
2.27.0

View File

@ -1,7 +1,7 @@
Name: kpatch Name: kpatch
Epoch: 1 Epoch: 1
Version: 0.9.1 Version: 0.9.1
Release: 12 Release: 13
Summary: A Linux dynamic kernel patching infrastructure Summary: A Linux dynamic kernel patching infrastructure
License: GPLv2 License: GPLv2
@ -38,6 +38,7 @@ Patch0023:0023-create-diff-object-fix-duplicate-symbols-for-vmlinux.patch
Patch0024:0024-optimize-for-out-of-tree-module.patch Patch0024:0024-optimize-for-out-of-tree-module.patch
Patch0025:0025-Fix-relocation-not-resolved-when-new-functions-expor.patch Patch0025:0025-Fix-relocation-not-resolved-when-new-functions-expor.patch
Patch0026:0026-support-remove-static-variables-using-KPATCH_IGNORE_.patch Patch0026:0026-support-remove-static-variables-using-KPATCH_IGNORE_.patch
Patch0027:0027-create-build-diff-support-for-.cold-functions-with-n.patch
BuildRequires: gcc elfutils-libelf-devel uname-build-checks kernel-devel git BuildRequires: gcc elfutils-libelf-devel uname-build-checks kernel-devel git
Requires: bc make gcc patch bison flex openssl-devel Requires: bc make gcc patch bison flex openssl-devel
@ -97,6 +98,12 @@ popd
%{_mandir}/man1/*.1.gz %{_mandir}/man1/*.1.gz
%changelog %changelog
* Sat May 29 2021 Wentao Fan<fanwentao@huawei.com> -1:0.9.1-13
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:support for .cold functions with no id suffix
* Wed Feb 10 2021 Zhipeng Xie<xiezhipeng1@huawei.com> -1:0.9.1-12 * Wed Feb 10 2021 Zhipeng Xie<xiezhipeng1@huawei.com> -1:0.9.1-12
- Type:enhancement - Type:enhancement
- ID:NA - ID:NA