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 10711C433E0 for ; Sat, 23 Jan 2021 17:22:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CD6A622DBF for ; Sat, 23 Jan 2021 17:22:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726229AbhAWRWB (ORCPT ); Sat, 23 Jan 2021 12:22:01 -0500 Received: from smtprelay0076.hostedemail.com ([216.40.44.76]:58820 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726094AbhAWRVr (ORCPT ); Sat, 23 Jan 2021 12:21:47 -0500 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay03.hostedemail.com (Postfix) with ESMTP id 95799837F24F; Sat, 23 Jan 2021 17:21:05 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-HE-Tag: sheet19_41034fd27576 X-Filterd-Recvd-Size: 3077 Received: from [192.168.1.159] (unknown [47.151.137.21]) (Authenticated sender: joe@perches.com) by omf15.hostedemail.com (Postfix) with ESMTPA; Sat, 23 Jan 2021 17:21:04 +0000 (UTC) Message-ID: Subject: Re: [PATCH v2] checkpatch: add warning for avoiding .L prefix symbols in assembly files From: Joe Perches To: Aditya Srivastava , linux-kernel@vger.kernel.org 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 Date: Sat, 23 Jan 2021 09:21:02 -0800 In-Reply-To: <20210123151405.26267-1-yashsri421@gmail.com> References: <20210123151405.26267-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 Sat, 2021-01-23 at 20:44 +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 in arch/x86/entry/* and arch/x86/lib/*, if it denotes > range of code via SYM_*_START/END annotation pair. > > Suggested-by: Mark Brown > Link: https://groups.google.com/g/clang-built-linux/c/-drkmLgu-cU/m/4staOlf-CgAJ Please do not use groups.google.com links, or if you must, please use links that are readable. For instance, this is a better link as it shows the context without struggling with the poor interface: https://groups.google.com/g/clang-built-linux/c/E-naBMt_1SM > Signed-off-by: Aditya Srivastava > --- > * Applies perfectly on next-20210122 > > 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 I think that's unnecessary. > diff --git 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 =~ m@^arch/x86/(?:entry|lib)/.*\.S$@ && Using /.S$/ should be enough > + $line =~ /^\+\s*SYM_[A-Z]+_(?:START|END)(?:_[A-Z_]+)?\s*\(\s*\.L/) { This might need to be + $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); > + } > +