From dde4e95fa4c3888971f7439df6b35b036b949b3f Mon Sep 17 00:00:00 2001 From: Kamalesh Babulal Date: Sun, 9 Jul 2017 23:44:12 -0400 Subject: [PATCH] kpatch-build: Build with insn support only on x86_64 kpatch-build/insn provides x86 instruction analysis, disable the analyzer support when build on powerpc. Cc: Josh Poimboeuf Signed-off-by: Kamalesh Babulal --- kpatch-build/Makefile | 10 ++++++++-- kpatch-build/create-diff-object.c | 11 +++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/kpatch-build/Makefile b/kpatch-build/Makefile index 6445cbb..6a1248a 100644 --- a/kpatch-build/Makefile +++ b/kpatch-build/Makefile @@ -7,7 +7,13 @@ TARGETS = create-diff-object create-klp-module create-kpatch-module SOURCES = create-diff-object.c kpatch-elf.c \ create-klp-module.c \ create-kpatch-module.c \ - lookup.c insn/insn.c insn/inat.c + create-kpatch-module.c lookup.c + +ifeq ($(ARCH),x86_64) +SOURCES += insn/insn.c insn/inat.c +INSN = insn/insn.o insn/inat.o +endif + all: $(TARGETS) @@ -17,7 +23,7 @@ all: $(TARGETS) $(CC) -MMD -MP $(CFLAGS) -c -o $@ $< create-diff-object: create-diff-object.o kpatch-elf.o \ - lookup.o insn/insn.o insn/inat.o + lookup.o $(INSN) create-klp-module: create-klp-module.o kpatch-elf.o create-kpatch-module: create-kpatch-module.o kpatch-elf.o diff --git a/kpatch-build/create-diff-object.c b/kpatch-build/create-diff-object.c index e2cb94b..ae3f370 100644 --- a/kpatch-build/create-diff-object.c +++ b/kpatch-build/create-diff-object.c @@ -225,6 +225,7 @@ 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. @@ -330,6 +331,12 @@ 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) { @@ -868,6 +875,7 @@ static void kpatch_compare_correlated_elements(struct kpatch_elf *kelf) kpatch_compare_symbols(&kelf->symbols); } +#ifdef __x86_64__ static void rela_insn(struct section *sec, struct rela *rela, struct insn *insn) { unsigned long insn_addr, start, end, rela_addr; @@ -886,6 +894,9 @@ static void rela_insn(struct section *sec, struct rela *rela, struct insn *insn) return; } } +#else +static void rela_insn(struct section *sec, struct rela *rela, struct insn *insn) { } +#endif /* * Mangle the relas a little. The compiler will sometimes use section symbols