Skip to contentSkip to conversation

Size and format of standalone apps

U-Boot-Users Robin Gilks 3 participants 7 messages Sep 7, 2004 – Sep 9, 2004

lore
Share & tools
lore
#0 lore raw

Greetings

I'm seeking illumination in the area of standalone applications.

For example, on powerpc, the hello_world binary is 90% nulls with just a few words on the end.

How can I truncate this to make the code more space efficient or change the link order to not have this vast embedded block of wasted space?

It appears to be associated with libgcc so perhaps there is a way of forcing these functions to be inlined? Is there a way of avoiding them altogether or perhaps since U-Boot has already included them, maybe more vectors to gain access to them?

Many thanks.

Signature · 17 lines
Robin Gilks
Senior Design Engineer          Phone: (+64)(3) 357 1569
Tait Electronics                Fax  :  (+64)(3) 359 4632
PO Box 1645 Christchurch        Email : robin.gilks at tait.co.nz
New Zealand

=======================================================================
This email, including any attachments, is only for the intended
addressee.  It is subject to copyright, is confidential and may be
the subject of legal or other privilege, none of which is waived or
lost by reason of this transmission.
If the receiver is not the intended addressee, please accept our
apologies, notify us by return, delete all copies and perform no
other act on the email.
Unfortunately, we cannot warrant that the email has not been
 altered or corrupted during transmission.
=======================================================================
#1 lore raw
Quoted 4 lines

It appears to be associated with libgcc so perhaps there is a way of forcing these functions to be inlined? Is there a way of avoiding them altogether or perhaps since U-Boot has already included them, maybe more vectors to gain access to them?

If size is a concern, you can try the uclibc alternative for glibc. Though I do not remember of the sizes of the binaries are smaller, the entire system certainly is (half the size or more).

Marc.

#2 lore raw
Quoted 10 lines · Marc Leeman
Quoted 4 lines

It appears to be associated with libgcc so perhaps there is a way of forcing these functions to be inlined? Is there a way of avoiding them altogether or perhaps since U-Boot has already included them, maybe more vectors to gain access to them?

If size is a concern, you can try the uclibc alternative for glibc. Though I do not remember of the sizes of the binaries are smaller, the entire system certainly is (half the size or more).

Unfortunately, U-Boot does not use any libc runtime so glibc or uclibc choices are all void (although I am using uclibc for the rest of my project!).

Thanks for the thought though...

Signature · 17 lines
Robin Gilks
Senior Design Engineer          Phone: (+64)(3) 357 1569
Tait Electronics                Fax  :  (+64)(3) 359 4632
PO Box 1645 Christchurch        Email : robin.gilks at tait.co.nz
New Zealand

=======================================================================
This email, including any attachments, is only for the intended
addressee.  It is subject to copyright, is confidential and may be
the subject of legal or other privilege, none of which is waived or
lost by reason of this transmission.
If the receiver is not the intended addressee, please accept our
apologies, notify us by return, delete all copies and perform no
other act on the email.
Unfortunately, we cannot warrant that the email has not been
 altered or corrupted during transmission.
=======================================================================
#3 lore raw
Quoted 4 lines · In message <[email protected]> you wrote:

Unfortunately, U-Boot does not use any libc runtime so glibc or uclibc choices are all void (although I am using uclibc for the rest of my project!).

Why is it unfortunate to NOT use some libraries we don't need at all?

Best regards,

Wolfgang Denk

Signature · 3 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd at denx.de
I haven't lost my mind -- it's backed up on tape somewhere.
#4 lore raw
In reply to Robin Gilks

Dear Robin,

Quoted 3 lines · in message <[email protected]> you wrote:

For example, on powerpc, the hello_world binary is 90% nulls with just a few words on the end.

Yes, ther eis a pretty huge gap between the .sdata2 and .data segments:

	-> objdump -h hello_world

	hello_world:     file format elf32-big

	Sections:
	Idx Name          Size      VMA       LMA       File off  Algn
	  0 .text         00000228  00040000  00040000  00010000  2**2
			  CONTENTS, ALLOC, LOAD, READONLY, CODE
	  1 .rodata       00000098  00040228  00040228  00010228  2**2
			  CONTENTS, ALLOC, LOAD, READONLY, DATA
	  2 .sdata2       00000000  000402c0  000402c0  000102c0  2**2
                                    ^^^^^^^^^^^^^^^^^^
			  CONTENTS, ALLOC, LOAD, READONLY, DATA
	  3 .data         00000000  000502c0  000502c0  000102c0  2**0
                                    ^^^^^^^^^^^^^^^^^^
			  CONTENTS, ALLOC, LOAD, DATA
	  4 .got2         00000028  000502c0  000502c0  000102c0  2**0
			  CONTENTS, ALLOC, LOAD, DATA
	  5 .sdata        00000000  000502e8  000502e8  000102e8  2**2
			  CONTENTS, ALLOC, LOAD, DATA
	  6 .sbss         00000000  000502e8  000502e8  000102e8  2**0
			  CONTENTS
	  7 .bss          00000000  000502e8  000502e8  000102e8  2**0
			  ALLOC
	  8 .comment      0000007a  00000000  00000000  000102e8  2**0
			  CONTENTS, READONLY

...

Quoted 2 lines

How can I truncate this to make the code more space efficient or change the link order to not have this vast embedded block of wasted space?

Use a linker script which optimizes the size of the segments.

Quoted 1 line

It appears to be associated with libgcc so perhaps there is a way of

No, this has nothing to do with libgcc. It's more a question of how you link the image.

Quoted 3 lines

forcing these functions to be inlined? Is there a way of avoiding them altogether or perhaps since U-Boot has already included them, maybe more vectors to gain access to them?

This is not the problem.

Best regards,

Wolfgang Denk

Signature · 4 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd at denx.de
Just about every computer on the market today runs Unix,  except  the
Mac (and nobody cares about it).                   - Bill Joy 6/21/85
#5 lore raw

Wolfgang Denk wrote:

[snip]

Quoted 6 lines
Quoted 2 lines

How can I truncate this to make the code more space efficient or change the link order to not have this vast embedded block of wasted space?

Use a linker script which optimizes the size of the segments.

I was afraid you'd say that!!

Any examples that might get me started - what little I have played with gcc linker scripts has involved too much black magic, prod and pray and outrright guesswork to start a script from scratch :-))

Signature · 17 lines
Robin Gilks
Senior Design Engineer          Phone: (+64)(3) 357 1569
Tait Electronics                Fax  :  (+64)(3) 359 4632
PO Box 1645 Christchurch        Email : robin.gilks at tait.co.nz
New Zealand

=======================================================================
This email, including any attachments, is only for the intended
addressee.  It is subject to copyright, is confidential and may be
the subject of legal or other privilege, none of which is waived or
lost by reason of this transmission.
If the receiver is not the intended addressee, please accept our
apologies, notify us by return, delete all copies and perform no
other act on the email.
Unfortunately, we cannot warrant that the email has not been
 altered or corrupted during transmission.
=======================================================================
#6 lore raw
Quoted 4 lines · In message <[email protected]> you wrote:
Quoted 2 lines

Use a linker script which optimizes the size of the segments.

I was afraid you'd say that!!

Why?

Quoted 3 lines

Any examples that might get me started - what little I have played with gcc linker scripts has involved too much black magic, prod and pray and outrright guesswork to start a script from scratch :-))

See board/*/u-boot.lds

Best regards,

Wolfgang Denk

Signature · 5 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd at denx.de
Prof:        So the American government went to IBM to come up with a
             data encryption standard and they came up with ...
Student:     EBCDIC!