Subject: Re: i386/ELF stabs
To: Todd Whitesel <toddpw@best.com>
From: Frank van der Linden <frank@wins.uva.nl>
List: tech-toolchain
Date: 07/08/1999 10:06:08
On Wed, Jul 07, 1999 at 08:24:36PM -0700, Todd Whitesel wrote:
> Beware!! Not all stabs are alike. According to the stabs document
> maintained by Cygnus, the default behavior is for the linker to fully
> relocate the stabs, but Sun hacked things in their 'acc' compiler to
> make the stabs be relative offsets (to speed up linking). See
> 
> http://sourceware.cygnus.com/gdb/onlinedocs/stabs_13.html#SEC89

Thanks for the pointer, I'll have a look at that.

> 
> That offset code is usually inside #ifdef SOFUN_ADDRESS_MAYBE_MISSING,
> which, in both GDB 4.17 and 4.18, is only activated for Solaris (on
> sparc, x86, and -- hmm! -- powerpc).

The code that you mention, while related, is not the problem here,
so it seems. It deals with the offset of the object file.

I noticed this: before, on a.out, we had gcc output stab function
information after the actual function. On the alpha port, which was
ELF earlier, things are still done this way. It works for the
alpha port, so somehow the alpha gdb configuration expects this.
For the sparc port, the svr4/solaris config was basically used,
so for the sparc the behaviour is like Solaris. 

The other ELF i386 systems out there I could check, as far as they are
using stabs anyway, seemed to use the relative offsets, like sun. So
I decided that this was the best way to go, and changed the egcs 
i386/netbsd-elf.h include file to do so.

We should probably be more consistent and use the same mechanism
on all our elf ports. Or just use DWARF.

- Frank