• Linus Torvalds's avatar
    update workarounds for gcc "asm goto" issue · 68fb3ca0
    Linus Torvalds authored
    In commit 4356e9f8 ("work around gcc bugs with 'asm goto' with
    outputs") I did the gcc workaround unconditionally, because the cause of
    the bad code generation wasn't entirely clear.
    
    In the meantime, Jakub Jelinek debugged the issue, and has come up with
    a fix in gcc [2], which also got backported to the still maintained
    branches of gcc-11, gcc-12 and gcc-13.
    
    Note that while the fix technically wasn't in the original gcc-14
    branch, Jakub says:
    
     "while it is true that no GCC 14 snapshots until today (or whenever the
      fix will be committed) have the fix, for GCC trunk it is up to the
      distros to use the latest snapshot if they use it at all and would
      allow better testing of the kernel code without the workaround, so
      that if there are other issues they won't be discovered years later.
      Most userland code doesn't actually use asm goto with outputs..."
    
    so we will consider gcc-14 to be fixed - if somebody is using gcc
    snapshots of the gcc-14 before the fix, they should upgrade.
    
    Note that while the bug goes back to gcc-11, in practice other gcc
    changes seem to have effectively hidden it since gcc-12.1 as per a
    bisect by Jakub.  So even a gcc-14 snapshot without the fix likely
    doesn't show actual problems.
    
    Also, make the default 'asm_goto_output()' macro mark the asm as
    volatile by hand, because of an unrelated gcc issue [1] where it doesn't
    match the documented behavior ("asm goto is always volatile").
    
    Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103979 [1]
    Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113921 [2]
    Link: https://lore.kernel.org/all/20240208220604.140859-1-seanjc@google.com/Requested-by: default avatarJakub Jelinek <jakub@redhat.com>
    Cc: Uros Bizjak <ubizjak@gmail.com>
    Cc: Nick Desaulniers <ndesaulniers@google.com>
    Cc: Sean Christopherson <seanjc@google.com>
    Cc: Andrew Pinski <quic_apinski@quicinc.com>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    68fb3ca0
Kconfig 63.2 KB