]> xenbits.xensource.com Git - people/dariof/xen.git/commitdiff
x86emul/test: generate non-pie executable for 64bit builds
authorWei Liu <wei.liu2@citrix.com>
Mon, 25 Sep 2017 10:46:36 +0000 (11:46 +0100)
committerWei Liu <wei.liu2@citrix.com>
Mon, 25 Sep 2017 14:29:04 +0000 (15:29 +0100)
PIE may (and commonly will) result in the binary being loaded above
the 4Gb boundary, which can't work with at least the VZEROUPPER compat
mode test.

Add -fno-PIE and -no-pie when appropriate so that gcc won't generate a
PIE executable.

Reported-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
tools/tests/x86_emulator/Makefile

index fd13ab53b1c76f107e3b02774f7b58d22aee3587..fbe02cd2f923a8056cd6f7ca9a7293ecffdc7b6a 100644 (file)
@@ -76,7 +76,7 @@ $(addsuffix .c,$(SIMD)) $(addsuffix -avx.c,$(filter sse%,$(SIMD))):
        ln -sf simd.c $@
 
 $(TARGET): x86_emulate.o test_x86_emulator.o
-       $(HOSTCC) -o $@ $^
+       $(HOSTCC) $(HOSTCFLAGS) -o $@ $^
 
 .PHONY: clean
 clean:
@@ -98,7 +98,9 @@ asm:
 
 asm/%: asm ;
 
-HOSTCFLAGS += $(CFLAGS_xeninclude) -I.
+HOSTCFLAGS-x86_64 := -fno-PIE
+$(call cc-option-add,HOSTCFLAGS-x86_64,HOSTCC,-no-pie)
+HOSTCFLAGS += $(CFLAGS_xeninclude) -I. $(HOSTCFLAGS-$(XEN_COMPILE_ARCH))
 
 x86.h := asm/x86-vendors.h asm/x86-defns.h asm/msr-index.h
 x86_emulate.h := x86_emulate.h x86_emulate/x86_emulate.h $(x86.h)