Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1182657imu; Tue, 20 Nov 2018 13:06:12 -0800 (PST) X-Google-Smtp-Source: AFSGD/VkEg2w8RZdDh4C4fi55LqOGTcXlrRZMXFA19mBtcfJJJnqVhsp6Nafovi+Ae5Da4gN6fYk X-Received: by 2002:a63:4b25:: with SMTP id y37mr2112231pga.181.1542747971940; Tue, 20 Nov 2018 13:06:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542747971; cv=none; d=google.com; s=arc-20160816; b=ofaNaGQk3tw6YP7oQFdBttrEm7EqkY4O8oitrPetT86GY3iovdgzSH7ctiY5IpeODe i0cKRLQ1AnFbuTtVawWRru23shzO0UyRNMevNIPWVso62gOJQm+XgNwV0sqwrGhv0KsZ WQLBh4Q/tjakS1zkF429fqc9ziVaQpUbTGkbq2QSxGtf3Dbqi9IbrrXjDlUwikc7WuA1 ZU+sQA6NzPvV6OF3Yi7lAqye/41D7XL7KX9JfbYPcyd7CQGawoTFCbaQBReE6+T0Kj4J nVHX2ZhPhgLyKh9u1Lg6QeZhmm6JQez/H/UIKCz3hXKeRg2weA/u72Rd9b5Eh//nQNO8 PUww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=Ts4jS/w5K16Pz1rq8wkR1+U6AXZIHKZ+0udkHjuRJDA=; b=bm65hccW9AhC32Q878IDGdA7spfr0vA9iIx9iFdCFhDNMCWxEMEEWxq1kOAQlM3/SW c7Q4FP0kZnXqbXr3bmr3gqUubgMhN6pAhGmnV2eVnA9G1aBPL8j90RXOoM+jPxdoiooA bWBEv4C0h5iHaLM4xWQqcThcXVBHa/XXh5BH6v/Cq8urNIK43LlSNEcAwvJ+6uyG2ojs P8Oqt3atZ7X/ObpUZz3laFohaCA/5XTWbLuZMIARmfDfSi80NsDyJsqZBBkWZttts0oL FtDfGy6JEKmIPC8hsVjtD5r/R31/pzuIPzxVB3LTLxk/S87F6LHSY6kgDcbVCvkhpI+t HcCw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c7si29503769plz.118.2018.11.20.13.05.56; Tue, 20 Nov 2018 13:06:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726106AbeKUGuV (ORCPT + 99 others); Wed, 21 Nov 2018 01:50:21 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59380 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725865AbeKUGuV (ORCPT ); Wed, 21 Nov 2018 01:50:21 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F0D583082E10; Tue, 20 Nov 2018 20:19:26 +0000 (UTC) Received: from jlaw-desktop.bos.com (dhcp-17-208.bos.redhat.com [10.18.17.208]) by smtp.corp.redhat.com (Postfix) with ESMTP id E27D268D4A; Tue, 20 Nov 2018 20:19:21 +0000 (UTC) From: Joe Lawrence To: linux-kernel@vger.kernel.org Cc: Steven Rostedt , Masahiro Yamada Subject: [RFC PATCH 0/1] support ftrace and -ffunction-sections Date: Tue, 20 Nov 2018 15:19:17 -0500 Message-Id: <1542745158-25392-1-git-send-email-joe.lawrence@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Tue, 20 Nov 2018 20:19:27 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Steve, I noticed that ftrace does not currently support functions built with the -ffunction-sections option as they end up in .text. ELF sections, never making into the __mcount_loc section. I modified the recordmcount scripts to handle such .text. section prefixes and this appears to work on x86_64, ppc64le, and s390x -- at least for simple modules, including the "Test trace_printk from module" ftrace self-test. That said, I did notice 90ad4052e85c ("kbuild: avoid conflict between -ffunction-sections and -pg on gcc-4.7") which indicates that the kernel still supports versions of gcc which may not play well with ftrace and -ffunction-sections. With that limitation in mind, can we support ftracing of functions in such sections for compiler versions that do support it? (fwiw, gcc v4.8.5 seems happy) And then if so, what additional testing or coding would need to be done to be confident that it is safe? Is matching on ".text.*" too inclusive? Thanks, -- Joe Joe Lawrence (1): scripts/recordmcount.{c,pl}: support -ffunction-sections .text.* section names scripts/recordmcount.c | 2 +- scripts/recordmcount.pl | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) -- 1.8.3.1