Re: [PATCH v2] x86: fix early boot crash on gcc-10
From: Michael Matz
Date: Wed Apr 22 2020 - 11:06:41 EST
Hello,
On Wed, 22 Apr 2020, Martin LiÅka wrote:
> One possible solution can be usage of a GCC pragma that will disable the
> tail-call optimization:
>
> $ cat tail.c
> int foo(int);
>
> #pragma GCC push_options
> #pragma GCC optimize("-fno-optimize-sibling-calls")
As we determined upthread (and the reason why we even still have this
thread): the optimize attribute (and pragma) reset flags from the command
line (the case in point was -fno-omit-frame-pointer). So, that's not a
solution for now.
> 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:
Right. I think the traditional asm (i.e. one without operands) is good
enough for the forseeable future from GCCs side: it relies on documented
behaviour of traditional asms, and hence would be very hard to change.
Ciao,
Michael.