aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt (VMware) <rostedt@goodmis.org>2017-03-23 10:33:53 -0400
committerThomas Gleixner <tglx@linutronix.de>2017-03-24 05:14:08 -0400
commit1fa9d67a2f07893fc7e4a880867a6cbb81dda547 (patch)
treeb91313082fbb3b6956e8d704a62f14af1b99868e
parent644e0e8dc76b919976c44d3929164d42cbe656bc (diff)
x86/ftrace: Use Makefile logic instead of #ifdef for compiling ftrace_*.o
Currently ftrace_32.S and ftrace_64.S are compiled even when CONFIG_FUNCTION_TRACER is not set. This means there's an unnecessary #ifdef to protect the code. Instead of using preprocessor directives, only compile those files when FUNCTION_TRACER is defined. Suggested-by: Josh Poimboeuf <jpoimboe@redhat.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Reviewed-by: Josh Poimboeuf <jpoimboe@redhat.com> Reviewed-by: Ingo Molnar <mingo@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Link: http://lkml.kernel.org/r/20170316210043.peycxdxktwwn6cid@treble Link: http://lkml.kernel.org/r/20170323143446.217684991@goodmis.org Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r--arch/x86/kernel/Makefile4
-rw-r--r--arch/x86/kernel/ftrace_32.S3
-rw-r--r--arch/x86/kernel/ftrace_64.S4
3 files changed, 2 insertions, 9 deletions
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index 55e8902c461f..4b994232cb57 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -46,8 +46,7 @@ obj-$(CONFIG_MODIFY_LDT_SYSCALL) += ldt.o
46obj-y += setup.o x86_init.o i8259.o irqinit.o jump_label.o 46obj-y += setup.o x86_init.o i8259.o irqinit.o jump_label.o
47obj-$(CONFIG_IRQ_WORK) += irq_work.o 47obj-$(CONFIG_IRQ_WORK) += irq_work.o
48obj-y += probe_roms.o 48obj-y += probe_roms.o
49obj-$(CONFIG_X86_64) += sys_x86_64.o ftrace_64.o 49obj-$(CONFIG_X86_64) += sys_x86_64.o
50obj-$(CONFIG_X86_32) += ftrace_32.o
51obj-$(CONFIG_X86_ESPFIX64) += espfix_64.o 50obj-$(CONFIG_X86_ESPFIX64) += espfix_64.o
52obj-$(CONFIG_SYSFS) += ksysfs.o 51obj-$(CONFIG_SYSFS) += ksysfs.o
53obj-y += bootflag.o e820.o 52obj-y += bootflag.o e820.o
@@ -83,6 +82,7 @@ obj-y += apic/
83obj-$(CONFIG_X86_REBOOTFIXUPS) += reboot_fixups_32.o 82obj-$(CONFIG_X86_REBOOTFIXUPS) += reboot_fixups_32.o
84obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o 83obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o
85obj-$(CONFIG_LIVEPATCH) += livepatch.o 84obj-$(CONFIG_LIVEPATCH) += livepatch.o
85obj-$(CONFIG_FUNCTION_TRACER) += ftrace_$(BITS).o
86obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o 86obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o
87obj-$(CONFIG_FTRACE_SYSCALLS) += ftrace.o 87obj-$(CONFIG_FTRACE_SYSCALLS) += ftrace.o
88obj-$(CONFIG_X86_TSC) += trace_clock.o 88obj-$(CONFIG_X86_TSC) += trace_clock.o
diff --git a/arch/x86/kernel/ftrace_32.S b/arch/x86/kernel/ftrace_32.S
index 80518ec5b882..07f40359c9ea 100644
--- a/arch/x86/kernel/ftrace_32.S
+++ b/arch/x86/kernel/ftrace_32.S
@@ -8,8 +8,6 @@
8#include <asm/export.h> 8#include <asm/export.h>
9#include <asm/ftrace.h> 9#include <asm/ftrace.h>
10 10
11#ifdef CONFIG_FUNCTION_TRACER
12
13#ifdef CC_USING_FENTRY 11#ifdef CC_USING_FENTRY
14# define function_hook __fentry__ 12# define function_hook __fentry__
15EXPORT_SYMBOL(__fentry__) 13EXPORT_SYMBOL(__fentry__)
@@ -206,7 +204,6 @@ ftrace_stub:
206 jmp ftrace_stub 204 jmp ftrace_stub
207END(function_hook) 205END(function_hook)
208#endif /* CONFIG_DYNAMIC_FTRACE */ 206#endif /* CONFIG_DYNAMIC_FTRACE */
209#endif /* CONFIG_FUNCTION_TRACER */
210 207
211#ifdef CONFIG_FUNCTION_GRAPH_TRACER 208#ifdef CONFIG_FUNCTION_GRAPH_TRACER
212ENTRY(ftrace_graph_caller) 209ENTRY(ftrace_graph_caller)
diff --git a/arch/x86/kernel/ftrace_64.S b/arch/x86/kernel/ftrace_64.S
index d1be3cbe2cd4..1dfac634bbf7 100644
--- a/arch/x86/kernel/ftrace_64.S
+++ b/arch/x86/kernel/ftrace_64.S
@@ -11,9 +11,6 @@
11 .code64 11 .code64
12 .section .entry.text, "ax" 12 .section .entry.text, "ax"
13 13
14
15#ifdef CONFIG_FUNCTION_TRACER
16
17#ifdef CC_USING_FENTRY 14#ifdef CC_USING_FENTRY
18# define function_hook __fentry__ 15# define function_hook __fentry__
19EXPORT_SYMBOL(__fentry__) 16EXPORT_SYMBOL(__fentry__)
@@ -295,7 +292,6 @@ trace:
295 jmp fgraph_trace 292 jmp fgraph_trace
296END(function_hook) 293END(function_hook)
297#endif /* CONFIG_DYNAMIC_FTRACE */ 294#endif /* CONFIG_DYNAMIC_FTRACE */
298#endif /* CONFIG_FUNCTION_TRACER */
299 295
300#ifdef CONFIG_FUNCTION_GRAPH_TRACER 296#ifdef CONFIG_FUNCTION_GRAPH_TRACER
301ENTRY(ftrace_graph_caller) 297ENTRY(ftrace_graph_caller)