History

checkpatch: add warning for avoiding .L prefix symbols in assembly files

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.

Aditya Srivastava committed 5 years ago

Commit de932451 parent 0972b8b1 file · +7 −0Browse files

Showing the changes to scripts/checkpatch.pl (1 of 1 file). Show all

Unified · Split

scripts/checkpatch.pl+7−0
@@ -3599,6 +3599,13 @@ sub process { · 3598 unmodified lines
3599 }3599 }
3600 }3600 }
3601 3601
3602# check for .L prefix local symbols in .S files
3603 if ($realfile =~ /\.S$/ &&
3604 $line =~ /^\+\s*(?:[A-Z]+_)?SYM_[A-Z]+_(?:START|END)(?:_[A-Z_]+)?\s*\(\s*\.L/) {
3605 WARN("AVOID_L_PREFIX",
3606 "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);
3607 }
3608
3602# check we are in a valid source file C or perl if not then ignore this hunk3609# check we are in a valid source file C or perl if not then ignore this hunk
3603 next if ($realfile !~ /\.(h|c|pl|dtsi|dts)$/);3610 next if ($realfile !~ /\.(h|c|pl|dtsi|dts)$/);
3604 3611