1 Star 0 Fork 47

xujialing/kpatch

forked from src-openEuler/kpatch 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0023-create-diff-object-fix-duplicate-symbols-for-vmlinux.patch 2.27 KB
一键复制 编辑 原始数据 按行查看 历史
谢志鹏 提交于 5年前 . code optimization
From 459018cfabc65e9f29bf25476c727b4d5d8089c4 Mon Sep 17 00:00:00 2001
From: Zhipeng Xie <xiezhipeng1@huawei.com>
Date: Wed, 22 Apr 2020 05:55:33 -0400
Subject: [PATCH 23/23] create-diff-object: fix duplicate symbols for vmlinux
symbol pos in vmlinux may be different with runtime
/proc/kallsyms, use ref_name and ref_offset method too.
Signed-off-by: Zhipeng Xie <xiezhipeng1@huawei.com>
---
kpatch-build/create-diff-object.c | 36 ++++++++++++++++---------------
1 file changed, 19 insertions(+), 17 deletions(-)
diff --git a/kpatch-build/create-diff-object.c b/kpatch-build/create-diff-object.c
index 4fa4488..ad5746b 100644
--- a/kpatch-build/create-diff-object.c
+++ b/kpatch-build/create-diff-object.c
@@ -3110,25 +3110,27 @@ static void kpatch_create_intermediate_sections(struct kpatch_elf *kelf,
else {
/* for modules, src is discovered at runtime */
ksyms[index].src = 0;
- if (lookup_is_duplicate_symbol(table, rela->sym->name, objname,
- result.pos)) {
- struct lookup_refsym refsym;
-
- if (lookup_ref_symbol_offset(table, rela->sym->name,
- &refsym, objname, &ref_offset))
- ERROR("unresolvable ambiguity on symbol %s\n",
- rela->sym->name);
-
- /* add rela to fill in ref_name field */
- ALLOC_LINK(rela2, &krela_sec->rela->relas);
- rela2->sym = strsym;
- rela2->type = absolute_rela_type;
- rela2->addend = offset_of_string(&kelf->strings,
- refsym.name);
- rela2->offset = (unsigned int)(index * sizeof(*krelas) +
+ }
+
+ if (lookup_is_duplicate_symbol(table, rela->sym->name, objname,
+ result.pos)) {
+ struct lookup_refsym refsym;
+
+ if (lookup_ref_symbol_offset(table, rela->sym->name,
+ &refsym, objname, &ref_offset))
+ ERROR("unresolvable ambiguity on symbol %s\n",
+ rela->sym->name);
+
+ /* add rela to fill in ref_name field */
+ ALLOC_LINK(rela2, &krela_sec->rela->relas);
+ rela2->sym = strsym;
+ rela2->type = absolute_rela_type;
+ rela2->addend = offset_of_string(&kelf->strings,
+ refsym.name);
+ rela2->offset = (unsigned int)(index * sizeof(*krelas) +
offsetof(struct kpatch_relocation, ref_name));
- }
}
+
ksyms[index].pos = result.pos;
ksyms[index].type = rela->sym->type;
ksyms[index].bind = rela->sym->bind;
--
2.18.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/sticky-rice-wine/kpatch.git
git@gitee.com:sticky-rice-wine/kpatch.git
sticky-rice-wine
kpatch
kpatch
master

搜索帮助