[PATCH] gas: Fix internal error on long local labels

H.J. Lu hjl.tools@gmail.com
Fri Aug 7 13:44:17 GMT 2020


On Thu, Aug 6, 2020 at 9:49 AM Alex Coplan <Alex.Coplan@arm.com> wrote:
>
> > -----Original Message-----
> > From: Alan Modra <amodra@gmail.com>
> > Sent: 06 August 2020 14:56
> > To: Alex Coplan <Alex.Coplan@arm.com>
> > Cc: binutils@sourceware.org
> > Subject: Re: [PATCH] gas: Fix internal error on long local labels
> >
> > On Wed, Aug 05, 2020 at 02:51:05PM +0100, Alex Coplan wrote:
> > >     * read.c (read_a_source_file): Use long for local labels, detect
> > >     overflow and raise an error for overly-long labels.
> > >     * testsuite/gas/all/gas.exp: Add local-label-overflow test.
> > >     * testsuite/gas/all/local-label-overflow.d: New test.
> > >     * testsuite/gas/all/local-label-overflow.l: Error output.
> > >     * testsuite/gas/all/local-label-overflow.s: Input.
> >
> > OK, but fix the following nits please.
>
> Thanks. Pushed to master with nits fixed as
> d27aad4ec307d91a6b9056127c6c248044391d7f.

The test failed on 32-bit hosts:

./as-new -o x.o
/export/gnu/import/git/sources/binutils-gdb/gas/testsuite/gas/all/local-label-overflow.s
/export/gnu/import/git/sources/binutils-gdb/gas/testsuite/gas/all/local-label-overflow.s:
Assembler messages:
/export/gnu/import/git/sources/binutils-gdb/gas/testsuite/gas/all/local-label-overflow.s:1:
Error: local label too large near 888888888888888888888888888:

/export/gnu/import/git/sources/binutils-gdb/gas/testsuite/gas/all/local-label-overflow.s:1:
Error: local label too large near 888888888888888888:

/export/gnu/import/git/sources/binutils-gdb/gas/testsuite/gas/all/local-label-overflow.s:1:
Error: local label too large near 888888888:

I am checking in this to fix it:

diff --git a/gas/read.c b/gas/read.c
index bd896580e5..cb41cc0685 100644
--- a/gas/read.c
+++ b/gas/read.c
@@ -1227,7 +1227,10 @@ read_a_source_file (const char *name)

         /* Overflow: stop processing the label.  */
         if (temp == -1)
-     continue;
+     {
+       ignore_rest_of_line ();
+       continue;
+     }

         if (LOCAL_LABELS_DOLLAR
        && *input_line_pointer == '$'

> Is it worth backporting?
>
> Alex



-- 
H.J.


More information about the Binutils mailing list