tools/tests/x86_emulator: Pass -no-pie -fno-pic to gcc
PATCH 1/1 tools/tests/x86_emulator: Pass -no-pie -fno-pic to gcc
[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.
--- tools/tests/x86_emulator/Makefile | 1 + 1 file changed, 1 insertion(+)
tools/tests/x86_emulator/Makefile +1 -0
@@ -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 $@ $<
Signature · 7 lines
2.10.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Andrew Cooper writes ("Re: [PATCH] tools/tests/x86_emulator: Pass -no-pie -fno-pic to gcc"):
Quoted 11 lines · Ian Jackson
Quoted 10 lines
Jan Beulich writes ("Re: [PATCH]
tools/tests/x86_emulator: Pass -no-pie -fno-pic to gcc"):Quoted 9 lines
Ian Jackson <[email protected]> 11/01/16 5:46 PM >>>
Quoted 7 lines
tools/tests/x86_emulator/Makefile +0
-0@@ -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
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
-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
[email protected]
https://lists.xen.org/xen-devel
Ian Jackson writes ("[PATCH] tools/tests/x86_emulator: Pass -no-pie -fno-pic to gcc"):
Quoted 2 lines
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
[email protected]
https://lists.xen.org/xen-devel
Ian Jackson writes ("Re: [PATCH for-4.8] tools/tests/x86_emulator: Pass -no-pie -fno-pic to gcc"):
Quoted 4 lines
Ian Jackson writes ("[PATCH]
tools/tests/x86_emulator: Pass -no-pie -fno-pic to gcc"):Quoted 1 line
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
[email protected]
https://lists.xen.org/xen-devel
PATCH v2 1/1 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.
squash! tools/tests/x86_emulator: Pass -no-pie -fno-pic to gcc
--- tools/tests/x86_emulator/Makefile | 4 ++++ 1 file changed, 4 insertions(+)
tools/tests/x86_emulator/Makefile +4 -0
@@ -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 $@ $<
Signature · 7 lines
2.10.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [PATCH for-4.8 v2] tools/tests/x86_emulator: Pass -no-pie -fno-pic to gcc on x86_32
tools/tests/x86_emulator/Makefile x86_emulate/x86_emulate.c x86_emulate/x86_emulate.h: · line 50
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 01.11.16 at 19:00, <[email protected]> wrote:
tools/tests/x86_emulator/Makefile +3
-0@@ -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
[email protected]
https://lists.xen.org/xen-devel