public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jim Wilson <wilson@cygnus.com>
To: robertlipe@usa.net
Cc: egcs@egcs.cygnus.com
Subject: Re: dwarf2 debug dependent upon GAS?
Date: Mon, 22 Feb 1999 17:24:00 -0000	[thread overview]
Message-ID: <199902230124.RAA24440@rtl.cygnus.com> (raw)
In-Reply-To: <19990221144644.M8783.cygnus.egcs@rjlhome.sco.com>

In article <19990221144644.M8783.cygnus.egcs@rjlhome.sco.com> you write:
>I've had it on my list to examine Dwarf2 debugging for System V.  I'm
>finding that it seems to depend upon a curiosity of the GNU assembler.
>Is this accurate?

It works with GNU as and SGI Irix6 as.  Those are the only dwarf2 aware
assemblers that I know about.

There are clear advantages to having a dwarf2 aware assembler when emitting
dwarf2 debug info.  There is only this one curiousity we need for correctness,
but there are a number of cases where special assembler support would give us
more compact debug info.  We currently don't take advantage of any GNU as
features for this yet, but I expect we will eventually.  This will mean that
we'll have smaller debug info if we use GNU as.

>I'm seeing EGCS (current trunk) generate refences to symbols that don't
>exist.  There are SECTIONS of that name, but no symbols.  Apparently
>GAS treat them interchangably.  Is it the intent for these to reference
>the beginning of the section in this file (i.e. local labels) or the
>beginning of that section once linked? (without making them global, I
>don't know how I would synthesize that.)

The latter, sort of.  The dwarf2 standard says that some fields are offsets
relative to the address of the final linked section.  This means that we can't
compute these offsets until link time.

You can get this effect by using a section name as a symbol name in GNU as
and SGI irix6 as.

If you don't have relocations and assembler syntax for this, then it will
be hard to synthesize it.  It might be possible to get the same effect
by creating a file that always gets linked first, and which contains special
labels to mark the start of each section, and then use label subtraction to
get an offset.  There are cases where this won't work, but I don't recall the
details.  I've discussed this before with other people and never found a
satisfactory solution.

There is some language in the MIPS processor supplement to the SVR4 ABI 
that seems to document this.  In the section Relocation, it defines a symbol
(S) relocation as
	Represents the value of the symbol whose index resides in the
	relocation entry, unless the symbol is STB_LOCAL and is of type
	STT_SECTION, in which case S represents the original sh_addr minus
	the final sh_addr.
and that gives the result that we want.  I haven't found similar language in
any other SVR4 ABI.  I don't know how this got into the MIPS SVR4 ABI.  This
is a 1990 copyright document, but dwarf2 didn't exist until several years
later, so it seems unlikely that it was added specifically for dwarf2.

If we can't get the exact result that the standard asks for, then perhaps
we can create a dwarf2-variant for dwarf2-unaware assemblers.  For instance,
substituting in an absolute address where the standard wants a section-relative
offset might make some of these problems go away.  This would require some
support in gdb for the dwarf2-variant though.

Jim

WARNING: multiple messages have this Message-ID
From: Jim Wilson <wilson@cygnus.com>
To: robertlipe@usa.net
Cc: egcs@egcs.cygnus.com
Subject: Re: dwarf2 debug dependent upon GAS?
Date: Sun, 28 Feb 1999 22:53:00 -0000	[thread overview]
Message-ID: <199902230124.RAA24440@rtl.cygnus.com> (raw)
Message-ID: <19990228225300.x65CQgBisV2Vz2st2BNj6jIgqB2DKTnEAyQ2ZILy0eQ@z> (raw)
In-Reply-To: <19990221144644.M8783.cygnus.egcs@rjlhome.sco.com>

In article <19990221144644.M8783.cygnus.egcs@rjlhome.sco.com> you write:
>I've had it on my list to examine Dwarf2 debugging for System V.  I'm
>finding that it seems to depend upon a curiosity of the GNU assembler.
>Is this accurate?

It works with GNU as and SGI Irix6 as.  Those are the only dwarf2 aware
assemblers that I know about.

There are clear advantages to having a dwarf2 aware assembler when emitting
dwarf2 debug info.  There is only this one curiousity we need for correctness,
but there are a number of cases where special assembler support would give us
more compact debug info.  We currently don't take advantage of any GNU as
features for this yet, but I expect we will eventually.  This will mean that
we'll have smaller debug info if we use GNU as.

>I'm seeing EGCS (current trunk) generate refences to symbols that don't
>exist.  There are SECTIONS of that name, but no symbols.  Apparently
>GAS treat them interchangably.  Is it the intent for these to reference
>the beginning of the section in this file (i.e. local labels) or the
>beginning of that section once linked? (without making them global, I
>don't know how I would synthesize that.)

The latter, sort of.  The dwarf2 standard says that some fields are offsets
relative to the address of the final linked section.  This means that we can't
compute these offsets until link time.

You can get this effect by using a section name as a symbol name in GNU as
and SGI irix6 as.

If you don't have relocations and assembler syntax for this, then it will
be hard to synthesize it.  It might be possible to get the same effect
by creating a file that always gets linked first, and which contains special
labels to mark the start of each section, and then use label subtraction to
get an offset.  There are cases where this won't work, but I don't recall the
details.  I've discussed this before with other people and never found a
satisfactory solution.

There is some language in the MIPS processor supplement to the SVR4 ABI 
that seems to document this.  In the section Relocation, it defines a symbol
(S) relocation as
	Represents the value of the symbol whose index resides in the
	relocation entry, unless the symbol is STB_LOCAL and is of type
	STT_SECTION, in which case S represents the original sh_addr minus
	the final sh_addr.
and that gives the result that we want.  I haven't found similar language in
any other SVR4 ABI.  I don't know how this got into the MIPS SVR4 ABI.  This
is a 1990 copyright document, but dwarf2 didn't exist until several years
later, so it seems unlikely that it was added specifically for dwarf2.

If we can't get the exact result that the standard asks for, then perhaps
we can create a dwarf2-variant for dwarf2-unaware assemblers.  For instance,
substituting in an absolute address where the standard wants a section-relative
offset might make some of these problems go away.  This would require some
support in gdb for the dwarf2-variant though.

Jim

       reply	other threads:[~1999-02-22 17:24 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <19990221144644.M8783.cygnus.egcs@rjlhome.sco.com>
1999-02-22 17:24 ` Jim Wilson [this message]
     [not found]   ` < 199902230124.RAA24440@rtl.cygnus.com >
1999-02-22 21:32     ` Robert Lipe
     [not found]       ` < 19990222233200.P325@rjlhome.sco.com >
1999-02-23  7:04         ` Brian Ford
     [not found]           ` < Pine.SGI.4.03.9902230903340.512-100000@uscream.vss.fsi.com >
1999-02-23  8:41             ` Robert Lipe
     [not found]               ` < 19990223104109.E2294@rjlhome.sco.com >
1999-02-23  9:03                 ` Brian Ford
1999-02-28 22:53                   ` Brian Ford
1999-02-23 17:39               ` Daniel Berlin
1999-02-28 22:53                 ` Daniel Berlin
1999-02-28 22:53               ` Robert Lipe
1999-02-28 22:53           ` Brian Ford
1999-02-23 14:19         ` Jim Wilson
1999-02-28 22:53           ` Jim Wilson
1999-02-28 22:53       ` Robert Lipe
1999-02-28 22:53   ` Jim Wilson
     [not found] ` <199902230124.RAA24440.cygnus.egcs@rtl.cygnus.com>
1999-02-25 12:05   ` Jason Merrill
     [not found]     ` <19990225143649.I17655@rjlhome.sco.com>
1999-02-25 18:13       ` Jason Merrill
     [not found]         ` < u9u2w9j4jr.fsf@yorick.cygnus.com >
1999-02-25 20:55           ` Robert Lipe
1999-02-25 21:02             ` Jason Merrill
     [not found]               ` < u9d82xiwp5.fsf@yorick.cygnus.com >
1999-02-25 21:21                 ` Robert Lipe
1999-02-25 21:27                   ` Jason Merrill
1999-02-28 22:53                     ` Jason Merrill
1999-02-28 22:53                   ` Robert Lipe
1999-02-25 22:16                 ` Robert Lipe
1999-02-25 22:31                   ` Jason Merrill
     [not found]                     ` < u93e3tism2.fsf@yorick.cygnus.com >
1999-02-25 23:25                       ` Robert Lipe
     [not found]                         ` < 19990226012522.D17655@rjlhome.sco.com >
1999-02-28  0:57                           ` Jeffrey A Law
1999-02-28 22:53                             ` Jeffrey A Law
1999-02-28 22:53                         ` Robert Lipe
1999-02-28 22:53                     ` Jason Merrill
1999-02-28 22:53                   ` Robert Lipe
1999-02-28 22:53               ` Jason Merrill
1999-02-25 21:19             ` Jason Merrill
1999-02-28 22:53               ` Jason Merrill
1999-02-28 22:53             ` Robert Lipe
1999-02-28 22:53         ` Jason Merrill
1999-02-28 22:53     ` Jason Merrill
1999-02-21 12:47 Robert Lipe
     [not found] ` < 19990221144644.M8783@rjlhome.sco.com >
1999-02-21 14:51   ` Jeffrey A Law
1999-02-28 22:53     ` Jeffrey A Law
1999-02-28 22:53 ` Robert Lipe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199902230124.RAA24440@rtl.cygnus.com \
    --to=wilson@cygnus.com \
    --cc=egcs@egcs.cygnus.com \
    --cc=robertlipe@usa.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).