[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] change to test_x86_emulator.c break gcc -fPIC flag, compile err



Hi Jan Beulich:
  sorry for taking so long to response.
  problem here is Gentoo Linux's hardened toolchain turn on -fPIC,
-fPIE flags by default, and here is a simple patch to fix this by
enable no-pic explicitly (I'd rather not touch the assemble code
myself)
  just let me know if you willing to take it(if yes,I could re-send a
patch with proper commit msg), btw, I'm also CCing the original patch
author - Claudio Calvelli.
  downstream bug: https://bugs.gentoo.org/show_bug.cgi?id=522642

--- a/tools/tests/x86_emulator/Makefile 2014-09-20 10:13:14.725597054 +0100
+++ b/tools/tests/x86_emulator/Makefile 2014-09-20 10:13:41.537107466 +0100
@@ -28,7 +28,7 @@
 endif

 $(TARGET): x86_emulate.o test_x86_emulator.o
- $(HOSTCC) -o $@ $^
+ $(HOSTCC) -fno-pie -o $@ $^

 .PHONY: clean
 clean:
@@ -43,7 +43,7 @@
 HOSTCFLAGS += $(CFLAGS_xeninclude)

 x86_emulate.o: x86_emulate.c x86_emulate/x86_emulate.c
x86_emulate/x86_emulate.h
- $(HOSTCC) $(HOSTCFLAGS) -c -g -o $@ $<
+ $(HOSTCC) $(HOSTCFLAGS) -fno-pie -c -g -o $@ $<

 test_x86_emulator.o: test_x86_emulator.c blowfish.h x86_emulate/x86_emulate.h
- $(HOSTCC) $(HOSTCFLAGS) -c -g -o $@ $<
+ $(HOSTCC) $(HOSTCFLAGS) -fno-pie -c -g -o $@ $<

On Tue, Sep 16, 2014 at 5:16 PM, Jan Beulich <JBeulich@xxxxxxxx> wrote:
>  >>> On 16.09.14 at 03:57, <dennis.yxun@xxxxxxxxx> wrote:
>> hello Jan Beulich:
>>
>> following commit break gcc -fPIC flag, but compiles fine if turn it off.
>> I'm using stable-4.4 branch
>
> So where does the -fPIC come from? HOSTCFLAGS doesn't include it
> afaict, and it also doesn't seem very useful for a _test executable_
> like this one. I assume you realize that you passing arbitrary flags
> to gcc to manually compile this file isn't something we really care
> about much: If you were to contribute an acceptable patch to
> address the issue, that would be fine, but unless building within the
> provided build environment fails I don't think we'd spend time on
> finding a solution for you.
>
> Jan
>
>> commit 91a13bcf99d1a47f6f7ccd364b95b1b8500c2be2
>> Author: Jan Beulich <jbeulich@xxxxxxxx>
>> Date:   Fri Aug 22 14:07:36 2014 +0200
>>
>>     x86_emulate: properly do IP updates and other side effects on success
>>
>>
>> x86_emulator # pwd
>> /var/tmp/portage/app-emulation/xen-tools-4.4.1/work/xen-4.4.1/tools/tests/x8
>> 6_emulator
>>  x86_emulator # gcc -Wall -Werror -Wstrict-prototypes -O2
>> -fomit-frame-pointer -fno-strict-aliasing
>> -Wdeclaration-after-statement
>> -I/var/tmp/portage/app-emulation/xen-tools-4.4.1/work/xen-4.4.1/tools/tests/
>> x86_emulator/../../../tools/include
>> -c -fPIC -g -o test_x86_emulator.o test_x86_emulator.c
>> /tmp/ccRSETSJ.s: Assembler messages:
>> /tmp/ccRSETSJ.s:2685: Error: missing or invalid displacement
>> expression `vmovsd_to_mem_len@GOTPCREL'
>> /tmp/ccRSETSJ.s:2782: Error: missing or invalid displacement
>> expression `vmovdqu_from_mem_len@GOTPCREL'
>> /tmp/ccRSETSJ.s:2997: Error: missing or invalid displacement
>> expression `movaps_from_mem_len@GOTPCREL'
>> /tmp/ccRSETSJ.s:3064: Error: missing or invalid displacement
>> expression `movdqu_to_mem_len@GOTPCREL'
>> /tmp/ccRSETSJ.s:3190: Error: missing or invalid displacement
>> expression `movdqu_from_mem_len@GOTPCREL'
>> /tmp/ccRSETSJ.s:3449: Error: missing or invalid displacement
>> expression `movsd_to_mem_len@GOTPCREL'
>> /tmp/ccRSETSJ.s:3557: Error: missing or invalid displacement
>> expression `vmovdqu_to_mem_len@GOTPCREL'
>> /tmp/ccRSETSJ.s:3665: Error: missing or invalid displacement
>> expression `movq_from_mem_len@GOTPCREL'
>> /tmp/ccRSETSJ.s:3829: Error: missing or invalid displacement
>> expression `movq_to_mem_len@GOTPCREL'
>> /tmp/ccRSETSJ.s:4210: Error: missing or invalid displacement
>> expression `vmovaps_from_mem_len@GOTPCREL'
>
>
>

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.