浏览代码

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>
Paul Mundt 16 年之前
父节点
当前提交
473d1cf4ee
共有 5 个文件被更改,包括 12 次插入4 次删除
  1. 5 0
      arch/sh/Kconfig.debug
  2. 4 0
      arch/sh/Makefile
  3. 1 1
      arch/sh/boot/compressed/Makefile
  4. 1 1
      arch/sh/kernel/sh_ksyms_32.c
  5. 1 2
      arch/sh/lib/Makefile

+ 5 - 0
arch/sh/Kconfig.debug

@@ -134,4 +134,9 @@ config STACK_DEBUG
 	  call and will therefore incur a major performance hit. Most
 	  users should say N.
 
+config MCOUNT
+	def_bool y
+	depends on SUPERH32
+	depends on STACK_DEBUG || FUNCTION_TRACER
+
 endmenu

+ 4 - 0
arch/sh/Makefile

@@ -186,6 +186,10 @@ KBUILD_CFLAGS		+= -pipe $(cflags-y)
 KBUILD_CPPFLAGS		+= $(cflags-y)
 KBUILD_AFLAGS		+= $(cflags-y)
 
+ifeq ($(CONFIG_MCOUNT),y)
+  KBUILD_CFLAGS += -pg
+endif
+
 libs-$(CONFIG_SUPERH32)		:= arch/sh/lib/	$(libs-y)
 libs-$(CONFIG_SUPERH64)		:= arch/sh/lib64/ $(libs-y)
 

+ 1 - 1
arch/sh/boot/compressed/Makefile

@@ -23,7 +23,7 @@ IMAGE_OFFSET	:= $(shell /bin/bash -c 'printf "0x%08x" \
 
 LIBGCC	:= $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
 
-ifeq ($(CONFIG_FUNCTION_TRACER),y)
+ifeq ($(CONFIG_MCOUNT),y)
 ORIG_CFLAGS := $(KBUILD_CFLAGS)
 KBUILD_CFLAGS = $(subst -pg, , $(ORIG_CFLAGS))
 endif

+ 1 - 1
arch/sh/kernel/sh_ksyms_32.c

@@ -106,7 +106,7 @@ EXPORT_SYMBOL(flush_dcache_page);
 EXPORT_SYMBOL(clear_user_page);
 #endif
 
-#ifdef CONFIG_FUNCTION_TRACER
+#ifdef CONFIG_MCOUNT
 EXPORT_SYMBOL(mcount);
 #endif
 EXPORT_SYMBOL(csum_partial);

+ 1 - 2
arch/sh/lib/Makefile

@@ -24,8 +24,7 @@ memcpy-y			:= memcpy.o
 memcpy-$(CONFIG_CPU_SH4)	:= memcpy-sh4.o
 
 lib-$(CONFIG_MMU)		+= copy_page.o clear_page.o
-lib-$(CONFIG_FUNCTION_TRACER)	+= mcount.o
-lib-$(CONFIG_FUNCTION_GRAPH_TRACER) += mcount.o
+lib-$(CONFIG_MCOUNT)		+= mcount.o
 lib-y				+= $(memcpy-y) $(udivsi3-y)
 
 EXTRA_CFLAGS += -Werror