This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Mixing 32-bit and 64-bit DWARF2/3 sections

On Mon, 2004-11-08 at 14:04, Mark Kettenis wrote:
> systems, gas currently generates the new DWARF3 64-bit format.  I
> merely want to argue that it probably would have been better if the
> default had been 32-bit for Linux.

It would be reasonable to try to use standard DWARF for non-Irix
systems, but the ambiguous SGI DWARF format complicates this.

With the SGI DWARF format, you can't tell whether you have 32-bit or
64-bit debug info by looking at the debug info alone.  You need external
info.  Currently, this is based on the ABI.  If we have N32 code, then
we have 32-bit DWARF always.  If we have N64 code, then we have
SGI-64-bit DWARF always.  (I see that neither bfd nor gdb actually do it
this way, but they are supposed to.)

In order to change this, we will need some other header flag to indicate
whether we are following the SGI scheme or the GNU scheme.  If we have
an OS field that is set consistently, then we could use that, but I as
skeptical whether this is safe in all cases.  Not all operating systems
have their own OS flags defined, especially for embedded systems.  There
is also a backwards compatibility problem.  That means we need a new
flag.  We need assembler support to set it, and an assembler directive
or option so that gcc can tell the assembler whether or not to set it. 
So we need an ELF header change, along with gcc, binutils, and gdb
patches to deal with it.  It isn't clear to me whether the benefits of
this change are worth the amount of effort needed to implement it.

Anyways, I think it is a reasonable goal, just not sure if it is worth
the trouble it will cause.

Besides the technical details, you will also need to get political buy
in from affected parties for an ABI change, which means mainly the
GNU/Linux mips64 folks.

I'd suggest that the easiest solution here is to fix gas.  Gas should
always use dwarf2_format_64bit_irix with the N64 ABI, regardless of
whether the target is Irix.  This will fix your debugging problems,
though it won't give the debug info format you want.

Checking, I see that the binutils patch came from here:
This is a thread with Alexandre Oliva trying to fix some problems with
the SGI-64-bit DWARF2 format, and Daniel Jacobowitz questioning why we
are using a non-standard format for non-Irix targets, and Alex made this
change to try to make Daniel happy.  Unfortunately, this causes your
current problem, as it makes gas incompatible with gcc.  I'd suggest
reverting this gas patch to solve your problem as a short term fix. 
Incidentally, this thread contains some info explaining why Alex thought
it was a good idea to be compatible with Irix here, as it made some
things easier.  The long term fix is a new elf header flag, and gcc,
binutils, and gdb changes to set and use it.  Reverting the gas patch is
far simpler.
Jim Wilson, GNU Tools Support,

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