qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] Compiling qemu as position-independent code on an x86_64 linux host
@ 2006-11-03 18:15 ` Paul Robinson
  2006-11-03 21:42   ` Paul Brook
  2006-12-14 12:10   ` G Portokalidis
  0 siblings, 2 replies; 6+ messages in thread
From: Paul Robinson @ 2006-11-03 18:15 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 855 bytes --]

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.

[-- Attachment #2: Type: text/html, Size: 1976 bytes --]

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

* Re: [Qemu-devel] Compiling qemu as position-independent code on an x86_64 linux host
  2006-11-03 18:15 ` [Qemu-devel] Compiling qemu as position-independent code on an x86_64 linux host Paul Robinson
@ 2006-11-03 21:42   ` Paul Brook
  2006-11-04  4:21     ` Daniel Jacobowitz
  2006-12-14 12:10   ` G Portokalidis
  1 sibling, 1 reply; 6+ messages in thread
From: Paul Brook @ 2006-11-03 21:42 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paul Robinson

On Friday 03 November 2006 18:15, 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)

More likely you just need to implement whetever relocation it's complaining 
about.

Paul

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

* Re: [Qemu-devel] Compiling qemu as position-independent code on an x86_64 linux host
  2006-11-03 21:42   ` Paul Brook
@ 2006-11-04  4:21     ` Daniel Jacobowitz
  0 siblings, 0 replies; 6+ messages in thread
From: Daniel Jacobowitz @ 2006-11-04  4:21 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paul Robinson

On Fri, Nov 03, 2006 at 09:42:18PM +0000, Paul Brook wrote:
> On Friday 03 November 2006 18:15, 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)
> 
> More likely you just need to implement whetever relocation it's complaining 
> about.

This is dyngen we're talking about - presumably that isn't the bit that
needs to be PIC?  Looks to me like the op file was compiled with the
PIC CFLAGS.

-- 
Daniel Jacobowitz
CodeSourcery

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

* Re: [Qemu-devel] Compiling qemu as position-independent code on an x86_64 linux host
  2006-11-03 18:15 ` [Qemu-devel] Compiling qemu as position-independent code on an x86_64 linux host Paul Robinson
  2006-11-03 21:42   ` Paul Brook
@ 2006-12-14 12:10   ` G Portokalidis
  2006-12-15 14:20     ` G Portokalidis
  1 sibling, 1 reply; 6+ messages in thread
From: G Portokalidis @ 2006-12-14 12:10 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paul.Robinson

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 <Paul.Robinson@scisys.co.uk> 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
>
>
>

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

* RE: [Qemu-devel] Compiling qemu as position-independent code on an x86_64 linux host
@ 2006-12-14 12:44 Paul Robinson
  0 siblings, 0 replies; 6+ messages in thread
From: Paul Robinson @ 2006-12-14 12:44 UTC (permalink / raw)
  To: G Portokalidis; +Cc: qemu-devel

> 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 <Paul.Robinson@scisys.co.uk> wrote:
> >
...

Hello Georgios,
The short answer is not yet. I made a start but then had to do other
things.
I'll be looking at this again soon (hopefully in December) and will post
the diffs to the list.

Regards,
Paul R.

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

* Re: [Qemu-devel] Compiling qemu as position-independent code on an x86_64 linux host
  2006-12-14 12:10   ` G Portokalidis
@ 2006-12-15 14:20     ` G Portokalidis
  0 siblings, 0 replies; 6+ messages in thread
From: G Portokalidis @ 2006-12-15 14:20 UTC (permalink / raw)
  To: qemu-devel

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 <georgios.portokalidis@gmail.com> 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 <Paul.Robinson@scisys.co.uk> 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
> >
> >
> >
>

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

end of thread, other threads:[~2006-12-15 14:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <Acb/dAolzRfkXTlURPONQ+3dZHSUZA==>
2006-11-03 18:15 ` [Qemu-devel] Compiling qemu as position-independent code on an x86_64 linux host Paul Robinson
2006-11-03 21:42   ` Paul Brook
2006-11-04  4:21     ` Daniel Jacobowitz
2006-12-14 12:10   ` G Portokalidis
2006-12-15 14:20     ` G Portokalidis
2006-12-14 12:44 Paul Robinson

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).