* [Qemu-devel] Possible?: statically converting i386 ELF object files to ARM ELF object files
@ 2005-04-19 9:10 Sebastian Nowozin
2005-04-19 11:49 ` Paul Brook
2005-04-19 15:53 ` Bob Deblier
0 siblings, 2 replies; 4+ messages in thread
From: Sebastian Nowozin @ 2005-04-19 9:10 UTC (permalink / raw)
To: qemu-devel
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, ...).
Thanks in advance,
Sebastian
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] Possible?: statically converting i386 ELF object files to ARM ELF object files
2005-04-19 9:10 [Qemu-devel] Possible?: statically converting i386 ELF object files to ARM ELF object files Sebastian Nowozin
@ 2005-04-19 11:49 ` Paul Brook
2005-04-19 14:41 ` John Reiser
2005-04-19 15:53 ` Bob Deblier
1 sibling, 1 reply; 4+ messages in thread
From: Paul Brook @ 2005-04-19 11:49 UTC (permalink / raw)
To: qemu-devel; +Cc: Sebastian Nowozin
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] Possible?: statically converting i386 ELF object files to ARM ELF object files
2005-04-19 11:49 ` Paul Brook
@ 2005-04-19 14:41 ` John Reiser
0 siblings, 0 replies; 4+ messages in thread
From: John Reiser @ 2005-04-19 14:41 UTC (permalink / raw)
To: qemu-devel; +Cc: Sebastian Nowozin
Paul Brook wrote:
> On Tuesday 19 April 2005 10:10, Sebastian Nowozin wrote:
[snip]
>>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.
[snip]
>>(Half a dozen small object files, clearly named like MD2.o MD5.o SHA1.o, ...).
> The short answer is no,it's not possible.
[snip]
> 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.
The even shorter answer is: Just do it.
For this particular library, with 6 to 10 particular _leaf_ (!!) functions
(functions that don't call any other functions) whose calling sequence
can be guessed, the translation is easy. Once you get to where qemu
takes care of the tedious part (register and opcode mapping), the rest
(inserting the relocation directives for access to a few static 'const'
arrays) is easy.
--
John Reiser, jreiser@BitWagon.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] Possible?: statically converting i386 ELF object files to ARM ELF object files
2005-04-19 9:10 [Qemu-devel] Possible?: statically converting i386 ELF object files to ARM ELF object files Sebastian Nowozin
2005-04-19 11:49 ` Paul Brook
@ 2005-04-19 15:53 ` Bob Deblier
1 sibling, 0 replies; 4+ messages in thread
From: Bob Deblier @ 2005-04-19 15:53 UTC (permalink / raw)
To: qemu-devel
On Tue, 2005-04-19 at 17:10 +0800, 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, ...).
Wouldn't it be easier to write your own crypto functions conform to the
API used by the platform? All the algorithms you mention above are well
documented.
Sincerely,
Bob Deblier
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-04-19 16:01 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-19 9:10 [Qemu-devel] Possible?: statically converting i386 ELF object files to ARM ELF object files Sebastian Nowozin
2005-04-19 11:49 ` Paul Brook
2005-04-19 14:41 ` John Reiser
2005-04-19 15:53 ` Bob Deblier
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).