public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* line number tracking for local labels
@ 2001-09-16 23:14 Ben Elliston
  2001-09-17  0:13 ` Alan Modra
  0 siblings, 1 reply; 7+ messages in thread
From: Ben Elliston @ 2001-09-16 23:14 UTC (permalink / raw)
  To: binutils

Here is a simple (fairly generic) test case that can be exercised by a
native i386 assembler:

.text
.global foo

foo:
	call 0f
	nop
	nop
	nop

# should be 0:
1:
	ret

Since there is no local label "0", the assembler emits:

foo.s: Assembler messages:
foo.s:12: Error: local label `"0" (instance number 1 of a fb label)' is not defined

It would be nice if the error message showed the site of the reference
to the label rather than the last line of the file, where the search
begins for the label.  Is there sufficient context tracking in GAS to
make this possible?

Ben

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

* Re: line number tracking for local labels
  2001-09-16 23:14 line number tracking for local labels Ben Elliston
@ 2001-09-17  0:13 ` Alan Modra
  2001-09-17  0:52   ` Hans-Peter Nilsson
  0 siblings, 1 reply; 7+ messages in thread
From: Alan Modra @ 2001-09-17  0:13 UTC (permalink / raw)
  To: Ben Elliston; +Cc: binutils

On Mon, Sep 17, 2001 at 04:14:45PM +1000, Ben Elliston wrote:
> Is there sufficient context tracking in GAS to make this possible?

No.

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

* Re: line number tracking for local labels
  2001-09-17  0:13 ` Alan Modra
@ 2001-09-17  0:52   ` Hans-Peter Nilsson
  2001-09-17  1:35     ` Alan Modra
  2001-09-17 13:01     ` Ben Elliston
  0 siblings, 2 replies; 7+ messages in thread
From: Hans-Peter Nilsson @ 2001-09-17  0:52 UTC (permalink / raw)
  To: Alan Modra; +Cc: Ben Elliston, binutils

On Mon, 17 Sep 2001, Alan Modra wrote:

> On Mon, Sep 17, 2001 at 04:14:45PM +1000, Ben Elliston wrote:
> > Is there sufficient context tracking in GAS to make this possible?
>
> No.

Sure?  I'd believe there is: fixS->fx_file, fx_line,
frag->fr_file, fr_line.  Maybe a well-placed as_where is all
that is needed.  Or maybe there's missing a move of the notes
from a frag to a fix.  Sorry for second-guessing "out of the
blue"; I didn't actually check tc-i386.c.

brgds, H-P

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

* Re: line number tracking for local labels
  2001-09-17  0:52   ` Hans-Peter Nilsson
@ 2001-09-17  1:35     ` Alan Modra
  2001-09-17 20:43       ` Hans-Peter Nilsson
  2001-09-17 13:01     ` Ben Elliston
  1 sibling, 1 reply; 7+ messages in thread
From: Alan Modra @ 2001-09-17  1:35 UTC (permalink / raw)
  To: Hans-Peter Nilsson; +Cc: Ben Elliston, binutils

On Mon, Sep 17, 2001 at 03:52:20AM -0400, Hans-Peter Nilsson wrote:
> On Mon, 17 Sep 2001, Alan Modra wrote:
> 
> > On Mon, Sep 17, 2001 at 04:14:45PM +1000, Ben Elliston wrote:
> > > Is there sufficient context tracking in GAS to make this possible?
> >
> > No.
> 
> Sure?  I'd believe there is: fixS->fx_file, fx_line,
> frag->fr_file, fr_line.  Maybe a well-placed as_where is all
> that is needed.  Or maybe there's missing a move of the notes
> from a frag to a fix.  Sorry for second-guessing "out of the
> blue"; I didn't actually check tc-i386.c.

What fixS?  sym->sy_frag isn't much use either, as that should give the
start of the frag where the sym was defined, not the line where the sym
was referenced.

Alan

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

* Re: line number tracking for local labels
  2001-09-17  0:52   ` Hans-Peter Nilsson
  2001-09-17  1:35     ` Alan Modra
@ 2001-09-17 13:01     ` Ben Elliston
  1 sibling, 0 replies; 7+ messages in thread
From: Ben Elliston @ 2001-09-17 13:01 UTC (permalink / raw)
  To: Hans-Peter Nilsson; +Cc: Alan Modra, binutils

>>>>> "Hans-Peter" == Hans-Peter Nilsson <hp@bitrange.com> writes:

  Hans-Peter> Sure?  I'd believe there is: fixS->fx_file, fx_line,
  frag-> fr_file, fr_line.  Maybe a well-placed as_where is all
  Hans-Peter> that is needed.  Or maybe there's missing a move of the notes
  Hans-Peter> from a frag to a fix.  Sorry for second-guessing "out of the
  Hans-Peter> blue"; I didn't actually check tc-i386.c.

You need not check tc-i386.c.  This applies to all targets -- I just
had to choose one target in order to write a program to demonstrate
it.

Ben

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

* Re: line number tracking for local labels
  2001-09-17  1:35     ` Alan Modra
@ 2001-09-17 20:43       ` Hans-Peter Nilsson
  2001-09-17 21:39         ` Alan Modra
  0 siblings, 1 reply; 7+ messages in thread
From: Hans-Peter Nilsson @ 2001-09-17 20:43 UTC (permalink / raw)
  To: Alan Modra; +Cc: Ben Elliston, binutils

On Mon, 17 Sep 2001, Alan Modra wrote:
> On Mon, Sep 17, 2001 at 03:52:20AM -0400, Hans-Peter Nilsson wrote:

> What fixS?  sym->sy_frag isn't much use either, as that should give the
> start of the frag where the sym was defined, not the line where the sym
> was referenced.

Ok, I see now.  Here, we're crawling the symbol chain, and
there's no handle to any user of the symbol.  Usually we have
the "current" frag or fix nearby, when something is wrong with
an operand or such.

I guess one could crawl all frags and try to find one/all users
if the error message is important enough.

brgds, H-P

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

* Re: line number tracking for local labels
  2001-09-17 20:43       ` Hans-Peter Nilsson
@ 2001-09-17 21:39         ` Alan Modra
  0 siblings, 0 replies; 7+ messages in thread
From: Alan Modra @ 2001-09-17 21:39 UTC (permalink / raw)
  To: Hans-Peter Nilsson; +Cc: Ben Elliston, binutils

On Mon, Sep 17, 2001 at 11:43:40PM -0400, Hans-Peter Nilsson wrote:
> 
> I guess one could crawl all frags and try to find one/all users
> if the error message is important enough.

You mean the fixup chain?  Yes, you could do something there in most
normal cases.  Abnormal cases being those where someone has used a
complex expression involving the label.

Alan

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

end of thread, other threads:[~2001-09-17 21:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-09-16 23:14 line number tracking for local labels Ben Elliston
2001-09-17  0:13 ` Alan Modra
2001-09-17  0:52   ` Hans-Peter Nilsson
2001-09-17  1:35     ` Alan Modra
2001-09-17 20:43       ` Hans-Peter Nilsson
2001-09-17 21:39         ` Alan Modra
2001-09-17 13:01     ` Ben Elliston

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).