From 0d809c9ac39e4953b941492685c7e177b4f23615 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 1 Nov 2016 16:20:27 +0000 Subject: [PATCH] tools/tests/x86_emulator: Pass -no-pie -fno-pic to gcc on x86_32 The current build fails with GCC6 on Debian sid i386 (unstable): /tmp/ccqjaueF.s: Assembler messages: /tmp/ccqjaueF.s:3713: Error: missing or invalid displacement expression `vmovd_to_reg_len@GOT' This is due to the combination of GCC6, and Debian's decision to enable some hardening flags by default (to try to make runtime addresses less predictable): https://wiki.debian.org/Hardening/PIEByDefaultTransition This is of no benefit for the x86 instruction emulator test, which is a rebuild of the emulator code for testing purposes only. So pass options to disable this. These options will be no-ops if they are the same as the compiler default. On amd64, the -fno-pic breaks the build in a different way. So do this only on i386. Signed-off-by: Ian Jackson CC: Jan Beulich CC: Andrew Cooper Gbp-Pq: Topic misc Gbp-Pq: Name toolstestsx86_emulator-pass--no-pie--fno.patch --- tools/tests/x86_emulator/Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/tests/x86_emulator/Makefile b/tools/tests/x86_emulator/Makefile index 48b3e6dce1..83bc757bb4 100644 --- a/tools/tests/x86_emulator/Makefile +++ b/tools/tests/x86_emulator/Makefile @@ -283,6 +283,10 @@ HOSTCFLAGS-x86_64 := -fno-PIE $(call cc-option-add,HOSTCFLAGS-x86_64,HOSTCC,-no-pie) HOSTCFLAGS += $(CFLAGS_xeninclude) -I. $(HOSTCFLAGS-$(XEN_COMPILE_ARCH)) +ifeq ($(XEN_TARGET_ARCH),x86_32) +HOSTCFLAGS += -no-pie -fno-pic +endif + x86.h := $(addprefix $(XEN_ROOT)/tools/include/xen/asm/,\ x86-vendors.h x86-defns.h msr-index.h) \ $(addprefix $(XEN_ROOT)/tools/include/xen/lib/x86/, \ -- 2.30.2