diff mbox

[for-4.8] tools/tests/x86_emulator: Pass -no-pie -fno-pic to gcc

Message ID 20161101162406.11767-1-ian.jackson@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ian Jackson Nov. 1, 2016, 4:24 p.m. UTC
[resending with slightly improved headers]

The current build fails with GCC6 on Debian sid (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.

Signed-off-by: Ian Jackson <ian.jackson@citrix.com>
CC: Jan Beulich <jbeulich@suse.com>
CC: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/tests/x86_emulator/Makefile | 1 +
 1 file changed, 1 insertion(+)

Comments

Ian Jackson Nov. 1, 2016, 5:03 p.m. UTC | #1
Andrew Cooper writes ("Re: [PATCH] tools/tests/x86_emulator: Pass -no-pie -fno-pic to gcc"):
> On 01/11/16 16:58, Ian Jackson wrote:
> > Jan Beulich writes ("Re: [PATCH] tools/tests/x86_emulator: Pass -no-pie -fno-pic to gcc"):
> >> Ian Jackson <ian.jackson@citrix.com> 11/01/16 5:46 PM >>>
> >>> --- a/tools/tests/x86_emulator/Makefile
> >>> +++ b/tools/tests/x86_emulator/Makefile
> >>> @@ -44,6 +44,7 @@ x86_emulate/x86_emulate.c x86_emulate/x86_emulate.h:
> >>> [ -L x86_emulate ] || ln -sf $(XEN_ROOT)/xen/arch/x86/x86_emulate .
> >>  >
> >>> HOSTCFLAGS += $(CFLAGS_xeninclude)
> >>> +HOSTCFLAGS += -no-pie -fno-pic
> >>  
> >> -fno-pic surely has been supported forever, but what about -no-pie? Do all
> >> gcc versions we support / the tools subtree can be built with understand it?
> > TBH, I don't know.  You're the one with the ancient compilers, can you
> > check ? :-)  I don't have a gcc that ancient here and checking will be
> > easier than trying to divine the answer from changelogs.
> 
> Also, any reason why this isn't on-list?

My original mail was mistakenly not on-list.  Jan replied to that
rather than the followup.

Ian.
Ian Jackson Nov. 1, 2016, 5:46 p.m. UTC | #2
Ian Jackson writes ("[PATCH] tools/tests/x86_emulator: Pass -no-pie -fno-pic to gcc"):
> The current build fails with GCC6 on Debian sid (unstable):
> 

Something seems wrong with this patch.  I will get back to you.

Ian.
Ian Jackson Nov. 1, 2016, 5:50 p.m. UTC | #3
Ian Jackson writes ("Re: [PATCH for-4.8] tools/tests/x86_emulator: Pass -no-pie -fno-pic to gcc"):
> Ian Jackson writes ("[PATCH] tools/tests/x86_emulator: Pass -no-pie -fno-pic to gcc"):
> > The current build fails with GCC6 on Debian sid (unstable):
> 
> Something seems wrong with this patch.  I will get back to you.

It breaks the build on amd64.

Ian.
diff mbox

Patch

diff --git a/tools/tests/x86_emulator/Makefile b/tools/tests/x86_emulator/Makefile
index 13ace9a..6281fdf 100644
--- a/tools/tests/x86_emulator/Makefile
+++ b/tools/tests/x86_emulator/Makefile
@@ -44,6 +44,7 @@  x86_emulate/x86_emulate.c x86_emulate/x86_emulate.h:
 	[ -L x86_emulate ] || ln -sf $(XEN_ROOT)/xen/arch/x86/x86_emulate .
 
 HOSTCFLAGS += $(CFLAGS_xeninclude)
+HOSTCFLAGS += -no-pie -fno-pic
 
 x86_emulate.o: x86_emulate.c x86_emulate/x86_emulate.c x86_emulate/x86_emulate.h
 	$(HOSTCC) $(HOSTCFLAGS) -c -g -o $@ $<