Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3f0116c3 authored by Ingo Molnar's avatar Ingo Molnar
Browse files

compiler/gcc4: Add quirk for 'asm goto' miscompilation bug

Fengguang Wu, Oleg Nesterov and Peter Zijlstra tracked down
a kernel crash to a GCC bug: GCC miscompiles certain 'asm goto'
constructs, as outlined here:

  http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670



Implement a workaround suggested by Jakub Jelinek.

Reported-and-tested-by: default avatarFengguang Wu <fengguang.wu@intel.com>
Reported-by: default avatarOleg Nesterov <oleg@redhat.com>
Reported-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
Suggested-by: default avatarJakub Jelinek <jakub@redhat.com>
Reviewed-by: default avatarRichard Henderson <rth@twiddle.net>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: <stable@kernel.org>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 2fe80d3b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@

static __always_inline bool arch_static_branch(struct static_key *key)
{
	asm goto("1:\n\t"
	asm_volatile_goto("1:\n\t"
		 JUMP_LABEL_NOP "\n\t"
		 ".pushsection __jump_table,  \"aw\"\n\t"
		 ".word 1b, %l[l_yes], %c0\n\t"
+1 −1
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@

static __always_inline bool arch_static_branch(struct static_key *key)
{
	asm goto("1:\tnop\n\t"
	asm_volatile_goto("1:\tnop\n\t"
		"nop\n\t"
		".pushsection __jump_table,  \"aw\"\n\t"
		WORD_INSN " 1b, %l[l_yes], %0\n\t"
+1 −1
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@

static __always_inline bool arch_static_branch(struct static_key *key)
{
	asm goto("1:\n\t"
	asm_volatile_goto("1:\n\t"
		 "nop\n\t"
		 ".pushsection __jump_table,  \"aw\"\n\t"
		 JUMP_ENTRY_TYPE "1b, %l[l_yes], %c0\n\t"
+1 −1
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@

static __always_inline bool arch_static_branch(struct static_key *key)
{
	asm goto("0:	brcl 0,0\n"
	asm_volatile_goto("0:	brcl 0,0\n"
		".pushsection __jump_table, \"aw\"\n"
		ASM_ALIGN "\n"
		ASM_PTR " 0b, %l[label], %0\n"
+1 −1
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@

static __always_inline bool arch_static_branch(struct static_key *key)
{
		asm goto("1:\n\t"
		asm_volatile_goto("1:\n\t"
			 "nop\n\t"
			 "nop\n\t"
			 ".pushsection __jump_table,  \"aw\"\n\t"
Loading