Re: [BUG REPORT] arch/x86/include/asm/uaccess_64.h:119: Error: junk at end of line

From: Willy Tarreau
Date: Sun Apr 16 2023 - 04:37:04 EST


Hi Boris,

On Sat, Apr 15, 2023 at 08:56:47PM +0200, Borislav Petkov wrote:
> On April 15, 2023 7:56:01 PM GMT+02:00, Willy Tarreau <w@xxxxxx> wrote:
> >May I send you a cleaner patch for this ?
>
> Can you pls first send a minimal reproducer so that we can show it to gcc folks?

Oh it's not even gcc, it's really just a matter of compatibility with
binutils. Documentation/Changes says binutils minimum is 2.25. This
toolchain I'm using in distcc was made against 2.27, I'm reproducing
the error with it:

$ cat repro.s
.4byte (1U)
.4byte (1UL)

$ /f/tc/x86_64-gcc75_glibc228-linux-gnu/bin/x86_64-gcc75_glibc228-linux-gnu-ld -v
GNU ld (crosstool-NG 1.24.0.500_645889f) 2.27
$ /f/tc/x86_64-gcc75_glibc228-linux-gnu/bin/x86_64-gcc75_glibc228-linux-gnu-as repro.s
repro.s: Assembler messages:
repro.s:2: Error: found 'L', expected: ')'
repro.s:2: Error: junk at end of line, first unrecognized character is `L'

This other one relying on 2.26 fails both on 1U and 1UL:

$ ld -v
GNU ld version 2.26.20160125
$ as repro.s
repro.s: Assembler messages:
repro.s:1: Error: missing ')'
repro.s:1: Error: junk at end of line, first unrecognized character is `U'
repro.s:2: Error: missing ')'
repro.s:2: Error: junk at end of line, first unrecognized character is `U'

And this one based on 2.29 works for both:

$ /dev/shm/gcc-5.5.0-nolibc/x86_64-linux/bin/x86_64-linux-ld -v
GNU ld (GNU Binutils) 2.29.1.20170915
$ /dev/shm/gcc-5.5.0-nolibc/x86_64-linux/bin/x86_64-linux-as repro.s

So it just means that the support for the "U" suffix on numbers was
added in binutils 2.27 and the "L" suffix on numbers was added somewhere
between 2.27 and 2.29.

And given that there's a single occurrence of all this in the whole tree,
that's why I'm proposing to just get back to the good old (1 << 0) instead
of BIT(0).

Thanks!
Willy