FROMLIST: tracing: add support for objtool mcount
This change adds build support for using objtool to generate __mcount_loc sections. Bug: 145210207 Change-Id: I58f4eae487a1f2cc1486daa6ae4927a2ef5f7137 Link: https://lore.kernel.org/lkml/20201013003203.4168817-6-samitolvanen@google.com/ Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
This commit is contained in:
7
Makefile
7
Makefile
@@ -861,6 +861,9 @@ ifdef CONFIG_FTRACE_MCOUNT_USE_CC
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
ifdef CONFIG_FTRACE_MCOUNT_USE_OBJTOOL
|
||||||
|
CC_FLAGS_USING += -DCC_USING_NOP_MCOUNT
|
||||||
|
endif
|
||||||
ifdef CONFIG_FTRACE_MCOUNT_USE_RECORDMCOUNT
|
ifdef CONFIG_FTRACE_MCOUNT_USE_RECORDMCOUNT
|
||||||
ifdef CONFIG_HAVE_C_RECORDMCOUNT
|
ifdef CONFIG_HAVE_C_RECORDMCOUNT
|
||||||
BUILD_C_RECORDMCOUNT := y
|
BUILD_C_RECORDMCOUNT := y
|
||||||
@@ -1273,6 +1276,10 @@ uapi-asm-generic:
|
|||||||
PHONY += prepare-objtool prepare-resolve_btfids
|
PHONY += prepare-objtool prepare-resolve_btfids
|
||||||
prepare-objtool: $(objtool_target)
|
prepare-objtool: $(objtool_target)
|
||||||
ifeq ($(SKIP_STACK_VALIDATION),1)
|
ifeq ($(SKIP_STACK_VALIDATION),1)
|
||||||
|
ifdef CONFIG_FTRACE_MCOUNT_USE_OBJTOOL
|
||||||
|
@echo "error: Cannot generate __mcount_loc for CONFIG_DYNAMIC_FTRACE=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel" >&2
|
||||||
|
@false
|
||||||
|
endif
|
||||||
ifdef CONFIG_UNWINDER_ORC
|
ifdef CONFIG_UNWINDER_ORC
|
||||||
@echo "error: Cannot generate ORC metadata for CONFIG_UNWINDER_ORC=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel" >&2
|
@echo "error: Cannot generate ORC metadata for CONFIG_UNWINDER_ORC=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel" >&2
|
||||||
@false
|
@false
|
||||||
|
@@ -51,6 +51,11 @@ config HAVE_NOP_MCOUNT
|
|||||||
help
|
help
|
||||||
Arch supports the gcc options -pg with -mrecord-mcount and -nop-mcount
|
Arch supports the gcc options -pg with -mrecord-mcount and -nop-mcount
|
||||||
|
|
||||||
|
config HAVE_OBJTOOL_MCOUNT
|
||||||
|
bool
|
||||||
|
help
|
||||||
|
Arch supports objtool --mcount
|
||||||
|
|
||||||
config HAVE_C_RECORDMCOUNT
|
config HAVE_C_RECORDMCOUNT
|
||||||
bool
|
bool
|
||||||
help
|
help
|
||||||
@@ -605,10 +610,18 @@ config FTRACE_MCOUNT_USE_CC
|
|||||||
depends on !FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY
|
depends on !FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY
|
||||||
depends on FTRACE_MCOUNT_RECORD
|
depends on FTRACE_MCOUNT_RECORD
|
||||||
|
|
||||||
|
config FTRACE_MCOUNT_USE_OBJTOOL
|
||||||
|
def_bool y
|
||||||
|
depends on HAVE_OBJTOOL_MCOUNT
|
||||||
|
depends on !FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY
|
||||||
|
depends on !FTRACE_MCOUNT_USE_CC
|
||||||
|
depends on FTRACE_MCOUNT_RECORD
|
||||||
|
|
||||||
config FTRACE_MCOUNT_USE_RECORDMCOUNT
|
config FTRACE_MCOUNT_USE_RECORDMCOUNT
|
||||||
def_bool y
|
def_bool y
|
||||||
depends on !FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY
|
depends on !FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY
|
||||||
depends on !FTRACE_MCOUNT_USE_CC
|
depends on !FTRACE_MCOUNT_USE_CC
|
||||||
|
depends on !FTRACE_MCOUNT_USE_OBJTOOL
|
||||||
depends on FTRACE_MCOUNT_RECORD
|
depends on FTRACE_MCOUNT_RECORD
|
||||||
|
|
||||||
config TRACING_MAP
|
config TRACING_MAP
|
||||||
|
@@ -238,6 +238,9 @@ endif
|
|||||||
ifdef CONFIG_X86_SMAP
|
ifdef CONFIG_X86_SMAP
|
||||||
objtool_args += --uaccess
|
objtool_args += --uaccess
|
||||||
endif
|
endif
|
||||||
|
ifdef CONFIG_FTRACE_MCOUNT_USE_OBJTOOL
|
||||||
|
objtool_args += --mcount
|
||||||
|
endif
|
||||||
|
|
||||||
# 'OBJECT_FILES_NON_STANDARD := y': skip objtool checking for a directory
|
# 'OBJECT_FILES_NON_STANDARD := y': skip objtool checking for a directory
|
||||||
# 'OBJECT_FILES_NON_STANDARD_foo.o := 'y': skip objtool checking for a file
|
# 'OBJECT_FILES_NON_STANDARD_foo.o := 'y': skip objtool checking for a file
|
||||||
|
Reference in New Issue
Block a user