qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] Possible?: statically converting i386 ELF object files


From: Paul Brook
Subject: Re: [Qemu-devel] Possible?: statically converting i386 ELF object files to ARM ELF object files
Date: Tue, 19 Apr 2005 12:49:33 +0100
User-agent: KMail/1.7.2

On Tuesday 19 April 2005 10:10, Sebastian Nowozin wrote:
> Hello everybody,
>
> (please quote my email address on a reply to this email, I am not member
> of the list, thanks.)
>
> I have wondered wether the code conversion ability of qemu could be
> utilized to convert ELF .o object files compiled for i386 Linux by GCC
> to .o object files for ARM/Linux.  Is this possible or has something
> been attempted in this direction?
>
> The need for such conversion occurs when porting the Java MIDP to ARM.
> Due to export restrictions, for some cryptography code in the MIDP, only
> linkable object files for i386 are available with the sources.  (Half a
> dozen small object files, clearly named like MD2.o MD5.o SHA1.o, ...).

The short answer is no,it's not possible.

In many cases it is possible to statically convert whole binaries from one 
arch to annother (http://www.complang.tuwien.ac.at/schani/bintrans/).

However in general it is not possible to convert a single object file/library 
then link it with native code. This would require inserting thunks on all the 
calls between native and translated code. To do this you need the full API 
used by the code. ie. what arguments are passed to each function, and how 
these arguments are used. C header files are not sufficient for this purpose 
by themselves.

To call non-native functions you need to use something like libffi 
(http://sources.redhat.com/libffi/), possibly with descriptions autogenerated 
from source annotations.

It would be possible to manually write thunks for a particular interface, but 
it's a lot of work, and has to be redone for every interface.

Paul




reply via email to

[Prev in Thread] Current Thread [Next in Thread]