Blob Blame History Raw
From: Miroslav Benes <mbenes@suse.cz>
Subject: livepatch: Add -fdump-ipa-clones to build
Patch-mainline: Never, SUSE-specific
References: jsc#SLE-17360 bsc#1190003

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.

Signed-off-by: Miroslav Benes <mbenes@suse.cz>
---
 Makefile                 |    6 ++++++
 kernel/livepatch/Kconfig |    8 ++++++++
 2 files changed, 14 insertions(+)

--- a/Makefile
+++ b/Makefile
@@ -982,6 +982,12 @@ ifdef CONFIG_DEBUG_FORCE_FUNCTION_ALIGN_
 KBUILD_CFLAGS += -falign-functions=64
 endif
 
+ifdef CONFIG_LIVEPATCH_IPA_CLONES
+ifeq ($(KBUILD_EXTMOD),)
+KBUILD_CFLAGS += -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)
 
--- a/kernel/livepatch/Kconfig
+++ b/kernel/livepatch/Kconfig
@@ -18,3 +18,11 @@ 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
+	depends on $(cc-option, -fdump-ipa-clones)
+	help
+	  Let GCC dump IPA clones during compilation.
+	  Say N if you are unsure.