1 Star 0 Fork 44

xujialing/kpatch

forked from src-openEuler/kpatch 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0001-support-compile-kpatch-on-aarch64.patch 3.25 KB
一键复制 编辑 原始数据 按行查看 历史
谢志鹏 提交于 2020-09-12 05:45 . code optimization
From 0de9a5da0cc278973caabfb9929dc58514c73639 Mon Sep 17 00:00:00 2001
From: Zhipeng Xie <xiezhipeng1@huawei.com>
Date: Thu, 20 Dec 2018 04:55:38 +0000
Subject: [PATCH 01/23] support compile kpatch on aarch64
delete __x86_64__ to support compile kpatch on aarch64.
Signed-off-by: Zhipeng Xie <xiezhipeng1@huawei.com>
---
kpatch-build/Makefile | 4 ++++
kpatch-build/create-diff-object.c | 14 +-------------
2 files changed, 5 insertions(+), 13 deletions(-)
diff --git a/kpatch-build/Makefile b/kpatch-build/Makefile
index 7505e07..8efae94 100644
--- a/kpatch-build/Makefile
+++ b/kpatch-build/Makefile
@@ -14,6 +14,10 @@ ifeq ($(ARCH),x86_64)
SOURCES += insn/insn.c insn/inat.c
INSN = insn/insn.o insn/inat.o
insn/%.o: CFLAGS := $(filter-out -Wconversion, $(CFLAGS))
+else ifeq ($(ARCH),aarch64)
+SOURCES += insn/insn.c insn/inat.c
+INSN = insn/insn.o insn/inat.o
+insn/%.o: CFLAGS := $(filter-out -Wconversion, $(CFLAGS))
else ifeq ($(ARCH),ppc64le)
SOURCES += gcc-plugins/ppc64le-plugin.c
PLUGIN = gcc-plugins/ppc64le-plugin.so
diff --git a/kpatch-build/create-diff-object.c b/kpatch-build/create-diff-object.c
index aedd07d..2707cdb 100644
--- a/kpatch-build/create-diff-object.c
+++ b/kpatch-build/create-diff-object.c
@@ -475,7 +475,6 @@ out:
log_debug("section %s has changed\n", sec->name);
}
-#ifdef __x86_64__
/*
* Determine if a section has changed only due to a WARN* or might_sleep
* macro call's embedding of the line number into an instruction operand.
@@ -586,7 +585,7 @@ static int kpatch_line_macro_change_only(struct section *sec)
return 1;
}
-#elif __powerpc64__
+#if __powerpc64__
#define PPC_INSTR_LEN 4
#define PPC_RA_OFFSET 16
@@ -652,11 +651,6 @@ static int kpatch_line_macro_change_only(struct section *sec)
return 1;
}
-#else
-static int kpatch_line_macro_change_only(struct section *sec)
-{
- return 0;
-}
#endif
static void kpatch_compare_sections(struct list_head *seclist)
@@ -1215,7 +1209,6 @@ static void kpatch_compare_correlated_elements(struct kpatch_elf *kelf)
kpatch_compare_symbols(&kelf->symbols);
}
-#ifdef __x86_64__
static void rela_insn(const struct section *sec, const struct rela *rela,
struct insn *insn)
{
@@ -1239,7 +1232,6 @@ static void rela_insn(const struct section *sec, const struct rela *rela,
return;
}
}
-#endif
static bool is_callback_section(struct section *sec) {
@@ -1785,7 +1777,6 @@ static int jump_table_group_size(struct kpatch_elf *kelf, int offset)
return size;
}
-#ifdef __x86_64__
static int parainstructions_group_size(struct kpatch_elf *kelf, int offset)
{
static int size = 0;
@@ -1820,7 +1811,6 @@ static int smp_locks_group_size(struct kpatch_elf *kelf, int offset)
{
return 4;
}
-#endif
#ifdef __powerpc64__
static int fixup_entry_group_size(struct kpatch_elf *kelf, int offset)
{
@@ -1915,7 +1905,6 @@ static struct special_section special_sections[] = {
.name = "__jump_table",
.group_size = jump_table_group_size,
},
-#ifdef __x86_64__
{
.name = ".smp_locks",
.group_size = smp_locks_group_size,
@@ -1928,7 +1917,6 @@ static struct special_section special_sections[] = {
.name = ".altinstructions",
.group_size = altinstructions_group_size,
},
-#endif
#ifdef __powerpc64__
{
.name = "__ftr_fixup",
--
2.18.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/sticky-rice-wine/kpatch.git
git@gitee.com:sticky-rice-wine/kpatch.git
sticky-rice-wine
kpatch
kpatch
master

搜索帮助