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.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 313B2C433DB for ; Sat, 23 Jan 2021 21:02:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DC39622CA0 for ; Sat, 23 Jan 2021 21:02:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726264AbhAWVC2 (ORCPT ); Sat, 23 Jan 2021 16:02:28 -0500 Received: from smtprelay0119.hostedemail.com ([216.40.44.119]:59546 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725765AbhAWVC0 (ORCPT ); Sat, 23 Jan 2021 16:02:26 -0500 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay01.hostedemail.com (Postfix) with ESMTP id 8D756100E7B42; Sat, 23 Jan 2021 21:01:45 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-HE-Tag: bait30_0e0497e27577 X-Filterd-Recvd-Size: 3210 Received: from [192.168.1.159] (unknown [47.151.137.21]) (Authenticated sender: joe@perches.com) by omf07.hostedemail.com (Postfix) with ESMTPA; Sat, 23 Jan 2021 21:01:43 +0000 (UTC) Message-ID: Subject: Re: [PATCH v3] checkpatch: add warning for avoiding .L prefix symbols in assembly files From: Joe Perches To: Aditya Srivastava , Andrew Morton Cc: lukas.bulwahn@gmail.com, dwaipayanray1@gmail.com, broonie@kernel.org, ndesaulniers@google.com, jpoimboe@redhat.com, linux-kernel-mentees@lists.linuxfoundation.org, clang-built-linux@googlegroups.com, linux-kernel@vger.kernel.org Date: Sat, 23 Jan 2021 13:01:42 -0800 In-Reply-To: <20210123190459.9701-1-yashsri421@gmail.com> References: <20210123190459.9701-1-yashsri421@gmail.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.38.1-1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > * 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)$/); >   >