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: 409448 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=-24.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, 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 1A047C433C1 for ; Thu, 25 Mar 2021 22:39:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E51E561A40 for ; Thu, 25 Mar 2021 22:39:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231264AbhCYWi5 (ORCPT ); Thu, 25 Mar 2021 18:38:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:49170 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231277AbhCYWi1 (ORCPT ); Thu, 25 Mar 2021 18:38:27 -0400 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 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.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 --- 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") {