Skip to content

Commit 1fa9d67

Browse files
rostedtKAGA-KOKO
authored andcommitted
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>
1 parent 644e0e8 commit 1fa9d67

File tree

3 files changed

+2
-9
lines changed

3 files changed

+2
-9
lines changed

arch/x86/kernel/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ obj-$(CONFIG_MODIFY_LDT_SYSCALL) += ldt.o
4646
obj-y += setup.o x86_init.o i8259.o irqinit.o jump_label.o
4747
obj-$(CONFIG_IRQ_WORK) += irq_work.o
4848
obj-y += probe_roms.o
49-
obj-$(CONFIG_X86_64) += sys_x86_64.o ftrace_64.o
50-
obj-$(CONFIG_X86_32) += ftrace_32.o
49+
obj-$(CONFIG_X86_64) += sys_x86_64.o
5150
obj-$(CONFIG_X86_ESPFIX64) += espfix_64.o
5251
obj-$(CONFIG_SYSFS) += ksysfs.o
5352
obj-y += bootflag.o e820.o
@@ -83,6 +82,7 @@ obj-y += apic/
8382
obj-$(CONFIG_X86_REBOOTFIXUPS) += reboot_fixups_32.o
8483
obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o
8584
obj-$(CONFIG_LIVEPATCH) += livepatch.o
85+
obj-$(CONFIG_FUNCTION_TRACER) += ftrace_$(BITS).o
8686
obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o
8787
obj-$(CONFIG_FTRACE_SYSCALLS) += ftrace.o
8888
obj-$(CONFIG_X86_TSC) += trace_clock.o

arch/x86/kernel/ftrace_32.S

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
#include <asm/export.h>
99
#include <asm/ftrace.h>
1010

11-
#ifdef CONFIG_FUNCTION_TRACER
12-
1311
#ifdef CC_USING_FENTRY
1412
# define function_hook __fentry__
1513
EXPORT_SYMBOL(__fentry__)
@@ -206,7 +204,6 @@ ftrace_stub:
206204
jmp ftrace_stub
207205
END(function_hook)
208206
#endif /* CONFIG_DYNAMIC_FTRACE */
209-
#endif /* CONFIG_FUNCTION_TRACER */
210207

211208
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
212209
ENTRY(ftrace_graph_caller)

arch/x86/kernel/ftrace_64.S

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@
1111
.code64
1212
.section .entry.text, "ax"
1313

14-
15-
#ifdef CONFIG_FUNCTION_TRACER
16-
1714
#ifdef CC_USING_FENTRY
1815
# define function_hook __fentry__
1916
EXPORT_SYMBOL(__fentry__)
@@ -295,7 +292,6 @@ trace:
295292
jmp fgraph_trace
296293
END(function_hook)
297294
#endif /* CONFIG_DYNAMIC_FTRACE */
298-
#endif /* CONFIG_FUNCTION_TRACER */
299295

300296
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
301297
ENTRY(ftrace_graph_caller)

0 commit comments

Comments
 (0)