From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87479C433E4 for ; Thu, 25 Mar 2021 22:38:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 481DB61A43 for ; Thu, 25 Mar 2021 22:38:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231312AbhCYWia (ORCPT ); Thu, 25 Mar 2021 18:38:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:49138 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230486AbhCYWiY (ORCPT ); Thu, 25 Mar 2021 18:38:24 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4A0E661A3A; Thu, 25 Mar 2021 22:38:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1616711903; bh=avDQo70jyLVlZwplCA1vAeUbTnOiqdYs1TebXaMbdnk=; h=From:To:Cc:Subject:Date:From; b=S9zGop5FjZn0ne2gCJwrwMtDLLIYkiq8kLKss27x/99AaEHni1Egu9OsrFnk1oYlW upcWJa0o1ND8d0wQMk/d2R+b/aHfaIyNx/EPxCCRvuUDcyoknG1J4fiIAmmp9oXaug 1k3bJ8WX8fMnFNZbQkLBCgsZPUNAjerJYkjh6CKaO08AKDCPxR/ikmfV/AH4fY34CJ JIiY9E/4imdjpWxyifhuP501yGsz1kzVOrGVnK7wmwLQUbPgjzIuwZr7Nu80BB48Zv TBxF+yV+tOndA50w8A7Th4MOuydCuZECihgqjFt2B3OHzESRUZwmiV1vzYOQCe//4C o6vInuThyjQ4A== From: Nathan Chancellor To: Palmer Dabbelt , Paul Walmsley , Albert Ou Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Nathan Chancellor Subject: [PATCH 0/3] Fix CONFIG_FUNCTION_TRACER with clang Date: Thu, 25 Mar 2021 15:38:04 -0700 Message-Id: <20210325223807.2423265-1-nathan@kernel.org> X-Mailer: git-send-email 2.31.0 MIME-Version: 1.0 X-Patchwork-Bot: notify Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi all, This series fixes function tracing with clang. Patch 1 adjusts the mcount regex in scripts/recordmcount.pl to handle the presence of PLT relocations, which happen with clang. Without this, the mcount_loc section will not be created properly. Patch 2 adds a workaround for clang less than 13.0.0 in relation to the mcount symbol name, which was "mcount" rather than "_mcount". This was written as a separate patch so that it can be reverted when the minimum clang version is bumped to clang 13.0.0. Patch 3 avoids a build error when -fpatchable-function-entry is not available, which is the case with clang less than 13.0.0. This will make dynamic ftrace unavailable but all of the other function tracing should work due to the prescence of the previous patch. I am hoping this series can go in as fixes for 5.12, due to patch 3, but if not, they can always be backported (patches 1 and 2 are already marked for stable). This series has been build tested with gcc-8 through gcc-10 and clang-11 through clang-13 with defconfig and nommu_virt_defconfig plus CONFIG_FTRACE=y and CONFIG_FUNCTION_TRACER=y then boot tested under QEMU. Cheers, Nathan Nathan Chancellor (3): scripts/recordmcount.pl: Fix RISC-V regex for clang riscv: Workaround mcount name prior to clang-13 riscv: Select HAVE_DYNAMIC_FTRACE when -fpatchable-function-entry is available arch/riscv/Kconfig | 2 +- arch/riscv/include/asm/ftrace.h | 14 ++++++++++++-- arch/riscv/kernel/mcount.S | 10 +++++----- scripts/recordmcount.pl | 2 +- 4 files changed, 19 insertions(+), 9 deletions(-) -- 2.31.0