From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GvDvP-0004Cj-DT for qemu-devel@nongnu.org; Fri, 15 Dec 2006 09:20:35 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GvDvL-00048Q-Lb for qemu-devel@nongnu.org; Fri, 15 Dec 2006 09:20:34 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GvDvL-000487-DT for qemu-devel@nongnu.org; Fri, 15 Dec 2006 09:20:31 -0500 Received: from [209.85.132.250] (helo=an-out-0708.google.com) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GvDvL-0007wm-9I for qemu-devel@nongnu.org; Fri, 15 Dec 2006 09:20:31 -0500 Received: by an-out-0708.google.com with SMTP id d40so457184and for ; Fri, 15 Dec 2006 06:20:30 -0800 (PST) Message-ID: Date: Fri, 15 Dec 2006 15:20:24 +0100 From: "G Portokalidis" Subject: Re: [Qemu-devel] Compiling qemu as position-independent code on an x86_64 linux host In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <61EB814CF63D9642BA6DD5B76DB0894306DA81@mx-met-exch0.scisys.co.uk> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org I managed to compile and use qemu as a shared library for the ii386 user space emulator. I didn't use -fPIC to compile anything and simply generated the lib by adding something like this in Makefile.target: $(CC) -shared -Wl,-soname,libqemu.so.0 -o libqemu.so.0 $(LIBOBJS) -lc I am not sure it should work under all circumstances. It also works when USE_CODE_COPY is not defined. On 14/12/06, G Portokalidis wrote: > Hello Paul, > I also need to use qemu as a shared library, so i was wandering > whether you had any luck with this? > > On 03/11/06, Paul Robinson wrote: > > > > > > > > Hi guys, > > > > I'm trying to use parts of qemu in an application that must be compiled as a > > shared library (i.e. a .so file). > > The code must be compiled with the -fPIC option otherwise the linker refuses > > to create a .so file > > but doing this causes dyngen to stop with the error: > > ../dyngen -o op.h op.o > > dyngen: unsupported X86_64 relocation (9) > > > > In dyngen-exec.h, if I change > > extern int __op_param1, __op_param2, __op_param3; > > to > > static int __op_param1, __op_param2, __op_param3; > > then dyngen stops with > > dyngen: unsupported X86_64 relocation (4) > > > > I suspect that I need to resort to assembly language (as has been done for > > alpha hosts). > > > > My question is: > > Has anyone already done this ? (so I don't have to re-invent the wheel). > > > > The nearest I've found so far is Johannes Schindelin's "Porting QEMU to [a] > > new CPU" guide. > > > > Regards, > > Paul R. > > _______________________________________________ > > Qemu-devel mailing list > > Qemu-devel@nongnu.org > > http://lists.nongnu.org/mailman/listinfo/qemu-devel > > > > > > >