On Mon, Apr 24, 2006 at 02:37:21PM -0600, Ronald G Minnich wrote:
> This program:
>
> compiles to a 512KB binary on linux with -static
glibc is bloated, printf and strtoul are also quite large. Try dietlibc
; diet gcc -c -Os testit.c
; size testit.o
text data bss dec hex filename
289 0 0 289 121 testit.o
; diet gcc -o testit -s -Os testit.c
; size testit
text data bss dec hex filename
9620 0 12 9632 25a0 testit
So the libraries come to over 9k, and there is still some
crud in the image:
; objdump -h testit
testit: file format elf32-i386
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 00001548 080480a0 080480a0 000000a0 2**4
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .rodata 00000ff4 08049600 08049600 00001600 2**5
CONTENTS, ALLOC, LOAD, READONLY, DATA
2 .data 00000000 0804b5f4 0804b5f4 000025f4 2**2
CONTENTS, ALLOC, LOAD, DATA
3 .eh_frame 00000058 0804b5f4 0804b5f4 000025f4 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
4 .bss 0000000c 0804b650 0804b650 00002650 2**3
ALLOC
5 .comment 0000005d 00000000 00000000 00002650 2**0
CONTENTS, READONLY
Why do I need an exception handler frame (assuming that is what
the name means)?
DF