This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: .line/.ln Directive
- To: Tracy dot Kuhrt at microchip dot com
- Subject: Re: .line/.ln Directive
- From: Nick Clifton <nickc at cambridge dot redhat dot com>
- Date: 28 Jun 2001 18:33:32 +0100
- Cc: binutils at sourceware dot cygnus dot com
- References: <OF6C3ACDA4.21509477-ON07256A72.0057843E@microchip.com>
Hi Tracy,
> Given the following assembly source file:
> .text
> nop
> .appline 5
> nop
> .line 10
> nop
> .ln 15
> .end
>
> I get the error
> line_test.s: Assembler messages:
> line_test.s:5: Internal error, aborting at /src/gas/config/obj-coff.c line
> 446 in add_lineno
>
> I am using binutils 2.11 with the following configuration.
> configure --host=sparc-sun-solaris2.6 --target=sparc-sun-coff
> --norecursion
> I have tracked this down, and I believe that the problem can be
> resolved with the following patch,which sets the appline argument to
> 1 so that these directives are treated as an .appline.
Well that will remove the bug, but it is not the right thing to do.
The .appline pseudo op has slightly different semantics to the .ln
directive, so changing the argument to 1 is incorrect.
Instead, please could you try this patch. It fixes the problem by
detecting the situation where the .ln directive is being used outside
of a function. Normally these directives only make sense when
functions are being created, since they get attached to symbols inside
the function. The test case however, does not define a function and
so triggers the abort.
Cheers
Nick
2001-06-28 Nick Clifton <nickc@cambridge.redhat.com>
* config/obj-coff.c (obj_coff_ln): Treat a .ln directive
outside of a function as a .appline directive.
Index: gas/config/obj-coff.c
===================================================================
RCS file: /cvs/src/src/gas/config/obj-coff.c,v
retrieving revision 1.48
diff -p -r1.48 obj-coff.c
*** obj-coff.c 2001/06/10 14:07:11 1.48
--- obj-coff.c 2001/06/28 17:32:14
*************** obj_coff_ln (appline)
*** 493,505 ****
}
l = get_absolute_expression ();
- if (!appline)
- {
- add_lineno (frag_now, frag_now_fix (), l);
- }
! if (appline)
new_logical_line ((char *) NULL, l - 1);
#ifndef NO_LISTING
{
--- 493,505 ----
}
l = get_absolute_expression ();
! /* If there is no lineno symbol, treat a .ln
! directive as if it were a .appline directive. */
! if (appline || current_lineno_sym == NULL)
new_logical_line ((char *) NULL, l - 1);
+ else
+ add_lineno (frag_now, frag_now_fix (), l);
#ifndef NO_LISTING
{