From patchwork Mon Apr 13 00:54:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andi Kleen X-Patchwork-Id: 6204261 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 58DC2BF4A6 for ; Mon, 13 Apr 2015 00:57:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 515712026F for ; Mon, 13 Apr 2015 00:57:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D575C20265 for ; Mon, 13 Apr 2015 00:57:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752199AbbDMA5M (ORCPT ); Sun, 12 Apr 2015 20:57:12 -0400 Received: from one.firstfloor.org ([193.170.194.197]:51019 "EHLO one.firstfloor.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752053AbbDMA5L (ORCPT ); Sun, 12 Apr 2015 20:57:11 -0400 Received: from basil.firstfloor.org (174-25-65-185.ptld.qwest.net [174.25.65.185]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by one.firstfloor.org (Postfix) with ESMTPSA id C0E0E86737; Mon, 13 Apr 2015 02:57:08 +0200 (CEST) Received: by basil.firstfloor.org (Postfix, from userid 1000) id 9242AA7EA1; Sun, 12 Apr 2015 17:54:30 -0700 (PDT) From: Andi Kleen To: rostedt@goodmis.org Cc: linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, mmarek@suse.cz, Andi Kleen Subject: [PATCH] Use -mcount-record for dynamic ftrace Date: Sun, 12 Apr 2015 17:54:27 -0700 Message-Id: <1428886467-4969-1-git-send-email-andi@firstfloor.org> X-Mailer: git-send-email 2.3.3 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 01df30a..f258e9b 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -210,6 +210,11 @@ cmd_modversions = \ fi; endif +# 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 CONFIG_FTRACE_MCOUNT_RECORD ifdef BUILD_C_RECORDMCOUNT ifeq ("$(origin RECORDMCOUNT_WARN)", "command line") @@ -240,6 +245,7 @@ cmd_record_mcount = \ $(sub_cmd_record_mcount) \ fi; endif +endif define rule_cc_o_c $(call echo-cmd,checksrc) $(cmd_checksrc) \