From: Nick Desaulniers <ndesaulniers@google.com> To: Joe Perches <joe@perches.com> Cc: Aditya Srivastava <yashsri421@gmail.com>, Andrew Morton <akpm@linux-foundation.org>, Lukas Bulwahn <lukas.bulwahn@gmail.com>, dwaipayanray1@gmail.com, Mark Brown <broonie@kernel.org>, Josh Poimboeuf <jpoimboe@redhat.com>, linux-kernel-mentees@lists.linuxfoundation.org, clang-built-linux <clang-built-linux@googlegroups.com>, LKML <linux-kernel@vger.kernel.org> Subject: Re: [PATCH v3] checkpatch: add warning for avoiding .L prefix symbols in assembly files Date: Mon, 25 Jan 2021 10:15:49 -0800 [thread overview] Message-ID: <CAKwvOdm+qyD-ycaP=x+JGEtFDvoW7SGwB0HJ1UJXm5cwqkR9PQ@mail.gmail.com> (raw) In-Reply-To: <a7329e5d5661ed6478a7eb33db854a6357447c16.camel@perches.com> On Sat, Jan 23, 2021 at 1:01 PM Joe Perches <joe@perches.com> 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 <broonie@kernel.org> > > Link: https://lore.kernel.org/lkml/20210112210154.GI4646@sirena.org.uk > > Signed-off-by: Aditya Srivastava <yashsri421@gmail.com> > > Acked-by: Joe Perches <joe@perches.com> Acked-by: Nick Desaulniers <ndesaulniers@google.com> 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
WARNING: multiple messages have this Message-ID (diff)
From: Nick Desaulniers via Linux-kernel-mentees <linux-kernel-mentees@lists.linuxfoundation.org> To: Joe Perches <joe@perches.com> Cc: Aditya Srivastava <yashsri421@gmail.com>, dwaipayanray1@gmail.com, LKML <linux-kernel@vger.kernel.org>, clang-built-linux <clang-built-linux@googlegroups.com>, Mark Brown <broonie@kernel.org>, Josh Poimboeuf <jpoimboe@redhat.com>, Andrew Morton <akpm@linux-foundation.org>, linux-kernel-mentees@lists.linuxfoundation.org Subject: Re: [Linux-kernel-mentees] [PATCH v3] checkpatch: add warning for avoiding .L prefix symbols in assembly files Date: Mon, 25 Jan 2021 10:15:49 -0800 [thread overview] Message-ID: <CAKwvOdm+qyD-ycaP=x+JGEtFDvoW7SGwB0HJ1UJXm5cwqkR9PQ@mail.gmail.com> (raw) In-Reply-To: <a7329e5d5661ed6478a7eb33db854a6357447c16.camel@perches.com> On Sat, Jan 23, 2021 at 1:01 PM Joe Perches <joe@perches.com> 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 <broonie@kernel.org> > > Link: https://lore.kernel.org/lkml/20210112210154.GI4646@sirena.org.uk > > Signed-off-by: Aditya Srivastava <yashsri421@gmail.com> > > Acked-by: Joe Perches <joe@perches.com> Acked-by: Nick Desaulniers <ndesaulniers@google.com> 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
next prev parent reply other threads:[~2021-01-25 18:17 UTC|newest] Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-01-20 7:25 [PATCH] checkpatch: add warning for avoiding .L prefix symbols in assembly files Aditya Srivastava 2021-01-20 7:25 ` [Linux-kernel-mentees] " Aditya Srivastava 2021-01-20 9:21 ` Joe Perches 2021-01-20 9:21 ` [Linux-kernel-mentees] " Joe Perches 2021-01-20 12:53 ` Aditya 2021-01-20 12:53 ` [Linux-kernel-mentees] " Aditya 2021-01-20 18:43 ` Joe Perches 2021-01-20 18:43 ` [Linux-kernel-mentees] " Joe Perches 2021-01-20 18:57 ` Nick Desaulniers 2021-01-20 18:57 ` [Linux-kernel-mentees] " Nick Desaulniers via Linux-kernel-mentees 2021-01-20 22:59 ` Josh Poimboeuf 2021-01-20 22:59 ` [Linux-kernel-mentees] " Josh Poimboeuf 2021-01-22 13:18 ` Aditya 2021-01-22 13:18 ` [Linux-kernel-mentees] " Aditya 2021-01-22 19:10 ` Joe Perches 2021-01-22 19:10 ` [Linux-kernel-mentees] " Joe Perches 2021-01-22 20:13 ` Aditya 2021-01-22 20:13 ` [Linux-kernel-mentees] " Aditya 2021-01-22 20:36 ` Fāng-ruì Sòng 2021-01-22 20:36 ` [Linux-kernel-mentees] " Fāng-ruì Sòng via Linux-kernel-mentees 2021-01-23 15:14 ` [PATCH v2] " Aditya Srivastava 2021-01-23 15:14 ` [Linux-kernel-mentees] " Aditya Srivastava 2021-01-23 17:21 ` Joe Perches 2021-01-23 17:21 ` [Linux-kernel-mentees] " Joe Perches 2021-01-23 18:23 ` Aditya 2021-01-23 18:23 ` [Linux-kernel-mentees] " Aditya 2021-01-23 19:04 ` [PATCH v3] " Aditya Srivastava 2021-01-23 19:04 ` [Linux-kernel-mentees] " Aditya Srivastava 2021-01-23 21:01 ` Joe Perches 2021-01-23 21:01 ` [Linux-kernel-mentees] " Joe Perches 2021-01-25 18:15 ` Nick Desaulniers [this message] 2021-01-25 18:15 ` Nick Desaulniers via Linux-kernel-mentees
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to='CAKwvOdm+qyD-ycaP=x+JGEtFDvoW7SGwB0HJ1UJXm5cwqkR9PQ@mail.gmail.com' \ --to=ndesaulniers@google.com \ --cc=akpm@linux-foundation.org \ --cc=broonie@kernel.org \ --cc=clang-built-linux@googlegroups.com \ --cc=dwaipayanray1@gmail.com \ --cc=joe@perches.com \ --cc=jpoimboe@redhat.com \ --cc=linux-kernel-mentees@lists.linuxfoundation.org \ --cc=linux-kernel@vger.kernel.org \ --cc=lukas.bulwahn@gmail.com \ --cc=yashsri421@gmail.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.