DWARF-2 is a format to store debugging information. It is used on many ELF systems such as GNU/Linux. With the way things are compiled, there is a lot of redundant information in the DWARF-2 sections of an ELF binary.
Fortunately, there is an option to gcc that helps dealing with the redundant information and downsizes the DWARF-2 sections of ELF binaries. This option is
Unfortunately, it doesn’t work with C++.
-g alone, libxul.so is 468 MB. With
-g -feliminate-dwarf2-dups, it is… 1.5 GB. FAIL.
The good news is that as stated in the message linked above,
-gdwarf-4 does indeed help reducing debugging information size. libxul.so, built with
-gdwarf-4 is 339 MB. This however requires gcc 4.6 and a pretty recent gdb.