On 29. Aug 2019, at 16:34, Konrad Rzeszutek Wilk > wrote: …snip... + +struct livepatch_func __section(".livepatch.funcs") livepatch_exceptions = { + .version = LIVEPATCH_PAYLOAD_VERSION, + .name = livepatch_exceptions_str, + .new_addr = xen_hello_world, + .old_addr = xen_extra_version, + .new_size = EXPECT_BYTES_COUNT, + .old_size = EXPECT_BYTES_COUNT, + .expect = { + .enabled = 1, + .len = EXPECT_BYTES_COUNT, + .data = EXPECT_BYTES + }, + +}; When I compile with 32-bit ARM 'make tests' I get: arm-eabi-ld -EL -EL --build-id=sha1 -r -o xen_action_hooks_norevert.livepatch xen_action_hooks_marker.o xen_hello_world_func.o note.o xen_note.o make[3]: Circular expect_config.h <- xen_expectations.o dependency dropped. objdump: can't disassemble for architecture UNKNOWN! (set -e; \ echo "#define EXPECT_BYTES {"; \ echo "#define EXPECT_BYTES_COUNT 6") > expect_config.h arm-eabi-gcc -marm -DBUILD_ID -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -Wno-unused-but-set-variable -Wno-unused-local-typedefs -O1 -fno-omit-frame-pointer -nostdinc -fno-builtin -fno-common -Werror -Wredundant-decls -Wno-pointer-arith -Wvla -pipe -D__XEN__ -include /home/konrad/A20/xen.git/xen/include/xen/config.h '-D__OBJECT_FILE__="xen_expectations.o"' -Wa,--strip-local-absolute -g -MMD -MF ./.xen_expectations.o.d -msoft-float -mcpu=cortex-a15 -DCONFIG_EARLY_PRINTK -DEARLY_PRINTK_INC=\"debug-8250.inc\" -DEARLY_PRINTK_BAUD= -DEARLY_UART_BASE_ADDRESS=0x01c28000 -DEARLY_UART_REG_SHIFT=2 -I/home/konrad/A20/xen.git/xen/include -fno-stack-protector -fno-exceptions -Wnested-externs -DGCC_HAS_VISIBILITY_ATTRIBUTE -marm -DBUILD_ID -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -Wno-unused-but-set-variable -Wno-unused-local-typedefs -c xen_expectations.c -o xen_expectations.o xen_expectations.c:31:2: error: expected '}' before ';' token }; ^ xen_expectations.c:18:76: note: to match this '{' struct livepatch_func __section(".livepatch.funcs") livepatch_exceptions = { ^ make[3]: *** [/home/konrad/A20/xen.git/xen/Rules.mk:202: xen_expectations.o] Error 1 make[3]: Leaving directory '/home/konrad/A20/xen.git/xen/test/livepatch' And this is what expect_config.h looks like: #define EXPECT_BYTES { #define EXPECT_BYTES_COUNT 6 Hi Konrad, I think I fixed it with the following change on top: [DIFF START] diff --git a/xen/test/livepatch/Makefile b/xen/test/livepatch/Makefile index 067861903f..20bdeb6c6d 100644 --- a/xen/test/livepatch/Makefile +++ b/xen/test/livepatch/Makefile @@ -186,10 +186,17 @@ xen_actions_hooks_norevert.o: config.h $(LIVEPATCH_ACTION_HOOKS_NOREVERT): xen_action_hooks_marker.o xen_hello_world_func.o note.o xen_note.o $(LD) $(LDFLAGS) $(build_id_linker) -r -o $(LIVEPATCH_ACTION_HOOKS_NOREVERT) $^ -CODE_GET_EXPECT=$(shell objdump -d --insn-width=1 $(1) | grep -A6 -E '<'$(2)'>:' | tail -n +2 | awk 'BEGIN {printf "{"} {printf "0x%s,", $$2}' | sed 's/,$$/}/g') +ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm) +INSN_WIDTH := 4 +INSN_PER_LINE := 2 +else +INSN_WIDTH := 1 +INSN_PER_LINE := 8 +endif +CODE_GET_EXPECT=$(shell $(OBJDUMP) -d --insn-width=$(INSN_WIDTH) $(1) | sed -n -e '/<'$(2)'>:$$/,/^$$/ p' | tail -n +2 | head -n $(INSN_PER_LINE) | awk '{printf "%s", $$2}' | sed 's/.\{2\}/0x&,/g' | sed 's/^/{/;s/,$$/}/g') .PHONY: expect_config.h expect_config.h: EXPECT_BYTES=$(call CODE_GET_EXPECT,$(BASEDIR)/xen-syms,xen_extra_version) -expect_config.h: EXPECT_BYTES_COUNT=6 +expect_config.h: EXPECT_BYTES_COUNT=8 expect_config.h: xen_expectations.o (set -e; \ echo "#define EXPECT_BYTES $(EXPECT_BYTES)"; \ [DIFF END] I will test that some more and add it to the v3 of the patchset. Best Regards, Pawel Wieczorkiewicz Amazon Development Center Germany GmbH Krausenstr. 38 10117 Berlin Geschaeftsfuehrung: Christian Schlaeger, Ralf Herbrich Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B Sitz: Berlin Ust-ID: DE 289 237 879