Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/kbuild: move -mprofile-kernel check to Kconfig

This eliminates the workaround that requires disabling
-mprofile-kernel by default in Kconfig.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Acked-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

authored by

Nicholas Piggin and committed by
Masahiro Yamada
abba7597 8373b7d9

+8 -34
+1 -15
arch/powerpc/Kconfig
··· 459 459 460 460 If unsure, say "N". 461 461 462 - config DISABLE_MPROFILE_KERNEL 463 - bool "Disable use of mprofile-kernel for kernel tracing" 464 - depends on PPC64 && CPU_LITTLE_ENDIAN 465 - default y 466 - help 467 - Selecting this options disables use of the mprofile-kernel ABI for 468 - kernel tracing. That will cause options such as live patching 469 - (CONFIG_LIVEPATCH) which depend on CONFIG_DYNAMIC_FTRACE_WITH_REGS to 470 - be disabled also. 471 - 472 - If you have a toolchain which supports mprofile-kernel, then you can 473 - disable this. Otherwise leave it enabled. If you're not sure, say 474 - "Y". 475 - 476 462 config MPROFILE_KERNEL 477 463 depends on PPC64 && CPU_LITTLE_ENDIAN 478 - def_bool !DISABLE_MPROFILE_KERNEL 464 + def_bool $(success,$(srctree)/arch/powerpc/tools/gcc-check-mprofile-kernel.sh $(CC) -I$(srctree)/include -D__KERNEL__) 479 465 480 466 config HOTPLUG_CPU 481 467 bool "Support for enabling/disabling CPUs"
+1 -12
arch/powerpc/Makefile
··· 161 161 endif 162 162 163 163 ifdef CONFIG_MPROFILE_KERNEL 164 - ifeq ($(shell $(srctree)/arch/powerpc/tools/gcc-check-mprofile-kernel.sh $(CC) -I$(srctree)/include -D__KERNEL__),OK) 165 - CC_FLAGS_FTRACE := -pg -mprofile-kernel 166 - KBUILD_CPPFLAGS += -DCC_USING_MPROFILE_KERNEL 167 - else 168 - # If the user asked for mprofile-kernel but the toolchain doesn't 169 - # support it, emit a warning and deliberately break the build later 170 - # with mprofile-kernel-not-supported. We would prefer to make this an 171 - # error right here, but then the user would never be able to run 172 - # oldconfig to change their configuration. 173 - $(warning Compiler does not support mprofile-kernel, set CONFIG_DISABLE_MPROFILE_KERNEL) 174 - CC_FLAGS_FTRACE := -mprofile-kernel-not-supported 175 - endif 164 + CC_FLAGS_FTRACE := -pg -mprofile-kernel 176 165 endif 177 166 178 167 CFLAGS-$(CONFIG_CELL_CPU) += $(call cc-option,-mcpu=cell)
+1 -1
arch/powerpc/include/asm/module.h
··· 14 14 #include <asm-generic/module.h> 15 15 16 16 17 - #ifdef CC_USING_MPROFILE_KERNEL 17 + #ifdef CONFIG_MPROFILE_KERNEL 18 18 #define MODULE_ARCH_VERMAGIC_FTRACE "mprofile-kernel " 19 19 #else 20 20 #define MODULE_ARCH_VERMAGIC_FTRACE ""
+2 -2
arch/powerpc/kernel/module_64.c
··· 466 466 return (unsigned long)&stubs[i]; 467 467 } 468 468 469 - #ifdef CC_USING_MPROFILE_KERNEL 469 + #ifdef CONFIG_MPROFILE_KERNEL 470 470 static bool is_mprofile_mcount_callsite(const char *name, u32 *instruction) 471 471 { 472 472 if (strcmp("_mcount", name)) ··· 753 753 754 754 #ifdef CONFIG_DYNAMIC_FTRACE 755 755 756 - #ifdef CC_USING_MPROFILE_KERNEL 756 + #ifdef CONFIG_MPROFILE_KERNEL 757 757 758 758 #define PACATOC offsetof(struct paca_struct, kernel_toc) 759 759
+3 -3
arch/powerpc/kernel/trace/ftrace.c
··· 144 144 return -EINVAL; 145 145 } 146 146 147 - #ifdef CC_USING_MPROFILE_KERNEL 147 + #ifdef CONFIG_MPROFILE_KERNEL 148 148 /* When using -mkernel_profile there is no load to jump over */ 149 149 pop = PPC_INST_NOP; 150 150 ··· 188 188 pr_err("Expected %08x found %08x\n", PPC_INST_LD_TOC, op); 189 189 return -EINVAL; 190 190 } 191 - #endif /* CC_USING_MPROFILE_KERNEL */ 191 + #endif /* CONFIG_MPROFILE_KERNEL */ 192 192 193 193 if (patch_instruction((unsigned int *)ip, pop)) { 194 194 pr_err("Patching NOP failed.\n"); ··· 324 324 * They should effectively be a NOP, and follow formal constraints, 325 325 * depending on the ABI. Return false if they don't. 326 326 */ 327 - #ifndef CC_USING_MPROFILE_KERNEL 327 + #ifndef CONFIG_MPROFILE_KERNEL 328 328 static int 329 329 expected_nop_sequence(void *ip, unsigned int op0, unsigned int op1) 330 330 {
-1
arch/powerpc/tools/gcc-check-mprofile-kernel.sh
··· 24 24 2> /dev/null | grep -q "_mcount" && \ 25 25 exit 1 26 26 27 - echo "OK" 28 27 exit 0