xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH for-4.8] tools/tests/x86_emulator: Pass -no-pie -fno-pic to gcc
@ 2016-11-01 16:24 Ian Jackson
       [not found] ` <5818C78C02000078000F265E@prv-mh.provo.novell.com>
  2016-11-01 17:46 ` [PATCH for-4.8] " Ian Jackson
  0 siblings, 2 replies; 6+ messages in thread
From: Ian Jackson @ 2016-11-01 16:24 UTC (permalink / raw)
  Cc: Ian Jackson, Jan Beulich, Andrew Cooper

[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(+)

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 $@ $<
-- 
2.10.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] tools/tests/x86_emulator: Pass -no-pie -fno-pic to gcc
       [not found]     ` <38fba51a-deb2-4346-884d-77ddd86f1594@citrix.com>
@ 2016-11-01 17:03       ` Ian Jackson
  0 siblings, 0 replies; 6+ messages in thread
From: Ian Jackson @ 2016-11-01 17:03 UTC (permalink / raw)
  To: Andrew Cooper; +Cc: xen-devel, Jan Beulich

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.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH for-4.8] tools/tests/x86_emulator: Pass -no-pie -fno-pic to gcc
  2016-11-01 16:24 [PATCH for-4.8] tools/tests/x86_emulator: Pass -no-pie -fno-pic to gcc Ian Jackson
       [not found] ` <5818C78C02000078000F265E@prv-mh.provo.novell.com>
@ 2016-11-01 17:46 ` Ian Jackson
  2016-11-01 17:50   ` Ian Jackson
  1 sibling, 1 reply; 6+ messages in thread
From: Ian Jackson @ 2016-11-01 17:46 UTC (permalink / raw)
  To: xen-devel; +Cc: Andrew Cooper, Jan Beulich

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.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH for-4.8] tools/tests/x86_emulator: Pass -no-pie -fno-pic to gcc
  2016-11-01 17:46 ` [PATCH for-4.8] " Ian Jackson
@ 2016-11-01 17:50   ` Ian Jackson
  2016-11-01 18:00     ` [PATCH for-4.8 v2] tools/tests/x86_emulator: Pass -no-pie -fno-pic to gcc on x86_32 Ian Jackson
  0 siblings, 1 reply; 6+ messages in thread
From: Ian Jackson @ 2016-11-01 17:50 UTC (permalink / raw)
  To: xen-devel, Jan Beulich, Andrew Cooper

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.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH for-4.8 v2] tools/tests/x86_emulator: Pass -no-pie -fno-pic to gcc on x86_32
  2016-11-01 17:50   ` Ian Jackson
@ 2016-11-01 18:00     ` Ian Jackson
  2016-11-02  9:02       ` Jan Beulich
  0 siblings, 1 reply; 6+ messages in thread
From: Ian Jackson @ 2016-11-01 18:00 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson, Jan Beulich, Andrew Cooper

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 <ian.jackson@citrix.com>
CC: Jan Beulich <jbeulich@suse.com>
CC: Andrew Cooper <andrew.cooper3@citrix.com>

squash! tools/tests/x86_emulator: Pass -no-pie -fno-pic to gcc

Signed-off-by: Ian Jackson <ian.jackson@citrix.com>
---
 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 13ace9a..d349c0f 100644
--- a/tools/tests/x86_emulator/Makefile
+++ b/tools/tests/x86_emulator/Makefile
@@ -45,6 +45,10 @@ x86_emulate/x86_emulate.c x86_emulate/x86_emulate.h:
 
 HOSTCFLAGS += $(CFLAGS_xeninclude)
 
+ifeq ($(XEN_TARGET_ARCH),x86_32)
+HOSTCFLAGS += -no-pie -fno-pic
+endif
+
 x86_emulate.o: x86_emulate.c x86_emulate/x86_emulate.c x86_emulate/x86_emulate.h
 	$(HOSTCC) $(HOSTCFLAGS) -c -g -o $@ $<
 
-- 
2.10.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH for-4.8 v2] tools/tests/x86_emulator: Pass -no-pie -fno-pic to gcc on x86_32
  2016-11-01 18:00     ` [PATCH for-4.8 v2] tools/tests/x86_emulator: Pass -no-pie -fno-pic to gcc on x86_32 Ian Jackson
@ 2016-11-02  9:02       ` Jan Beulich
  0 siblings, 0 replies; 6+ messages in thread
From: Jan Beulich @ 2016-11-02  9:02 UTC (permalink / raw)
  To: Ian Jackson; +Cc: Andrew Cooper, xen-devel

>>> On 01.11.16 at 19:00, <ian.jackson@citrix.com> wrote:
> --- a/tools/tests/x86_emulator/Makefile
> +++ b/tools/tests/x86_emulator/Makefile
> @@ -45,6 +45,10 @@ x86_emulate/x86_emulate.c x86_emulate/x86_emulate.h:
>  
>  HOSTCFLAGS += $(CFLAGS_xeninclude)
>  
> +ifeq ($(XEN_TARGET_ARCH),x86_32)
> +HOSTCFLAGS += -no-pie -fno-pic
> +endif

I've quickly tried with gcc 4.3.4, and that one doesn't appear to know
of -no-pie. And then I went through some older gcc builds I still have
around, and to my surprise even 5.x doesn't seem to know of the
option yet (i.e. only 6.x really does).

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-11-02  9:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-01 16:24 [PATCH for-4.8] tools/tests/x86_emulator: Pass -no-pie -fno-pic to gcc Ian Jackson
     [not found] ` <5818C78C02000078000F265E@prv-mh.provo.novell.com>
     [not found]   ` <22552.51627.491295.371723@mariner.uk.xensource.com>
     [not found]     ` <38fba51a-deb2-4346-884d-77ddd86f1594@citrix.com>
2016-11-01 17:03       ` [PATCH] " Ian Jackson
2016-11-01 17:46 ` [PATCH for-4.8] " Ian Jackson
2016-11-01 17:50   ` Ian Jackson
2016-11-01 18:00     ` [PATCH for-4.8 v2] tools/tests/x86_emulator: Pass -no-pie -fno-pic to gcc on x86_32 Ian Jackson
2016-11-02  9:02       ` Jan Beulich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).