Duplicated debug information in linked images

John Haller jhaller@lucent.com
Tue Feb 6 11:04:00 GMT 2001


I have noticed duplicated debug information in linked images.
This causes a large bloat in the size of the object, and makes
starting debuggers longer.
  common.hpp:
     #pragma interface
     typedef enum
     {
        value1,
        value2
     } sample_enum;


  file1.cpp:
     #include "common.hpp"

  file2.cpp:
      #include "common.hpp"

g++ -c -g file1.cpp
g++ -c -g file2.cpp
gld -r -o combined.o file*.o
objdump --debugging combined.o

combined.o:     file format elf32-sparc

/home/jhaller/symbols/file1.cpp:
typedef int32 int;
  ...
 common.hpp:
typedef enum { value1, value2 } sample_enum;
/home/jhaller/symbols/file2.cpp:
typedef int32 int;
  ...
 common.hpp:
typedef enum { value1, value2 } sample_enum;

gld -v   
GNU ld version 2.9.1 (with BFD 2.9.1)

As you can see, the typedefs appear twice in the combined object module
symbol table.  Does the current version of gld have any support
for compressing these debugging symbols?  The version currently
installed on my system doesn't, and the documentation doesn't mention
any flag that would seem to do this compression.  I am currently
working on a executable that contains about 4MB of instructions/data,
but the executable is about 45MB.  The example above is
a smaller version that exhibits the same symptoms.

I'm new to the list.  I searched the mail archives, but didn't
see this topic discussed.  Sorry if this is a duplicate.

-- 
John Haller 630-979-6407 jhaller@lucent.com


More information about the Binutils mailing list