[PATCH 6/6] checkpatch.pl: generalize linker script macro exceptions

From: Jim Cromie via B4 Relay

Date: Sat Nov 21 2026 - 17:50:02 EST


From: Jim Cromie <jim.cromie@xxxxxxxxx>

checkpatch skips macro-rule checks in linker scripts; 3 of them
explicitly check for vmlinux.lds.h, and 1 (the 1st) skips on any
*.lds.h. Generalize the 3 to match the 1st, including the escapes on
the dots, so they're literal checks for '.'

Signed-off-by: Jim Cromie <jim.cromie@xxxxxxxxx>
---
scripts/checkpatch.pl | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index b8b64f720191..318e1f2577fd 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -6016,7 +6016,7 @@ sub process {
# Usually multi-statement macros should be enclosed in a do {} while
# (0) loop. Grab the first statement and ensure its the whole macro
# if its not enclosed in a known good container
- if ($realfile !~ m@/vmlinux.lds.h$@ &&
+ if ($realfile !~ m@/\.lds\.h$@ &&
$line =~ /^.\s*\#\s*define\s*$Ident(\()?/) {
my $ln = $linenr;
my $cnt = $realcnt;
@@ -6175,7 +6175,7 @@ sub process {

# check for line continuations outside of #defines, preprocessor #, and asm

- } elsif ($realfile =~ m@/vmlinux.lds.h$@) {
+ } elsif ($realfile =~ m@/\.lds\.h$@) {
$line =~ s/(\w+)/$maybe_linker_symbol{$1}++/ge;
#print "REAL: $realfile\nln: $line\nkeys:", sort keys %maybe_linker_symbol;
} else {
@@ -6192,7 +6192,7 @@ sub process {
# single-statement macros do not need to be enclosed in do while (0) loop,
# macro should not end with a semicolon
if ($perl_version_ok &&
- $realfile !~ m@/vmlinux.lds.h$@ &&
+ $realfile !~ m@/\.lds\.h$@ &&
$line =~ /^.\s*\#\s*define\s+$Ident(\()?/) {
my $ln = $linenr;
my $cnt = $realcnt;

--
2.56.1