Re: [PATCH v2] x86: fix early boot crash on gcc-10

From: Jakub Jelinek
Date: Wed Apr 22 2020 - 13:03:37 EST


On Wed, Apr 22, 2020 at 06:53:39PM +0200, Borislav Petkov wrote:
> > $ cat asm-detect.c
> > int foo(int a);
> > int bar(int a)
> > {
> > int r = foo(a);
> > asm ("");
> > return r;
> > }
> >
> > $ gcc -O2 -c asm-detect.c -S -o/dev/stdout | grep jmp
> > [no output]
>
> That is a good test to run at the beginning of the compilation I guess.

If it is x86 specific, it can work, though I'd suggest -o - instead of
-o/dev/stdout and being more picky on where you want to match the jmp,
as you don't want to match it in comments, or say filenames in the asm file
etc. E.g. require that jmp must be preceeded on the line only by whitespace
and followed by whitespace.

Jakub