From: Aditya <yashsri421@gmail.com>
To: Dwaipayan Ray <dwaipayanray1@gmail.com>
Cc: linux-kernel-mentees@lists.linuxfoundation.org
Subject: Re: [Linux-kernel-mentees] [PATCH] checkpatch: add warning for avoiding .L prefix symbols in assembly files
Date: Sat, 16 Jan 2021 18:48:20 +0530 [thread overview]
Message-ID: <86deb3fe-0b48-da0c-5f95-448fe9d97c19@gmail.com> (raw)
In-Reply-To: <CABJPP5CxhBreFsM_YZvr3V4_jOdrRVkUX22E2bEwnL+Wf=nYJQ@mail.gmail.com>
On 16/1/21 6:13 pm, Dwaipayan Ray wrote:
> On Sat, Jan 16, 2021 at 5:52 PM Aditya Srivastava <yashsri421@gmail.com> wrote:
>>
>> Local symbols prefixed with '.L' 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 warning on finding the usage of '.L' symbols
>> in '.S' files.
>>
>> 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>
>> ---
>> scripts/checkpatch.pl | 6 ++++++
>> 1 file changed, 6 insertions(+)
>>
>> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
>> index 7030c4d6d126..87d96a039e64 100755
>> --- a/scripts/checkpatch.pl
>> +++ b/scripts/checkpatch.pl
>> @@ -3590,6 +3590,12 @@ sub process {
>> }
>> }
>>
>> +# check for .L prefix local symbols in .S files
>> + if ($realfile =~ /\.S$/ && $line =~ /\.L\S+/) {
>> + 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)$/);
>>
>> --
>> 2.17.1
>
> From an earlier conversation:
>> So basically, you can use an .L symbol *inside* a function or a code
>> segment, you just can't use the .L symbol to contain the code using a
>> SYM_*_START/END annotation pair.
>
> So this check warns on all uses of the .L prefix
> I think that might be incorrect.
>
Hey Dwaipayan,
I think you missed this:
> - If the line contains ".L" prefixed symbol, give user a
> warning/check, so that they can ensure that the line is not inside
> START/END block. (As we may not be able to make sure about the same,
> if the START/END line is not in the patch; otherwise we could run a
> while loop)
At best, I think, we could use $context_function, which should work
for patches, but again, this will not work for files.
Do you have any suggestions?
Thanks
Aditya
_______________________________________________
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-16 13:18 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-16 12:22 [Linux-kernel-mentees] [PATCH] checkpatch: add warning for avoiding .L prefix symbols in assembly files Aditya Srivastava
2021-01-16 12:43 ` Dwaipayan Ray
2021-01-16 13:18 ` Aditya [this message]
2021-01-16 13:38 ` Dwaipayan Ray
2021-01-16 14:57 ` Aditya
2021-01-18 5:25 ` Lukas Bulwahn
2021-01-18 14:44 ` Aditya Srivastava
2021-01-18 17:24 ` Lukas Bulwahn
2021-01-18 18:42 ` Aditya
2021-01-18 19:13 ` Aditya Srivastava
2021-01-19 16:32 ` Lukas Bulwahn
-- strict thread matches above, loose matches on Subject: below --
2021-01-20 7:25 Aditya Srivastava
2021-01-20 9:21 ` Joe Perches
2021-01-20 12:53 ` Aditya
2021-01-20 18:43 ` Joe Perches
2021-01-20 18:57 ` Nick Desaulniers via Linux-kernel-mentees
2021-01-20 22:59 ` Josh Poimboeuf
2021-01-22 13:18 ` Aditya
2021-01-22 19:10 ` Joe Perches
2021-01-22 20:13 ` Aditya
2021-01-22 20:36 ` Fāng-ruì Sòng 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=86deb3fe-0b48-da0c-5f95-448fe9d97c19@gmail.com \
--to=yashsri421@gmail.com \
--cc=dwaipayanray1@gmail.com \
--cc=linux-kernel-mentees@lists.linuxfoundation.org \
/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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox