public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot-Users] Size and format of standalone apps
@ 2004-09-07  4:09 Robin Gilks
  2004-09-07  5:04 ` Marc Leeman
  2004-09-07  7:23 ` Wolfgang Denk
  0 siblings, 2 replies; 7+ messages in thread
From: Robin Gilks @ 2004-09-07  4:09 UTC (permalink / raw)
  To: u-boot

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.

-- 
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.
=======================================================================

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot-Users] Size and format of standalone apps
  2004-09-07  4:09 [U-Boot-Users] Size and format of standalone apps Robin Gilks
@ 2004-09-07  5:04 ` Marc Leeman
  2004-09-08 22:01   ` Robin Gilks
  2004-09-07  7:23 ` Wolfgang Denk
  1 sibling, 1 reply; 7+ messages in thread
From: Marc Leeman @ 2004-09-07  5:04 UTC (permalink / raw)
  To: u-boot

> 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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot-Users] Size and format of standalone apps
  2004-09-07  4:09 [U-Boot-Users] Size and format of standalone apps Robin Gilks
  2004-09-07  5:04 ` Marc Leeman
@ 2004-09-07  7:23 ` Wolfgang Denk
  2004-09-08 22:03   ` Robin Gilks
  1 sibling, 1 reply; 7+ messages in thread
From: Wolfgang Denk @ 2004-09-07  7:23 UTC (permalink / raw)
  To: u-boot

Dear Robin,

in message <413D346D.2030606@tait.co.nz> 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
...

> 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.

> 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.

> 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

-- 
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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot-Users] Size and format of standalone apps
  2004-09-07  5:04 ` Marc Leeman
@ 2004-09-08 22:01   ` Robin Gilks
  2004-09-09  0:17     ` Wolfgang Denk
  0 siblings, 1 reply; 7+ messages in thread
From: Robin Gilks @ 2004-09-08 22:01 UTC (permalink / raw)
  To: u-boot

Marc Leeman wrote:
>>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...

-- 
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.
=======================================================================

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot-Users] Size and format of standalone apps
  2004-09-07  7:23 ` Wolfgang Denk
@ 2004-09-08 22:03   ` Robin Gilks
  2004-09-09  0:16     ` Wolfgang Denk
  0 siblings, 1 reply; 7+ messages in thread
From: Robin Gilks @ 2004-09-08 22:03 UTC (permalink / raw)
  To: u-boot

Wolfgang Denk wrote:

[snip]

>>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 :-))

-- 
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.
=======================================================================

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot-Users] Size and format of standalone apps
  2004-09-08 22:03   ` Robin Gilks
@ 2004-09-09  0:16     ` Wolfgang Denk
  0 siblings, 0 replies; 7+ messages in thread
From: Wolfgang Denk @ 2004-09-09  0:16 UTC (permalink / raw)
  To: u-boot

In message <413F81CD.3050703@tait.co.nz> you wrote:
> 
> > Use a linker script which optimizes the size of the segments.
> 
> I was afraid you'd say that!!

Why?

> 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

-- 
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!

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot-Users] Size and format of standalone apps
  2004-09-08 22:01   ` Robin Gilks
@ 2004-09-09  0:17     ` Wolfgang Denk
  0 siblings, 0 replies; 7+ messages in thread
From: Wolfgang Denk @ 2004-09-09  0:17 UTC (permalink / raw)
  To: u-boot

In message <413F8127.1080703@tait.co.nz> 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

-- 
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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-09-09  0:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-07  4:09 [U-Boot-Users] Size and format of standalone apps Robin Gilks
2004-09-07  5:04 ` Marc Leeman
2004-09-08 22:01   ` Robin Gilks
2004-09-09  0:17     ` Wolfgang Denk
2004-09-07  7:23 ` Wolfgang Denk
2004-09-08 22:03   ` Robin Gilks
2004-09-09  0:16     ` Wolfgang Denk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox