From patchwork Thu Mar 25 22:38:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Chancellor X-Patchwork-Id: 12165115 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=-22.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,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 5475EC433DB for ; Thu, 25 Mar 2021 22:38:48 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 02AC7619B4 for ; Thu, 25 Mar 2021 22:38:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 02AC7619B4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=pY7Ej7LFtYg6ltFzmUtqJCnicZlESNTbdvN6GFVhEfg=; b=n2eWuUY8GTg3WTwExx9q3q4lr dRXLWSgA8TGun1oH0oOKWkncSo8F7EmQgvzz4tKGov32zUGqJa61lY5gKLXMAP8RyPGVG+aSc7GVB 3YXBQCf+jyDqEImSK5fQbAcviBhiKm7+yN1RkHo8vkpfU1/HpGnNR39BtzXYVq7++JvTM2KkrW9oC mVDa5ScOaEq3swzfr1xJwAuD8D+S/bXstNniQGbN5EW1/fsRt4gd3velvDqSavkDDB9Ekqk1e0S0F Rw2zyAR/2wSSymzuvrb9J16U8qaw6YbZO00fcqOY3BWJ2FaUHR+jp32pqIiNg7oTmzkqgHKcVSPqR 5sMpqskbg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lPYcc-002IJt-Tx; Thu, 25 Mar 2021 22:38:35 +0000 Received: from mail.kernel.org ([198.145.29.99]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lPYcW-002IIy-MA for linux-riscv@lists.infradead.org; Thu, 25 Mar 2021 22:38:30 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id ED2CA61A38; Thu, 25 Mar 2021 22:38:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1616711907; bh=73VsQ5V66Z2i7UXDiahsIQeBPPsxjN8due9MczLEMgA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dRF7V82Cjx0UE7OpHE9CYFwTxnGorcqrArlaxwiXw09aA7xjV84Mh7qKkbMlVA55G zVeSjr8BjzfGh0UVaOFX+nLpdD91EeWEW2+85FV4GjRn6YM0ckCbk/4Hpq7iQXS83r w0zNmMm3rW4SDn5QMH6X3jJRJbK8vmTBISf4iKs4g1HlxdM9Pg+NZziOuinvQ5fxb6 gIFK1bSKKv2xGuzWzoj5OrcisVPSbd7BDVEfw6C2sIBnYbOFIwucs1Zg+pHwQpFpgA /2c5XgMc/8Y1Y3ZQubBkMKMBs4BZAkaXq56HAkSRmxbJzjh6o7cfeimQ4MUs3B2h+1 34GnFcvzYGQ1A== 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 , stable@vger.kernel.org Subject: [PATCH 1/3] scripts/recordmcount.pl: Fix RISC-V regex for clang Date: Thu, 25 Mar 2021 15:38:05 -0700 Message-Id: <20210325223807.2423265-2-nathan@kernel.org> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20210325223807.2423265-1-nathan@kernel.org> References: <20210325223807.2423265-1-nathan@kernel.org> MIME-Version: 1.0 X-Patchwork-Bot: notify X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210325_223828_933685_090E851A X-CRM114-Status: UNSURE ( 8.77 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Clang can generate R_RISCV_CALL_PLT relocations to _mcount: $ llvm-objdump -dr build/riscv/init/main.o | rg mcount 000000000000000e: R_RISCV_CALL_PLT _mcount 000000000000004e: R_RISCV_CALL_PLT _mcount After this, the __start_mcount_loc section is properly generated and function tracing still works. Cc: stable@vger.kernel.org Link: https://github.com/ClangBuiltLinux/linux/issues/1331 Signed-off-by: Nathan Chancellor Reviewed-by: Fangrui Song --- scripts/recordmcount.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl index 867860ea57da..a36df04cfa09 100755 --- a/scripts/recordmcount.pl +++ b/scripts/recordmcount.pl @@ -392,7 +392,7 @@ if ($arch eq "x86_64") { $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s_mcount\$"; } elsif ($arch eq "riscv") { $function_regex = "^([0-9a-fA-F]+)\\s+<([^.0-9][0-9a-zA-Z_\\.]+)>:"; - $mcount_regex = "^\\s*([0-9a-fA-F]+):\\sR_RISCV_CALL\\s_mcount\$"; + $mcount_regex = "^\\s*([0-9a-fA-F]+):\\sR_RISCV_CALL(_PLT)?\\s_mcount\$"; $type = ".quad"; $alignment = 2; } elsif ($arch eq "nds32") { From patchwork Thu Mar 25 22:38:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Chancellor X-Patchwork-Id: 12165121 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=-22.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,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 2BAFBC433E1 for ; Thu, 25 Mar 2021 22:38:56 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CB1146196C for ; Thu, 25 Mar 2021 22:38:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CB1146196C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=sSwWdMV7wkjOB1HkTsdcGHROPM6h34YosIY6jq45L6k=; b=LNV4jR7+paOEuNpO9pNjoFLgh RMEiiWRvVXGsfrAYPjORh+9Vc2YmXeRUdQDfez+L1ATrph6tJiAXhvU6doyLuSEfHGNLAHX4VG0oW dvtEsTLYWzzNidAZvxN8IJ4hX6/KxAGThH6cAkd9XvCDfGqK+/eKftINVpFUxqW/287L5NVtOOaLk Lq5uuXyL0b4Uox5uBJR10JI8vWLrcgC0TJbeoKaRcc5gYDHrOTpJg7WpV6ZPNyC3JEoxwWUFxB38p B6tPc7M+BXkpgzh73bKNM+ycy/1EsyBUqn6mra7wjPgoa71mm4GkGsxRiuE6Bm9ufBaZcENuZCe3B uBxgfbu9w==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lPYce-002IKT-RS; Thu, 25 Mar 2021 22:38:36 +0000 Received: from mail.kernel.org ([198.145.29.99]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lPYcZ-002IJJ-E4 for linux-riscv@lists.infradead.org; Thu, 25 Mar 2021 22:38:34 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 980E261A3F; Thu, 25 Mar 2021 22:38:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1616711910; bh=YOqY1pCqDVwIwgnlGDQ6eRUuwWftFL3Tzwr2ZTIYg5M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LgZ2XfmoZhKDXO8+GEY6vInykeD1x16nUT+xsvmc0+MePMXKAg0LX2QTBnAgY7HyF T00kv7f5BsPm3ckUQabQ5hRwZSMruZ6QirLyGHewQY1VBFYnRidaiUsSSqq+tC7W/x 3l75uOOeTnJRcyVWqPO3svMJvSCLeCgajQJ5a18r0LXLqnFF4roHzpNx10/zrum8T9 DLjad31A6LgHsSRmsyzCG+AphPYhFQzNal+1MUfVVmd4jLcjIcD30K4i83yE9DWX89 6uWYDw/Olt7ku0p+WH0D/H74upJsfFV0zBSGySTvzcOl+wxky97ePMa9cd5kpSoXAR /qU6k5hm6yzJw== 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 , stable@vger.kernel.org Subject: [PATCH 2/3] riscv: Workaround mcount name prior to clang-13 Date: Thu, 25 Mar 2021 15:38:06 -0700 Message-Id: <20210325223807.2423265-3-nathan@kernel.org> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20210325223807.2423265-1-nathan@kernel.org> References: <20210325223807.2423265-1-nathan@kernel.org> MIME-Version: 1.0 X-Patchwork-Bot: notify X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210325_223832_062784_757AB4EA X-CRM114-Status: GOOD ( 13.13 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Prior to clang 13.0.0, the RISC-V name for the mcount symbol was "mcount", which differs from the GCC version of "_mcount", which results in the following errors: riscv64-linux-gnu-ld: init/main.o: in function `__traceiter_initcall_level': main.c:(.text+0xe): undefined reference to `mcount' riscv64-linux-gnu-ld: init/main.o: in function `__traceiter_initcall_start': main.c:(.text+0x4e): undefined reference to `mcount' riscv64-linux-gnu-ld: init/main.o: in function `__traceiter_initcall_finish': main.c:(.text+0x92): undefined reference to `mcount' riscv64-linux-gnu-ld: init/main.o: in function `.LBB32_28': main.c:(.text+0x30c): undefined reference to `mcount' riscv64-linux-gnu-ld: init/main.o: in function `free_initmem': main.c:(.text+0x54c): undefined reference to `mcount' This has been corrected in https://reviews.llvm.org/D98881 but the minimum supported clang version is 10.0.1. To avoid build errors and to gain a working function tracer, adjust the name of the mcount symbol for older versions of clang in mount.S and recordmcount.pl. Cc: stable@vger.kernel.org Link: https://github.com/ClangBuiltLinux/linux/issues/1331 Signed-off-by: Nathan Chancellor Reviewed-by: Nick Desaulniers --- arch/riscv/include/asm/ftrace.h | 14 ++++++++++++-- arch/riscv/kernel/mcount.S | 10 +++++----- scripts/recordmcount.pl | 2 +- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/arch/riscv/include/asm/ftrace.h b/arch/riscv/include/asm/ftrace.h index 845002cc2e57..04dad3380041 100644 --- a/arch/riscv/include/asm/ftrace.h +++ b/arch/riscv/include/asm/ftrace.h @@ -13,9 +13,19 @@ #endif #define HAVE_FUNCTION_GRAPH_RET_ADDR_PTR +/* + * Clang prior to 13 had "mcount" instead of "_mcount": + * https://reviews.llvm.org/D98881 + */ +#if defined(CONFIG_CC_IS_GCC) || CONFIG_CLANG_VERSION >= 130000 +#define MCOUNT_NAME _mcount +#else +#define MCOUNT_NAME mcount +#endif + #define ARCH_SUPPORTS_FTRACE_OPS 1 #ifndef __ASSEMBLY__ -void _mcount(void); +void MCOUNT_NAME(void); static inline unsigned long ftrace_call_adjust(unsigned long addr) { return addr; @@ -36,7 +46,7 @@ struct dyn_arch_ftrace { * both auipc and jalr at the same time. */ -#define MCOUNT_ADDR ((unsigned long)_mcount) +#define MCOUNT_ADDR ((unsigned long)MCOUNT_NAME) #define JALR_SIGN_MASK (0x00000800) #define JALR_OFFSET_MASK (0x00000fff) #define AUIPC_OFFSET_MASK (0xfffff000) diff --git a/arch/riscv/kernel/mcount.S b/arch/riscv/kernel/mcount.S index 8a5593ff9ff3..6d462681c9c0 100644 --- a/arch/riscv/kernel/mcount.S +++ b/arch/riscv/kernel/mcount.S @@ -47,8 +47,8 @@ ENTRY(ftrace_stub) #ifdef CONFIG_DYNAMIC_FTRACE - .global _mcount - .set _mcount, ftrace_stub + .global MCOUNT_NAME + .set MCOUNT_NAME, ftrace_stub #endif ret ENDPROC(ftrace_stub) @@ -78,7 +78,7 @@ ENDPROC(return_to_handler) #endif #ifndef CONFIG_DYNAMIC_FTRACE -ENTRY(_mcount) +ENTRY(MCOUNT_NAME) la t4, ftrace_stub #ifdef CONFIG_FUNCTION_GRAPH_TRACER la t0, ftrace_graph_return @@ -124,6 +124,6 @@ do_trace: jalr t5 RESTORE_ABI_STATE ret -ENDPROC(_mcount) +ENDPROC(MCOUNT_NAME) #endif -EXPORT_SYMBOL(_mcount) +EXPORT_SYMBOL(MCOUNT_NAME) diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl index a36df04cfa09..7b83a1aaec98 100755 --- a/scripts/recordmcount.pl +++ b/scripts/recordmcount.pl @@ -392,7 +392,7 @@ if ($arch eq "x86_64") { $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s_mcount\$"; } elsif ($arch eq "riscv") { $function_regex = "^([0-9a-fA-F]+)\\s+<([^.0-9][0-9a-zA-Z_\\.]+)>:"; - $mcount_regex = "^\\s*([0-9a-fA-F]+):\\sR_RISCV_CALL(_PLT)?\\s_mcount\$"; + $mcount_regex = "^\\s*([0-9a-fA-F]+):\\sR_RISCV_CALL(_PLT)?\\s_?mcount\$"; $type = ".quad"; $alignment = 2; } elsif ($arch eq "nds32") { From patchwork Thu Mar 25 22:38:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Chancellor X-Patchwork-Id: 12165117 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=-22.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,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 8DCDFC433C1 for ; Thu, 25 Mar 2021 22:38:53 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 377D9619DC for ; Thu, 25 Mar 2021 22:38:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 377D9619DC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=JmhMKouqGU3KgrhakVaPQcUM/Lkq4ufMYJSuBCRjPdg=; b=YJbq4Zex+XC6QWG1L9b1rrTku Mnpu8dvEuc9o3si2hbt74BexOW3rv0Xo4QPFVxzguZlBFqhJqOon6rFr2iKgyxfti5Q+CVlBi87FO tZLpxnQACnTCpWusFbpW1cwd/RPzuzCwG/ECuprvW6Qqg7yv7M/ommpWgtZfUM9JFf1YqQ5v7eANA 7DPIOh9oBhJSWDgaqFNar/ja1G8pOCJLY+eMbo3QQTvtRJsfE9qXtuFvbu8AwCqi96VdC8PlugqT1 TyL+SJ2via4/FtDZAcejS4pvzoHwEBIeA2U15anJVXTap2vZl5xHUexQMvLwuumiR8r+k9RTRFAqp e9lcqOuow==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lPYch-002ILC-9Z; Thu, 25 Mar 2021 22:38:39 +0000 Received: from mail.kernel.org ([198.145.29.99]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lPYcc-002IJm-4h for linux-riscv@lists.infradead.org; Thu, 25 Mar 2021 22:38:36 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6F90961A38; Thu, 25 Mar 2021 22:38:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1616711913; bh=4GybQa7x965w/lvJpnsuebjZBuJAklLkJS0kqW10SlI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AQI76ZNAc2kYisTlQkA41/g1kQ67/tVaO15bbvMmK88fkN0onr1G+Ko7wyP6xc0I+ 6rClyDTLwT4L5Z4Rhr2wrCcJUDP5BbVPFEK+ph5So7pksluRk4ySFgHiPvBfQjB1ol fMx3ZURFNR+HIl/jIaOGQIs38ZwQ8OupO3shL4zZnuWCRuvp/ts5HpaTXBtgee94rg QCkviWbbq4M2Y+gIWqb7JnakATMHN3G2ybTG1/Eh3IEkR0pHwO6SkKZBoK0/VNqPwf 7sIWLJf0PAdRi+PTAgkl2koj6ruDAp9NEzK+ZkPLSjaTBEgBRScQJLQKpiZvHKitpR oxI3MhBoZE8MA== 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 , kernel test robot Subject: [PATCH 3/3] riscv: Select HAVE_DYNAMIC_FTRACE when -fpatchable-function-entry is available Date: Thu, 25 Mar 2021 15:38:07 -0700 Message-Id: <20210325223807.2423265-4-nathan@kernel.org> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20210325223807.2423265-1-nathan@kernel.org> References: <20210325223807.2423265-1-nathan@kernel.org> MIME-Version: 1.0 X-Patchwork-Bot: notify X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210325_223835_028300_B0E99B59 X-CRM114-Status: UNSURE ( 9.91 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org clang prior to 13.0.0 does not support -fpatchable-function-entry for RISC-V. clang: error: unsupported option '-fpatchable-function-entry=8' for target 'riscv64-unknown-linux-gnu' To avoid this error, only select HAVE_DYNAMIC_FTRACE when this option is not available. Fixes: afc76b8b8011 ("riscv: Using PATCHABLE_FUNCTION_ENTRY instead of MCOUNT") Link: https://github.com/ClangBuiltLinux/linux/issues/1268 Reported-by: kernel test robot Signed-off-by: Nathan Chancellor Reviewed-by: Fangrui Song --- arch/riscv/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 87d7b52f278f..ba1d07640b66 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -227,7 +227,7 @@ config ARCH_RV64I bool "RV64I" select 64BIT select ARCH_SUPPORTS_INT128 if CC_HAS_INT128 && GCC_VERSION >= 50000 - select HAVE_DYNAMIC_FTRACE if MMU + select HAVE_DYNAMIC_FTRACE if MMU && $(cc-option,-fpatchable-function-entry=8) select HAVE_DYNAMIC_FTRACE_WITH_REGS if HAVE_DYNAMIC_FTRACE select HAVE_FTRACE_MCOUNT_RECORD select HAVE_FUNCTION_GRAPH_TRACER