[U-Boot-Users] Size and format of standalone apps

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.

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.

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

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

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

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

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
participants (3)
-
Marc Leeman
-
Robin Gilks
-
Wolfgang Denk