This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos 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: strange size issue (i386 vs ARM)


>>>>> "Mandeep" == Mandeep Sandhu <mandeepsandhu.chd@gmail.com> writes:

    Mandeep> Look at the size output for the _same_ app compiled with
    Mandeep> the Linux Synthetic target:

    Mandeep> $ i386-elf-size myapp
    Mandeep>    text	   data	    bss	    dec	    hex	filename
    Mandeep>  103690	   7328	8381268	8492286	 8194fe	myapp

    Mandeep> The text size of the ARM binary (~127KB) is
    Mandeep> understandably larger than the i386 one (~102 KB).

    Mandeep> But how come the data+bss value is so different!?!? The
    Mandeep> i386 one is more than 8MB!

    Mandeep> Is this expected? I'm still googling to find the answer.

On real embedded targets the memory is physical. Not so on the
synthetic target. Somehow or other the executable's ELF header info
must tell the Linux OS to allocate 8MB of memory for the emulated
target's RAM. Without that things like malloc() would not work, at
least not without playing nasty games with mmap() at run-time. The
easiest way to make things work is to make it seem like data+bss
occupy all of 8MB, irrespective of the application's actual static
data requirements. The surplus over 8MB reported by size is likely to
be const data and the like which the linker script places in the
read-only code region.

This could probably be fixed if it was really necessary, but it would
be non-trivial and I don't recall anybody reporting the issue in the
past. Generally memory usage on the synthetic target will not give an
accurate indication of memory usage on real targets because of the
need for much larger stack sizes etc. - I won't go into all the
unpleasant details.

Bart

-- 
Bart Veer                                   eCos Configuration Architect
eCosCentric Limited    The eCos experts      http://www.ecoscentric.com/
Barnwell House, Barnwell Drive, Cambridge, UK.      Tel: +44 1223 245571
Registered in England and Wales: Reg No 4422071.
       >>>> Visit us at ESC-UK  http://www.embedded.co.uk <<<<
       >>>> Oct 7-8 on Stand 433 at FIVE ISC, Farnborough <<<<

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


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