From 0de9a5da0cc278973caabfb9929dc58514c73639 Mon Sep 17 00:00:00 2001 From: Zhipeng Xie 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 --- 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