diff options
author | Anton Blanchard <anton@samba.org> | 2015-04-08 23:51:31 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2015-04-09 03:40:24 -0400 |
commit | c0ccf6f99e3a43b87980c9df7da48427885206d0 (patch) | |
tree | 75ed67a3b57d5b7326255b747756f2e63d53da97 | |
parent | 55dd0df781e58ec23d218376ea4a676e7362a98c (diff) |
jump_label: Allow jump labels to be used in assembly
To use jump labels in assembly we need the HAVE_JUMP_LABEL
define, so we select a fallback version if the toolchain does
not support them.
Modify linux/jump_label.h so it can be included by assembly
files. We also need to add -DCC_HAVE_ASM_GOTO to KBUILD_AFLAGS.
Signed-off-by: Anton Blanchard <anton@samba.org>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: benh@kernel.crashing.org
Cc: catalin.marinas@arm.com
Cc: davem@davemloft.net
Cc: heiko.carstens@de.ibm.com
Cc: jbaron@akamai.com
Cc: linux@arm.linux.org.uk
Cc: linuxppc-dev@lists.ozlabs.org
Cc: liuj97@gmail.com
Cc: mgorman@suse.de
Cc: mmarek@suse.cz
Cc: mpe@ellerman.id.au
Cc: paulus@samba.org
Cc: ralf@linux-mips.org
Cc: rostedt@goodmis.org
Cc: schwidefsky@de.ibm.com
Cc: will.deacon@arm.com
Link: http://lkml.kernel.org/r/1428551492-21977-2-git-send-email-anton@samba.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | Makefile | 1 | ||||
-rw-r--r-- | include/linux/jump_label.h | 21 |
2 files changed, 18 insertions, 4 deletions
@@ -779,6 +779,7 @@ KBUILD_ARFLAGS := $(call ar-option,D) | |||
779 | # check for 'asm goto' | 779 | # check for 'asm goto' |
780 | ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC)), y) | 780 | ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC)), y) |
781 | KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO | 781 | KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO |
782 | KBUILD_AFLAGS += -DCC_HAVE_ASM_GOTO | ||
782 | endif | 783 | endif |
783 | 784 | ||
784 | include $(srctree)/scripts/Makefile.kasan | 785 | include $(srctree)/scripts/Makefile.kasan |
diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h index 98f923b6a0ea..f4de473f226b 100644 --- a/include/linux/jump_label.h +++ b/include/linux/jump_label.h | |||
@@ -45,6 +45,12 @@ | |||
45 | * same as using STATIC_KEY_INIT_FALSE. | 45 | * same as using STATIC_KEY_INIT_FALSE. |
46 | */ | 46 | */ |
47 | 47 | ||
48 | #if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_JUMP_LABEL) | ||
49 | # define HAVE_JUMP_LABEL | ||
50 | #endif | ||
51 | |||
52 | #ifndef __ASSEMBLY__ | ||
53 | |||
48 | #include <linux/types.h> | 54 | #include <linux/types.h> |
49 | #include <linux/compiler.h> | 55 | #include <linux/compiler.h> |
50 | #include <linux/bug.h> | 56 | #include <linux/bug.h> |
@@ -55,7 +61,7 @@ extern bool static_key_initialized; | |||
55 | "%s used before call to jump_label_init", \ | 61 | "%s used before call to jump_label_init", \ |
56 | __func__) | 62 | __func__) |
57 | 63 | ||
58 | #if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_JUMP_LABEL) | 64 | #ifdef HAVE_JUMP_LABEL |
59 | 65 | ||
60 | struct static_key { | 66 | struct static_key { |
61 | atomic_t enabled; | 67 | atomic_t enabled; |
@@ -66,13 +72,18 @@ struct static_key { | |||
66 | #endif | 72 | #endif |
67 | }; | 73 | }; |
68 | 74 | ||
69 | # include <asm/jump_label.h> | ||
70 | # define HAVE_JUMP_LABEL | ||
71 | #else | 75 | #else |
72 | struct static_key { | 76 | struct static_key { |
73 | atomic_t enabled; | 77 | atomic_t enabled; |
74 | }; | 78 | }; |
75 | #endif /* CC_HAVE_ASM_GOTO && CONFIG_JUMP_LABEL */ | 79 | #endif /* HAVE_JUMP_LABEL */ |
80 | #endif /* __ASSEMBLY__ */ | ||
81 | |||
82 | #ifdef HAVE_JUMP_LABEL | ||
83 | #include <asm/jump_label.h> | ||
84 | #endif | ||
85 | |||
86 | #ifndef __ASSEMBLY__ | ||
76 | 87 | ||
77 | enum jump_label_type { | 88 | enum jump_label_type { |
78 | JUMP_LABEL_DISABLE = 0, | 89 | JUMP_LABEL_DISABLE = 0, |
@@ -203,3 +214,5 @@ static inline bool static_key_enabled(struct static_key *key) | |||
203 | } | 214 | } |
204 | 215 | ||
205 | #endif /* _LINUX_JUMP_LABEL_H */ | 216 | #endif /* _LINUX_JUMP_LABEL_H */ |
217 | |||
218 | #endif /* __ASSEMBLY__ */ | ||