Hi. I'm trying to compile this program: int main() { int i, j; for (i = 0; i < 100; i++) { j = j+1; } return 0; }
arm-elf-gcc -s -Os -o test.elf test.c produces a program with the following output from arm-elf-size: text data bss dec hex filename 5484 1872 184 7540 1d74 test.elf
Also, tracing the linking: (arm-elf-gcc -s -Os -Wl,--trace -o test.elf test.c) /export/home1/jamesl/arm/arm-elf/bin/ld: mode armelf /export/home1/jamesl/arm/lib/gcc-lib/arm-elf/2.95.3/crtbegin.o /export/home1/jamesl/arm/arm-elf/lib/crt0.o /tmp/cc9r4g2Q.o (/export/home1/jamesl/arm/lib/gcc-lib/arm-elf/2.95.3/libgcc.a)__main.o (/export/home1/jamesl/arm/lib/gcc-lib/arm-elf/2.95.3/libgcc.a)_exit.o (/export/home1/jamesl/arm/arm-elf/lib/libc.a)atexit.o (/export/home1/jamesl/arm/arm-elf/lib/libc.a)exit.o (/export/home1/jamesl/arm/arm-elf/lib/libc.a)impure.o (/export/home1/jamesl/arm/arm-elf/lib/libc.a)malloc.o (/export/home1/jamesl/arm/arm-elf/lib/libc.a)mallocr.o (/export/home1/jamesl/arm/arm-elf/lib/libc.a)memset.o (/export/home1/jamesl/arm/arm-elf/lib/libc.a)mlock.o (/export/home1/jamesl/arm/arm-elf/lib/libc.a)sbrkr.o (/export/home1/jamesl/arm/arm-elf/lib/libc.a)syscalls.o (/export/home1/jamesl/arm/arm-elf/lib/libc.a)errno.o (/export/home1/jamesl/arm/arm-elf/lib/libc.a)freer.o (/export/home1/jamesl/arm/lib/gcc-lib/arm-elf/2.95.3/libgcc.a)_udivsi3.o (/export/home1/jamesl/arm/lib/gcc-lib/arm-elf/2.95.3/libgcc.a)_dvmd_tls. o /export/home1/jamesl/arm/lib/gcc-lib/arm-elf/2.95.3/crtend.o
Is there anyway to prevent all these calls?
5484 bytes of code and 1872 bytes of data for a small program like that is crazy!I suspect the problem is the _exit() call in crt0.S
Does anyone have a workaround for this. I'm using newlib-1.8.1 as my libc.
Thanks.
Please CC me for I"m not subscribed to the list.
--James Lamanna