Hello, I am trying to reduce the size of debug information for a large C++ project and tried -feliminate-dwarf2-dups. This did not work as expected, I got even a slight increase in .debug_info (instead of some decrease). I put together a minimal example (a source file including two header files with a struct definition each) and was surprised to see that all this seems to work when compiled as C, but not when compiled as C++: When compiled with gcc-4.4.4 as C code, I get the following two sections in the resulting object: .gnu.linkonce.wi.bar.h.60f9683b .gnu.linkonce.wi.foo.h.22b1f5d9 I think this is as it should be: the compiler creates separate "compilation unit" sections for the contributions from each header file, and the linker emits only one of possibly many identical sections from the header files into the final executable (so is my naive understanding of the mechanism...) When compiled as C++ code (by specifying -x c++), I get only one such section which is named after the source file, not after the header files: .gnu.linkonce.wi.bar.c.b403f86f This does, I think, defeat the whole mechanism: the linker will simply add the contents of this section to .debug_info in the executable, and this will not result in any savings. >From this I conclude that there seems to be something wrong with -feliminate-dwarf2-dups when used with C++ (unless I am seriously misunderstanding this mechanism or I have somehow misconfigured gcc). I observe this with gcc-4.4.4 built for Solaris10/x86 (configured to use the GNU linker). Has anybody tried this option recently with gcc-4.4.x and C++? The Sun-built gcc (which is version 3.4.3) seems not to have this problem. The (trivial) setup is as follows: ------ source file bar.c: -------- #include "foo.h" #include "bar.h" struct Foo myfoo; struct Bar mybar; ---------------------------------- ------ header file foo.h: -------- struct Foo { double d_foo; int i_foo; }; ---------------------------------- ------ header file bar.h: -------- struct Bar { double d_bar; int i_bar; char c_bar; }; ---------------------------------- The compilation commands: as C code: .../gcc -gdwarf-2 -O2 -feliminate-dwarf2-dups -c bar.c as C++ code: .../gcc -x c++ -gdwarf-2 -O2 -feliminate-dwarf2-dups -c bar.c I obtained the section names by using elfdump -c bar.o | grep linkonce Any help or insight into this would be very much appreciated. Regards Dieter Ruppert