From: Miroslav Benes <mbenes@suse.cz>
Subject: livepatch: Add -fdump-ipa-clones to build
Patch-mainline: Never, SUSE-specific
References: fate#323487
When -fdump-ipa-clones option is enabled, GCC reports about its cloning
operation during IPA optimizations. We use the information for live
patches preparation, because it is crucial to know if and how functions
are optimized.
Introduce LIVEPATCH_IPA_CLONES to allow dumping the ipa clones during our
kernel build.
[ a shortcut compared to SLE15-SP2 taken. 4.12 kernels do not support testing
for GCC flags in Kconfig. SLE GCC supports the required option though. ]
Signed-off-by: Miroslav Benes <mbenes@suse.cz>
---
Makefile | 6 ++++++
kernel/livepatch/Kconfig | 7 +++++++
2 files changed, 13 insertions(+)
--- a/Makefile
+++ b/Makefile
@@ -819,6 +819,12 @@ ifdef CONFIG_LIVEPATCH
KBUILD_CFLAGS += $(call cc-option, -flive-patching=inline-clone)
endif
+ifdef CONFIG_LIVEPATCH_IPA_CLONES
+ifeq ($(KBUILD_EXTMOD),)
+KBUILD_CFLAGS += $(call cc-option, -fdump-ipa-clones)
+endif
+endif
+
# arch Makefile may override CC so keep this after arch Makefile is included
NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
CHECKFLAGS += $(NOSTDINC_FLAGS)
--- a/kernel/livepatch/Kconfig
+++ b/kernel/livepatch/Kconfig
@@ -17,3 +17,10 @@ config LIVEPATCH
module uses the interface provided by this option to register
a patch, causing calls to patched functions to be redirected
to new function code contained in the patch module.
+
+config LIVEPATCH_IPA_CLONES
+ bool "Kernel Live Patching - Dump IPA Clones"
+ depends on LIVEPATCH
+ help
+ Let GCC dump IPA clones during compilation.
+ Say N if you are unsure.