ARM-ELF -> PE-COFF with objcopy

pps i-love-spam@yandex.ru
Mon Apr 27 09:45:00 GMT 2009


Hello everybody,
I have source for a voice codec and I want to evaluate performance 
difference if compiled with different compilers. Target device is WinCE 
6.0 HTC smartphone (which is arm11).
I decided to try RVCT which produces elf objects, but for wince I need coff.
So, one of the options I have is to convert elf to coff with objcopy.
I downloaded latest binutils and compiled it with support for all 
targets. Then I did this:
objcopy.exe -I elf32-littlearm -O pe-arm-wince-little test.o test.obj
test.cpp was just extern "C" int add(int a, int b) { return a + b; }
Then I tried to link produced test.obj and it doesn't work.

I use VS2008 and the error is: test.obj : fatal error LNK1136: invalid 
or corrupt file

Then I tried to do it different way. First I converted test.o to 
symbolsrec format and then from symbolsrec I converted to 
pe-arm-wince-little. In this case I was able to link to the test.obj, 
but the executable crashes:
         int X2 = add(X, Y);
00011068  ldr         r1, Y, #0x28
0001106C  ldr         r0, X, #0x2C
00011070  bl          |WinMain + 0xfffff000 ( 10000h )|  <- crash

Other than that I tried to use objcopy from gnuarm, codesourcery and 
cegcc distributions hoping that it would work with other binaries but in 
all cases I couldn't get it working.

I also noticed that after I tried to remove some symbols from 
pe-arm-wince-little with strip VS linker would reject updated object 
file as currupted. SO, I think there is some problem in arm-coff part of 
BFD.

Can anybody comment on that, or suggest what I should try?
Thanks



More information about the Binutils mailing list