Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp846172pxf; Thu, 25 Mar 2021 15:40:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+7sgnebQjczx13MhHOFx4v89unfgc9yw0Y27Z2U3kE9J4A7KFvKIuRGblOQo/l1OGndBS X-Received: by 2002:a05:6402:3495:: with SMTP id v21mr11509202edc.117.1616712018285; Thu, 25 Mar 2021 15:40:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616712018; cv=none; d=google.com; s=arc-20160816; b=wxVxVIXHSg+pYtyquwG/JKrxRuSOiwk6CoMSr1QiRsLPa/YAZqNJFiPewy78jJV+P8 W/9jvF76mfvh/UCrisvI1h66Qr4D+andfRSPJAt+6SaELVhNXxq8R+xBIy2TgwJOFihW GMnuQ74j2d+YaqSI9oAUj6G1U5/5uxmblzWmL9Yj+E3YUt7+V9Aucw6fk3oLQIFuf1x1 0wTWMM28rN2nObfdAE+S1GLcC/2f1sArsxKKyeEmQi5bUUJUWyYdcheH6x1AU0OG/DM2 x8vxFZDLVWhSgOnB3XnkXcoAkGObBVxWTOY9EQ6JScnGl6ng3+RwgZaGK52cyKI3qXHX WAdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=4VnSn4JzR4Q+mLFvENUPrBC24IMGJ1sf6xhSdsjItsI=; b=sy91sc5BAAnG58fD9V/T+rA7GD8cgQBJXTgXEDyaDu45A6Bv4glD3Xlv0yPEbCatGt tI6lmN6/GqpBayt5mYHClfcQa+cEdHlsDEyijX0y4usrw2GYGxQB/uSVMkofjDswXXJR S7Iscn+ggAQu6+crGmYYDSu2gHqTWU2yGvrIK6NYnFNpDCXyknv5fICOqQb/vZj6mmhz 4kPcxc3J4nibwpGfl2O4ujwN+Nw+ZoLhBzHMW2G41juzoQbIUsNz8P10DLFsxqIjN8EA gzNuiu5PU9At27wX7PYrLAKmjJkOHloTt15JZuu3xBmTA1IKBnGqzPkg6jHW7dV1WZUB h0Vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=S9zGop5F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t3si5168968ejy.142.2021.03.25.15.39.55; Thu, 25 Mar 2021 15:40:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=S9zGop5F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231308AbhCYWi3 (ORCPT + 99 others); Thu, 25 Mar 2021 18:38:29 -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