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=-23.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_IN_DEF_DKIM_WL 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 8849AC433E0 for ; Mon, 25 Jan 2021 18:17:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 611C922583 for ; Mon, 25 Jan 2021 18:17:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730757AbhAYSRF (ORCPT ); Mon, 25 Jan 2021 13:17:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730916AbhAYSQk (ORCPT ); Mon, 25 Jan 2021 13:16:40 -0500 Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E5CCC061574 for ; Mon, 25 Jan 2021 10:16:00 -0800 (PST) Received: by mail-pg1-x530.google.com with SMTP id q7so9476712pgm.5 for ; Mon, 25 Jan 2021 10:16:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ZCe2/FF+DvZDaRPvAZh3BnHgq5iKGe4t/Q1fBpszZFI=; b=Gi+ZKU1fgDCC43LVWcDLZi1V+dwx/rGL4iwHTgjDq1/GzDKWVBq6+7M102wga4p9gm cUwDbRj2TBu4MeTHxmEQKFYLadgFOXz2euunjPwMOz/RPdraM6RFRyCQiRh0Brzlz9Tw FN/axQhY4MULtWEHP32q6YfgdwNPq5ytkQ+6oHFmwae9MqDVo1+eIbugfHC51vLDeqnK hyay/bTK2QwtHHdhEKN5sysPYR/pmw0tRrXerU59neaWXaamTJY52lLTvPGMlBEOJJS0 dNz6h76WyO+Fwq3T8K8HK1P4BizLK/8S6xHqfYOy/I1s1juPAyzkDbnyUmL89t6W0WFL ellw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ZCe2/FF+DvZDaRPvAZh3BnHgq5iKGe4t/Q1fBpszZFI=; b=mmO3O8Hjf2B6OC8IqnPJrxlqOFP9gGzHXX5ADPsY8HsQBRBC3PIkIgodoUPQVyUNd8 pbuY+r4nvVQCLKZUkEMvT9Ocv0wLxWn2o89NcaRCAnKeQ5EgdQ4PdlQBw+rAEyxMUN+9 4rrTRSAGB7GBnzSXuVSnWr85ptEhNtwrtfR5yexKM0MyQ6mxksXB9oWEC7vfBT33W7lD BwICfXVvAG6Lxvdadlo5oVvG12pM5nPOs44/tsBxhSO9bpIyvH9CfPo7D7GkrcG98Kvx J0QXcHPxRTtWp/rlc+H11BLjSornrpL95kxQ7NYGsnVkJtBFhb4oRL1Ob5/KnxNYPWXQ pnfg== X-Gm-Message-State: AOAM530GGt2TTHyE/XF11jKC+ElSdFSSI3HOp2ZF9T37kODfhIfM9WRT p3CRMmbqacGaUghI1rnHOc9GmTbRTbpb1EsixynIOw== X-Google-Smtp-Source: ABdhPJwM4jcYIy9qZyhngA4TyoNbXq1yWRIwl283sE9sMGQlNDftJP0R9B92LOZv2Y/jakyTdjE67K5jac7l8BuJckw= X-Received: by 2002:a63:1f47:: with SMTP id q7mr1786622pgm.10.1611598560014; Mon, 25 Jan 2021 10:16:00 -0800 (PST) MIME-Version: 1.0 References: <20210123190459.9701-1-yashsri421@gmail.com> In-Reply-To: From: Nick Desaulniers Date: Mon, 25 Jan 2021 10:15:49 -0800 Message-ID: Subject: Re: [PATCH v3] checkpatch: add warning for avoiding .L prefix symbols in assembly files To: Joe Perches Cc: Aditya Srivastava , Andrew Morton , Lukas Bulwahn , dwaipayanray1@gmail.com, Mark Brown , Josh Poimboeuf , linux-kernel-mentees@lists.linuxfoundation.org, clang-built-linux , LKML Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jan 23, 2021 at 1:01 PM Joe Perches wrote: > > On Sun, 2021-01-24 at 00:34 +0530, Aditya Srivastava wrote: > > objtool requires that all code must be contained in an ELF symbol. > > Symbol names that have a '.L' prefix do not emit symbol table entries, as > > they have special meaning for the assembler. > > > > '.L' prefixed symbols can be used within a code region, but should be > > avoided for denoting a range of code via 'SYM_*_START/END' annotations. > > > > Add a new check to emit a warning on finding the usage of '.L' symbols > > for '.S' files, if it denotes range of code via SYM_*_START/END > > annotation pair. > > > > Suggested-by: Mark Brown > > Link: https://lore.kernel.org/lkml/20210112210154.GI4646@sirena.org.uk > > Signed-off-by: Aditya Srivastava > > Acked-by: Joe Perches Acked-by: Nick Desaulniers Thanks for the patch Aditya! > > > --- > > * Applies perfectly on next-20210122 > > > > Changes in v3: > > - Modify regex for SYM_*_START/END pair > > - remove check for arch/x86/entry/* and arch/x86/lib/* > > - change 'Link:' in commit message to lkml > > - Modify commit description accordingly > > > > Changes in v2: > > - Reduce the check to only SYM_*_START/END lines > > - Reduce the check for only .S files in arch/x86/entry/* and arch/x86/lib/* as suggested by Josh and Nick > > - Modify commit message > > > > scripts/checkpatch.pl | 7 +++++++ > > 1 file changed, 7 insertions(+) > > > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > > index 7030c4d6d126..4a03326c87b6 100755 > > --- a/scripts/checkpatch.pl > > +++ b/scripts/checkpatch.pl > > @@ -3590,6 +3590,13 @@ sub process { > > } > > } > > > > > > +# check for .L prefix local symbols in .S files > > + if ($realfile =~ /\.S$/ && > > + $line =~ /^\+\s*(?:[A-Z]+_)?SYM_[A-Z]+_(?:START|END)(?:_[A-Z_]+)?\s*\(\s*\.L/) { > > + WARN("AVOID_L_PREFIX", > > + "Avoid using '.L' prefixed local symbol names for denoting a range of code via 'SYM_*_START/END' annotations; see Documentation/asm-annotations.rst\n" . $herecurr); > > + } > > + > > # check we are in a valid source file C or perl if not then ignore this hunk > > next if ($realfile !~ /\.(h|c|pl|dtsi|dts)$/); > > > > > > -- Thanks, ~Nick Desaulniers 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=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 EF48FC433E0 for ; Mon, 25 Jan 2021 18:22:33 +0000 (UTC) Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (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 ED5EE22D50 for ; Mon, 25 Jan 2021 18:22:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ED5EE22D50 Authentication-Results: mail.kernel.org; dmarc=pass (p=none dis=none) header.from=lists.linuxfoundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linux-kernel-mentees-bounces@lists.linuxfoundation.org Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 4F66485DC4; Mon, 25 Jan 2021 18:22:32 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aRqe3khz5rAF; Mon, 25 Jan 2021 18:22:31 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id 528A885785; Mon, 25 Jan 2021 18:22:31 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 22E9DC08A1; Mon, 25 Jan 2021 18:22:31 +0000 (UTC) Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 19178C013A for ; Mon, 25 Jan 2021 18:22:30 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 0594C86FDB for ; Mon, 25 Jan 2021 18:22:30 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Q4frrLhavvrL for ; Mon, 25 Jan 2021 18:22:29 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-io1-f41.google.com (mail-io1-f41.google.com [209.85.166.41]) by whitealder.osuosl.org (Postfix) with ESMTPS id 30B5586E9F for ; Mon, 25 Jan 2021 18:22:29 +0000 (UTC) Received: by mail-io1-f41.google.com with SMTP id x21so28498443iog.10 for ; Mon, 25 Jan 2021 10:22:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ZCe2/FF+DvZDaRPvAZh3BnHgq5iKGe4t/Q1fBpszZFI=; b=Gi+ZKU1fgDCC43LVWcDLZi1V+dwx/rGL4iwHTgjDq1/GzDKWVBq6+7M102wga4p9gm cUwDbRj2TBu4MeTHxmEQKFYLadgFOXz2euunjPwMOz/RPdraM6RFRyCQiRh0Brzlz9Tw FN/axQhY4MULtWEHP32q6YfgdwNPq5ytkQ+6oHFmwae9MqDVo1+eIbugfHC51vLDeqnK hyay/bTK2QwtHHdhEKN5sysPYR/pmw0tRrXerU59neaWXaamTJY52lLTvPGMlBEOJJS0 dNz6h76WyO+Fwq3T8K8HK1P4BizLK/8S6xHqfYOy/I1s1juPAyzkDbnyUmL89t6W0WFL ellw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ZCe2/FF+DvZDaRPvAZh3BnHgq5iKGe4t/Q1fBpszZFI=; b=ITxr53ug+9zGvTHjmrhg2btnxd9tFaz7rM7gcxtbdZTILvuI/4xtKRQAgGWRzQ0eME unlVmcqVkLrwafIt4JAjQWGekuFUfWkoeD2/QUJDu2UFklcOmyhDBWN8hCMP1GGBOkE0 3q78d0BbjvJnXqevWORTqMp2SlojvA6qCdv4/X+QOGt8t1Toue6V4+ckz0iYkaGSmCiO 2V8u2QS1UyEWaOfpvlJXXRHtCHSvsZmkCRyOnEjXS4O8LogYKt9ubSJAQIhkY9G0fBuT vqftbzBVlwz7/9ne2ibmrmUb0pVvSyl/hPzn2/jx0Scon+P5LuhUjZLjMrHlsk5lmwJL FlUA== X-Gm-Message-State: AOAM533JXrCjt02Fb4gRuEnbhKmqyQs2VpzgDh2ZIMPg/4nfYUyaPWab oOK0dh3RhFCztL0SMrf1A6hkiCbBL0pgV+yTVr/rWKI4PZg= X-Google-Smtp-Source: ABdhPJwM4jcYIy9qZyhngA4TyoNbXq1yWRIwl283sE9sMGQlNDftJP0R9B92LOZv2Y/jakyTdjE67K5jac7l8BuJckw= X-Received: by 2002:a63:1f47:: with SMTP id q7mr1786622pgm.10.1611598560014; Mon, 25 Jan 2021 10:16:00 -0800 (PST) MIME-Version: 1.0 References: <20210123190459.9701-1-yashsri421@gmail.com> In-Reply-To: Date: Mon, 25 Jan 2021 10:15:49 -0800 Message-ID: To: Joe Perches Cc: Aditya Srivastava , dwaipayanray1@gmail.com, LKML , clang-built-linux , Mark Brown , Josh Poimboeuf , Andrew Morton , linux-kernel-mentees@lists.linuxfoundation.org Subject: Re: [Linux-kernel-mentees] [PATCH v3] checkpatch: add warning for avoiding .L prefix symbols in assembly files X-BeenThere: linux-kernel-mentees@lists.linuxfoundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Nick Desaulniers via Linux-kernel-mentees Reply-To: Nick Desaulniers Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-kernel-mentees-bounces@lists.linuxfoundation.org Sender: "Linux-kernel-mentees" On Sat, Jan 23, 2021 at 1:01 PM Joe Perches wrote: > > On Sun, 2021-01-24 at 00:34 +0530, Aditya Srivastava wrote: > > objtool requires that all code must be contained in an ELF symbol. > > Symbol names that have a '.L' prefix do not emit symbol table entries, as > > they have special meaning for the assembler. > > > > '.L' prefixed symbols can be used within a code region, but should be > > avoided for denoting a range of code via 'SYM_*_START/END' annotations. > > > > Add a new check to emit a warning on finding the usage of '.L' symbols > > for '.S' files, if it denotes range of code via SYM_*_START/END > > annotation pair. > > > > Suggested-by: Mark Brown > > Link: https://lore.kernel.org/lkml/20210112210154.GI4646@sirena.org.uk > > Signed-off-by: Aditya Srivastava > > Acked-by: Joe Perches Acked-by: Nick Desaulniers Thanks for the patch Aditya! > > > --- > > * Applies perfectly on next-20210122 > > > > Changes in v3: > > - Modify regex for SYM_*_START/END pair > > - remove check for arch/x86/entry/* and arch/x86/lib/* > > - change 'Link:' in commit message to lkml > > - Modify commit description accordingly > > > > Changes in v2: > > - Reduce the check to only SYM_*_START/END lines > > - Reduce the check for only .S files in arch/x86/entry/* and arch/x86/lib/* as suggested by Josh and Nick > > - Modify commit message > > > > scripts/checkpatch.pl | 7 +++++++ > > 1 file changed, 7 insertions(+) > > > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > > index 7030c4d6d126..4a03326c87b6 100755 > > --- a/scripts/checkpatch.pl > > +++ b/scripts/checkpatch.pl > > @@ -3590,6 +3590,13 @@ sub process { > > } > > } > > > > > > +# check for .L prefix local symbols in .S files > > + if ($realfile =~ /\.S$/ && > > + $line =~ /^\+\s*(?:[A-Z]+_)?SYM_[A-Z]+_(?:START|END)(?:_[A-Z_]+)?\s*\(\s*\.L/) { > > + WARN("AVOID_L_PREFIX", > > + "Avoid using '.L' prefixed local symbol names for denoting a range of code via 'SYM_*_START/END' annotations; see Documentation/asm-annotations.rst\n" . $herecurr); > > + } > > + > > # check we are in a valid source file C or perl if not then ignore this hunk > > next if ($realfile !~ /\.(h|c|pl|dtsi|dts)$/); > > > > > > -- Thanks, ~Nick Desaulniers _______________________________________________ Linux-kernel-mentees mailing list Linux-kernel-mentees@lists.linuxfoundation.org https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees