Commit 080ba929651a32f1840751d2b862e64c8ee1f0c6

Authored by Mike Frysinger
Committed by Linus Torvalds
1 parent 86f9d059c6

checkpatch: try to catch missing VMLINUX_SYMBOL() in vmlinux.lds.h

Seems like every other release we have someone who updates vmlinux.lds.h
and adds C-visible symbols without VMLINUX_SYMBOL() around them.  So start
checking the file and reject assignments which have plain symbols on
either side.

[apw@canonical.com: soften the check, add tests]
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 9 additions and 0 deletions Side-by-side Diff

scripts/checkpatch.pl
... ... @@ -2224,6 +2224,15 @@
2224 2224 }
2225 2225 }
2226 2226  
  2227 +# make sure symbols are always wrapped with VMLINUX_SYMBOL() ...
  2228 +# all assignments may have only one of the following with an assignment:
  2229 +# .
  2230 +# ALIGN(...)
  2231 +# VMLINUX_SYMBOL(...)
  2232 + if ($realfile eq 'vmlinux.lds.h' && $line =~ /(?:(?:^|\s)$Ident\s*=|=\s*$Ident(?:\s|$))/) {
  2233 + WARN("vmlinux.lds.h needs VMLINUX_SYMBOL() around C-visible symbols\n" . $herecurr);
  2234 + }
  2235 +
2227 2236 # check for redundant bracing round if etc
2228 2237 if ($line =~ /(^.*)\bif\b/ && $1 !~ /else\s*$/) {
2229 2238 my ($level, $endln, @chunks) =