This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ARM-ELF -> PE-COFF with objcopy


Dave Korn wrote:
Ian Lance Taylor wrote:

I don't really understand what you are trying to do or why you are using
ELF at all.  Why not just compile your code into PE format in the first
place?

It's all simple, I wrote an optimized version of a voice codec (amr-nb) for arm. In our project performance of the codec is *very* important, because on a simple mobile we need to decode and encode realtime multiple speech streams simultaneously (project requirement). We obtained a commercial product from one of the companies and they charge for it around 15-25K for optimized version for arm-wince. I have lots of experience working with voice codecs and I was given a task to try to optimize it even more. So far, I already beat the comercial version by around 20% while my implementation is more conformant to the specs (bit exact).
With MS compiler I'm quite limited in ARM instructionset, it even rejects some of the asm functions and it doesn't support inline assembler in wince. While inspecting produced assembly listing I see some room for improvement. So, I decided to try some other compilers and see if the results are worse or better. I didn't even try gcc-ce yet, because I don't think it would be able to beat ms compiler in optimizations; the RVCT from arm.com seems to be a good choice in my case - it's ARM only compiler and optimized for arm architecture. I also was curious myself which one of them would generate better code. The only problem is that it generates ELF binaries and in wince I need pe-coff. I wrote my code in a way that it doesn't have any dependencies, it's a bunch of static const tables with data and a few functions. It doesn't allocate/free any memory dynamically also. So, I was thinking that all I need is to somehow extract the binary code and try to run it :)
I also tried to produce assembly listing with RVCT, but ms assembler for arm rejects some of the instructions. Maybe I should try gnu assembler from cegcc for that?


The only realistic way that you can create a PE DLL is to compile code
with a PE compiler.  Otherwise you aren't going to get the right code
sequences and relocations.  It is theoretically possible to pursue other
paths but they are all going to be complex and difficult.

What about this whole ELF->PE post-linking stuff that symbian arm-eabi targets apparently do? Could that be adapted for wince?


Maybe that was on older devices, but right now I checked binaries produced for symbian and they are elf, not PE (I check it by opening in notepad to see ELF at the beginning :))


What surprises me is this: gcc is able to take lots of lots c++ files, preprocess them, compile etc... then link produced object files. It understands all the formats, so, why not to take produced object code from an ELF object and link it... producing a PE-coff executable??


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]