gcc 5 supports a new -mcount-record option to generate ftrace tables directly. This avoids the need to run record_mcount manually. Use this option when available. So far doesn't use -mcount-nop, which also exists now. This is needed to make ftrace work with LTO because the normal record-mcount script doesn't run over the link time output. It should also improve build times slightly in the general case. Link: http://lkml.kernel.org/r/20171127213423.27218-12-andi@firstfloor.org
Unified · Split
| @@ -207,6 +207,11 @@ cmd_modversions_c = \ · 206 unmodified lines | ||
| 207 | 207 | endif |
| 208 | 208 | |
| 209 | 209 | ifdef CONFIG_FTRACE_MCOUNT_RECORD |
| 210 | +# gcc 5 supports generating the mcount tables directly | |
| 211 | +ifneq ($(call cc-option,-mrecord-mcount,y),y) | |
| 212 | +KBUILD_CFLAGS += -mrecord-mcount | |
| 213 | +else | |
| 214 | +# else do it all manually | |
| 210 | 215 | ifdef BUILD_C_RECORDMCOUNT |
| 211 | 216 | ifeq ("$(origin RECORDMCOUNT_WARN)", "command line") |
| 212 | 217 | RECORDMCOUNT_FLAGS = -w |
| @@ -259,6 +264,7 @@ ifneq ($(RETPOLINE_CFLAGS),) · 46 unmodified lines | ||
| 259 | 264 | objtool_args += --retpoline |
| 260 | 265 | endif |
| 261 | 266 | endif |
| 267 | +endif | |
| 262 | 268 | |
| 263 | 269 | |
| 264 | 270 | ifdef CONFIG_MODVERSIONS |