We need to two things: 1) Wrap the platform-specific objcopy paramters in defines The input and output parmeters for $(OBJCOPY) are different based on the platforms. As such provide them in the OBJCOPY_MAGIC define and use that.
2) The alternative is a bit different and there are no exceptions under ARM. We are not yet attempting to build them under ARM32 so that is still ifdefed out. Signed-off-by: Konrad Rzeszutek Wilk <[email protected]> --- Cc: Andrew Cooper <[email protected]> Cc: George Dunlap <[email protected]> Cc: Ian Jackson <[email protected]> Cc: Jan Beulich <[email protected]> Cc: Konrad Rzeszutek Wilk <[email protected]> Cc: Stefano Stabellini <[email protected]> Cc: Tim Deegan <[email protected]> Cc: Wei Liu <[email protected]> v1: First submission --- xen/common/Makefile | 2 +- xen/common/test/Makefile | 10 ++++++++-- xen/common/test/xen_hello_world_func.c | 7 ++++++- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/xen/common/Makefile b/xen/common/Makefile index 22806b6..fe83653 100644 --- a/xen/common/Makefile +++ b/xen/common/Makefile @@ -82,6 +82,6 @@ subdir-$(CONFIG_HAS_DEVICE_TREE) += libfdt .PHONY: tests tests: -ifeq ($(XEN_TARGET_ARCH),x86_64) +ifneq ($(XEN_TARGET_ARCH),arm32) $(MAKE) -f $(BASEDIR)/Rules.mk -C test livepatch endif diff --git a/xen/common/test/Makefile b/xen/common/test/Makefile index 23dff1d..3eed6dd 100644 --- a/xen/common/test/Makefile +++ b/xen/common/test/Makefile @@ -1,5 +1,11 @@ include $(XEN_ROOT)/Config.mk +ifeq ($(XEN_TARGET_ARCH),x86_64) +OBJCOPY_MAGIC := -I binary -O elf64-x86-64 -B i386:x86-64 +else +OBJCOPY_MAGIC := -I binary -O elf64-littleaarch64 -B aarch64 +endif + CODE_ADDR=$(shell nm --defined $(1) | grep $(2) | awk '{print "0x"$$1}') CODE_SZ=$(shell nm --defined -S $(1) | grep $(2) | awk '{ print "0x"$$2}') @@ -54,7 +60,7 @@ $(LIVEPATCH): xen_hello_world_func.o xen_hello_world.o note.o .PHONY: note.o note.o: $(OBJCOPY) -O binary --only-section=.note.gnu.build-id $(BASEDIR)/xen-syms [email protected] - $(OBJCOPY) -I binary -O elf64-x86-64 -B i386:x86-64 \ + $(OBJCOPY) $(OBJCOPY_MAGIC) \ --rename-section=.data=.livepatch.depends -S [email protected] $@ rm -f [email protected] @@ -65,7 +71,7 @@ note.o: .PHONY: hello_world_note.o hello_world_note.o: $(LIVEPATCH) $(OBJCOPY) -O binary --only-section=.note.gnu.build-id $(LIVEPATCH) [email protected] - $(OBJCOPY) -I binary -O elf64-x86-64 -B i386:x86-64 \ + $(OBJCOPY) $(OBJCOPY_MAGIC) \ --rename-section=.data=.livepatch.depends -S [email protected] $@ rm -f [email protected] diff --git a/xen/common/test/xen_hello_world_func.c b/xen/common/test/xen_hello_world_func.c index 03d6b84..0e1a722 100644 --- a/xen/common/test/xen_hello_world_func.c +++ b/xen/common/test/xen_hello_world_func.c @@ -6,14 +6,17 @@ #include <xen/types.h> #include <asm/alternative.h> +#ifdef CONFIG_X86 #include <asm/nops.h> #include <asm/uaccess.h> static unsigned long *non_canonical_addr = (unsigned long *)0xdead000000000000ULL; +#endif /* Our replacement function for xen_extra_version. */ const char *xen_hello_world(void) { +#ifdef CONFIG_X86 unsigned long tmp; int rc; @@ -24,7 +27,9 @@ const char *xen_hello_world(void) */ rc = __get_user(tmp, non_canonical_addr); BUG_ON(rc != -EFAULT); - +#else + asm(ALTERNATIVE("nop", "nop", 1)); +#endif return "Hello World"; } -- 2.4.11 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
