public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Re: Mixing 32-bit and 64-bit DWARF2/3 sections
@ 2004-11-09 22:10 David Anderson
  0 siblings, 0 replies; 14+ messages in thread
From: David Anderson @ 2004-11-09 22:10 UTC (permalink / raw)
  To: gdb


James E Wilson <wilson@specifixinc.com> writes:
|SGI Irix6 created the N64 ABI, and they decreed that one must use a 
|(non-standard) 64-bit DWARF format with it.  We are just following the 
|ABI here.  If we change it, then we lose compatibility with Irix6, and 
|the published ABI.

There was no standard 64 bit dwarf format at the time (1992,3,4).
A straight '64 bit address-size and offset' was simple to define
and understand.

|> P.S. It seems that MIPS is the only 64-bit target for which this is a
|>      problem, since all other 64-bit targets (AMD64, UltraSPARC) still
|>      use the 32-bit DWARF format.

|This is because SGI decided that DWARF2 was broken, and tried to fix it 
|by adding 64-bit extensions.  These extensions are only needed if you 
|have more than 4GB of DWARF debug info, and hence is unlikely, but SGI 
|claims that they did hit this limit.  No one else has apparently ever 
|hit the limit.

Allow me to correct that impression.  I don't know that anyone
has exceeded a 4GB dwarf section. Nor did we think DWARF2 was
broken, exactly.  Knowing that the issue of gigantic debug
files was simply never on the table at the DWARF committee
meetings, (there being no need at that point in time), we made
a guess as to what a future DWARFx would have.  Bad guess.
The DWARF committee was either exhausted or dormant (depending
on the date) by this time, so no further changes could
be contemplated there.

This was 1992 or so. 

It was clear from past experience was that *someone would*
exceed 32 bits of offset.  And when it happened, the
restriction was going to seem arbitrary and would be painful to
correct.

Every limit in mdebug had been hit by that time, and being
unable to correct those problems was...painful.  We'd only felt
able to correct an mdebug limit once (back around 1989) and
that binary incompatibility was --- painful to deal with.  (In
that case MIPS [as a separate company] broke the ABI to fix an
mdebug limit and we went along as that was the only real
choice.)

|Unfortunately, the way that SGI extended DWARF2 caused problems, as it 
|resulted in ambiguous DWARF info, so the DWARF3 committee defined a 
|different way that is self descriptive.  But since this happened after 
|Irix6 had already been released, and SGI could not break backwards 
|compatibility with Irix6, N64 still uses the non-standard 64-bit DWARF 
|format that SGI invented.  And gcc uses this non-standard 64-bit DWARF 
|format for all mips64 targets, for consistency, and to conform with the ABI.

At the time there was only one 64bit MIPS, and no 64bit offset DWARF.
[And no other 64-bit ELF users? (I vaguely recall.).  No 
other DWARF2 users at that time.]
We at SGI felt obliged to do something to avoid the limits in 32bit
offset DWARF2.  Our choice did not really meet the needs and desires of
today's community thus DWARF3 has a different approach to 64bit offsets.

Daniel Berlin <dberlin@dberlin.org> writes:
[...]
|In short, there is no limitation in dwarf3 that SGI is solving.
|It's just a matter of them not solving it in a backwards compatible way, 
|and everyone else paying the consequences :)

Well, we associate dwarf-offset with elf-offset.
So 64-bit-elf-offset means 64-bit-dwarf offset.
It seemed perfectly compatible then.
Our solution was for a limitation in DWARF2, and only DWARF2 existed
at the time.

Jim Wilson again:
>I don't think we should be worried about use of 32-bit DWARF2 debug
>info.  We are unlikely to hit the limits anytime soon.  And if we do hit
>the limits, then we will likely have other more serious problems.

The limits will be hit, likely before long.
The problems will be seen only in a tiny subset of applications.
Since 13TB ram-memory machines exist today, a 5GB .debug_info
does not seem that large. Admittedly such a size is likely avoidable
by using shared-libraries.

On IRIX the only appropriate 64-bit DWARF2 is
the IRIX definition.    Beyond that I'm not going...

David Anderson
[PS: Opinions my own, not those of SGI. History is as I recall what
happened at the time.]

^ permalink raw reply	[flat|nested] 14+ messages in thread
* Mixing 32-bit and 64-bit DWARF2/3 sections
@ 2004-11-07 15:31 Mark Kettenis
  2004-11-07 16:29 ` Daniel Jacobowitz
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Mark Kettenis @ 2004-11-07 15:31 UTC (permalink / raw)
  To: gcc, binutils; +Cc: echristo, seufer, gdb

Currently GDB barfs when you use it on an executable that contains
compilation units that mix 32-bit and 64-bit DWARF sections.  Looking
at the (latest?) DWARF3 draft it doesn't seem to be unreasonable that
it does so:

  "The 32-bit and 64-bit DWARF format conventions must not be
   intermixed within a single compilation unit."

The way things are structured now, it is easy to end up with a
configuration where this happens since some DWARF sections are
generated by GCC and others by gas, i.e. if GCC is configured to
generate 32-bit DWARF, and gas will generate 64-bit dwarf.  This is
currently the case for the (not yet contributed) GCC configuration
that's currently used by OpenBSD/mips64.  Now this can be easily fixed
by changing either the GCC config or gas, but the DWARF3 draft also
says:

  "It is expected that DWARF producing compilers will not use the
   64-bit format by default. In most cases, the division of even very
   large applications into a number of executable and shared objects
   will suffice to assure that the DWARF sections within each
   individual linked object are less than 4 GBytes in size. However,
   for those cases where needed, the 64-format allows the unusual case
   to be handled as well. Even in this case, it is expected that only
   application supplied objects will need be compiled using the 64-bit
   format; separate 32-bit format versions of system supplied shared
   executable libraries can still be used."

This argues that what's currently done in gas and GCC for most 64-bit
MIPS targets is wrong, since these use the 64-bit DWARF format
unconditionally for the n64 ABI.

Fixing this would be a tricky though, since doing it requires some
coordination between GCC and binutils.  We could add a switch to gas
to tell it to generate 64-bit DWARF format.  But even then GCC will
probably need to support old gas versions that generate 64-bit format
by default, adding more config goo to GCC.  So I think the existing
MIPS targets should probably keep doing what they do now.

However, I could make OpenBSD/mips64 do the right thing, making both
GCC and gas generate 32-bit DWARF by default.  What do the MIPS people
think about that?

Cheers,

Mark

P.S. It seems that MIPS is the only 64-bit target for which this is a
     problem, since all other 64-bit targets (AMD64, UltraSPARC) still
     use the 32-bit DWARF format.

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2004-11-09 21:54 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-09 22:10 Mixing 32-bit and 64-bit DWARF2/3 sections David Anderson
  -- strict thread matches above, loose matches on Subject: below --
2004-11-07 15:31 Mark Kettenis
2004-11-07 16:29 ` Daniel Jacobowitz
2004-11-07 17:16   ` Mark Kettenis
2004-11-08  0:19     ` Daniel Jacobowitz
2004-11-08 21:44 ` James E Wilson
2004-11-08 23:03   ` Mark Kettenis
2004-11-08 23:37     ` James E Wilson
2004-11-08 23:46       ` Thiemo Seufer
2004-11-08 23:55         ` Daniel Berlin
2004-11-09  0:15         ` James E Wilson
2004-11-08 23:50   ` Daniel Jacobowitz
2004-11-09  0:29     ` James E Wilson
2004-11-09 20:58 ` Dean Luick

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).