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

Commit 0276ebf1 authored by Masahiro Yamada's avatar Masahiro Yamada Committed by Greg Kroah-Hartman
Browse files

jump_label: move 'asm goto' support test to Kconfig



commit e9666d10a5677a494260d60d1fa0b73cc7646eb3 upstream.

Currently, CONFIG_JUMP_LABEL just means "I _want_ to use jump label".

The jump label is controlled by HAVE_JUMP_LABEL, which is defined
like this:

  #if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_JUMP_LABEL)
  # define HAVE_JUMP_LABEL
  #endif

We can improve this by testing 'asm goto' support in Kconfig, then
make JUMP_LABEL depend on CC_HAS_ASM_GOTO.

Ugly #ifdef HAVE_JUMP_LABEL will go away, and CONFIG_JUMP_LABEL will
match to the real kernel capability.

Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
Tested-by: default avatarSedat Dilek <sedat.dilek@gmail.com>
[nc: Fix trivial conflicts in 4.19
     arch/xtensa/kernel/jump_label.c doesn't exist yet
     Ensured CC_HAVE_ASM_GOTO and HAVE_JUMP_LABEL were sufficiently
     eliminated]
Signed-off-by: default avatarNathan Chancellor <natechancellor@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 75332872
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -508,13 +508,6 @@ export RETPOLINE_VDSO_CFLAGS
KBUILD_CFLAGS	+= $(call cc-option,-fno-PIE)
KBUILD_AFLAGS	+= $(call cc-option,-fno-PIE)

# check for 'asm goto'
ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLAGS)), y)
  CC_HAVE_ASM_GOTO := 1
  KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO
  KBUILD_AFLAGS += -DCC_HAVE_ASM_GOTO
endif

# The expansion should be delayed until arch/$(SRCARCH)/Makefile is included.
# Some architectures define CROSS_COMPILE in arch/$(SRCARCH)/Makefile.
# CC_VERSION_TEXT is referenced from Kconfig (so it needs export),
+1 −0
Original line number Diff line number Diff line
@@ -71,6 +71,7 @@ config KPROBES
config JUMP_LABEL
       bool "Optimize very unlikely/likely branches"
       depends on HAVE_ARCH_JUMP_LABEL
       depends on CC_HAS_ASM_GOTO
       help
         This option enables a transparent branch optimization that
	 makes certain almost-always-true or almost-always-false branch
+0 −4
Original line number Diff line number Diff line
@@ -4,8 +4,6 @@
#include <asm/patch.h>
#include <asm/insn.h>

#ifdef HAVE_JUMP_LABEL

static void __arch_jump_label_transform(struct jump_entry *entry,
					enum jump_label_type type,
					bool is_static)
@@ -35,5 +33,3 @@ void arch_jump_label_transform_static(struct jump_entry *entry,
{
	__arch_jump_label_transform(entry, type, true);
}

#endif
+0 −4
Original line number Diff line number Diff line
@@ -20,8 +20,6 @@
#include <linux/jump_label.h>
#include <asm/insn.h>

#ifdef HAVE_JUMP_LABEL

void arch_jump_label_transform(struct jump_entry *entry,
			       enum jump_label_type type)
{
@@ -49,5 +47,3 @@ void arch_jump_label_transform_static(struct jump_entry *entry,
	 * NOP needs to be replaced by a branch.
	 */
}

#endif	/* HAVE_JUMP_LABEL */
+0 −4
Original line number Diff line number Diff line
@@ -16,8 +16,6 @@
#include <asm/cacheflush.h>
#include <asm/inst.h>

#ifdef HAVE_JUMP_LABEL

/*
 * Define parameters for the standard MIPS and the microMIPS jump
 * instruction encoding respectively:
@@ -70,5 +68,3 @@ void arch_jump_label_transform(struct jump_entry *e,

	mutex_unlock(&text_mutex);
}

#endif /* HAVE_JUMP_LABEL */
Loading