6.2. About debugging symbols

Most programs and libraries by default are compiled with debugging symbols (gcc option -g).

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 friendly. These debugging symbols also enlarge the program or library significantly.

Before you start wondering whether these debugging symbols really make a big difference, here are some statistics. Use them to draw your own conclusion.

Sizes vary depending on which compiler was used and which C library version was used to link dynamic programs against, but results will be similar if you compare programs with and without debugging symbols.

To remove debugging symbols from a binary (must be an a.out or ELF binary) run strip --strip-debug filename. Wildcards can be used to strip debugging symbols from multiple files (use something like strip --strip-debug $LFS/usr/bin/*). Most people will probably never use a debugger on software, so by removing those symbols a lot of disk space can be regained.

For your convenience, chapter 9 includes one simple command to strip all debugging symbols from all programs and libraries on your system.

You might find additional information in the optimization hint which can be found at http://hints.linuxfromscratch.org/hints/optimization.txt .