[Linux-kernel-mentees] [PATCH] checkpatch: add warning for avoiding .L prefix symbols in assembly files

Aditya yashsri421 at gmail.com
Mon Jan 18 18:42:10 UTC 2021

On 18/1/21 10:54 pm, Lukas Bulwahn wrote:
> On Mon, Jan 18, 2021 at 3:44 PM Aditya Srivastava <yashsri421 at 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
> to emit a warning


>> in '.S' files, if it lies within SYM_*_START/END annotation pair.
>> Suggested-by: Mark Brown <bro... at kernel.org>
> Hmm, that is not an email?

Oops, I'll fix it.

> Did you test running it on the patch that introduced the bug initially
> which then led to the overall discussion I pointed out to you?

Hi Lukas
So, the patch led to the initial discussion was probably this:

This patch is related to changes made in tools/objtool. So, we
probably cannot test this patch for AVOID_L_PREFIX warning.

I'll walk you through the discussion:

Because of the above changes in objtool, [PATCH] x86/entry: use
STB_GLOBAL for register restoring thunk was proposed

It was later decided that the changes can be instead made to .L prefix
local symbols here for avoiding the objtool warning:

And for standardizing this practice, the suggestion for checkpatch
rule was made here:

However, I have tested the patch on arch/x86/ files and also the patch
proposed here fixing for one of those files.

As expected, I got no warnings for the patch fixing the warnings for
thunk_64.S file, and some warnings for files where the prefix was used.


More information about the Linux-kernel-mentees mailing list