From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755311AbcKBC1b (ORCPT ); Tue, 1 Nov 2016 22:27:31 -0400 Received: from mga14.intel.com ([192.55.52.115]:34636 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753888AbcKBC1a (ORCPT ); Tue, 1 Nov 2016 22:27:30 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,582,1473145200"; d="scan'208";a="26413828" From: Andi Kleen To: rostedt@goodmis.org Cc: linux-kernel@vger.kernel.org, Andi Kleen Subject: [PATCH] Use -mcount-record for dynamic ftrace Date: Tue, 1 Nov 2016 19:27:27 -0700 Message-Id: <1478053647-15565-1-git-send-email-andi@firstfloor.org> X-Mailer: git-send-email 2.5.5 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andi Kleen 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. It also has a -mcount-nop option to generate the mcount calls as nops. So far that is not implemented, but it could be used to optimize patching at boot up. Signed-off-by: Andi Kleen --- scripts/Makefile.build | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/Makefile.build b/scripts/Makefile.build index de46ab03f063..2d7467076411 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -212,6 +212,11 @@ cmd_modversions = \ endif ifdef CONFIG_FTRACE_MCOUNT_RECORD +# gcc 5 supports generating the mcount tables directly +ifneq ($(call cc-option,-mrecord-mcount,y),y) + KBUILD_CFLAGS += -mrecord-mcount +else +# else do it all manually ifdef BUILD_C_RECORDMCOUNT ifeq ("$(origin RECORDMCOUNT_WARN)", "command line") RECORDMCOUNT_FLAGS = -w @@ -241,6 +246,7 @@ cmd_record_mcount = \ $(sub_cmd_record_mcount) \ fi; endif +endif ifdef CONFIG_STACK_VALIDATION ifneq ($(SKIP_STACK_VALIDATION),1) -- 2.5.5