| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 | <sect1 id="ch06-aboutdebug"><title>About debugging symbols</title><para>Most programs and libraries by default are compiled with debuggingsymbols and optimizing level 2 (gcc options -g and -O2) and are compiledfor a specific CPU. On Intel platforms software is compiled for i386processors by default. If a user doesn't wish to run software on othermachines other than his own, he might want to change the defaultcompiler options so that they will be compiled with a higheroptimization level, no debugging symbols and generate code for his specific architecture. Let me first explain what debugging symbolsare.</para><para>A program compiled with debugging symbols means a user can run a program or library through a debugger and the debugger's output will be user friendlier. These debugging symbols also enlarge the program or library significantly. </para><para>To remove debugging symbols from a binary (must be an a.out or ELF binary)run <userinput>strip --strip-debug filename</userinput>. A user can use wild cardsif he needs to strip debugging symbols from multiple files (use something likestrip --strip-debug $LFS/usr/bin/*). Another, easier, options is justnot to compile programs with debugging symbols. Most people will probablynever use a debugger on software, so by leaving those symbols out a lot of diskspace can be saved.</para><para>Before someone wonders if these debugging symbols would make a big difference, here are some statistics:</para><itemizedlist><listitem><para>        A dynamic Bash binary with debugging symbols: 1.2MB</para></listitem><listitem><para>        A dynamic Bash binary without debugging symbols: 478KB</para></listitem><listitem><para>        /lib and /usr/lib (glibc and gcc files) with debugging                symbols: 87MB</para></listitem><listitem><para>        /lib and /usr/lib (glibc and gcc files) without                debugging symbols: 16MB</para></listitem></itemizedlist><para>Sizes may vary depending on which compiler was used and which C libraryversion was used to link dynamic programs against, but results will besimilar if a user compares programs with and without debugging symbols. AfterI was done with this chapter and stripped all debugging symbols from all LFSbinaries and libraries I regained a little over 102 MB of disk space. Quitethe difference.</para></sect1>
 |