Skip to content

Commit 473d1cf

Browse files
committed
sh: Decouple mcount from ftrace.
This adds a general CONFIG_MCOUNT in order to permit mcount generation without ftrace support. This is primarily for allowing platforms to enable aggressive stack overflow checking without having to enable ftrace support. Based on the sparc64 implementation. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
1 parent f686d8c commit 473d1cf

File tree

5 files changed

+12
-4
lines changed

5 files changed

+12
-4
lines changed

arch/sh/Kconfig.debug

+5
Original file line numberDiff line numberDiff line change
@@ -134,4 +134,9 @@ config STACK_DEBUG
134134
call and will therefore incur a major performance hit. Most
135135
users should say N.
136136

137+
config MCOUNT
138+
def_bool y
139+
depends on SUPERH32
140+
depends on STACK_DEBUG || FUNCTION_TRACER
141+
137142
endmenu

arch/sh/Makefile

+4
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,10 @@ KBUILD_CFLAGS += -pipe $(cflags-y)
186186
KBUILD_CPPFLAGS += $(cflags-y)
187187
KBUILD_AFLAGS += $(cflags-y)
188188

189+
ifeq ($(CONFIG_MCOUNT),y)
190+
KBUILD_CFLAGS += -pg
191+
endif
192+
189193
libs-$(CONFIG_SUPERH32) := arch/sh/lib/ $(libs-y)
190194
libs-$(CONFIG_SUPERH64) := arch/sh/lib64/ $(libs-y)
191195

arch/sh/boot/compressed/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ IMAGE_OFFSET := $(shell /bin/bash -c 'printf "0x%08x" \
2323

2424
LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
2525

26-
ifeq ($(CONFIG_FUNCTION_TRACER),y)
26+
ifeq ($(CONFIG_MCOUNT),y)
2727
ORIG_CFLAGS := $(KBUILD_CFLAGS)
2828
KBUILD_CFLAGS = $(subst -pg, , $(ORIG_CFLAGS))
2929
endif

arch/sh/kernel/sh_ksyms_32.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ EXPORT_SYMBOL(flush_dcache_page);
106106
EXPORT_SYMBOL(clear_user_page);
107107
#endif
108108

109-
#ifdef CONFIG_FUNCTION_TRACER
109+
#ifdef CONFIG_MCOUNT
110110
EXPORT_SYMBOL(mcount);
111111
#endif
112112
EXPORT_SYMBOL(csum_partial);

arch/sh/lib/Makefile

+1-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ memcpy-y := memcpy.o
2424
memcpy-$(CONFIG_CPU_SH4) := memcpy-sh4.o
2525

2626
lib-$(CONFIG_MMU) += copy_page.o clear_page.o
27-
lib-$(CONFIG_FUNCTION_TRACER) += mcount.o
28-
lib-$(CONFIG_FUNCTION_GRAPH_TRACER) += mcount.o
27+
lib-$(CONFIG_MCOUNT) += mcount.o
2928
lib-y += $(memcpy-y) $(udivsi3-y)
3029

3130
EXTRA_CFLAGS += -Werror

0 commit comments

Comments
 (0)