[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200422165339.GE26846@zn.tnic>
Date: Wed, 22 Apr 2020 18:53:39 +0200
From: Borislav Petkov <bp@...en8.de>
To: Martin Liška <mliska@...e.cz>
Cc: Jakub Jelinek <jakub@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Michael Matz <matz@...e.de>,
Sergei Trofimovich <slyfox@...too.org>,
LKML <linux-kernel@...r.kernel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
"H. Peter Anvin" <hpa@...or.com>,
Andy Lutomirski <luto@...nel.org>,
"maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" <x86@...nel.org>,
clang-built-linux <clang-built-linux@...glegroups.com>
Subject: Re: [PATCH v2] x86: fix early boot crash on gcc-10
On Wed, Apr 22, 2020 at 04:16:53PM +0200, Martin Liška wrote:
> And as I talked to Boris, I would recommend to come up with a "configure" check
> that a compiler does not optimize the key code sequence:
>
> $ 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.
Without the asm("") it produces:
bar:
.LFB0:
.cfi_startproc
jmp foo@PLT
.cfi_endproc
I'd like for LLVM folks to confirm that this is a good test for LLVM too
Trying that here with clang gives:
bar: # @bar
.cfi_startproc
# %bb.0:
jmp foo # TAILCALL
.Lfunc_end0:
so this *looks* like it would work with LLVM too but I might be missing
something...
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists