This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: commitment to DWARF2 debugging information


> Date: Wed, 7 Jun 2000 13:44:57 -0700
> From: Nick Clifton <nickc@cygnus.com>

> Is this improvement to LD something that is simple to do ?  If so I
> would be interested in trying to do it myself, especially if you
> could give me some pointers as to what needs to be done.

I can try.  Ian did the original ld stabs work.  He could refine and
elaborate on my description if it isn't clear.  Basically, the problem
is #include.  #include replicates the code the compiler sees.  Part of
this code, generates debugging information.  The trick is to eliminate
the resources consumed by the duplicates.

The typical C project looks like:

h.h:

int bar1(int);
int bar2(int);
[ ... ]
int barm(int);

c1.c:

#include "h.h"

void foo1() { }

c2.c:

#include "h.h"

void foo2() { }

c3.c:

#include "h.h"

void foo3() { }

...

cn.c:

#include "h.h"

void foon() { }

Now, compile and see how much linker memory it takes (a lot), and see
how big the resulting file is (big).  If you don't believe it, remove
foo1 through foon fom the .c files, and use n == 1000, m=1000, and see
if the bars appears many times, or once.  With stabs (stabs aout?),
they appears once.  The stabs trick uses N_BINCL and exact equality,
and when it hits, it collapses, as I recall.  See:

Wed Dec 13 15:44:06 1995  Ian Lance Taylor  <ian@cygnus.com>

    * aoutx.h: Include <ctype.h>.
    (struct aout_link_includes_table): Define.
    (struct aout_link_includes_totals): Define.
    (struct aout_link_includes_entry): Define.
    (aout_link_includes_lookup): Define macro.
    (struct aout_final_link_info): Add includes field.
    (aout_link_includes_newfunc): New static function.
    (NAME(aout,final_link)): Initialize includes hash table.
    (aout_link_write_symbols): Eliminate duplicate N_BINCL entries.

in bfd, for an idea that works with stabs.  Also, careful testing in
C++; the compiler avoid outputing some things in some versions of the
header files, and this _optimization_ defeats the N_BINCL
optimization.  :-( The C++ optimization predates the ld one.

For dwarf, I suspect we have to be careful about the definition of
equality...

Anyway, hope that helps get you started.  I can try and answer
specific questions if you have them.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]