1 Star 0 Fork 42

陈子扬 / kpatch

forked from src-openEuler / kpatch 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0013-kpatch-build-ignore-debuginfo-in-patch.patch 1.90 KB
一键复制 编辑 原始数据 按行查看 历史
HuBin95 提交于 2023-01-30 16:10 . upgrade kpatch to version 0.9.7
From 5e9f742fae2faef7ce30acd3bcf0f3085f55a0f6 Mon Sep 17 00:00:00 2001
From: Zhipeng Xie <xiezhipeng1@huawei.com>
Date: Wed, 26 Feb 2020 21:01:02 -0500
Subject: [PATCH 13/37] kpatch-build: ignore debuginfo in patch
Just ignore all .debug_* sections
Signed-off-by: Zhipeng Xie <xiezhipeng1@huawei.com>
---
kpatch-build/create-diff-object.c | 18 ++++++++++++++++++
kpatch-build/kpatch-build | 1 +
2 files changed, 19 insertions(+)
diff --git a/kpatch-build/create-diff-object.c b/kpatch-build/create-diff-object.c
index e11a900..9b966e8 100644
--- a/kpatch-build/create-diff-object.c
+++ b/kpatch-build/create-diff-object.c
@@ -2763,6 +2763,23 @@ static void kpatch_include_debug_sections(struct kpatch_elf *kelf)
}
}
+static void kpatch_ignore_debug_sections(struct kpatch_elf *kelf)
+{
+ struct section *sec;
+
+ /* include all .debug_* sections */
+ list_for_each_entry(sec, &kelf->sections, list) {
+ if (is_debug_section(sec)) {
+ sec->include = 0;
+ sec->status = SAME;
+ if (!is_rela_section(sec)) {
+ sec->secsym->include = 0;
+ sec->secsym->status = SAME;
+ }
+ }
+ }
+}
+
static void kpatch_mark_ignored_sections(struct kpatch_elf *kelf)
{
struct section *sec, *strsec, *ignoresec;
@@ -4054,6 +4071,7 @@ int main(int argc, char *argv[])
new_globals_exist = kpatch_include_new_globals(kelf_patched);
kpatch_include_new_static_var(kelf_patched);
kpatch_include_debug_sections(kelf_patched);
+ kpatch_ignore_debug_sections(kelf_patched);
kpatch_process_special_sections(kelf_patched, lookup);
diff --git a/kpatch-build/kpatch-build b/kpatch-build/kpatch-build
index a5324db..84d8592 100755
--- a/kpatch-build/kpatch-build
+++ b/kpatch-build/kpatch-build
@@ -1273,6 +1273,7 @@ CROSS_COMPILE="$CROSS_COMPILE"
save_env
make "${MAKEVARS[@]}" 2>&1 | logger || die
+strip -g "$TEMPDIR/patch/$MODNAME.ko"
if [[ "$USE_KLP" -eq 1 ]]; then
if [[ "$USE_KLP_ARCH" -eq 0 ]]; then
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ziyangc/kpatch.git
git@gitee.com:ziyangc/kpatch.git
ziyangc
kpatch
kpatch
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891