diff options
author | Torsten Duwe <duwe@lst.de> | 2016-03-03 15:27:00 +1100 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2016-03-07 14:53:56 +1100 |
commit | 8c50b72a3b4f1f7cdfdfebd233b1cbd121262e65 (patch) | |
tree | e705558f3855d60ef389e651ad204e5c1f3f3f9d /arch/powerpc/Makefile | |
parent | 153086644fd1fb07fb3af84d9f11542a19b1e8b6 (diff) | |
download | linux-8c50b72a3b4f1f7cdfdfebd233b1cbd121262e65.tar.gz linux-8c50b72a3b4f1f7cdfdfebd233b1cbd121262e65.tar.bz2 linux-8c50b72a3b4f1f7cdfdfebd233b1cbd121262e65.zip |
powerpc/ftrace: Add Kconfig & Make glue for mprofile-kernel
Firstly we add logic to Kconfig to allow a user to choose if they want
mprofile-kernel. This has to be user-selectable because only some
current toolchains support it. If we enabled it unconditionally we would
prevent some users from building the kernel entirely.
Arguably it would be nice if we could detect if mprofile-kernel was
available, and use it then. However that would violate the principle of
least surprise because a user having choosen options such as live
patching, would then see them quietly disabled at build time.
We also make the user selectable option negative, ie. it disables when
selected, so that allyesconfig continues to build on old toolchains.
Once we've decided we do want to use mprofile-kernel, we then add a
script which checks it actually works. That is because there are
versions of gcc that accept the flag but don't generate correct code.
Due to the way kconfig works, we can't error out when we detect a
non-working toolchain. If we did a user would never be able to modify
their config and run oldconfig - because the check would block oldconfig
from running. Instead we emit a warning and add a bogus flag to CFLAGS
so that the build will fail.
Signed-off-by: Torsten Duwe <duwe@suse.de>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/Makefile')
-rw-r--r-- | arch/powerpc/Makefile | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile index 96efd8213c1c..f4e49a4153cb 100644 --- a/arch/powerpc/Makefile +++ b/arch/powerpc/Makefile @@ -133,6 +133,21 @@ else CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=powerpc64 endif +ifdef CONFIG_MPROFILE_KERNEL + ifeq ($(shell $(srctree)/arch/powerpc/scripts/gcc-check-mprofile-kernel.sh $(CC) -I$(srctree)/include -D__KERNEL__),OK) + CC_FLAGS_FTRACE := -pg -mprofile-kernel + KBUILD_CPPFLAGS += -DCC_USING_MPROFILE_KERNEL + else + # If the user asked for mprofile-kernel but the toolchain doesn't + # support it, emit a warning and deliberately break the build later + # with mprofile-kernel-not-supported. We would prefer to make this an + # error right here, but then the user would never be able to run + # oldconfig to change their configuration. + $(warning Compiler does not support mprofile-kernel, set CONFIG_DISABLE_MPROFILE_KERNEL) + CC_FLAGS_FTRACE := -mprofile-kernel-not-supported + endif +endif + CFLAGS-$(CONFIG_CELL_CPU) += $(call cc-option,-mcpu=cell) CFLAGS-$(CONFIG_POWER4_CPU) += $(call cc-option,-mcpu=power4) CFLAGS-$(CONFIG_POWER5_CPU) += $(call cc-option,-mcpu=power5) |