diff options
author | Josh Poimboeuf <jpoimboe@redhat.com> | 2017-04-18 17:44:29 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2017-04-19 03:57:23 -0400 |
commit | a5859c6d7b6114fc0e52be40f7b0f5451c4aba93 (patch) | |
tree | 185259ce56a5b6fa1c998e501b265551786c2844 | |
parent | 34a477e5297cbaa6ecc6e17c042a866e1cbe80d6 (diff) |
x86/build: convert function graph '-Os' error to warning
For pre-4.6.0 versions of GCC, which don't have '-mfentry', the
'-maccumulate-outgoing-args' option is required for function graph
tracing in order to avoid GCC bug 42109.
However, GCC ignores '-maccumulate-outgoing-args' when '-Os' is
also set.
Currently we force a build error to prevent that scenario, but that
breaks randconfigs. So change the error to a warning which also
disables CONFIG_CC_OPTIMIZE_FOR_SIZE.
Reported-by: Andi Kleen <andi@firstfloor.org>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: kbuild test robot <fengguang.wu@intel.com>
Cc: kbuild-all@01.org
Link: http://lkml.kernel.org/r/20170418214429.o7fbwbmf4nqosezy@treble
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | arch/x86/Makefile | 8 | ||||
-rw-r--r-- | arch/x86/kernel/ftrace.c | 6 |
2 files changed, 8 insertions, 6 deletions
diff --git a/arch/x86/Makefile b/arch/x86/Makefile index a94a4d10f2df..49d160b781f0 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile | |||
@@ -154,6 +154,14 @@ ifdef CONFIG_FUNCTION_GRAPH_TRACER | |||
154 | else | 154 | else |
155 | ifeq ($(call cc-option-yn, -mfentry), n) | 155 | ifeq ($(call cc-option-yn, -mfentry), n) |
156 | ACCUMULATE_OUTGOING_ARGS := 1 | 156 | ACCUMULATE_OUTGOING_ARGS := 1 |
157 | |||
158 | # GCC ignores '-maccumulate-outgoing-args' when used with '-Os'. | ||
159 | # If '-Os' is enabled, disable it and print a warning. | ||
160 | ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE | ||
161 | undefine CONFIG_CC_OPTIMIZE_FOR_SIZE | ||
162 | $(warning Disabling CONFIG_CC_OPTIMIZE_FOR_SIZE. Your compiler does not have -mfentry so you cannot optimize for size with CONFIG_FUNCTION_GRAPH_TRACER.) | ||
163 | endif | ||
164 | |||
157 | endif | 165 | endif |
158 | endif | 166 | endif |
159 | endif | 167 | endif |
diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c index 0e5ceac3597d..5b7153540727 100644 --- a/arch/x86/kernel/ftrace.c +++ b/arch/x86/kernel/ftrace.c | |||
@@ -29,12 +29,6 @@ | |||
29 | #include <asm/ftrace.h> | 29 | #include <asm/ftrace.h> |
30 | #include <asm/nops.h> | 30 | #include <asm/nops.h> |
31 | 31 | ||
32 | #if defined(CONFIG_FUNCTION_GRAPH_TRACER) && \ | ||
33 | !defined(CC_USING_FENTRY) && \ | ||
34 | !defined(CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE) | ||
35 | # error The following combination is not supported: ((compiler missing -mfentry) || (CONFIG_X86_32 and !CONFIG_DYNAMIC_FTRACE)) && CONFIG_FUNCTION_GRAPH_TRACER && CONFIG_CC_OPTIMIZE_FOR_SIZE | ||
36 | #endif | ||
37 | |||
38 | #ifdef CONFIG_DYNAMIC_FTRACE | 32 | #ifdef CONFIG_DYNAMIC_FTRACE |
39 | 33 | ||
40 | int ftrace_arch_code_modify_prepare(void) | 34 | int ftrace_arch_code_modify_prepare(void) |