This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.
See the CrossGCC FAQ for lots more information.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
"Aaron J. Grier" wrote: > > On Thu, Mar 14, 2002 at 02:54:53PM -0700, Jibin Han wrote: > > I just built an ELF format executible by linking hello_world.o, > > bsp archive and libc. The file size is around 300k even I use -o3 in > > compile option. hello_world.c is trivial. Someone else ported libc > > for powerpc eabi, and it seems no problem. Ever heard about someone debugging the produced executable at source- level ? Then the produced executable and also the C-library routines may include quite a lot extra stuff called 'debug info'... > you are calling printf, which references other code which must then be > linked in from libc. Not strip'ing the debug info away from the resulted executable is the most usual reason for very big executables. If one chooses to not debug the C-libraries, they should be produced without the '-g' or strip'ed afterwards with 'strip --strip-debug' (a plain vanilla 'strip' removes all symbols from them, and in libraries these will be needed)... ---------------------------------- clip ---------------------------------------- E:\usr\local\ppc-eabi\bin>strip --help Usage: strip <switches> in-file(s) The switches are: <snip> -s --strip-all Remove all symbol and relocation information -g -S --strip-debug Remove all debugging symbols --strip-unneeded Remove all symbols not needed by relocations <snip> -h --help Display this output -o <file> Place stripped output into <file> strip: supported targets: elf32-powerpc aixcoff-rs6000 elf32-powerpcle ppcboot elf32-little elf32-big srec symbolsrec tekhex binary ihex Report bugs to bug-gnu-utils@gnu.org ---------------------------------- clip ---------------------------------------- IMHO everybody should learn to write '<command> --help' for the GNU tools, when needing any help for them, not handling others as 'walking manuals' ;-) A simple test with not-so-trivial 'test-tprintf' program gives (output snipped) : e:\usr\local\samples>gcc-ppc-eabi -myellowknife -Os -o tst_ppc-eabi.x tprintf.c e:\usr\local\samples>dir tst_ppc-eabi.x 15.03.2002 11:06 74 672 tst_ppc-eabi.x e:\usr\local\samples>\usr\local\ppc-eabi\bin\strip tst_ppc-eabi.x e:\usr\local\samples>dir tst_ppc-eabi.x 15.03.2002 11:06 43 440 tst_ppc-eabi.x e:\usr\local\samples>\usr\local\ppc-eabi\bin\size tst_ppc-eabi.x text data bss dec hex filename 34080 5580 8 39668 9af4 tst_ppc-eabi.x So 30 k for a "Hello World" would be more expected with 'ppc-eabi' and with some bsp-package / glue-library, not the 300 k ... > > Is there any tool to help debuging that? Just check the situation with your C-libraries, the 'libc.a' I have has a size of 365 kbytes, if yours is 3 Mbytes or such, it has still the debug info in it... The 'libg.a' may include the debug info and '-g*' in the GCC command line should trigger the linker using it. For any library where you don't want any debug info any more, just run the following: powerpc-eabi-strip --strip-debug <libname>.a for instance: powerpc-eabi-strip --strip-debug libc.a in order to strip the debug info away. Taking backups first is of course highly recommended... Cheers, Kai ------ Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/ Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |