Hi All,
I want to disassembly an uClinux application (.flt file) and after assembler and execute again.
Using the bFLT loader available (with IDA Pro) and following sample code (main.c):
int main(int argc, char **argv)
{
return 0;
}
After pass this code by the toolchain [i) gcc -S main.c, ii) as main.o, iii) ld.exe -elf2flt crti.o crtn.o crt1.o libc.a main.o), the program run without problems in a Coldfire board.
After that, I disassemble the main.flt (obtained from the previous process) with the bFLT loader and IDA (with default options). Later, I produce the assembler code (mainR.s) and I do the following tasks: i) as -M mainR.s, ii) ld.exe -elf2flt, iii) Execute the mainR.flt. In this last task, I get an error if I try to execute the program mainR.flt:
"Unable to read code data bss, errno 22"
The header FLT is:
Magic: bFLT
Rev: 4
Build Date: Mon Feb 18 18:02:34 2013
Entry: 0x50
Data Start: 0x480
Data End: 0x3f
BSS End: 0x3f
Stack Size: 0x1000
Reloc Start: 0x3f
Reloc Count: 0xb
Flags: 0x1 ( Load-to-Ram )
And the original (before use the loader and IDA) is:
Magic: bFLT
Rev: 4
Build Date: Mon Feb 18 17:46:13 2013
Entry: 0x44
Data Start: 0x400
Data End: 0x43c
BSS End: 0x470
Stack Size: 0x1000
Reloc Start: 0x43c
Reloc Count: 0x2f
Flags: 0x1 ( Load-to-Ram )
I'm not sure where the problem is.
Please, if you can give any advices.
Thanks