This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: arm-elf-gcc comprehension
Hi again,
So i work on my problem !! but i see a strange thinks !!
When i make this command,
arm-elf-gcc -c test.c -ggdb -Wall
Normally it generate a "test.o" object file !!! but by hazardous way i see that it's already an elf
executable file
I test it with "arm-elf-size test.o"
>> text data bss dec hex filename
>> 84 0 0 84 54 test.o
and with "arm-elf-readelf -S test.o"
>> Section Headers:
>> [Nr] Name Type Addr Off Size ES Flg Lk Inf Al
>> [ 0] NULL 00000000 000000 000000 00 0 0 0
>> [ 1] .text PROGBITS 00000000 000034 000054 00 AX 0 0 4
>> [ 2] .rel.text REL 00000000 00064c 000028 08 15 1 4
>> [ 3] .data PROGBITS 00000000 000088 000000 00 WA 0 0 1
>> [ 4] .bss NOBITS 00000000 000088 000000 00 WA 0 0 1
>> [ 5] .debug_abbrev PROGBITS 00000000 000088 000045 00 0 0 1
>> [ 6] .debug_info PROGBITS 00000000 0000cd 00007b 00 0 0 1
>> [ 7] .rel.debug_info REL 00000000 000674 000030 08 15 6 4
>> [ 8] .debug_line PROGBITS 00000000 000148 000066 00 0 0 1
>> [ 9] .rel.debug_line REL 00000000 0006a4 000040 08 15 8 4
>> [10] .debug_pubnames PROGBITS 00000000 0001ae 00001b 00 0 0 1
>>[11] .rel.debug_pubnam REL 00000000 0006e4 000008 08 15 a 4
>> [12] .debug_aranges PROGBITS 00000000 0001c9 000020 00 0 0 1
>> [13] .rel.debug_arange REL 00000000 0006ec 000010 08 15 c 4
>> [14] .shstrtab STRTAB 00000000 0001e9 0000c2 00 0 0 1
>> [15] .symtab SYMTAB 00000000 000554 0000d0 10 16 b 4
>>[16] .strtab STRTAB 00000000 000624 000027 00 0 0 1
and i can simulate it on arm-elf-gdb !!!
WHAT IS HAPPENED !!!??? Why it's an elf-executable ? and not an object file ???
best regards,
Sébastien.
ANDRE Sébastien wrote:
> Hi all,
>
> So i try a test with "arm-elf-gdb" and "arm-elf-gcc" !!
>
> Typically i write a basycally C program like it
>
> int main()
> { int a;
> while (a < 5000)
> { a++ ; }
> return a;
> }
>
> ==> a program without stdlib, stdio, etc ..... :-)
>
> So i want to compile and build it for arm processor but NOT for eCos Kernel !!
> I want only arm executable file (it possible normally ?)
>
> and after my idea is to try to simulate it on gdb (normally it's possible now because no really hardware
> dependant exept arm core ! ?)
> If i'm wrong somewhere again !! say me it !
>
> So i build around like it :
> arm-elf-gcc -c test.c -o test.o -ggdb -Wall
> arm-elf-gcc -Wl,--gc-sections -o test test.o -nostdlib
>
> PS: i try without "-Wl,--gcc-sections" but if i suppress it i have an error build process like it :
> test.o: In function `main':
> /root/test/test.c:4: undefined reference to `__gccmain'
> collect2: ld returned 1 exit status
>
> An executalble file is generate ..... but i have two mistake (in reallity only one i think)
>
> If i try to simulate it (debug) on gdb with this procedure
> arm-elf-gdb test
> > target sim
> > load
>
> i have this error :
> gdbsim: no loadable sections "/root/test/test"
> unable to load program
>
> So now for see if i have some sections i launch this command :
> arm-elf-size test
> and say it :
>
> text data bss dec hex filename
> 0 0 0 0 0 test
>
> So what i miss for build correctly my elf executable files ?
>
> So i know that isn't really an eCos problem but i thanks you if somebody can help me..
>
> bestregards,
> Sébastien.