aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Kbuild.include21
-rw-r--r--scripts/Kconfig.include2
-rw-r--r--scripts/Makefile3
-rw-r--r--scripts/Makefile.asm-generic11
-rw-r--r--scripts/Makefile.build33
-rw-r--r--scripts/Makefile.gcc-plugins2
-rw-r--r--scripts/Makefile.host6
-rw-r--r--scripts/Makefile.kasan5
-rw-r--r--scripts/Makefile.lib48
-rw-r--r--scripts/Makefile.modinst2
-rw-r--r--scripts/Makefile.modpost3
-rwxr-xr-xscripts/adjust_autoksyms.sh9
-rwxr-xr-xscripts/atomic/atomic-tbl.sh186
-rwxr-xr-xscripts/atomic/atomics.tbl41
-rwxr-xr-xscripts/atomic/check-atomics.sh33
-rwxr-xr-xscripts/atomic/fallbacks/acquire9
-rwxr-xr-xscripts/atomic/fallbacks/add_negative16
-rwxr-xr-xscripts/atomic/fallbacks/add_unless16
-rwxr-xr-xscripts/atomic/fallbacks/andnot7
-rwxr-xr-xscripts/atomic/fallbacks/dec7
-rwxr-xr-xscripts/atomic/fallbacks/dec_and_test15
-rwxr-xr-xscripts/atomic/fallbacks/dec_if_positive15
-rwxr-xr-xscripts/atomic/fallbacks/dec_unless_positive14
-rwxr-xr-xscripts/atomic/fallbacks/fence11
-rwxr-xr-xscripts/atomic/fallbacks/fetch_add_unless23
-rwxr-xr-xscripts/atomic/fallbacks/inc7
-rwxr-xr-xscripts/atomic/fallbacks/inc_and_test15
-rwxr-xr-xscripts/atomic/fallbacks/inc_not_zero14
-rwxr-xr-xscripts/atomic/fallbacks/inc_unless_negative14
-rwxr-xr-xscripts/atomic/fallbacks/read_acquire7
-rwxr-xr-xscripts/atomic/fallbacks/release8
-rwxr-xr-xscripts/atomic/fallbacks/set_release7
-rwxr-xr-xscripts/atomic/fallbacks/sub_and_test16
-rwxr-xr-xscripts/atomic/fallbacks/try_cmpxchg11
-rwxr-xr-xscripts/atomic/gen-atomic-fallback.sh181
-rwxr-xr-xscripts/atomic/gen-atomic-instrumented.sh182
-rwxr-xr-xscripts/atomic/gen-atomic-long.sh101
-rw-r--r--scripts/atomic/gen-atomics.sh20
-rwxr-xr-xscripts/checkpatch.pl51
-rwxr-xr-xscripts/clang-version.sh10
-rw-r--r--scripts/coccinelle/free/put_device.cocci56
-rwxr-xr-xscripts/decode_stacktrace.sh9
-rwxr-xr-xscripts/dtc/dtx_diff13
-rw-r--r--scripts/gcc-plugins/Kconfig62
-rw-r--r--scripts/gcc-plugins/structleak_plugin.c36
-rwxr-xr-xscripts/gcc-version.sh27
-rw-r--r--scripts/gdb/linux/Makefile25
-rw-r--r--scripts/gdb/linux/constants.py.in12
-rw-r--r--scripts/gdb/linux/proc.py12
-rw-r--r--scripts/kallsyms.c13
-rw-r--r--scripts/kconfig/Makefile9
-rw-r--r--scripts/kconfig/conf.c13
-rw-r--r--scripts/kconfig/expr.h2
-rw-r--r--scripts/kconfig/lexer.l (renamed from scripts/kconfig/zconf.l)2
-rw-r--r--scripts/kconfig/lkc.h2
-rw-r--r--scripts/kconfig/lxdialog/.gitignore4
-rw-r--r--scripts/kconfig/parser.y (renamed from scripts/kconfig/zconf.y)0
-rw-r--r--scripts/kconfig/qconf.cc42
-rw-r--r--scripts/kconfig/qconf.h1
-rwxr-xr-xscripts/kernel-doc2
-rwxr-xr-xscripts/leaking_addresses.pl9
-rwxr-xr-xscripts/link-vmlinux.sh55
-rwxr-xr-xscripts/mkcompile_h4
-rw-r--r--scripts/mod/devicetable-offsets.c6
-rw-r--r--scripts/mod/file2alias.c47
-rw-r--r--scripts/mod/modpost.c27
-rw-r--r--scripts/package/Makefile8
-rwxr-xr-xscripts/package/builddeb42
-rwxr-xr-xscripts/package/buildtar4
-rwxr-xr-xscripts/package/mkdebian45
-rwxr-xr-xscripts/spdxcheck.py8
-rw-r--r--scripts/spelling.txt69
-rwxr-xr-xscripts/ver_linux6
73 files changed, 1523 insertions, 331 deletions
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index 30816037036e..7484b9d8272f 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -24,6 +24,10 @@ depfile = $(subst $(comma),_,$(dot-target).d)
24basetarget = $(basename $(notdir $@)) 24basetarget = $(basename $(notdir $@))
25 25
26### 26###
27# real prerequisites without phony targets
28real-prereqs = $(filter-out $(PHONY), $^)
29
30###
27# Escape single quote for use in echo statements 31# Escape single quote for use in echo statements
28escsq = $(subst $(squote),'\$(squote)',$1) 32escsq = $(subst $(squote),'\$(squote)',$1)
29 33
@@ -67,14 +71,10 @@ endef
67 71
68# cc-cross-prefix 72# cc-cross-prefix
69# Usage: CROSS_COMPILE := $(call cc-cross-prefix, m68k-linux-gnu- m68k-linux-) 73# Usage: CROSS_COMPILE := $(call cc-cross-prefix, m68k-linux-gnu- m68k-linux-)
70# Return first prefix where a prefix$(CC) is found in PATH. 74# Return first <prefix> where a <prefix>gcc is found in PATH.
71# If no $(CC) found in PATH with listed prefixes return nothing 75# If no gcc found in PATH with listed prefixes return nothing
72cc-cross-prefix = \ 76cc-cross-prefix = $(firstword $(foreach c, $(filter-out -%, $(1)), \
73 $(word 1, $(foreach c,$(1), \ 77 $(if $(shell which $(c)gcc), $(c))))
74 $(shell set -e; \
75 if (which $(strip $(c))$(CC)) > /dev/null 2>&1 ; then \
76 echo $(c); \
77 fi)))
78 78
79# output directory for tests below 79# output directory for tests below
80TMPOUT := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/) 80TMPOUT := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/)
@@ -134,12 +134,9 @@ cc-option-yn = $(call try-run,\
134cc-disable-warning = $(call try-run,\ 134cc-disable-warning = $(call try-run,\
135 $(CC) -Werror $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1))) 135 $(CC) -Werror $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1)))
136 136
137# cc-version
138cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh $(CC))
139
140# cc-ifversion 137# cc-ifversion
141# Usage: EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1) 138# Usage: EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1)
142cc-ifversion = $(shell [ $(cc-version) $(1) $(2) ] && echo $(3) || echo $(4)) 139cc-ifversion = $(shell [ $(CONFIG_GCC_VERSION)0 $(1) $(2)000 ] && echo $(3) || echo $(4))
143 140
144# cc-ldoption 141# cc-ldoption
145# Usage: ldflags += $(call cc-ldoption, -Wl$(comma)--hash-style=both) 142# Usage: ldflags += $(call cc-ldoption, -Wl$(comma)--hash-style=both)
diff --git a/scripts/Kconfig.include b/scripts/Kconfig.include
index dad5583451af..87ff1dcc6bd5 100644
--- a/scripts/Kconfig.include
+++ b/scripts/Kconfig.include
@@ -27,4 +27,4 @@ cc-option = $(success,$(CC) -Werror $(1) -E -x c /dev/null -o /dev/null)
27ld-option = $(success,$(LD) -v $(1)) 27ld-option = $(success,$(LD) -v $(1))
28 28
29# gcc version including patch level 29# gcc version including patch level
30gcc-version := $(shell,$(srctree)/scripts/gcc-version.sh -p $(CC) | sed 's/^0*//') 30gcc-version := $(shell,$(srctree)/scripts/gcc-version.sh $(CC))
diff --git a/scripts/Makefile b/scripts/Makefile
index feb1f71381d7..9d442ee050bd 100644
--- a/scripts/Makefile
+++ b/scripts/Makefile
@@ -39,7 +39,6 @@ build_unifdef: $(obj)/unifdef
39subdir-$(CONFIG_GCC_PLUGINS) += gcc-plugins 39subdir-$(CONFIG_GCC_PLUGINS) += gcc-plugins
40subdir-$(CONFIG_MODVERSIONS) += genksyms 40subdir-$(CONFIG_MODVERSIONS) += genksyms
41subdir-$(CONFIG_SECURITY_SELINUX) += selinux 41subdir-$(CONFIG_SECURITY_SELINUX) += selinux
42subdir-$(CONFIG_GDB_SCRIPTS) += gdb
43 42
44# Let clean descend into subdirs 43# Let clean descend into subdirs
45subdir- += basic dtc kconfig mod package 44subdir- += basic dtc gdb kconfig mod package
diff --git a/scripts/Makefile.asm-generic b/scripts/Makefile.asm-generic
index a62d2823f6cf..82ad63dcd62b 100644
--- a/scripts/Makefile.asm-generic
+++ b/scripts/Makefile.asm-generic
@@ -12,8 +12,19 @@ all:
12src := $(subst /generated,,$(obj)) 12src := $(subst /generated,,$(obj))
13-include $(src)/Kbuild 13-include $(src)/Kbuild
14 14
15# $(generic)/Kbuild lists mandatory-y. Exclude um since it is a special case.
16ifneq ($(SRCARCH),um)
17include $(generic)/Kbuild
18endif
19
15include scripts/Kbuild.include 20include scripts/Kbuild.include
16 21
22redundant := $(filter $(mandatory-y) $(generated-y), $(generic-y))
23redundant += $(foreach f, $(generic-y), $(if $(wildcard $(srctree)/$(src)/$(f)),$(f)))
24redundant := $(sort $(redundant))
25$(if $(redundant),\
26 $(warning redundant generic-y found in $(src)/Kbuild: $(redundant)))
27
17# If arch does not implement mandatory headers, fallback to asm-generic ones. 28# If arch does not implement mandatory headers, fallback to asm-generic ones.
18mandatory-y := $(filter-out $(generated-y), $(mandatory-y)) 29mandatory-y := $(filter-out $(generated-y), $(mandatory-y))
19generic-y += $(foreach f, $(mandatory-y), $(if $(wildcard $(srctree)/$(src)/$(f)),,$(f))) 30generic-y += $(foreach f, $(mandatory-y), $(if $(wildcard $(srctree)/$(src)/$(f)),,$(f)))
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index fd03d60f6c5a..2554a15ecf2b 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -63,7 +63,9 @@ ifneq ($(strip $(real-obj-y) $(need-builtin)),)
63builtin-target := $(obj)/built-in.a 63builtin-target := $(obj)/built-in.a
64endif 64endif
65 65
66ifdef CONFIG_MODULES
66modorder-target := $(obj)/modules.order 67modorder-target := $(obj)/modules.order
68endif
67 69
68# We keep a list of all modules in $(MODVERDIR) 70# We keep a list of all modules in $(MODVERDIR)
69 71
@@ -104,7 +106,7 @@ modkern_cflags = \
104quiet_modtag = $(if $(part-of-module),[M], ) 106quiet_modtag = $(if $(part-of-module),[M], )
105 107
106quiet_cmd_cc_s_c = CC $(quiet_modtag) $@ 108quiet_cmd_cc_s_c = CC $(quiet_modtag) $@
107cmd_cc_s_c = $(CC) $(c_flags) $(DISABLE_LTO) -fverbose-asm -S -o $@ $< 109 cmd_cc_s_c = $(CC) $(filter-out $(DEBUG_CFLAGS), $(c_flags)) $(DISABLE_LTO) -fverbose-asm -S -o $@ $<
108 110
109$(obj)/%.s: $(src)/%.c FORCE 111$(obj)/%.s: $(src)/%.c FORCE
110 $(call if_changed_dep,cc_s_c) 112 $(call if_changed_dep,cc_s_c)
@@ -118,7 +120,7 @@ $(obj)/%.i: $(src)/%.c FORCE
118# These mirror gensymtypes_S and co below, keep them in synch. 120# These mirror gensymtypes_S and co below, keep them in synch.
119cmd_gensymtypes_c = \ 121cmd_gensymtypes_c = \
120 $(CPP) -D__GENKSYMS__ $(c_flags) $< | \ 122 $(CPP) -D__GENKSYMS__ $(c_flags) $< | \
121 $(GENKSYMS) $(if $(1), -T $(2)) \ 123 scripts/genksyms/genksyms $(if $(1), -T $(2)) \
122 $(patsubst y,-R,$(CONFIG_MODULE_REL_CRCS)) \ 124 $(patsubst y,-R,$(CONFIG_MODULE_REL_CRCS)) \
123 $(if $(KBUILD_PRESERVE),-p) \ 125 $(if $(KBUILD_PRESERVE),-p) \
124 -r $(firstword $(wildcard $(2:.symtypes=.symref) /dev/null)) 126 -r $(firstword $(wildcard $(2:.symtypes=.symref) /dev/null))
@@ -312,13 +314,13 @@ $(real-obj-m:.o=.s): modkern_aflags := $(KBUILD_AFLAGS_MODULE) $(AFLAGS_MODULE)
312# 314#
313# These mirror gensymtypes_c and co above, keep them in synch. 315# These mirror gensymtypes_c and co above, keep them in synch.
314cmd_gensymtypes_S = \ 316cmd_gensymtypes_S = \
315 (echo "\#include <linux/kernel.h>" ; \ 317 { echo "\#include <linux/kernel.h>" ; \
316 echo "\#include <asm/asm-prototypes.h>" ; \ 318 echo "\#include <asm/asm-prototypes.h>" ; \
317 $(CPP) $(a_flags) $< | \ 319 $(CPP) $(a_flags) $< | \
318 grep "\<___EXPORT_SYMBOL\>" | \ 320 grep "\<___EXPORT_SYMBOL\>" | \
319 sed 's/.*___EXPORT_SYMBOL[[:space:]]*\([a-zA-Z0-9_]*\)[[:space:]]*,.*/EXPORT_SYMBOL(\1);/' ) | \ 321 sed 's/.*___EXPORT_SYMBOL[[:space:]]*\([a-zA-Z0-9_]*\)[[:space:]]*,.*/EXPORT_SYMBOL(\1);/' ; } | \
320 $(CPP) -D__GENKSYMS__ $(c_flags) -xc - | \ 322 $(CPP) -D__GENKSYMS__ $(c_flags) -xc - | \
321 $(GENKSYMS) $(if $(1), -T $(2)) \ 323 scripts/genksyms/genksyms $(if $(1), -T $(2)) \
322 $(patsubst y,-R,$(CONFIG_MODULE_REL_CRCS)) \ 324 $(patsubst y,-R,$(CONFIG_MODULE_REL_CRCS)) \
323 $(if $(KBUILD_PRESERVE),-p) \ 325 $(if $(KBUILD_PRESERVE),-p) \
324 -r $(firstword $(wildcard $(2:.symtypes=.symref) /dev/null)) 326 -r $(firstword $(wildcard $(2:.symtypes=.symref) /dev/null))
@@ -394,17 +396,12 @@ $(obj)/%.asn1.c $(obj)/%.asn1.h: $(src)/%.asn1 $(objtree)/scripts/asn1_compiler
394$(sort $(subdir-obj-y)): $(subdir-ym) ; 396$(sort $(subdir-obj-y)): $(subdir-ym) ;
395 397
396# 398#
397# Rule to compile a set of .o files into one .o file 399# Rule to compile a set of .o files into one .a file (without symbol table)
398# 400#
399ifdef builtin-target 401ifdef builtin-target
400 402
401# built-in.a archives are made with no symbol table or index which
402# makes them small and fast, but unable to be used by the linker.
403# scripts/link-vmlinux.sh builds an aggregate built-in.a with a symbol
404# table and index.
405quiet_cmd_ar_builtin = AR $@ 403quiet_cmd_ar_builtin = AR $@
406 cmd_ar_builtin = rm -f $@; \ 404 cmd_ar_builtin = rm -f $@; $(AR) rcSTP$(KBUILD_ARFLAGS) $@ $(real-prereqs)
407 $(AR) rcSTP$(KBUILD_ARFLAGS) $@ $(filter $(real-obj-y), $^)
408 405
409$(builtin-target): $(real-obj-y) FORCE 406$(builtin-target): $(real-obj-y) FORCE
410 $(call if_changed,ar_builtin) 407 $(call if_changed,ar_builtin)
@@ -426,16 +423,12 @@ $(modorder-target): $(subdir-ym) FORCE
426 $(Q)(cat /dev/null; $(modorder-cmds)) > $@ 423 $(Q)(cat /dev/null; $(modorder-cmds)) > $@
427 424
428# 425#
429# Rule to compile a set of .o files into one .a file 426# Rule to compile a set of .o files into one .a file (with symbol table)
430# 427#
431ifdef lib-target 428ifdef lib-target
432quiet_cmd_link_l_target = AR $@
433
434# lib target archives do get a symbol table and index
435cmd_link_l_target = rm -f $@; $(AR) rcsTP$(KBUILD_ARFLAGS) $@ $(lib-y)
436 429
437$(lib-target): $(lib-y) FORCE 430$(lib-target): $(lib-y) FORCE
438 $(call if_changed,link_l_target) 431 $(call if_changed,ar)
439 432
440targets += $(lib-target) 433targets += $(lib-target)
441 434
@@ -457,6 +450,10 @@ targets += $(obj)/lib-ksyms.o
457 450
458endif 451endif
459 452
453# NOTE:
454# Do not replace $(filter %.o,^) with $(real-prereqs). When a single object
455# module is turned into a multi object module, $^ will contain header file
456# dependencies recorded in the .*.cmd file.
460quiet_cmd_link_multi-m = LD [M] $@ 457quiet_cmd_link_multi-m = LD [M] $@
461cmd_link_multi-m = $(LD) $(ld_flags) -r -o $@ $(filter %.o,$^) $(cmd_secanalysis) 458cmd_link_multi-m = $(LD) $(ld_flags) -r -o $@ $(filter %.o,$^) $(cmd_secanalysis)
462 459
diff --git a/scripts/Makefile.gcc-plugins b/scripts/Makefile.gcc-plugins
index 35042d96cf5d..5f7df50cfe7a 100644
--- a/scripts/Makefile.gcc-plugins
+++ b/scripts/Makefile.gcc-plugins
@@ -15,6 +15,8 @@ gcc-plugin-$(CONFIG_GCC_PLUGIN_SANCOV) += sancov_plugin.so
15gcc-plugin-$(CONFIG_GCC_PLUGIN_STRUCTLEAK) += structleak_plugin.so 15gcc-plugin-$(CONFIG_GCC_PLUGIN_STRUCTLEAK) += structleak_plugin.so
16gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STRUCTLEAK_VERBOSE) \ 16gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STRUCTLEAK_VERBOSE) \
17 += -fplugin-arg-structleak_plugin-verbose 17 += -fplugin-arg-structleak_plugin-verbose
18gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF) \
19 += -fplugin-arg-structleak_plugin-byref
18gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL) \ 20gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL) \
19 += -fplugin-arg-structleak_plugin-byref-all 21 += -fplugin-arg-structleak_plugin-byref-all
20gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STRUCTLEAK) \ 22gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STRUCTLEAK) \
diff --git a/scripts/Makefile.host b/scripts/Makefile.host
index 0393f75db4d4..a115259b57e7 100644
--- a/scripts/Makefile.host
+++ b/scripts/Makefile.host
@@ -67,13 +67,15 @@ _hostc_flags = $(KBUILD_HOSTCFLAGS) $(HOST_EXTRACFLAGS) \
67_hostcxx_flags = $(KBUILD_HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) \ 67_hostcxx_flags = $(KBUILD_HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) \
68 $(HOSTCXXFLAGS_$(basetarget).o) 68 $(HOSTCXXFLAGS_$(basetarget).o)
69 69
70ifeq ($(KBUILD_SRC),)
71__hostc_flags = $(_hostc_flags) 70__hostc_flags = $(_hostc_flags)
72__hostcxx_flags = $(_hostcxx_flags) 71__hostcxx_flags = $(_hostcxx_flags)
73else 72
73ifeq ($(KBUILD_EXTMOD),)
74ifneq ($(KBUILD_SRC),)
74__hostc_flags = -I$(obj) $(call flags,_hostc_flags) 75__hostc_flags = -I$(obj) $(call flags,_hostc_flags)
75__hostcxx_flags = -I$(obj) $(call flags,_hostcxx_flags) 76__hostcxx_flags = -I$(obj) $(call flags,_hostcxx_flags)
76endif 77endif
78endif
77 79
78hostc_flags = -Wp,-MD,$(depfile) $(__hostc_flags) 80hostc_flags = -Wp,-MD,$(depfile) $(__hostc_flags)
79hostcxx_flags = -Wp,-MD,$(depfile) $(__hostcxx_flags) 81hostcxx_flags = -Wp,-MD,$(depfile) $(__hostcxx_flags)
diff --git a/scripts/Makefile.kasan b/scripts/Makefile.kasan
index 6deabedc67fc..6410bd22fe38 100644
--- a/scripts/Makefile.kasan
+++ b/scripts/Makefile.kasan
@@ -27,14 +27,9 @@ else
27 $(call cc-param,asan-globals=1) \ 27 $(call cc-param,asan-globals=1) \
28 $(call cc-param,asan-instrumentation-with-call-threshold=$(call_threshold)) \ 28 $(call cc-param,asan-instrumentation-with-call-threshold=$(call_threshold)) \
29 $(call cc-param,asan-stack=$(CONFIG_KASAN_STACK)) \ 29 $(call cc-param,asan-stack=$(CONFIG_KASAN_STACK)) \
30 $(call cc-param,asan-use-after-scope=1) \
31 $(call cc-param,asan-instrument-allocas=1) 30 $(call cc-param,asan-instrument-allocas=1)
32endif 31endif
33 32
34ifdef CONFIG_KASAN_EXTRA
35CFLAGS_KASAN += $(call cc-option, -fsanitize-address-use-after-scope)
36endif
37
38endif # CONFIG_KASAN_GENERIC 33endif # CONFIG_KASAN_GENERIC
39 34
40ifdef CONFIG_KASAN_SW_TAGS 35ifdef CONFIG_KASAN_SW_TAGS
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 12b88d09c3a4..8a1f64f17740 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -137,14 +137,14 @@ _c_flags += $(if $(patsubst n%,, \
137 $(CFLAGS_KCOV)) 137 $(CFLAGS_KCOV))
138endif 138endif
139 139
140# If building the kernel in a separate objtree expand all occurrences
141# of -Idir to -I$(srctree)/dir except for absolute paths (starting with '/').
142
143ifeq ($(KBUILD_SRC),)
144__c_flags = $(_c_flags) 140__c_flags = $(_c_flags)
145__a_flags = $(_a_flags) 141__a_flags = $(_a_flags)
146__cpp_flags = $(_cpp_flags) 142__cpp_flags = $(_cpp_flags)
147else 143
144# If building the kernel in a separate objtree expand all occurrences
145# of -Idir to -I$(srctree)/dir except for absolute paths (starting with '/').
146ifeq ($(KBUILD_EXTMOD),)
147ifneq ($(KBUILD_SRC),)
148 148
149# -I$(obj) locates generated .h files 149# -I$(obj) locates generated .h files
150# $(call addtree,-I$(obj)) locates .h files in srctree, from generated .c files 150# $(call addtree,-I$(obj)) locates .h files in srctree, from generated .c files
@@ -155,6 +155,7 @@ __c_flags = $(if $(obj),$(call addtree,-I$(src)) -I$(obj)) \
155__a_flags = $(call flags,_a_flags) 155__a_flags = $(call flags,_a_flags)
156__cpp_flags = $(call flags,_cpp_flags) 156__cpp_flags = $(call flags,_cpp_flags)
157endif 157endif
158endif
158 159
159c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \ 160c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \
160 -include $(srctree)/include/linux/compiler_types.h \ 161 -include $(srctree)/include/linux/compiler_types.h \
@@ -230,7 +231,13 @@ $(obj)/%: $(src)/%_shipped
230# --------------------------------------------------------------------------- 231# ---------------------------------------------------------------------------
231 232
232quiet_cmd_ld = LD $@ 233quiet_cmd_ld = LD $@
233cmd_ld = $(LD) $(ld_flags) $(filter-out FORCE,$^) -o $@ 234 cmd_ld = $(LD) $(ld_flags) $(real-prereqs) -o $@
235
236# Archive
237# ---------------------------------------------------------------------------
238
239quiet_cmd_ar = AR $@
240 cmd_ar = rm -f $@; $(AR) rcsTP$(KBUILD_ARFLAGS) $@ $(real-prereqs)
234 241
235# Objcopy 242# Objcopy
236# --------------------------------------------------------------------------- 243# ---------------------------------------------------------------------------
@@ -242,7 +249,7 @@ cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $(OBJCOPYFLAGS_$(@F)) $< $@
242# --------------------------------------------------------------------------- 249# ---------------------------------------------------------------------------
243 250
244quiet_cmd_gzip = GZIP $@ 251quiet_cmd_gzip = GZIP $@
245 cmd_gzip = cat $(filter-out FORCE,$^) | gzip -n -f -9 > $@ 252 cmd_gzip = cat $(real-prereqs) | gzip -n -f -9 > $@
246 253
247# DTC 254# DTC
248# --------------------------------------------------------------------------- 255# ---------------------------------------------------------------------------
@@ -270,7 +277,7 @@ DTC_FLAGS += $(DTC_FLAGS_$(basetarget))
270# Generate an assembly file to wrap the output of the device tree compiler 277# Generate an assembly file to wrap the output of the device tree compiler
271quiet_cmd_dt_S_dtb= DTB $@ 278quiet_cmd_dt_S_dtb= DTB $@
272cmd_dt_S_dtb= \ 279cmd_dt_S_dtb= \
273( \ 280{ \
274 echo '\#include <asm-generic/vmlinux.lds.h>'; \ 281 echo '\#include <asm-generic/vmlinux.lds.h>'; \
275 echo '.section .dtb.init.rodata,"a"'; \ 282 echo '.section .dtb.init.rodata,"a"'; \
276 echo '.balign STRUCT_ALIGNMENT'; \ 283 echo '.balign STRUCT_ALIGNMENT'; \
@@ -280,7 +287,7 @@ cmd_dt_S_dtb= \
280 echo '__dtb_$(subst -,_,$(*F))_end:'; \ 287 echo '__dtb_$(subst -,_,$(*F))_end:'; \
281 echo '.global __dtb_$(subst -,_,$(*F))_end'; \ 288 echo '.global __dtb_$(subst -,_,$(*F))_end'; \
282 echo '.balign STRUCT_ALIGNMENT'; \ 289 echo '.balign STRUCT_ALIGNMENT'; \
283) > $@ 290} > $@
284 291
285$(obj)/%.dtb.S: $(obj)/%.dtb FORCE 292$(obj)/%.dtb.S: $(obj)/%.dtb FORCE
286 $(call if_changed,dt_S_dtb) 293 $(call if_changed,dt_S_dtb)
@@ -320,7 +327,7 @@ dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp)
320# append the size as a 32-bit littleendian number as gzip does. 327# append the size as a 32-bit littleendian number as gzip does.
321size_append = printf $(shell \ 328size_append = printf $(shell \
322dec_size=0; \ 329dec_size=0; \
323for F in $1; do \ 330for F in $(real-prereqs); do \
324 fsize=$$($(CONFIG_SHELL) $(srctree)/scripts/file-size.sh $$F); \ 331 fsize=$$($(CONFIG_SHELL) $(srctree)/scripts/file-size.sh $$F); \
325 dec_size=$$(expr $$dec_size + $$fsize); \ 332 dec_size=$$(expr $$dec_size + $$fsize); \
326done; \ 333done; \
@@ -334,23 +341,20 @@ printf "%08x\n" $$dec_size | \
334) 341)
335 342
336quiet_cmd_bzip2 = BZIP2 $@ 343quiet_cmd_bzip2 = BZIP2 $@
337cmd_bzip2 = (cat $(filter-out FORCE,$^) | \ 344 cmd_bzip2 = { cat $(real-prereqs) | bzip2 -9 && $(size_append); } > $@
338 bzip2 -9 && $(call size_append, $(filter-out FORCE,$^))) > $@
339 345
340# Lzma 346# Lzma
341# --------------------------------------------------------------------------- 347# ---------------------------------------------------------------------------
342 348
343quiet_cmd_lzma = LZMA $@ 349quiet_cmd_lzma = LZMA $@
344cmd_lzma = (cat $(filter-out FORCE,$^) | \ 350 cmd_lzma = { cat $(real-prereqs) | lzma -9 && $(size_append); } > $@
345 lzma -9 && $(call size_append, $(filter-out FORCE,$^))) > $@
346 351
347quiet_cmd_lzo = LZO $@ 352quiet_cmd_lzo = LZO $@
348cmd_lzo = (cat $(filter-out FORCE,$^) | \ 353 cmd_lzo = { cat $(real-prereqs) | lzop -9 && $(size_append); } > $@
349 lzop -9 && $(call size_append, $(filter-out FORCE,$^))) > $@
350 354
351quiet_cmd_lz4 = LZ4 $@ 355quiet_cmd_lz4 = LZ4 $@
352cmd_lz4 = (cat $(filter-out FORCE,$^) | \ 356 cmd_lz4 = { cat $(real-prereqs) | lz4c -l -c1 stdin stdout && \
353 lz4c -l -c1 stdin stdout && $(call size_append, $(filter-out FORCE,$^))) > $@ 357 $(size_append); } > $@
354 358
355# U-Boot mkimage 359# U-Boot mkimage
356# --------------------------------------------------------------------------- 360# ---------------------------------------------------------------------------
@@ -392,13 +396,11 @@ quiet_cmd_uimage = UIMAGE $@
392# big dictionary would increase the memory usage too much in the multi-call 396# big dictionary would increase the memory usage too much in the multi-call
393# decompression mode. A BCJ filter isn't used either. 397# decompression mode. A BCJ filter isn't used either.
394quiet_cmd_xzkern = XZKERN $@ 398quiet_cmd_xzkern = XZKERN $@
395cmd_xzkern = (cat $(filter-out FORCE,$^) | \ 399 cmd_xzkern = { cat $(real-prereqs) | sh $(srctree)/scripts/xz_wrap.sh && \
396 sh $(srctree)/scripts/xz_wrap.sh && \ 400 $(size_append); } > $@
397 $(call size_append, $(filter-out FORCE,$^))) > $@
398 401
399quiet_cmd_xzmisc = XZMISC $@ 402quiet_cmd_xzmisc = XZMISC $@
400cmd_xzmisc = (cat $(filter-out FORCE,$^) | \ 403 cmd_xzmisc = cat $(real-prereqs) | xz --check=crc32 --lzma2=dict=1MiB > $@
401 xz --check=crc32 --lzma2=dict=1MiB) > $@
402 404
403# ASM offsets 405# ASM offsets
404# --------------------------------------------------------------------------- 406# ---------------------------------------------------------------------------
diff --git a/scripts/Makefile.modinst b/scripts/Makefile.modinst
index ff5ca9817a85..0dae402661f3 100644
--- a/scripts/Makefile.modinst
+++ b/scripts/Makefile.modinst
@@ -23,7 +23,7 @@ quiet_cmd_modules_install = INSTALL $@
23 mkdir -p $(2) ; \ 23 mkdir -p $(2) ; \
24 cp $@ $(2) ; \ 24 cp $@ $(2) ; \
25 $(mod_strip_cmd) $(2)/$(notdir $@) ; \ 25 $(mod_strip_cmd) $(2)/$(notdir $@) ; \
26 $(mod_sign_cmd) $(2)/$(notdir $@) $(patsubst %,|| true,$(KBUILD_EXTMOD)) && \ 26 $(mod_sign_cmd) $(2)/$(notdir $@) $(patsubst %,|| true,$(KBUILD_EXTMOD)) ; \
27 $(mod_compress_cmd) $(2)/$(notdir $@) 27 $(mod_compress_cmd) $(2)/$(notdir $@)
28 28
29# Modules built outside the kernel source tree go into extra by default 29# Modules built outside the kernel source tree go into extra by default
diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost
index 7d4af0d0accb..6b7f354f189a 100644
--- a/scripts/Makefile.modpost
+++ b/scripts/Makefile.modpost
@@ -77,7 +77,6 @@ modpost = scripts/mod/modpost \
77 $(if $(KBUILD_EXTMOD),-I $(modulesymfile)) \ 77 $(if $(KBUILD_EXTMOD),-I $(modulesymfile)) \
78 $(if $(KBUILD_EXTRA_SYMBOLS), $(patsubst %, -e %,$(KBUILD_EXTRA_SYMBOLS))) \ 78 $(if $(KBUILD_EXTRA_SYMBOLS), $(patsubst %, -e %,$(KBUILD_EXTRA_SYMBOLS))) \
79 $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \ 79 $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \
80 $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \
81 $(if $(CONFIG_SECTION_MISMATCH_WARN_ONLY),,-E) \ 80 $(if $(CONFIG_SECTION_MISMATCH_WARN_ONLY),,-E) \
82 $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w) 81 $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w)
83 82
@@ -122,7 +121,7 @@ quiet_cmd_ld_ko_o = LD [M] $@
122 cmd_ld_ko_o = \ 121 cmd_ld_ko_o = \
123 $(LD) -r $(KBUILD_LDFLAGS) \ 122 $(LD) -r $(KBUILD_LDFLAGS) \
124 $(KBUILD_LDFLAGS_MODULE) $(LDFLAGS_MODULE) \ 123 $(KBUILD_LDFLAGS_MODULE) $(LDFLAGS_MODULE) \
125 -o $@ $(filter-out FORCE,$^) ; \ 124 -o $@ $(real-prereqs) ; \
126 $(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true) 125 $(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true)
127 126
128$(modules): %.ko :%.o %.mod.o FORCE 127$(modules): %.ko :%.o %.mod.o FORCE
diff --git a/scripts/adjust_autoksyms.sh b/scripts/adjust_autoksyms.sh
index 6e6d63957da3..84bf6b500815 100755
--- a/scripts/adjust_autoksyms.sh
+++ b/scripts/adjust_autoksyms.sh
@@ -39,14 +39,7 @@ case "$KBUILD_VERBOSE" in
39esac 39esac
40 40
41# We need access to CONFIG_ symbols 41# We need access to CONFIG_ symbols
42case "${KCONFIG_CONFIG}" in 42. include/config/auto.conf
43*/*)
44 . "${KCONFIG_CONFIG}"
45 ;;
46*)
47 # Force using a file from the current directory
48 . "./${KCONFIG_CONFIG}"
49esac
50 43
51# Generate a new ksym list file with symbols needed by the current 44# Generate a new ksym list file with symbols needed by the current
52# set of modules. 45# set of modules.
diff --git a/scripts/atomic/atomic-tbl.sh b/scripts/atomic/atomic-tbl.sh
new file mode 100755
index 000000000000..81d5c32039dd
--- /dev/null
+++ b/scripts/atomic/atomic-tbl.sh
@@ -0,0 +1,186 @@
1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0
3# helpers for dealing with atomics.tbl
4
5#meta_in(meta, match)
6meta_in()
7{
8 case "$1" in
9 [$2]) return 0;;
10 esac
11
12 return 1
13}
14
15#meta_has_ret(meta)
16meta_has_ret()
17{
18 meta_in "$1" "bBiIfFlR"
19}
20
21#meta_has_acquire(meta)
22meta_has_acquire()
23{
24 meta_in "$1" "BFIlR"
25}
26
27#meta_has_release(meta)
28meta_has_release()
29{
30 meta_in "$1" "BFIRs"
31}
32
33#meta_has_relaxed(meta)
34meta_has_relaxed()
35{
36 meta_in "$1" "BFIR"
37}
38
39#find_fallback_template(pfx, name, sfx, order)
40find_fallback_template()
41{
42 local pfx="$1"; shift
43 local name="$1"; shift
44 local sfx="$1"; shift
45 local order="$1"; shift
46
47 local base=""
48 local file=""
49
50 # We may have fallbacks for a specific case (e.g. read_acquire()), or
51 # an entire class, e.g. *inc*().
52 #
53 # Start at the most specific, and fall back to the most general. Once
54 # we find a specific fallback, don't bother looking for more.
55 for base in "${pfx}${name}${sfx}${order}" "${name}"; do
56 file="${ATOMICDIR}/fallbacks/${base}"
57
58 if [ -f "${file}" ]; then
59 printf "${file}"
60 break
61 fi
62 done
63}
64
65#gen_ret_type(meta, int)
66gen_ret_type() {
67 local meta="$1"; shift
68 local int="$1"; shift
69
70 case "${meta}" in
71 [sv]) printf "void";;
72 [bB]) printf "bool";;
73 [aiIfFlR]) printf "${int}";;
74 esac
75}
76
77#gen_ret_stmt(meta)
78gen_ret_stmt()
79{
80 if meta_has_ret "${meta}"; then
81 printf "return ";
82 fi
83}
84
85# gen_param_name(arg)
86gen_param_name()
87{
88 # strip off the leading 'c' for 'cv'
89 local name="${1#c}"
90 printf "${name#*:}"
91}
92
93# gen_param_type(arg, int, atomic)
94gen_param_type()
95{
96 local type="${1%%:*}"; shift
97 local int="$1"; shift
98 local atomic="$1"; shift
99
100 case "${type}" in
101 i) type="${int} ";;
102 p) type="${int} *";;
103 v) type="${atomic}_t *";;
104 cv) type="const ${atomic}_t *";;
105 esac
106
107 printf "${type}"
108}
109
110#gen_param(arg, int, atomic)
111gen_param()
112{
113 local arg="$1"; shift
114 local int="$1"; shift
115 local atomic="$1"; shift
116 local name="$(gen_param_name "${arg}")"
117 local type="$(gen_param_type "${arg}" "${int}" "${atomic}")"
118
119 printf "${type}${name}"
120}
121
122#gen_params(int, atomic, arg...)
123gen_params()
124{
125 local int="$1"; shift
126 local atomic="$1"; shift
127
128 while [ "$#" -gt 0 ]; do
129 gen_param "$1" "${int}" "${atomic}"
130 [ "$#" -gt 1 ] && printf ", "
131 shift;
132 done
133}
134
135#gen_args(arg...)
136gen_args()
137{
138 while [ "$#" -gt 0 ]; do
139 printf "$(gen_param_name "$1")"
140 [ "$#" -gt 1 ] && printf ", "
141 shift;
142 done
143}
144
145#gen_proto_order_variants(meta, pfx, name, sfx, ...)
146gen_proto_order_variants()
147{
148 local meta="$1"; shift
149 local pfx="$1"; shift
150 local name="$1"; shift
151 local sfx="$1"; shift
152
153 gen_proto_order_variant "${meta}" "${pfx}" "${name}" "${sfx}" "" "$@"
154
155 if meta_has_acquire "${meta}"; then
156 gen_proto_order_variant "${meta}" "${pfx}" "${name}" "${sfx}" "_acquire" "$@"
157 fi
158 if meta_has_release "${meta}"; then
159 gen_proto_order_variant "${meta}" "${pfx}" "${name}" "${sfx}" "_release" "$@"
160 fi
161 if meta_has_relaxed "${meta}"; then
162 gen_proto_order_variant "${meta}" "${pfx}" "${name}" "${sfx}" "_relaxed" "$@"
163 fi
164}
165
166#gen_proto_variants(meta, name, ...)
167gen_proto_variants()
168{
169 local meta="$1"; shift
170 local name="$1"; shift
171 local pfx=""
172 local sfx=""
173
174 meta_in "${meta}" "fF" && pfx="fetch_"
175 meta_in "${meta}" "R" && sfx="_return"
176
177 gen_proto_order_variants "${meta}" "${pfx}" "${name}" "${sfx}" "$@"
178}
179
180#gen_proto(meta, ...)
181gen_proto() {
182 local meta="$1"; shift
183 for m in $(echo "${meta}" | grep -o .); do
184 gen_proto_variants "${m}" "$@"
185 done
186}
diff --git a/scripts/atomic/atomics.tbl b/scripts/atomic/atomics.tbl
new file mode 100755
index 000000000000..fbee2f6190d9
--- /dev/null
+++ b/scripts/atomic/atomics.tbl
@@ -0,0 +1,41 @@
1# name meta args...
2#
3# Where meta contains a string of variants to generate.
4# Upper-case implies _{acquire,release,relaxed} variants.
5# Valid meta values are:
6# * B/b - bool: returns bool
7# * v - void: returns void
8# * I/i - int: returns base type
9# * R - return: returns base type (has _return variants)
10# * F/f - fetch: returns base type (has fetch_ variants)
11# * l - load: returns base type (has _acquire order variant)
12# * s - store: returns void (has _release order variant)
13#
14# Where args contains list of type[:name], where type is:
15# * cv - const pointer to atomic base type (atomic_t/atomic64_t/atomic_long_t)
16# * v - pointer to atomic base type (atomic_t/atomic64_t/atomic_long_t)
17# * i - base type (int/s64/long)
18# * p - pointer to base type (int/s64/long)
19#
20read l cv
21set s v i
22add vRF i v
23sub vRF i v
24inc vRF v
25dec vRF v
26and vF i v
27andnot vF i v
28or vF i v
29xor vF i v
30xchg I v i
31cmpxchg I v i:old i:new
32try_cmpxchg B v p:old i:new
33sub_and_test b i v
34dec_and_test b v
35inc_and_test b v
36add_negative b i v
37add_unless fb v i:a i:u
38inc_not_zero b v
39inc_unless_negative b v
40dec_unless_positive b v
41dec_if_positive i v
diff --git a/scripts/atomic/check-atomics.sh b/scripts/atomic/check-atomics.sh
new file mode 100755
index 000000000000..cfa0c2f71c84
--- /dev/null
+++ b/scripts/atomic/check-atomics.sh
@@ -0,0 +1,33 @@
1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0
3#
4# Check if atomic headers are up-to-date
5
6ATOMICDIR=$(dirname $0)
7ATOMICTBL=${ATOMICDIR}/atomics.tbl
8LINUXDIR=${ATOMICDIR}/../..
9
10echo '' | sha1sum - > /dev/null 2>&1
11if [ $? -ne 0 ]; then
12 printf "sha1sum not available, skipping atomic header checks.\n"
13 exit 0
14fi
15
16cat <<EOF |
17asm-generic/atomic-instrumented.h
18asm-generic/atomic-long.h
19linux/atomic-fallback.h
20EOF
21while read header; do
22 OLDSUM="$(tail -n 1 ${LINUXDIR}/include/${header})"
23 OLDSUM="${OLDSUM#// }"
24
25 NEWSUM="$(head -n -1 ${LINUXDIR}/include/${header} | sha1sum)"
26 NEWSUM="${NEWSUM%% *}"
27
28 if [ "${OLDSUM}" != "${NEWSUM}" ]; then
29 printf "warning: generated include/${header} has been modified.\n"
30 fi
31done
32
33exit 0
diff --git a/scripts/atomic/fallbacks/acquire b/scripts/atomic/fallbacks/acquire
new file mode 100755
index 000000000000..e38871e64db6
--- /dev/null
+++ b/scripts/atomic/fallbacks/acquire
@@ -0,0 +1,9 @@
1cat <<EOF
2static inline ${ret}
3${atomic}_${pfx}${name}${sfx}_acquire(${params})
4{
5 ${ret} ret = ${atomic}_${pfx}${name}${sfx}_relaxed(${args});
6 __atomic_acquire_fence();
7 return ret;
8}
9EOF
diff --git a/scripts/atomic/fallbacks/add_negative b/scripts/atomic/fallbacks/add_negative
new file mode 100755
index 000000000000..e6f4815637de
--- /dev/null
+++ b/scripts/atomic/fallbacks/add_negative
@@ -0,0 +1,16 @@
1cat <<EOF
2/**
3 * ${atomic}_add_negative - add and test if negative
4 * @i: integer value to add
5 * @v: pointer of type ${atomic}_t
6 *
7 * Atomically adds @i to @v and returns true
8 * if the result is negative, or false when
9 * result is greater than or equal to zero.
10 */
11static inline bool
12${atomic}_add_negative(${int} i, ${atomic}_t *v)
13{
14 return ${atomic}_add_return(i, v) < 0;
15}
16EOF
diff --git a/scripts/atomic/fallbacks/add_unless b/scripts/atomic/fallbacks/add_unless
new file mode 100755
index 000000000000..792533885fbf
--- /dev/null
+++ b/scripts/atomic/fallbacks/add_unless
@@ -0,0 +1,16 @@
1cat << EOF
2/**
3 * ${atomic}_add_unless - add unless the number is already a given value
4 * @v: pointer of type ${atomic}_t
5 * @a: the amount to add to v...
6 * @u: ...unless v is equal to u.
7 *
8 * Atomically adds @a to @v, if @v was not already @u.
9 * Returns true if the addition was done.
10 */
11static inline bool
12${atomic}_add_unless(${atomic}_t *v, ${int} a, ${int} u)
13{
14 return ${atomic}_fetch_add_unless(v, a, u) != u;
15}
16EOF
diff --git a/scripts/atomic/fallbacks/andnot b/scripts/atomic/fallbacks/andnot
new file mode 100755
index 000000000000..9f3a3216b5e3
--- /dev/null
+++ b/scripts/atomic/fallbacks/andnot
@@ -0,0 +1,7 @@
1cat <<EOF
2static inline ${ret}
3${atomic}_${pfx}andnot${sfx}${order}(${int} i, ${atomic}_t *v)
4{
5 ${retstmt}${atomic}_${pfx}and${sfx}${order}(~i, v);
6}
7EOF
diff --git a/scripts/atomic/fallbacks/dec b/scripts/atomic/fallbacks/dec
new file mode 100755
index 000000000000..10bbc82be31d
--- /dev/null
+++ b/scripts/atomic/fallbacks/dec
@@ -0,0 +1,7 @@
1cat <<EOF
2static inline ${ret}
3${atomic}_${pfx}dec${sfx}${order}(${atomic}_t *v)
4{
5 ${retstmt}${atomic}_${pfx}sub${sfx}${order}(1, v);
6}
7EOF
diff --git a/scripts/atomic/fallbacks/dec_and_test b/scripts/atomic/fallbacks/dec_and_test
new file mode 100755
index 000000000000..0ce7103b3df2
--- /dev/null
+++ b/scripts/atomic/fallbacks/dec_and_test
@@ -0,0 +1,15 @@
1cat <<EOF
2/**
3 * ${atomic}_dec_and_test - decrement and test
4 * @v: pointer of type ${atomic}_t
5 *
6 * Atomically decrements @v by 1 and
7 * returns true if the result is 0, or false for all other
8 * cases.
9 */
10static inline bool
11${atomic}_dec_and_test(${atomic}_t *v)
12{
13 return ${atomic}_dec_return(v) == 0;
14}
15EOF
diff --git a/scripts/atomic/fallbacks/dec_if_positive b/scripts/atomic/fallbacks/dec_if_positive
new file mode 100755
index 000000000000..c52eacec43c8
--- /dev/null
+++ b/scripts/atomic/fallbacks/dec_if_positive
@@ -0,0 +1,15 @@
1cat <<EOF
2static inline ${ret}
3${atomic}_dec_if_positive(${atomic}_t *v)
4{
5 ${int} dec, c = ${atomic}_read(v);
6
7 do {
8 dec = c - 1;
9 if (unlikely(dec < 0))
10 break;
11 } while (!${atomic}_try_cmpxchg(v, &c, dec));
12
13 return dec;
14}
15EOF
diff --git a/scripts/atomic/fallbacks/dec_unless_positive b/scripts/atomic/fallbacks/dec_unless_positive
new file mode 100755
index 000000000000..8a2578f14268
--- /dev/null
+++ b/scripts/atomic/fallbacks/dec_unless_positive
@@ -0,0 +1,14 @@
1cat <<EOF
2static inline bool
3${atomic}_dec_unless_positive(${atomic}_t *v)
4{
5 ${int} c = ${atomic}_read(v);
6
7 do {
8 if (unlikely(c > 0))
9 return false;
10 } while (!${atomic}_try_cmpxchg(v, &c, c - 1));
11
12 return true;
13}
14EOF
diff --git a/scripts/atomic/fallbacks/fence b/scripts/atomic/fallbacks/fence
new file mode 100755
index 000000000000..82f68fa6931a
--- /dev/null
+++ b/scripts/atomic/fallbacks/fence
@@ -0,0 +1,11 @@
1cat <<EOF
2static inline ${ret}
3${atomic}_${pfx}${name}${sfx}(${params})
4{
5 ${ret} ret;
6 __atomic_pre_full_fence();
7 ret = ${atomic}_${pfx}${name}${sfx}_relaxed(${args});
8 __atomic_post_full_fence();
9 return ret;
10}
11EOF
diff --git a/scripts/atomic/fallbacks/fetch_add_unless b/scripts/atomic/fallbacks/fetch_add_unless
new file mode 100755
index 000000000000..d2c091db7eae
--- /dev/null
+++ b/scripts/atomic/fallbacks/fetch_add_unless
@@ -0,0 +1,23 @@
1cat << EOF
2/**
3 * ${atomic}_fetch_add_unless - add unless the number is already a given value
4 * @v: pointer of type ${atomic}_t
5 * @a: the amount to add to v...
6 * @u: ...unless v is equal to u.
7 *
8 * Atomically adds @a to @v, so long as @v was not already @u.
9 * Returns original value of @v
10 */
11static inline ${int}
12${atomic}_fetch_add_unless(${atomic}_t *v, ${int} a, ${int} u)
13{
14 ${int} c = ${atomic}_read(v);
15
16 do {
17 if (unlikely(c == u))
18 break;
19 } while (!${atomic}_try_cmpxchg(v, &c, c + a));
20
21 return c;
22}
23EOF
diff --git a/scripts/atomic/fallbacks/inc b/scripts/atomic/fallbacks/inc
new file mode 100755
index 000000000000..f866b3ad2353
--- /dev/null
+++ b/scripts/atomic/fallbacks/inc
@@ -0,0 +1,7 @@
1cat <<EOF
2static inline ${ret}
3${atomic}_${pfx}inc${sfx}${order}(${atomic}_t *v)
4{
5 ${retstmt}${atomic}_${pfx}add${sfx}${order}(1, v);
6}
7EOF
diff --git a/scripts/atomic/fallbacks/inc_and_test b/scripts/atomic/fallbacks/inc_and_test
new file mode 100755
index 000000000000..4e2068869f7e
--- /dev/null
+++ b/scripts/atomic/fallbacks/inc_and_test
@@ -0,0 +1,15 @@
1cat <<EOF
2/**
3 * ${atomic}_inc_and_test - increment and test
4 * @v: pointer of type ${atomic}_t
5 *
6 * Atomically increments @v by 1
7 * and returns true if the result is zero, or false for all
8 * other cases.
9 */
10static inline bool
11${atomic}_inc_and_test(${atomic}_t *v)
12{
13 return ${atomic}_inc_return(v) == 0;
14}
15EOF
diff --git a/scripts/atomic/fallbacks/inc_not_zero b/scripts/atomic/fallbacks/inc_not_zero
new file mode 100755
index 000000000000..a7c45c8d107c
--- /dev/null
+++ b/scripts/atomic/fallbacks/inc_not_zero
@@ -0,0 +1,14 @@
1cat <<EOF
2/**
3 * ${atomic}_inc_not_zero - increment unless the number is zero
4 * @v: pointer of type ${atomic}_t
5 *
6 * Atomically increments @v by 1, if @v is non-zero.
7 * Returns true if the increment was done.
8 */
9static inline bool
10${atomic}_inc_not_zero(${atomic}_t *v)
11{
12 return ${atomic}_add_unless(v, 1, 0);
13}
14EOF
diff --git a/scripts/atomic/fallbacks/inc_unless_negative b/scripts/atomic/fallbacks/inc_unless_negative
new file mode 100755
index 000000000000..0c266e71dbd4
--- /dev/null
+++ b/scripts/atomic/fallbacks/inc_unless_negative
@@ -0,0 +1,14 @@
1cat <<EOF
2static inline bool
3${atomic}_inc_unless_negative(${atomic}_t *v)
4{
5 ${int} c = ${atomic}_read(v);
6
7 do {
8 if (unlikely(c < 0))
9 return false;
10 } while (!${atomic}_try_cmpxchg(v, &c, c + 1));
11
12 return true;
13}
14EOF
diff --git a/scripts/atomic/fallbacks/read_acquire b/scripts/atomic/fallbacks/read_acquire
new file mode 100755
index 000000000000..75863b5203f7
--- /dev/null
+++ b/scripts/atomic/fallbacks/read_acquire
@@ -0,0 +1,7 @@
1cat <<EOF
2static inline ${ret}
3${atomic}_read_acquire(const ${atomic}_t *v)
4{
5 return smp_load_acquire(&(v)->counter);
6}
7EOF
diff --git a/scripts/atomic/fallbacks/release b/scripts/atomic/fallbacks/release
new file mode 100755
index 000000000000..3f628a3802d9
--- /dev/null
+++ b/scripts/atomic/fallbacks/release
@@ -0,0 +1,8 @@
1cat <<EOF
2static inline ${ret}
3${atomic}_${pfx}${name}${sfx}_release(${params})
4{
5 __atomic_release_fence();
6 ${retstmt}${atomic}_${pfx}${name}${sfx}_relaxed(${args});
7}
8EOF
diff --git a/scripts/atomic/fallbacks/set_release b/scripts/atomic/fallbacks/set_release
new file mode 100755
index 000000000000..45bb5e0cfc08
--- /dev/null
+++ b/scripts/atomic/fallbacks/set_release
@@ -0,0 +1,7 @@
1cat <<EOF
2static inline void
3${atomic}_set_release(${atomic}_t *v, ${int} i)
4{
5 smp_store_release(&(v)->counter, i);
6}
7EOF
diff --git a/scripts/atomic/fallbacks/sub_and_test b/scripts/atomic/fallbacks/sub_and_test
new file mode 100755
index 000000000000..289ef17a2d7a
--- /dev/null
+++ b/scripts/atomic/fallbacks/sub_and_test
@@ -0,0 +1,16 @@
1cat <<EOF
2/**
3 * ${atomic}_sub_and_test - subtract value from variable and test result
4 * @i: integer value to subtract
5 * @v: pointer of type ${atomic}_t
6 *
7 * Atomically subtracts @i from @v and returns
8 * true if the result is zero, or false for all
9 * other cases.
10 */
11static inline bool
12${atomic}_sub_and_test(${int} i, ${atomic}_t *v)
13{
14 return ${atomic}_sub_return(i, v) == 0;
15}
16EOF
diff --git a/scripts/atomic/fallbacks/try_cmpxchg b/scripts/atomic/fallbacks/try_cmpxchg
new file mode 100755
index 000000000000..4ed85e2f5378
--- /dev/null
+++ b/scripts/atomic/fallbacks/try_cmpxchg
@@ -0,0 +1,11 @@
1cat <<EOF
2static inline bool
3${atomic}_try_cmpxchg${order}(${atomic}_t *v, ${int} *old, ${int} new)
4{
5 ${int} r, o = *old;
6 r = ${atomic}_cmpxchg${order}(v, o, new);
7 if (unlikely(r != o))
8 *old = r;
9 return likely(r == o);
10}
11EOF
diff --git a/scripts/atomic/gen-atomic-fallback.sh b/scripts/atomic/gen-atomic-fallback.sh
new file mode 100755
index 000000000000..1bd7c1707633
--- /dev/null
+++ b/scripts/atomic/gen-atomic-fallback.sh
@@ -0,0 +1,181 @@
1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0
3
4ATOMICDIR=$(dirname $0)
5
6. ${ATOMICDIR}/atomic-tbl.sh
7
8#gen_template_fallback(template, meta, pfx, name, sfx, order, atomic, int, args...)
9gen_template_fallback()
10{
11 local template="$1"; shift
12 local meta="$1"; shift
13 local pfx="$1"; shift
14 local name="$1"; shift
15 local sfx="$1"; shift
16 local order="$1"; shift
17 local atomic="$1"; shift
18 local int="$1"; shift
19
20 local atomicname="${atomic}_${pfx}${name}${sfx}${order}"
21
22 local ret="$(gen_ret_type "${meta}" "${int}")"
23 local retstmt="$(gen_ret_stmt "${meta}")"
24 local params="$(gen_params "${int}" "${atomic}" "$@")"
25 local args="$(gen_args "$@")"
26
27 if [ ! -z "${template}" ]; then
28 printf "#ifndef ${atomicname}\n"
29 . ${template}
30 printf "#define ${atomicname} ${atomicname}\n"
31 printf "#endif\n\n"
32 fi
33}
34
35#gen_proto_fallback(meta, pfx, name, sfx, order, atomic, int, args...)
36gen_proto_fallback()
37{
38 local meta="$1"; shift
39 local pfx="$1"; shift
40 local name="$1"; shift
41 local sfx="$1"; shift
42 local order="$1"; shift
43
44 local tmpl="$(find_fallback_template "${pfx}" "${name}" "${sfx}" "${order}")"
45 gen_template_fallback "${tmpl}" "${meta}" "${pfx}" "${name}" "${sfx}" "${order}" "$@"
46}
47
48#gen_basic_fallbacks(basename)
49gen_basic_fallbacks()
50{
51 local basename="$1"; shift
52cat << EOF
53#define ${basename}_acquire ${basename}
54#define ${basename}_release ${basename}
55#define ${basename}_relaxed ${basename}
56EOF
57}
58
59#gen_proto_order_variants(meta, pfx, name, sfx, atomic, int, args...)
60gen_proto_order_variants()
61{
62 local meta="$1"; shift
63 local pfx="$1"; shift
64 local name="$1"; shift
65 local sfx="$1"; shift
66 local atomic="$1"
67
68 local basename="${atomic}_${pfx}${name}${sfx}"
69
70 local template="$(find_fallback_template "${pfx}" "${name}" "${sfx}" "${order}")"
71
72 # If we don't have relaxed atomics, then we don't bother with ordering fallbacks
73 # read_acquire and set_release need to be templated, though
74 if ! meta_has_relaxed "${meta}"; then
75 gen_proto_fallback "${meta}" "${pfx}" "${name}" "${sfx}" "" "$@"
76
77 if meta_has_acquire "${meta}"; then
78 gen_proto_fallback "${meta}" "${pfx}" "${name}" "${sfx}" "_acquire" "$@"
79 fi
80
81 if meta_has_release "${meta}"; then
82 gen_proto_fallback "${meta}" "${pfx}" "${name}" "${sfx}" "_release" "$@"
83 fi
84
85 return
86 fi
87
88 printf "#ifndef ${basename}_relaxed\n"
89
90 if [ ! -z "${template}" ]; then
91 printf "#ifdef ${basename}\n"
92 fi
93
94 gen_basic_fallbacks "${basename}"
95
96 if [ ! -z "${template}" ]; then
97 printf "#endif /* ${atomic}_${pfx}${name}${sfx} */\n\n"
98 gen_proto_fallback "${meta}" "${pfx}" "${name}" "${sfx}" "" "$@"
99 gen_proto_fallback "${meta}" "${pfx}" "${name}" "${sfx}" "_acquire" "$@"
100 gen_proto_fallback "${meta}" "${pfx}" "${name}" "${sfx}" "_release" "$@"
101 gen_proto_fallback "${meta}" "${pfx}" "${name}" "${sfx}" "_relaxed" "$@"
102 fi
103
104 printf "#else /* ${basename}_relaxed */\n\n"
105
106 gen_template_fallback "${ATOMICDIR}/fallbacks/acquire" "${meta}" "${pfx}" "${name}" "${sfx}" "_acquire" "$@"
107 gen_template_fallback "${ATOMICDIR}/fallbacks/release" "${meta}" "${pfx}" "${name}" "${sfx}" "_release" "$@"
108 gen_template_fallback "${ATOMICDIR}/fallbacks/fence" "${meta}" "${pfx}" "${name}" "${sfx}" "" "$@"
109
110 printf "#endif /* ${basename}_relaxed */\n\n"
111}
112
113gen_xchg_fallbacks()
114{
115 local xchg="$1"; shift
116cat <<EOF
117#ifndef ${xchg}_relaxed
118#define ${xchg}_relaxed ${xchg}
119#define ${xchg}_acquire ${xchg}
120#define ${xchg}_release ${xchg}
121#else /* ${xchg}_relaxed */
122
123#ifndef ${xchg}_acquire
124#define ${xchg}_acquire(...) \\
125 __atomic_op_acquire(${xchg}, __VA_ARGS__)
126#endif
127
128#ifndef ${xchg}_release
129#define ${xchg}_release(...) \\
130 __atomic_op_release(${xchg}, __VA_ARGS__)
131#endif
132
133#ifndef ${xchg}
134#define ${xchg}(...) \\
135 __atomic_op_fence(${xchg}, __VA_ARGS__)
136#endif
137
138#endif /* ${xchg}_relaxed */
139
140EOF
141}
142
143cat << EOF
144// SPDX-License-Identifier: GPL-2.0
145
146// Generated by $0
147// DO NOT MODIFY THIS FILE DIRECTLY
148
149#ifndef _LINUX_ATOMIC_FALLBACK_H
150#define _LINUX_ATOMIC_FALLBACK_H
151
152EOF
153
154for xchg in "xchg" "cmpxchg" "cmpxchg64"; do
155 gen_xchg_fallbacks "${xchg}"
156done
157
158grep '^[a-z]' "$1" | while read name meta args; do
159 gen_proto "${meta}" "${name}" "atomic" "int" ${args}
160done
161
162cat <<EOF
163#define atomic_cond_read_acquire(v, c) smp_cond_load_acquire(&(v)->counter, (c))
164#define atomic_cond_read_relaxed(v, c) smp_cond_load_relaxed(&(v)->counter, (c))
165
166#ifdef CONFIG_GENERIC_ATOMIC64
167#include <asm-generic/atomic64.h>
168#endif
169
170EOF
171
172grep '^[a-z]' "$1" | while read name meta args; do
173 gen_proto "${meta}" "${name}" "atomic64" "s64" ${args}
174done
175
176cat <<EOF
177#define atomic64_cond_read_acquire(v, c) smp_cond_load_acquire(&(v)->counter, (c))
178#define atomic64_cond_read_relaxed(v, c) smp_cond_load_relaxed(&(v)->counter, (c))
179
180#endif /* _LINUX_ATOMIC_FALLBACK_H */
181EOF
diff --git a/scripts/atomic/gen-atomic-instrumented.sh b/scripts/atomic/gen-atomic-instrumented.sh
new file mode 100755
index 000000000000..e09812372b17
--- /dev/null
+++ b/scripts/atomic/gen-atomic-instrumented.sh
@@ -0,0 +1,182 @@
1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0
3
4ATOMICDIR=$(dirname $0)
5
6. ${ATOMICDIR}/atomic-tbl.sh
7
8#gen_param_check(arg)
9gen_param_check()
10{
11 local arg="$1"; shift
12 local type="${arg%%:*}"
13 local name="$(gen_param_name "${arg}")"
14 local rw="write"
15
16 case "${type#c}" in
17 i) return;;
18 esac
19
20 # We don't write to constant parameters
21 [ ${type#c} != ${type} ] && rw="read"
22
23 printf "\tkasan_check_${rw}(${name}, sizeof(*${name}));\n"
24}
25
26#gen_param_check(arg...)
27gen_params_checks()
28{
29 while [ "$#" -gt 0 ]; do
30 gen_param_check "$1"
31 shift;
32 done
33}
34
35# gen_guard(meta, atomic, pfx, name, sfx, order)
36gen_guard()
37{
38 local meta="$1"; shift
39 local atomic="$1"; shift
40 local pfx="$1"; shift
41 local name="$1"; shift
42 local sfx="$1"; shift
43 local order="$1"; shift
44
45 local atomicname="arch_${atomic}_${pfx}${name}${sfx}${order}"
46
47 local template="$(find_fallback_template "${pfx}" "${name}" "${sfx}" "${order}")"
48
49 # We definitely need a preprocessor symbol for this atomic if it is an
50 # ordering variant, or if there's a generic fallback.
51 if [ ! -z "${order}" ] || [ ! -z "${template}" ]; then
52 printf "defined(${atomicname})"
53 return
54 fi
55
56 # If this is a base variant, but a relaxed variant *may* exist, then we
57 # only have a preprocessor symbol if the relaxed variant isn't defined
58 if meta_has_relaxed "${meta}"; then
59 printf "!defined(${atomicname}_relaxed) || defined(${atomicname})"
60 fi
61}
62
63#gen_proto_order_variant(meta, pfx, name, sfx, order, atomic, int, arg...)
64gen_proto_order_variant()
65{
66 local meta="$1"; shift
67 local pfx="$1"; shift
68 local name="$1"; shift
69 local sfx="$1"; shift
70 local order="$1"; shift
71 local atomic="$1"; shift
72 local int="$1"; shift
73
74 local atomicname="${atomic}_${pfx}${name}${sfx}${order}"
75
76 local guard="$(gen_guard "${meta}" "${atomic}" "${pfx}" "${name}" "${sfx}" "${order}")"
77
78 local ret="$(gen_ret_type "${meta}" "${int}")"
79 local params="$(gen_params "${int}" "${atomic}" "$@")"
80 local checks="$(gen_params_checks "$@")"
81 local args="$(gen_args "$@")"
82 local retstmt="$(gen_ret_stmt "${meta}")"
83
84 [ ! -z "${guard}" ] && printf "#if ${guard}\n"
85
86cat <<EOF
87static inline ${ret}
88${atomicname}(${params})
89{
90${checks}
91 ${retstmt}arch_${atomicname}(${args});
92}
93#define ${atomicname} ${atomicname}
94EOF
95
96 [ ! -z "${guard}" ] && printf "#endif\n"
97
98 printf "\n"
99}
100
101gen_xchg()
102{
103 local xchg="$1"; shift
104 local mult="$1"; shift
105
106cat <<EOF
107#define ${xchg}(ptr, ...) \\
108({ \\
109 typeof(ptr) __ai_ptr = (ptr); \\
110 kasan_check_write(__ai_ptr, ${mult}sizeof(*__ai_ptr)); \\
111 arch_${xchg}(__ai_ptr, __VA_ARGS__); \\
112})
113EOF
114}
115
116gen_optional_xchg()
117{
118 local name="$1"; shift
119 local sfx="$1"; shift
120 local guard="defined(arch_${name}${sfx})"
121
122 [ -z "${sfx}" ] && guard="!defined(arch_${name}_relaxed) || defined(arch_${name})"
123
124 printf "#if ${guard}\n"
125 gen_xchg "${name}${sfx}" ""
126 printf "#endif\n\n"
127}
128
129cat << EOF
130// SPDX-License-Identifier: GPL-2.0
131
132// Generated by $0
133// DO NOT MODIFY THIS FILE DIRECTLY
134
135/*
136 * This file provides wrappers with KASAN instrumentation for atomic operations.
137 * To use this functionality an arch's atomic.h file needs to define all
138 * atomic operations with arch_ prefix (e.g. arch_atomic_read()) and include
139 * this file at the end. This file provides atomic_read() that forwards to
140 * arch_atomic_read() for actual atomic operation.
141 * Note: if an arch atomic operation is implemented by means of other atomic
142 * operations (e.g. atomic_read()/atomic_cmpxchg() loop), then it needs to use
143 * arch_ variants (i.e. arch_atomic_read()/arch_atomic_cmpxchg()) to avoid
144 * double instrumentation.
145 */
146#ifndef _ASM_GENERIC_ATOMIC_INSTRUMENTED_H
147#define _ASM_GENERIC_ATOMIC_INSTRUMENTED_H
148
149#include <linux/build_bug.h>
150#include <linux/kasan-checks.h>
151
152EOF
153
154grep '^[a-z]' "$1" | while read name meta args; do
155 gen_proto "${meta}" "${name}" "atomic" "int" ${args}
156done
157
158grep '^[a-z]' "$1" | while read name meta args; do
159 gen_proto "${meta}" "${name}" "atomic64" "s64" ${args}
160done
161
162for xchg in "xchg" "cmpxchg" "cmpxchg64"; do
163 for order in "" "_acquire" "_release" "_relaxed"; do
164 gen_optional_xchg "${xchg}" "${order}"
165 done
166done
167
168for xchg in "cmpxchg_local" "cmpxchg64_local" "sync_cmpxchg"; do
169 gen_xchg "${xchg}" ""
170 printf "\n"
171done
172
173gen_xchg "cmpxchg_double" "2 * "
174
175printf "\n\n"
176
177gen_xchg "cmpxchg_double_local" "2 * "
178
179cat <<EOF
180
181#endif /* _ASM_GENERIC_ATOMIC_INSTRUMENTED_H */
182EOF
diff --git a/scripts/atomic/gen-atomic-long.sh b/scripts/atomic/gen-atomic-long.sh
new file mode 100755
index 000000000000..c240a7231b2e
--- /dev/null
+++ b/scripts/atomic/gen-atomic-long.sh
@@ -0,0 +1,101 @@
1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0
3
4ATOMICDIR=$(dirname $0)
5
6. ${ATOMICDIR}/atomic-tbl.sh
7
8#gen_cast(arg, int, atomic)
9gen_cast()
10{
11 local arg="$1"; shift
12 local int="$1"; shift
13 local atomic="$1"; shift
14
15 [ "${arg%%:*}" = "p" ] || return
16
17 printf "($(gen_param_type "${arg}" "${int}" "${atomic}"))"
18}
19
20#gen_args_cast(int, atomic, arg...)
21gen_args_cast()
22{
23 local int="$1"; shift
24 local atomic="$1"; shift
25
26 while [ "$#" -gt 0 ]; do
27 local cast="$(gen_cast "$1" "${int}" "${atomic}")"
28 local arg="$(gen_param_name "$1")"
29 printf "${cast}${arg}"
30 [ "$#" -gt 1 ] && printf ", "
31 shift;
32 done
33}
34
35#gen_proto_order_variant(meta, pfx, name, sfx, order, atomic, int, arg...)
36gen_proto_order_variant()
37{
38 local meta="$1"; shift
39 local name="$1$2$3$4"; shift; shift; shift; shift
40 local atomic="$1"; shift
41 local int="$1"; shift
42
43 local ret="$(gen_ret_type "${meta}" "long")"
44 local params="$(gen_params "long" "atomic_long" "$@")"
45 local argscast="$(gen_args_cast "${int}" "${atomic}" "$@")"
46 local retstmt="$(gen_ret_stmt "${meta}")"
47
48cat <<EOF
49static inline ${ret}
50atomic_long_${name}(${params})
51{
52 ${retstmt}${atomic}_${name}(${argscast});
53}
54
55EOF
56}
57
58cat << EOF
59// SPDX-License-Identifier: GPL-2.0
60
61// Generated by $0
62// DO NOT MODIFY THIS FILE DIRECTLY
63
64#ifndef _ASM_GENERIC_ATOMIC_LONG_H
65#define _ASM_GENERIC_ATOMIC_LONG_H
66
67#include <asm/types.h>
68
69#ifdef CONFIG_64BIT
70typedef atomic64_t atomic_long_t;
71#define ATOMIC_LONG_INIT(i) ATOMIC64_INIT(i)
72#define atomic_long_cond_read_acquire atomic64_cond_read_acquire
73#define atomic_long_cond_read_relaxed atomic64_cond_read_relaxed
74#else
75typedef atomic_t atomic_long_t;
76#define ATOMIC_LONG_INIT(i) ATOMIC_INIT(i)
77#define atomic_long_cond_read_acquire atomic_cond_read_acquire
78#define atomic_long_cond_read_relaxed atomic_cond_read_relaxed
79#endif
80
81#ifdef CONFIG_64BIT
82
83EOF
84
85grep '^[a-z]' "$1" | while read name meta args; do
86 gen_proto "${meta}" "${name}" "atomic64" "s64" ${args}
87done
88
89cat <<EOF
90#else /* CONFIG_64BIT */
91
92EOF
93
94grep '^[a-z]' "$1" | while read name meta args; do
95 gen_proto "${meta}" "${name}" "atomic" "int" ${args}
96done
97
98cat <<EOF
99#endif /* CONFIG_64BIT */
100#endif /* _ASM_GENERIC_ATOMIC_LONG_H */
101EOF
diff --git a/scripts/atomic/gen-atomics.sh b/scripts/atomic/gen-atomics.sh
new file mode 100644
index 000000000000..27400b0cd732
--- /dev/null
+++ b/scripts/atomic/gen-atomics.sh
@@ -0,0 +1,20 @@
1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0
3#
4# Generate atomic headers
5
6ATOMICDIR=$(dirname $0)
7ATOMICTBL=${ATOMICDIR}/atomics.tbl
8LINUXDIR=${ATOMICDIR}/../..
9
10cat <<EOF |
11gen-atomic-instrumented.sh asm-generic/atomic-instrumented.h
12gen-atomic-long.sh asm-generic/atomic-long.h
13gen-atomic-fallback.sh linux/atomic-fallback.h
14EOF
15while read script header; do
16 ${ATOMICDIR}/${script} ${ATOMICTBL} > ${LINUXDIR}/include/${header}
17 HASH="$(sha1sum ${LINUXDIR}/include/${header})"
18 HASH="${HASH%% *}"
19 printf "// %s\n" "${HASH}" >> ${LINUXDIR}/include/${header}
20done
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index b737ca9d7204..5b756278df13 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -61,7 +61,7 @@ my $codespellfile = "/usr/share/codespell/dictionary.txt";
61my $conststructsfile = "$D/const_structs.checkpatch"; 61my $conststructsfile = "$D/const_structs.checkpatch";
62my $typedefsfile = ""; 62my $typedefsfile = "";
63my $color = "auto"; 63my $color = "auto";
64my $allow_c99_comments = 1; 64my $allow_c99_comments = 1; # Can be overridden by --ignore C99_COMMENT_TOLERANCE
65 65
66sub help { 66sub help {
67 my ($exitcode) = @_; 67 my ($exitcode) = @_;
@@ -466,6 +466,16 @@ our $logFunctions = qr{(?x:
466 seq_vprintf|seq_printf|seq_puts 466 seq_vprintf|seq_printf|seq_puts
467)}; 467)};
468 468
469our $allocFunctions = qr{(?x:
470 (?:(?:devm_)?
471 (?:kv|k|v)[czm]alloc(?:_node|_array)? |
472 kstrdup(?:_const)? |
473 kmemdup(?:_nul)?) |
474 (?:\w+)?alloc_skb(?:ip_align)? |
475 # dev_alloc_skb/netdev_alloc_skb, et al
476 dma_alloc_coherent
477)};
478
469our $signature_tags = qr{(?xi: 479our $signature_tags = qr{(?xi:
470 Signed-off-by:| 480 Signed-off-by:|
471 Co-developed-by:| 481 Co-developed-by:|
@@ -1011,6 +1021,7 @@ if ($git) {
1011} 1021}
1012 1022
1013my $vname; 1023my $vname;
1024$allow_c99_comments = !defined $ignore_type{"C99_COMMENT_TOLERANCE"};
1014for my $filename (@ARGV) { 1025for my $filename (@ARGV) {
1015 my $FILE; 1026 my $FILE;
1016 if ($git) { 1027 if ($git) {
@@ -3037,6 +3048,14 @@ sub process {
3037 $comment = '..'; 3048 $comment = '..';
3038 } 3049 }
3039 3050
3051# check SPDX comment style for .[chsS] files
3052 if ($realfile =~ /\.[chsS]$/ &&
3053 $rawline =~ /SPDX-License-Identifier:/ &&
3054 $rawline !~ /^\+\s*\Q$comment\E\s*/) {
3055 WARN("SPDX_LICENSE_TAG",
3056 "Improper SPDX comment style for '$realfile', please use '$comment' instead\n" . $herecurr);
3057 }
3058
3040 if ($comment !~ /^$/ && 3059 if ($comment !~ /^$/ &&
3041 $rawline !~ /^\+\Q$comment\E SPDX-License-Identifier: /) { 3060 $rawline !~ /^\+\Q$comment\E SPDX-License-Identifier: /) {
3042 WARN("SPDX_LICENSE_TAG", 3061 WARN("SPDX_LICENSE_TAG",
@@ -3054,6 +3073,14 @@ sub process {
3054# check we are in a valid source file if not then ignore this hunk 3073# check we are in a valid source file if not then ignore this hunk
3055 next if ($realfile !~ /\.(h|c|s|S|sh|dtsi|dts)$/); 3074 next if ($realfile !~ /\.(h|c|s|S|sh|dtsi|dts)$/);
3056 3075
3076# check for using SPDX-License-Identifier on the wrong line number
3077 if ($realline != $checklicenseline &&
3078 $rawline =~ /\bSPDX-License-Identifier:/ &&
3079 substr($line, @-, @+ - @-) eq "$;" x (@+ - @-)) {
3080 WARN("SPDX_LICENSE_TAG",
3081 "Misplaced SPDX-License-Identifier tag - use line $checklicenseline instead\n" . $herecurr);
3082 }
3083
3057# line length limit (with some exclusions) 3084# line length limit (with some exclusions)
3058# 3085#
3059# There are a few types of lines that may extend beyond $max_line_length: 3086# There are a few types of lines that may extend beyond $max_line_length:
@@ -5545,7 +5572,8 @@ sub process {
5545 my ($s, $c) = ctx_statement_block($linenr - 3, $realcnt, 0); 5572 my ($s, $c) = ctx_statement_block($linenr - 3, $realcnt, 0);
5546# print("line: <$line>\nprevline: <$prevline>\ns: <$s>\nc: <$c>\n\n\n"); 5573# print("line: <$line>\nprevline: <$prevline>\ns: <$s>\nc: <$c>\n\n\n");
5547 5574
5548 if ($s =~ /(?:^|\n)[ \+]\s*(?:$Type\s*)?\Q$testval\E\s*=\s*(?:\([^\)]*\)\s*)?\s*(?:devm_)?(?:[kv][czm]alloc(?:_node|_array)?\b|kstrdup|kmemdup|(?:dev_)?alloc_skb)/) { 5575 if ($s =~ /(?:^|\n)[ \+]\s*(?:$Type\s*)?\Q$testval\E\s*=\s*(?:\([^\)]*\)\s*)?\s*$allocFunctions\s*\(/ &&
5576 $s !~ /\b__GFP_NOWARN\b/ ) {
5549 WARN("OOM_MESSAGE", 5577 WARN("OOM_MESSAGE",
5550 "Possible unnecessary 'out of memory' message\n" . $hereprev); 5578 "Possible unnecessary 'out of memory' message\n" . $hereprev);
5551 } 5579 }
@@ -6196,8 +6224,8 @@ sub process {
6196 } 6224 }
6197 } 6225 }
6198 6226
6199# check for pointless casting of kmalloc return 6227# check for pointless casting of alloc functions
6200 if ($line =~ /\*\s*\)\s*[kv][czm]alloc(_node){0,1}\b/) { 6228 if ($line =~ /\*\s*\)\s*$allocFunctions\b/) {
6201 WARN("UNNECESSARY_CASTS", 6229 WARN("UNNECESSARY_CASTS",
6202 "unnecessary cast may hide bugs, see http://c-faq.com/malloc/mallocnocast.html\n" . $herecurr); 6230 "unnecessary cast may hide bugs, see http://c-faq.com/malloc/mallocnocast.html\n" . $herecurr);
6203 } 6231 }
@@ -6205,7 +6233,7 @@ sub process {
6205# alloc style 6233# alloc style
6206# p = alloc(sizeof(struct foo), ...) should be p = alloc(sizeof(*p), ...) 6234# p = alloc(sizeof(struct foo), ...) should be p = alloc(sizeof(*p), ...)
6207 if ($perl_version_ok && 6235 if ($perl_version_ok &&
6208 $line =~ /\b($Lval)\s*\=\s*(?:$balanced_parens)?\s*([kv][mz]alloc(?:_node)?)\s*\(\s*(sizeof\s*\(\s*struct\s+$Lval\s*\))/) { 6236 $line =~ /\b($Lval)\s*\=\s*(?:$balanced_parens)?\s*((?:kv|k|v)[mz]alloc(?:_node)?)\s*\(\s*(sizeof\s*\(\s*struct\s+$Lval\s*\))/) {
6209 CHK("ALLOC_SIZEOF_STRUCT", 6237 CHK("ALLOC_SIZEOF_STRUCT",
6210 "Prefer $3(sizeof(*$1)...) over $3($4...)\n" . $herecurr); 6238 "Prefer $3(sizeof(*$1)...) over $3($4...)\n" . $herecurr);
6211 } 6239 }
@@ -6368,19 +6396,6 @@ sub process {
6368 } 6396 }
6369 } 6397 }
6370 6398
6371# check for bool bitfields
6372 if ($sline =~ /^.\s+bool\s*$Ident\s*:\s*\d+\s*;/) {
6373 WARN("BOOL_BITFIELD",
6374 "Avoid using bool as bitfield. Prefer bool bitfields as unsigned int or u<8|16|32>\n" . $herecurr);
6375 }
6376
6377# check for bool use in .h files
6378 if ($realfile =~ /\.h$/ &&
6379 $sline =~ /^.\s+bool\s*$Ident\s*(?::\s*d+\s*)?;/) {
6380 CHK("BOOL_MEMBER",
6381 "Avoid using bool structure members because of possible alignment issues - see: https://lkml.org/lkml/2017/11/21/384\n" . $herecurr);
6382 }
6383
6384# check for semaphores initialized locked 6399# check for semaphores initialized locked
6385 if ($line =~ /^.\s*sema_init.+,\W?0\W?\)/) { 6400 if ($line =~ /^.\s*sema_init.+,\W?0\W?\)/) {
6386 WARN("CONSIDER_COMPLETION", 6401 WARN("CONSIDER_COMPLETION",
diff --git a/scripts/clang-version.sh b/scripts/clang-version.sh
index e65fbc3079d4..6fabf0695761 100755
--- a/scripts/clang-version.sh
+++ b/scripts/clang-version.sh
@@ -1,14 +1,10 @@
1#!/bin/sh 1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0 2# SPDX-License-Identifier: GPL-2.0
3# 3#
4# clang-version [-p] clang-command 4# clang-version clang-command
5#
6# Prints the compiler version of `clang-command' in a canonical 4-digit form
7# such as `0500' for clang-5.0 etc.
8#
9# With the -p option, prints the patchlevel as well, for example `050001' for
10# clang-5.0.1 etc.
11# 5#
6# Print the compiler version of `clang-command' in a 5 or 6-digit form
7# such as `50001' for clang-5.0.1 etc.
12 8
13compiler="$*" 9compiler="$*"
14 10
diff --git a/scripts/coccinelle/free/put_device.cocci b/scripts/coccinelle/free/put_device.cocci
new file mode 100644
index 000000000000..7395697e7f19
--- /dev/null
+++ b/scripts/coccinelle/free/put_device.cocci
@@ -0,0 +1,56 @@
1// SPDX-License-Identifier: GPL-2.0
2/// Find missing put_device for every of_find_device_by_node.
3///
4// Confidence: Moderate
5// Copyright: (C) 2018-2019 Wen Yang, ZTE.
6// Comments:
7// Options: --no-includes --include-headers
8
9virtual report
10virtual org
11
12@search exists@
13local idexpression id;
14expression x,e,e1;
15position p1,p2;
16type T,T1,T2,T3;
17@@
18
19id = of_find_device_by_node@p1(x)
20... when != e = id
21if (id == NULL || ...) { ... return ...; }
22... when != put_device(&id->dev)
23 when != platform_device_put(id)
24 when != of_dev_put(id)
25 when != if (id) { ... put_device(&id->dev) ... }
26 when != e1 = (T)id
27 when != e1 = &id->dev
28 when != e1 = get_device(&id->dev)
29 when != e1 = (T1)platform_get_drvdata(id)
30(
31 return
32( id
33| (T2)dev_get_drvdata(&id->dev)
34| (T3)platform_get_drvdata(id)
35);
36| return@p2 ...;
37)
38
39@script:python depends on report@
40p1 << search.p1;
41p2 << search.p2;
42@@
43
44coccilib.report.print_report(p2[0], "ERROR: missing put_device; "
45 + "call of_find_device_by_node on line "
46 + p1[0].line
47 + ", but without a corresponding object release "
48 + "within this function.")
49
50@script:python depends on org@
51p1 << search.p1;
52p2 << search.p2;
53@@
54
55cocci.print_main("of_find_device_by_node", p1)
56cocci.print_secs("needed put_device", p2)
diff --git a/scripts/decode_stacktrace.sh b/scripts/decode_stacktrace.sh
index 98a7d63a723e..bcdd45df3f51 100755
--- a/scripts/decode_stacktrace.sh
+++ b/scripts/decode_stacktrace.sh
@@ -37,6 +37,13 @@ parse_symbol() {
37 symbol=${symbol#\(} 37 symbol=${symbol#\(}
38 symbol=${symbol%\)} 38 symbol=${symbol%\)}
39 39
40 # Strip segment
41 local segment
42 if [[ $symbol == *:* ]] ; then
43 segment=${symbol%%:*}:
44 symbol=${symbol#*:}
45 fi
46
40 # Strip the symbol name so that we could look it up 47 # Strip the symbol name so that we could look it up
41 local name=${symbol%+*} 48 local name=${symbol%+*}
42 49
@@ -84,7 +91,7 @@ parse_symbol() {
84 code=${code//$'\n'/' '} 91 code=${code//$'\n'/' '}
85 92
86 # Replace old address with pretty line numbers 93 # Replace old address with pretty line numbers
87 symbol="$name ($code)" 94 symbol="$segment$name ($code)"
88} 95}
89 96
90decode_code() { 97decode_code() {
diff --git a/scripts/dtc/dtx_diff b/scripts/dtc/dtx_diff
index 8c4fbad2055e..0d8572008729 100755
--- a/scripts/dtc/dtx_diff
+++ b/scripts/dtc/dtx_diff
@@ -21,6 +21,7 @@ Usage:
21 diff DTx_1 and DTx_2 21 diff DTx_1 and DTx_2
22 22
23 23
24 --annotate synonym for -T
24 -f print full dts in diff (--unified=99999) 25 -f print full dts in diff (--unified=99999)
25 -h synonym for --help 26 -h synonym for --help
26 -help synonym for --help 27 -help synonym for --help
@@ -28,6 +29,7 @@ Usage:
28 -s SRCTREE linux kernel source tree is at path SRCTREE 29 -s SRCTREE linux kernel source tree is at path SRCTREE
29 (default is current directory) 30 (default is current directory)
30 -S linux kernel source tree is at root of current git repo 31 -S linux kernel source tree is at root of current git repo
32 -T Annotate output .dts with input source file and line (-T -T for more details)
31 -u unsorted, do not sort DTx 33 -u unsorted, do not sort DTx
32 34
33 35
@@ -174,6 +176,7 @@ compile_to_dts() {
174 176
175# ----- start of script 177# ----- start of script
176 178
179annotate=""
177cmd_diff=0 180cmd_diff=0
178diff_flags="-u" 181diff_flags="-u"
179dtx_file_1="" 182dtx_file_1=""
@@ -208,6 +211,14 @@ while [ $# -gt 0 ] ; do
208 shift 211 shift
209 ;; 212 ;;
210 213
214 -T | --annotate )
215 if [ "${annotate}" = "" ] ; then
216 annotate="-T"
217 elif [ "${annotate}" = "-T" ] ; then
218 annotate="-T -T"
219 fi
220 shift
221 ;;
211 -u ) 222 -u )
212 dtc_sort="" 223 dtc_sort=""
213 shift 224 shift
@@ -327,7 +338,7 @@ cpp_flags="\
327DTC="\ 338DTC="\
328 ${DTC} \ 339 ${DTC} \
329 -i ${srctree}/scripts/dtc/include-prefixes \ 340 -i ${srctree}/scripts/dtc/include-prefixes \
330 -O dts -qq -f ${dtc_sort} -o -" 341 -O dts -qq -f ${dtc_sort} ${annotate} -o -"
331 342
332 343
333# ----- do the diff or decompile 344# ----- do the diff or decompile
diff --git a/scripts/gcc-plugins/Kconfig b/scripts/gcc-plugins/Kconfig
index d45f7f36b859..74271dba4f94 100644
--- a/scripts/gcc-plugins/Kconfig
+++ b/scripts/gcc-plugins/Kconfig
@@ -67,27 +67,59 @@ config GCC_PLUGIN_LATENT_ENTROPY
67 * https://pax.grsecurity.net/ 67 * https://pax.grsecurity.net/
68 68
69config GCC_PLUGIN_STRUCTLEAK 69config GCC_PLUGIN_STRUCTLEAK
70 bool "Force initialization of variables containing userspace addresses" 70 bool "Zero initialize stack variables"
71 # Currently STRUCTLEAK inserts initialization out of live scope of
72 # variables from KASAN point of view. This leads to KASAN false
73 # positive reports. Prohibit this combination for now.
74 depends on !KASAN_EXTRA
75 help 71 help
76 This plugin zero-initializes any structures containing a 72 While the kernel is built with warnings enabled for any missed
77 __user attribute. This can prevent some classes of information 73 stack variable initializations, this warning is silenced for
78 exposures. 74 anything passed by reference to another function, under the
79 75 occasionally misguided assumption that the function will do
80 This plugin was ported from grsecurity/PaX. More information at: 76 the initialization. As this regularly leads to exploitable
77 flaws, this plugin is available to identify and zero-initialize
78 such variables, depending on the chosen level of coverage.
79
80 This plugin was originally ported from grsecurity/PaX. More
81 information at:
81 * https://grsecurity.net/ 82 * https://grsecurity.net/
82 * https://pax.grsecurity.net/ 83 * https://pax.grsecurity.net/
83 84
84config GCC_PLUGIN_STRUCTLEAK_BYREF_ALL 85choice
85 bool "Force initialize all struct type variables passed by reference" 86 prompt "Coverage"
86 depends on GCC_PLUGIN_STRUCTLEAK 87 depends on GCC_PLUGIN_STRUCTLEAK
87 depends on !COMPILE_TEST 88 default GCC_PLUGIN_STRUCTLEAK_BYREF_ALL
88 help 89 help
89 Zero initialize any struct type local variable that may be passed by 90 This chooses the level of coverage over classes of potentially
90 reference without having been initialized. 91 uninitialized variables. The selected class will be
92 zero-initialized before use.
93
94 config GCC_PLUGIN_STRUCTLEAK_USER
95 bool "structs marked for userspace"
96 help
97 Zero-initialize any structures on the stack containing
98 a __user attribute. This can prevent some classes of
99 uninitialized stack variable exploits and information
100 exposures, like CVE-2013-2141:
101 https://git.kernel.org/linus/b9e146d8eb3b9eca
102
103 config GCC_PLUGIN_STRUCTLEAK_BYREF
104 bool "structs passed by reference"
105 help
106 Zero-initialize any structures on the stack that may
107 be passed by reference and had not already been
108 explicitly initialized. This can prevent most classes
109 of uninitialized stack variable exploits and information
110 exposures, like CVE-2017-1000410:
111 https://git.kernel.org/linus/06e7e776ca4d3654
112
113 config GCC_PLUGIN_STRUCTLEAK_BYREF_ALL
114 bool "anything passed by reference"
115 help
116 Zero-initialize any stack variables that may be passed
117 by reference and had not already been explicitly
118 initialized. This is intended to eliminate all classes
119 of uninitialized stack variable exploits and information
120 exposures.
121
122endchoice
91 123
92config GCC_PLUGIN_STRUCTLEAK_VERBOSE 124config GCC_PLUGIN_STRUCTLEAK_VERBOSE
93 bool "Report forcefully initialized variables" 125 bool "Report forcefully initialized variables"
diff --git a/scripts/gcc-plugins/structleak_plugin.c b/scripts/gcc-plugins/structleak_plugin.c
index 10292f791e99..e89be8f5c859 100644
--- a/scripts/gcc-plugins/structleak_plugin.c
+++ b/scripts/gcc-plugins/structleak_plugin.c
@@ -16,6 +16,7 @@
16 * Options: 16 * Options:
17 * -fplugin-arg-structleak_plugin-disable 17 * -fplugin-arg-structleak_plugin-disable
18 * -fplugin-arg-structleak_plugin-verbose 18 * -fplugin-arg-structleak_plugin-verbose
19 * -fplugin-arg-structleak_plugin-byref
19 * -fplugin-arg-structleak_plugin-byref-all 20 * -fplugin-arg-structleak_plugin-byref-all
20 * 21 *
21 * Usage: 22 * Usage:
@@ -26,7 +27,6 @@
26 * $ gcc -fplugin=./structleak_plugin.so test.c -O2 27 * $ gcc -fplugin=./structleak_plugin.so test.c -O2
27 * 28 *
28 * TODO: eliminate redundant initializers 29 * TODO: eliminate redundant initializers
29 * increase type coverage
30 */ 30 */
31 31
32#include "gcc-common.h" 32#include "gcc-common.h"
@@ -37,13 +37,18 @@
37__visible int plugin_is_GPL_compatible; 37__visible int plugin_is_GPL_compatible;
38 38
39static struct plugin_info structleak_plugin_info = { 39static struct plugin_info structleak_plugin_info = {
40 .version = "201607271510vanilla", 40 .version = "20190125vanilla",
41 .help = "disable\tdo not activate plugin\n" 41 .help = "disable\tdo not activate plugin\n"
42 "verbose\tprint all initialized variables\n", 42 "byref\tinit structs passed by reference\n"
43 "byref-all\tinit anything passed by reference\n"
44 "verbose\tprint all initialized variables\n",
43}; 45};
44 46
47#define BYREF_STRUCT 1
48#define BYREF_ALL 2
49
45static bool verbose; 50static bool verbose;
46static bool byref_all; 51static int byref;
47 52
48static tree handle_user_attribute(tree *node, tree name, tree args, int flags, bool *no_add_attrs) 53static tree handle_user_attribute(tree *node, tree name, tree args, int flags, bool *no_add_attrs)
49{ 54{
@@ -118,6 +123,7 @@ static void initialize(tree var)
118 gimple_stmt_iterator gsi; 123 gimple_stmt_iterator gsi;
119 tree initializer; 124 tree initializer;
120 gimple init_stmt; 125 gimple init_stmt;
126 tree type;
121 127
122 /* this is the original entry bb before the forced split */ 128 /* this is the original entry bb before the forced split */
123 bb = single_succ(ENTRY_BLOCK_PTR_FOR_FN(cfun)); 129 bb = single_succ(ENTRY_BLOCK_PTR_FOR_FN(cfun));
@@ -148,11 +154,15 @@ static void initialize(tree var)
148 if (verbose) 154 if (verbose)
149 inform(DECL_SOURCE_LOCATION(var), 155 inform(DECL_SOURCE_LOCATION(var),
150 "%s variable will be forcibly initialized", 156 "%s variable will be forcibly initialized",
151 (byref_all && TREE_ADDRESSABLE(var)) ? "byref" 157 (byref && TREE_ADDRESSABLE(var)) ? "byref"
152 : "userspace"); 158 : "userspace");
153 159
154 /* build the initializer expression */ 160 /* build the initializer expression */
155 initializer = build_constructor(TREE_TYPE(var), NULL); 161 type = TREE_TYPE(var);
162 if (AGGREGATE_TYPE_P(type))
163 initializer = build_constructor(type, NULL);
164 else
165 initializer = fold_convert(type, integer_zero_node);
156 166
157 /* build the initializer stmt */ 167 /* build the initializer stmt */
158 init_stmt = gimple_build_assign(var, initializer); 168 init_stmt = gimple_build_assign(var, initializer);
@@ -184,13 +194,13 @@ static unsigned int structleak_execute(void)
184 if (!auto_var_in_fn_p(var, current_function_decl)) 194 if (!auto_var_in_fn_p(var, current_function_decl))
185 continue; 195 continue;
186 196
187 /* only care about structure types */ 197 /* only care about structure types unless byref-all */
188 if (TREE_CODE(type) != RECORD_TYPE && TREE_CODE(type) != UNION_TYPE) 198 if (byref != BYREF_ALL && TREE_CODE(type) != RECORD_TYPE && TREE_CODE(type) != UNION_TYPE)
189 continue; 199 continue;
190 200
191 /* if the type is of interest, examine the variable */ 201 /* if the type is of interest, examine the variable */
192 if (TYPE_USERSPACE(type) || 202 if (TYPE_USERSPACE(type) ||
193 (byref_all && TREE_ADDRESSABLE(var))) 203 (byref && TREE_ADDRESSABLE(var)))
194 initialize(var); 204 initialize(var);
195 } 205 }
196 206
@@ -232,8 +242,12 @@ __visible int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gc
232 verbose = true; 242 verbose = true;
233 continue; 243 continue;
234 } 244 }
245 if (!strcmp(argv[i].key, "byref")) {
246 byref = BYREF_STRUCT;
247 continue;
248 }
235 if (!strcmp(argv[i].key, "byref-all")) { 249 if (!strcmp(argv[i].key, "byref-all")) {
236 byref_all = true; 250 byref = BYREF_ALL;
237 continue; 251 continue;
238 } 252 }
239 error(G_("unknown option '-fplugin-arg-%s-%s'"), plugin_name, argv[i].key); 253 error(G_("unknown option '-fplugin-arg-%s-%s'"), plugin_name, argv[i].key);
diff --git a/scripts/gcc-version.sh b/scripts/gcc-version.sh
index 11bb909845e7..ae353432539b 100755
--- a/scripts/gcc-version.sh
+++ b/scripts/gcc-version.sh
@@ -1,33 +1,20 @@
1#!/bin/sh 1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0 2# SPDX-License-Identifier: GPL-2.0
3# 3#
4# gcc-version [-p] gcc-command 4# gcc-version gcc-command
5#
6# Prints the gcc version of `gcc-command' in a canonical 4-digit form
7# such as `0295' for gcc-2.95, `0303' for gcc-3.3, etc.
8#
9# With the -p option, prints the patchlevel as well, for example `029503' for
10# gcc-2.95.3, `030301' for gcc-3.3.1, etc.
11# 5#
12 6# Print the gcc version of `gcc-command' in a 5 or 6-digit form
13if [ "$1" = "-p" ] ; then 7# such as `29503' for gcc-2.95.3, `30301' for gcc-3.3.1, etc.
14 with_patchlevel=1;
15 shift;
16fi
17 8
18compiler="$*" 9compiler="$*"
19 10
20if [ ${#compiler} -eq 0 ]; then 11if [ ${#compiler} -eq 0 ]; then
21 echo "Error: No compiler specified." 12 echo "Error: No compiler specified." >&2
22 printf "Usage:\n\t$0 <gcc-command>\n" 13 printf "Usage:\n\t$0 <gcc-command>\n" >&2
23 exit 1 14 exit 1
24fi 15fi
25 16
26MAJOR=$(echo __GNUC__ | $compiler -E -x c - | tail -n 1) 17MAJOR=$(echo __GNUC__ | $compiler -E -x c - | tail -n 1)
27MINOR=$(echo __GNUC_MINOR__ | $compiler -E -x c - | tail -n 1) 18MINOR=$(echo __GNUC_MINOR__ | $compiler -E -x c - | tail -n 1)
28if [ "x$with_patchlevel" != "x" ] ; then 19PATCHLEVEL=$(echo __GNUC_PATCHLEVEL__ | $compiler -E -x c - | tail -n 1)
29 PATCHLEVEL=$(echo __GNUC_PATCHLEVEL__ | $compiler -E -x c - | tail -n 1) 20printf "%d%02d%02d\\n" $MAJOR $MINOR $PATCHLEVEL
30 printf "%02d%02d%02d\\n" $MAJOR $MINOR $PATCHLEVEL
31else
32 printf "%02d%02d\\n" $MAJOR $MINOR
33fi
diff --git a/scripts/gdb/linux/Makefile b/scripts/gdb/linux/Makefile
index aba23be985e4..3df395a9c2ce 100644
--- a/scripts/gdb/linux/Makefile
+++ b/scripts/gdb/linux/Makefile
@@ -1,24 +1,25 @@
1# SPDX-License-Identifier: GPL-2.0 1# SPDX-License-Identifier: GPL-2.0
2always := gdb-scripts
3 2
4SRCTREE := $(abspath $(srctree))
5
6$(obj)/gdb-scripts:
7ifneq ($(KBUILD_SRC),) 3ifneq ($(KBUILD_SRC),)
8 $(Q)ln -fsn $(SRCTREE)/$(obj)/*.py $(objtree)/$(obj) 4
5symlinks := $(patsubst $(srctree)/$(src)/%,%,$(wildcard $(srctree)/$(src)/*.py))
6
7quiet_cmd_symlink = SYMLINK $@
8 cmd_symlink = ln -fsn $(patsubst $(obj)/%,$(abspath $(srctree))/$(src)/%,$@) $@
9
10extra-y += $(symlinks)
11$(addprefix $(obj)/, $(symlinks)): FORCE
12 $(call if_changed,symlink)
13
9endif 14endif
10 @:
11 15
12quiet_cmd_gen_constants_py = GEN $@ 16quiet_cmd_gen_constants_py = GEN $@
13 cmd_gen_constants_py = \ 17 cmd_gen_constants_py = \
14 $(CPP) -E -x c -P $(c_flags) $< > $@ ;\ 18 $(CPP) -E -x c -P $(c_flags) $< > $@ ;\
15 sed -i '1,/<!-- end-c-headers -->/d;' $@ 19 sed -i '1,/<!-- end-c-headers -->/d;' $@
16 20
17targets += constants.py 21extra-y += constants.py
18$(obj)/constants.py: $(SRCTREE)/$(obj)/constants.py.in FORCE 22$(obj)/constants.py: $(src)/constants.py.in FORCE
19 $(call if_changed_dep,gen_constants_py) 23 $(call if_changed_dep,gen_constants_py)
20 24
21build_constants_py: $(obj)/constants.py 25clean-files := *.pyc *.pyo
22 @:
23
24clean-files := *.pyc *.pyo $(if $(KBUILD_SRC),*.py) $(obj)/constants.py
diff --git a/scripts/gdb/linux/constants.py.in b/scripts/gdb/linux/constants.py.in
index 7aad82406422..d3319a80788a 100644
--- a/scripts/gdb/linux/constants.py.in
+++ b/scripts/gdb/linux/constants.py.in
@@ -37,12 +37,12 @@
37import gdb 37import gdb
38 38
39/* linux/fs.h */ 39/* linux/fs.h */
40LX_VALUE(MS_RDONLY) 40LX_VALUE(SB_RDONLY)
41LX_VALUE(MS_SYNCHRONOUS) 41LX_VALUE(SB_SYNCHRONOUS)
42LX_VALUE(MS_MANDLOCK) 42LX_VALUE(SB_MANDLOCK)
43LX_VALUE(MS_DIRSYNC) 43LX_VALUE(SB_DIRSYNC)
44LX_VALUE(MS_NOATIME) 44LX_VALUE(SB_NOATIME)
45LX_VALUE(MS_NODIRATIME) 45LX_VALUE(SB_NODIRATIME)
46 46
47/* linux/mount.h */ 47/* linux/mount.h */
48LX_VALUE(MNT_NOSUID) 48LX_VALUE(MNT_NOSUID)
diff --git a/scripts/gdb/linux/proc.py b/scripts/gdb/linux/proc.py
index 0aebd7565b03..2f01a958eb22 100644
--- a/scripts/gdb/linux/proc.py
+++ b/scripts/gdb/linux/proc.py
@@ -114,11 +114,11 @@ def info_opts(lst, opt):
114 return opts 114 return opts
115 115
116 116
117FS_INFO = {constants.LX_MS_SYNCHRONOUS: ",sync", 117FS_INFO = {constants.LX_SB_SYNCHRONOUS: ",sync",
118 constants.LX_MS_MANDLOCK: ",mand", 118 constants.LX_SB_MANDLOCK: ",mand",
119 constants.LX_MS_DIRSYNC: ",dirsync", 119 constants.LX_SB_DIRSYNC: ",dirsync",
120 constants.LX_MS_NOATIME: ",noatime", 120 constants.LX_SB_NOATIME: ",noatime",
121 constants.LX_MS_NODIRATIME: ",nodiratime"} 121 constants.LX_SB_NODIRATIME: ",nodiratime"}
122 122
123MNT_INFO = {constants.LX_MNT_NOSUID: ",nosuid", 123MNT_INFO = {constants.LX_MNT_NOSUID: ",nosuid",
124 constants.LX_MNT_NODEV: ",nodev", 124 constants.LX_MNT_NODEV: ",nodev",
@@ -184,7 +184,7 @@ values of that process namespace"""
184 fstype = superblock['s_type']['name'].string() 184 fstype = superblock['s_type']['name'].string()
185 s_flags = int(superblock['s_flags']) 185 s_flags = int(superblock['s_flags'])
186 m_flags = int(vfs['mnt']['mnt_flags']) 186 m_flags = int(vfs['mnt']['mnt_flags'])
187 rd = "ro" if (s_flags & constants.LX_MS_RDONLY) else "rw" 187 rd = "ro" if (s_flags & constants.LX_SB_RDONLY) else "rw"
188 188
189 gdb.write( 189 gdb.write(
190 "{} {} {} {}{}{} 0 0\n" 190 "{} {} {} {}{}{} 0 0\n"
diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
index f75e7bda4889..e17837f1d3f2 100644
--- a/scripts/kallsyms.c
+++ b/scripts/kallsyms.c
@@ -62,11 +62,11 @@ static int all_symbols = 0;
62static int absolute_percpu = 0; 62static int absolute_percpu = 0;
63static int base_relative = 0; 63static int base_relative = 0;
64 64
65int token_profit[0x10000]; 65static int token_profit[0x10000];
66 66
67/* the table that holds the result of the compression */ 67/* the table that holds the result of the compression */
68unsigned char best_table[256][2]; 68static unsigned char best_table[256][2];
69unsigned char best_table_len[256]; 69static unsigned char best_table_len[256];
70 70
71 71
72static void usage(void) 72static void usage(void)
@@ -80,7 +80,7 @@ static void usage(void)
80 * This ignores the intensely annoying "mapping symbols" found 80 * This ignores the intensely annoying "mapping symbols" found
81 * in ARM ELF files: $a, $t and $d. 81 * in ARM ELF files: $a, $t and $d.
82 */ 82 */
83static inline int is_arm_mapping_symbol(const char *str) 83static int is_arm_mapping_symbol(const char *str)
84{ 84{
85 return str[0] == '$' && strchr("axtd", str[1]) 85 return str[0] == '$' && strchr("axtd", str[1])
86 && (str[2] == '\0' || str[2] == '.'); 86 && (str[2] == '\0' || str[2] == '.');
@@ -331,7 +331,7 @@ static void write_src(void)
331 unsigned int *markers; 331 unsigned int *markers;
332 char buf[KSYM_NAME_LEN]; 332 char buf[KSYM_NAME_LEN];
333 333
334 printf("#include <asm/types.h>\n"); 334 printf("#include <asm/bitsperlong.h>\n");
335 printf("#if BITS_PER_LONG == 64\n"); 335 printf("#if BITS_PER_LONG == 64\n");
336 printf("#define PTR .quad\n"); 336 printf("#define PTR .quad\n");
337 printf("#define ALGN .balign 8\n"); 337 printf("#define ALGN .balign 8\n");
@@ -596,9 +596,6 @@ static void insert_real_symbols_in_table(void)
596{ 596{
597 unsigned int i, j, c; 597 unsigned int i, j, c;
598 598
599 memset(best_table, 0, sizeof(best_table));
600 memset(best_table_len, 0, sizeof(best_table_len));
601
602 for (i = 0; i < table_cnt; i++) { 599 for (i = 0; i < table_cnt; i++) {
603 for (j = 0; j < table[i].len; j++) { 600 for (j = 0; j < table[i].len; j++) {
604 c = table[i].sym[j]; 601 c = table[i].sym[j];
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 181973509a05..7c5dc31c1d95 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -143,11 +143,12 @@ help:
143 143
144# =========================================================================== 144# ===========================================================================
145# object files used by all kconfig flavours 145# object files used by all kconfig flavours
146common-objs := confdata.o expr.o symbol.o preprocess.o zconf.lex.o zconf.tab.o 146common-objs := confdata.o expr.o lexer.lex.o parser.tab.o preprocess.o \
147 symbol.o
147 148
148$(obj)/zconf.lex.o: $(obj)/zconf.tab.h 149$(obj)/lexer.lex.o: $(obj)/parser.tab.h
149HOSTCFLAGS_zconf.lex.o := -I$(src) 150HOSTCFLAGS_lexer.lex.o := -I$(src)
150HOSTCFLAGS_zconf.tab.o := -I$(src) 151HOSTCFLAGS_parser.tab.o := -I$(src)
151 152
152# conf: Used for defconfig, oldconfig and related targets 153# conf: Used for defconfig, oldconfig and related targets
153hostprogs-y += conf 154hostprogs-y += conf
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index da89ef788a8d..ef3678c24bab 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -488,7 +488,6 @@ int main(int ac, char **av)
488 const char *progname = av[0]; 488 const char *progname = av[0];
489 int opt; 489 int opt;
490 const char *name, *defconfig_file = NULL /* gcc uninit */; 490 const char *name, *defconfig_file = NULL /* gcc uninit */;
491 struct stat tmpstat;
492 int no_conf_write = 0; 491 int no_conf_write = 0;
493 492
494 tty_stdio = isatty(0) && isatty(1); 493 tty_stdio = isatty(0) && isatty(1);
@@ -560,18 +559,6 @@ int main(int ac, char **av)
560 name = av[optind]; 559 name = av[optind];
561 conf_parse(name); 560 conf_parse(name);
562 //zconfdump(stdout); 561 //zconfdump(stdout);
563 if (sync_kconfig) {
564 name = conf_get_configname();
565 if (stat(name, &tmpstat)) {
566 fprintf(stderr, "***\n"
567 "*** Configuration file \"%s\" not found!\n"
568 "***\n"
569 "*** Please run some configurator (e.g. \"make oldconfig\" or\n"
570 "*** \"make menuconfig\" or \"make xconfig\").\n"
571 "***\n", name);
572 exit(1);
573 }
574 }
575 562
576 switch (input_mode) { 563 switch (input_mode) {
577 case defconfig: 564 case defconfig:
diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h
index 999edb60cd53..8dde65bc3165 100644
--- a/scripts/kconfig/expr.h
+++ b/scripts/kconfig/expr.h
@@ -172,7 +172,7 @@ struct symbol {
172 * int "BAZ Value" 172 * int "BAZ Value"
173 * range 1..255 173 * range 1..255
174 * 174 *
175 * Please, also check zconf.y:print_symbol() when modifying the 175 * Please, also check parser.y:print_symbol() when modifying the
176 * list of property types! 176 * list of property types!
177 */ 177 */
178enum prop_type { 178enum prop_type {
diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/lexer.l
index b2d0a3b0bce9..c9df1c8b9824 100644
--- a/scripts/kconfig/zconf.l
+++ b/scripts/kconfig/lexer.l
@@ -15,7 +15,7 @@
15#include <unistd.h> 15#include <unistd.h>
16 16
17#include "lkc.h" 17#include "lkc.h"
18#include "zconf.tab.h" 18#include "parser.tab.h"
19 19
20#define YY_DECL static int yylex1(void) 20#define YY_DECL static int yylex1(void)
21 21
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h
index 531ff7c57d92..d871539e4b45 100644
--- a/scripts/kconfig/lkc.h
+++ b/scripts/kconfig/lkc.h
@@ -90,7 +90,7 @@ void *xrealloc(void *p, size_t size);
90char *xstrdup(const char *s); 90char *xstrdup(const char *s);
91char *xstrndup(const char *s, size_t n); 91char *xstrndup(const char *s, size_t n);
92 92
93/* zconf.l */ 93/* lexer.l */
94int yylex(void); 94int yylex(void);
95 95
96struct gstr { 96struct gstr {
diff --git a/scripts/kconfig/lxdialog/.gitignore b/scripts/kconfig/lxdialog/.gitignore
deleted file mode 100644
index 90b08ff025a6..000000000000
--- a/scripts/kconfig/lxdialog/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
1#
2# Generated files
3#
4lxdialog
diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/parser.y
index 60936c76865b..60936c76865b 100644
--- a/scripts/kconfig/zconf.y
+++ b/scripts/kconfig/parser.y
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 8be8a70c5542..ce7fc87a49a7 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -1392,6 +1392,8 @@ ConfigMainWindow::ConfigMainWindow(void)
1392 conf_set_changed_callback(conf_changed); 1392 conf_set_changed_callback(conf_changed);
1393 // Set saveAction's initial state 1393 // Set saveAction's initial state
1394 conf_changed(); 1394 conf_changed();
1395 configname = xstrdup(conf_get_configname());
1396
1395 QAction *saveAsAction = new QAction("Save &As...", this); 1397 QAction *saveAsAction = new QAction("Save &As...", this);
1396 connect(saveAsAction, SIGNAL(triggered(bool)), SLOT(saveConfigAs())); 1398 connect(saveAsAction, SIGNAL(triggered(bool)), SLOT(saveConfigAs()));
1397 QAction *searchAction = new QAction("&Find", this); 1399 QAction *searchAction = new QAction("&Find", this);
@@ -1520,17 +1522,29 @@ ConfigMainWindow::ConfigMainWindow(void)
1520 1522
1521void ConfigMainWindow::loadConfig(void) 1523void ConfigMainWindow::loadConfig(void)
1522{ 1524{
1523 QString s = QFileDialog::getOpenFileName(this, "", conf_get_configname()); 1525 QString str;
1524 if (s.isNull()) 1526 QByteArray ba;
1527 const char *name;
1528
1529 str = QFileDialog::getOpenFileName(this, "", configname);
1530 if (str.isNull())
1525 return; 1531 return;
1526 if (conf_read(QFile::encodeName(s))) 1532
1533 ba = str.toLocal8Bit();
1534 name = ba.data();
1535
1536 if (conf_read(name))
1527 QMessageBox::information(this, "qconf", "Unable to load configuration!"); 1537 QMessageBox::information(this, "qconf", "Unable to load configuration!");
1538
1539 free(configname);
1540 configname = xstrdup(name);
1541
1528 ConfigView::updateListAll(); 1542 ConfigView::updateListAll();
1529} 1543}
1530 1544
1531bool ConfigMainWindow::saveConfig(void) 1545bool ConfigMainWindow::saveConfig(void)
1532{ 1546{
1533 if (conf_write(NULL)) { 1547 if (conf_write(configname)) {
1534 QMessageBox::information(this, "qconf", "Unable to save configuration!"); 1548 QMessageBox::information(this, "qconf", "Unable to save configuration!");
1535 return false; 1549 return false;
1536 } 1550 }
@@ -1541,10 +1555,24 @@ bool ConfigMainWindow::saveConfig(void)
1541 1555
1542void ConfigMainWindow::saveConfigAs(void) 1556void ConfigMainWindow::saveConfigAs(void)
1543{ 1557{
1544 QString s = QFileDialog::getSaveFileName(this, "", conf_get_configname()); 1558 QString str;
1545 if (s.isNull()) 1559 QByteArray ba;
1560 const char *name;
1561
1562 str = QFileDialog::getSaveFileName(this, "", configname);
1563 if (str.isNull())
1546 return; 1564 return;
1547 saveConfig(); 1565
1566 ba = str.toLocal8Bit();
1567 name = ba.data();
1568
1569 if (conf_write(name)) {
1570 QMessageBox::information(this, "qconf", "Unable to save configuration!");
1571 }
1572 conf_write_autoconf(0);
1573
1574 free(configname);
1575 configname = xstrdup(name);
1548} 1576}
1549 1577
1550void ConfigMainWindow::searchConfig(void) 1578void ConfigMainWindow::searchConfig(void)
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h
index 41df466e67d9..45bfe9b2b966 100644
--- a/scripts/kconfig/qconf.h
+++ b/scripts/kconfig/qconf.h
@@ -291,6 +291,7 @@ protected:
291class ConfigMainWindow : public QMainWindow { 291class ConfigMainWindow : public QMainWindow {
292 Q_OBJECT 292 Q_OBJECT
293 293
294 char *configname;
294 static QAction *saveAction; 295 static QAction *saveAction;
295 static void conf_changed(void); 296 static void conf_changed(void);
296public: 297public:
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index c5333d251985..3350e498b4ce 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -1474,7 +1474,7 @@ sub push_parameter($$$$) {
1474 if (!defined $parameterdescs{$param} && $param !~ /^#/) { 1474 if (!defined $parameterdescs{$param} && $param !~ /^#/) {
1475 $parameterdescs{$param} = $undescribed; 1475 $parameterdescs{$param} = $undescribed;
1476 1476
1477 if (show_warnings($type, $declaration_name)) { 1477 if (show_warnings($type, $declaration_name) && $param !~ /\./) {
1478 print STDERR 1478 print STDERR
1479 "${file}:$.: warning: Function parameter or member '$param' not described in '$declaration_name'\n"; 1479 "${file}:$.: warning: Function parameter or member '$param' not described in '$declaration_name'\n";
1480 ++$warnings; 1480 ++$warnings;
diff --git a/scripts/leaking_addresses.pl b/scripts/leaking_addresses.pl
index 6a897788f5a7..ef9e5b2a1614 100755
--- a/scripts/leaking_addresses.pl
+++ b/scripts/leaking_addresses.pl
@@ -97,7 +97,7 @@ Options:
97 --32-bit Scan 32-bit kernel. 97 --32-bit Scan 32-bit kernel.
98 --page-offset-32-bit=o Page offset (for 32-bit kernel 0xABCD1234). 98 --page-offset-32-bit=o Page offset (for 32-bit kernel 0xABCD1234).
99 -d, --debug Display debugging output. 99 -d, --debug Display debugging output.
100 -h, --help, --version Display this help and exit. 100 -h, --help Display this help and exit.
101 101
102Scans the running kernel for potential leaking addresses. 102Scans the running kernel for potential leaking addresses.
103 103
@@ -108,7 +108,6 @@ EOM
108GetOptions( 108GetOptions(
109 'd|debug' => \$debug, 109 'd|debug' => \$debug,
110 'h|help' => \$help, 110 'h|help' => \$help,
111 'version' => \$help,
112 'o|output-raw=s' => \$output_raw, 111 'o|output-raw=s' => \$output_raw,
113 'i|input-raw=s' => \$input_raw, 112 'i|input-raw=s' => \$input_raw,
114 'suppress-dmesg' => \$suppress_dmesg, 113 'suppress-dmesg' => \$suppress_dmesg,
@@ -231,7 +230,7 @@ sub get_kernel_config_option
231 my $tmp_file = "/tmp/tmpkconf"; 230 my $tmp_file = "/tmp/tmpkconf";
232 231
233 if (system("gunzip < /proc/config.gz > $tmp_file")) { 232 if (system("gunzip < /proc/config.gz > $tmp_file")) {
234 dprint "$0: system(gunzip < /proc/config.gz) failed\n"; 233 dprint("system(gunzip < /proc/config.gz) failed\n");
235 return ""; 234 return "";
236 } else { 235 } else {
237 @config_files = ($tmp_file); 236 @config_files = ($tmp_file);
@@ -243,7 +242,7 @@ sub get_kernel_config_option
243 } 242 }
244 243
245 foreach my $file (@config_files) { 244 foreach my $file (@config_files) {
246 dprint("parsing config file: %s\n", $file); 245 dprint("parsing config file: $file\n");
247 $value = option_from_file($option, $file); 246 $value = option_from_file($option, $file);
248 if ($value ne "") { 247 if ($value ne "") {
249 last; 248 last;
@@ -502,7 +501,7 @@ sub walk
502 next; 501 next;
503 } 502 }
504 503
505 dprint "parsing: $path\n"; 504 dprint("parsing: $path\n");
506 timed_parse_file($path); 505 timed_parse_file($path);
507 } 506 }
508 } 507 }
diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
index c8cf45362bd6..dc0e8c5a1402 100755
--- a/scripts/link-vmlinux.sh
+++ b/scripts/link-vmlinux.sh
@@ -3,22 +3,17 @@
3# 3#
4# link vmlinux 4# link vmlinux
5# 5#
6# vmlinux is linked from the objects selected by $(KBUILD_VMLINUX_INIT) and 6# vmlinux is linked from the objects selected by $(KBUILD_VMLINUX_OBJS) and
7# $(KBUILD_VMLINUX_MAIN) and $(KBUILD_VMLINUX_LIBS). Most are built-in.a files 7# $(KBUILD_VMLINUX_LIBS). Most are built-in.a files from top-level directories
8# from top-level directories in the kernel tree, others are specified in 8# in the kernel tree, others are specified in arch/$(ARCH)/Makefile.
9# arch/$(ARCH)/Makefile. Ordering when linking is important, and 9# $(KBUILD_VMLINUX_LIBS) are archives which are linked conditionally
10# $(KBUILD_VMLINUX_INIT) must be first. $(KBUILD_VMLINUX_LIBS) are archives 10# (not within --whole-archive), and do not require symbol indexes added.
11# which are linked conditionally (not within --whole-archive), and do not
12# require symbol indexes added.
13# 11#
14# vmlinux 12# vmlinux
15# ^ 13# ^
16# | 14# |
17# +-< $(KBUILD_VMLINUX_INIT) 15# +--< $(KBUILD_VMLINUX_OBJS)
18# | +--< init/version.o + more 16# | +--< init/built-in.a drivers/built-in.a mm/built-in.a + more
19# |
20# +--< $(KBUILD_VMLINUX_MAIN)
21# | +--< drivers/built-in.a mm/built-in.a + more
22# | 17# |
23# +--< $(KBUILD_VMLINUX_LIBS) 18# +--< $(KBUILD_VMLINUX_LIBS)
24# | +--< lib/lib.a + more 19# | +--< lib/lib.a + more
@@ -44,24 +39,6 @@ info()
44 fi 39 fi
45} 40}
46 41
47# Thin archive build here makes a final archive with symbol table and indexes
48# from vmlinux objects INIT and MAIN, which can be used as input to linker.
49# KBUILD_VMLINUX_LIBS archives should already have symbol table and indexes
50# added.
51#
52# Traditional incremental style of link does not require this step
53#
54# built-in.a output file
55#
56archive_builtin()
57{
58 info AR built-in.a
59 rm -f built-in.a;
60 ${AR} rcsTP${KBUILD_ARFLAGS} built-in.a \
61 ${KBUILD_VMLINUX_INIT} \
62 ${KBUILD_VMLINUX_MAIN}
63}
64
65# Link of vmlinux.o used for section mismatch analysis 42# Link of vmlinux.o used for section mismatch analysis
66# ${1} output file 43# ${1} output file
67modpost_link() 44modpost_link()
@@ -69,7 +46,7 @@ modpost_link()
69 local objects 46 local objects
70 47
71 objects="--whole-archive \ 48 objects="--whole-archive \
72 built-in.a \ 49 ${KBUILD_VMLINUX_OBJS} \
73 --no-whole-archive \ 50 --no-whole-archive \
74 --start-group \ 51 --start-group \
75 ${KBUILD_VMLINUX_LIBS} \ 52 ${KBUILD_VMLINUX_LIBS} \
@@ -88,7 +65,7 @@ vmlinux_link()
88 65
89 if [ "${SRCARCH}" != "um" ]; then 66 if [ "${SRCARCH}" != "um" ]; then
90 objects="--whole-archive \ 67 objects="--whole-archive \
91 built-in.a \ 68 ${KBUILD_VMLINUX_OBJS} \
92 --no-whole-archive \ 69 --no-whole-archive \
93 --start-group \ 70 --start-group \
94 ${KBUILD_VMLINUX_LIBS} \ 71 ${KBUILD_VMLINUX_LIBS} \
@@ -99,7 +76,7 @@ vmlinux_link()
99 -T ${lds} ${objects} 76 -T ${lds} ${objects}
100 else 77 else
101 objects="-Wl,--whole-archive \ 78 objects="-Wl,--whole-archive \
102 built-in.a \ 79 ${KBUILD_VMLINUX_OBJS} \
103 -Wl,--no-whole-archive \ 80 -Wl,--no-whole-archive \
104 -Wl,--start-group \ 81 -Wl,--start-group \
105 ${KBUILD_VMLINUX_LIBS} \ 82 ${KBUILD_VMLINUX_LIBS} \
@@ -160,7 +137,6 @@ cleanup()
160 rm -f .tmp_System.map 137 rm -f .tmp_System.map
161 rm -f .tmp_kallsyms* 138 rm -f .tmp_kallsyms*
162 rm -f .tmp_vmlinux* 139 rm -f .tmp_vmlinux*
163 rm -f built-in.a
164 rm -f System.map 140 rm -f System.map
165 rm -f vmlinux 141 rm -f vmlinux
166 rm -f vmlinux.o 142 rm -f vmlinux.o
@@ -195,14 +171,7 @@ if [ "$1" = "clean" ]; then
195fi 171fi
196 172
197# We need access to CONFIG_ symbols 173# We need access to CONFIG_ symbols
198case "${KCONFIG_CONFIG}" in 174. include/config/auto.conf
199*/*)
200 . "${KCONFIG_CONFIG}"
201 ;;
202*)
203 # Force using a file from the current directory
204 . "./${KCONFIG_CONFIG}"
205esac
206 175
207# Update version 176# Update version
208info GEN .version 177info GEN .version
@@ -217,8 +186,6 @@ fi;
217# final build of init/ 186# final build of init/
218${MAKE} -f "${srctree}/scripts/Makefile.build" obj=init 187${MAKE} -f "${srctree}/scripts/Makefile.build" obj=init
219 188
220archive_builtin
221
222#link vmlinux.o 189#link vmlinux.o
223info LD vmlinux.o 190info LD vmlinux.o
224modpost_link vmlinux.o 191modpost_link vmlinux.o
diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h
index 87f1fc9801d7..2339f86126cb 100755
--- a/scripts/mkcompile_h
+++ b/scripts/mkcompile_h
@@ -62,7 +62,7 @@ UTS_TRUNCATE="cut -b -$UTS_LEN"
62 62
63# Generate a temporary compile.h 63# Generate a temporary compile.h
64 64
65( echo /\* This file is auto generated, version $VERSION \*/ 65{ echo /\* This file is auto generated, version $VERSION \*/
66 if [ -n "$CONFIG_FLAGS" ] ; then echo "/* $CONFIG_FLAGS */"; fi 66 if [ -n "$CONFIG_FLAGS" ] ; then echo "/* $CONFIG_FLAGS */"; fi
67 67
68 echo \#define UTS_MACHINE \"$ARCH\" 68 echo \#define UTS_MACHINE \"$ARCH\"
@@ -73,7 +73,7 @@ UTS_TRUNCATE="cut -b -$UTS_LEN"
73 echo \#define LINUX_COMPILE_HOST \"`echo $LINUX_COMPILE_HOST | $UTS_TRUNCATE`\" 73 echo \#define LINUX_COMPILE_HOST \"`echo $LINUX_COMPILE_HOST | $UTS_TRUNCATE`\"
74 74
75 echo \#define LINUX_COMPILER \"`$CC -v 2>&1 | grep ' version ' | sed 's/[[:space:]]*$//'`\" 75 echo \#define LINUX_COMPILER \"`$CC -v 2>&1 | grep ' version ' | sed 's/[[:space:]]*$//'`\"
76) > .tmpcompile 76} > .tmpcompile
77 77
78# Only replace the real compile.h if the new one is different, 78# Only replace the real compile.h if the new one is different,
79# in order to preserve the timestamp and avoid unnecessary 79# in order to preserve the timestamp and avoid unnecessary
diff --git a/scripts/mod/devicetable-offsets.c b/scripts/mod/devicetable-offsets.c
index 293004499b4d..054405b90ba4 100644
--- a/scripts/mod/devicetable-offsets.c
+++ b/scripts/mod/devicetable-offsets.c
@@ -225,5 +225,11 @@ int main(void)
225 DEVID_FIELD(typec_device_id, svid); 225 DEVID_FIELD(typec_device_id, svid);
226 DEVID_FIELD(typec_device_id, mode); 226 DEVID_FIELD(typec_device_id, mode);
227 227
228 DEVID(tee_client_device_id);
229 DEVID_FIELD(tee_client_device_id, uuid);
230
231 DEVID(wmi_device_id);
232 DEVID_FIELD(wmi_device_id, guid_string);
233
228 return 0; 234 return 0;
229} 235}
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index a37af7d71973..e17a29ae2e97 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -37,6 +37,10 @@ typedef unsigned char __u8;
37typedef struct { 37typedef struct {
38 __u8 b[16]; 38 __u8 b[16];
39} uuid_le; 39} uuid_le;
40typedef struct {
41 __u8 b[16];
42} uuid_t;
43#define UUID_STRING_LEN 36
40 44
41/* Big exception to the "don't include kernel headers into userspace, which 45/* Big exception to the "don't include kernel headers into userspace, which
42 * even potentially has different endianness and word sizes, since 46 * even potentially has different endianness and word sizes, since
@@ -50,6 +54,9 @@ struct devtable {
50 int (*do_entry)(const char *filename, void *symval, char *alias); 54 int (*do_entry)(const char *filename, void *symval, char *alias);
51}; 55};
52 56
57/* Size of alias provided to do_entry functions */
58#define ALIAS_SIZE 500
59
53/* Define a variable f that holds the value of field f of struct devid 60/* Define a variable f that holds the value of field f of struct devid
54 * based at address m. 61 * based at address m.
55 */ 62 */
@@ -1287,6 +1294,42 @@ static int do_typec_entry(const char *filename, void *symval, char *alias)
1287 return 1; 1294 return 1;
1288} 1295}
1289 1296
1297/* Looks like: tee:uuid */
1298static int do_tee_entry(const char *filename, void *symval, char *alias)
1299{
1300 DEF_FIELD(symval, tee_client_device_id, uuid);
1301
1302 sprintf(alias, "tee:%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
1303 uuid.b[0], uuid.b[1], uuid.b[2], uuid.b[3], uuid.b[4],
1304 uuid.b[5], uuid.b[6], uuid.b[7], uuid.b[8], uuid.b[9],
1305 uuid.b[10], uuid.b[11], uuid.b[12], uuid.b[13], uuid.b[14],
1306 uuid.b[15]);
1307
1308 add_wildcard(alias);
1309 return 1;
1310}
1311
1312/* Looks like: wmi:guid */
1313static int do_wmi_entry(const char *filename, void *symval, char *alias)
1314{
1315 int len;
1316 DEF_FIELD_ADDR(symval, wmi_device_id, guid_string);
1317
1318 if (strlen(*guid_string) != UUID_STRING_LEN) {
1319 warn("Invalid WMI device id 'wmi:%s' in '%s'\n",
1320 *guid_string, filename);
1321 return 0;
1322 }
1323
1324 len = snprintf(alias, ALIAS_SIZE, WMI_MODULE_PREFIX "%s", *guid_string);
1325 if (len < 0 || len >= ALIAS_SIZE) {
1326 warn("Could not generate all MODULE_ALIAS's in '%s'\n",
1327 filename);
1328 return 0;
1329 }
1330 return 1;
1331}
1332
1290/* Does namelen bytes of name exactly match the symbol? */ 1333/* Does namelen bytes of name exactly match the symbol? */
1291static bool sym_is(const char *name, unsigned namelen, const char *symbol) 1334static bool sym_is(const char *name, unsigned namelen, const char *symbol)
1292{ 1335{
@@ -1303,7 +1346,7 @@ static void do_table(void *symval, unsigned long size,
1303 struct module *mod) 1346 struct module *mod)
1304{ 1347{
1305 unsigned int i; 1348 unsigned int i;
1306 char alias[500]; 1349 char alias[ALIAS_SIZE];
1307 1350
1308 device_id_check(mod->name, device_id, size, id_size, symval); 1351 device_id_check(mod->name, device_id, size, id_size, symval);
1309 /* Leave last one: it's the terminator. */ 1352 /* Leave last one: it's the terminator. */
@@ -1357,6 +1400,8 @@ static const struct devtable devtable[] = {
1357 {"fslmc", SIZE_fsl_mc_device_id, do_fsl_mc_entry}, 1400 {"fslmc", SIZE_fsl_mc_device_id, do_fsl_mc_entry},
1358 {"tbsvc", SIZE_tb_service_id, do_tbsvc_entry}, 1401 {"tbsvc", SIZE_tb_service_id, do_tbsvc_entry},
1359 {"typec", SIZE_typec_device_id, do_typec_entry}, 1402 {"typec", SIZE_typec_device_id, do_typec_entry},
1403 {"tee", SIZE_tee_client_device_id, do_tee_entry},
1404 {"wmi", SIZE_wmi_device_id, do_wmi_entry},
1360}; 1405};
1361 1406
1362/* Create MODULE_ALIAS() statements. 1407/* Create MODULE_ALIAS() statements.
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 26bf886bd168..0b0d1080b1c5 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -35,7 +35,6 @@ static int vmlinux_section_warnings = 1;
35static int warn_unresolved = 0; 35static int warn_unresolved = 0;
36/* How a symbol is exported */ 36/* How a symbol is exported */
37static int sec_mismatch_count = 0; 37static int sec_mismatch_count = 0;
38static int sec_mismatch_verbose = 1;
39static int sec_mismatch_fatal = 0; 38static int sec_mismatch_fatal = 0;
40/* ignore missing files */ 39/* ignore missing files */
41static int ignore_missing_files; 40static int ignore_missing_files;
@@ -1406,8 +1405,6 @@ static void report_sec_mismatch(const char *modname,
1406 char *prl_to; 1405 char *prl_to;
1407 1406
1408 sec_mismatch_count++; 1407 sec_mismatch_count++;
1409 if (!sec_mismatch_verbose)
1410 return;
1411 1408
1412 get_pretty_name(from_is_func, &from, &from_p); 1409 get_pretty_name(from_is_func, &from, &from_p);
1413 get_pretty_name(to_is_func, &to, &to_p); 1410 get_pretty_name(to_is_func, &to, &to_p);
@@ -1655,9 +1652,7 @@ static void extable_mismatch_handler(const char* modname, struct elf_info *elf,
1655 1652
1656 sec_mismatch_count++; 1653 sec_mismatch_count++;
1657 1654
1658 if (sec_mismatch_verbose) 1655 report_extable_warnings(modname, elf, mismatch, r, sym, fromsec, tosec);
1659 report_extable_warnings(modname, elf, mismatch, r, sym,
1660 fromsec, tosec);
1661 1656
1662 if (match(tosec, mismatch->bad_tosec)) 1657 if (match(tosec, mismatch->bad_tosec))
1663 fatal("The relocation at %s+0x%lx references\n" 1658 fatal("The relocation at %s+0x%lx references\n"
@@ -2433,7 +2428,7 @@ int main(int argc, char **argv)
2433 struct ext_sym_list *extsym_iter; 2428 struct ext_sym_list *extsym_iter;
2434 struct ext_sym_list *extsym_start = NULL; 2429 struct ext_sym_list *extsym_start = NULL;
2435 2430
2436 while ((opt = getopt(argc, argv, "i:I:e:mnsST:o:awE")) != -1) { 2431 while ((opt = getopt(argc, argv, "i:I:e:mnsT:o:awE")) != -1) {
2437 switch (opt) { 2432 switch (opt) {
2438 case 'i': 2433 case 'i':
2439 kernel_read = optarg; 2434 kernel_read = optarg;
@@ -2465,9 +2460,6 @@ int main(int argc, char **argv)
2465 case 's': 2460 case 's':
2466 vmlinux_section_warnings = 0; 2461 vmlinux_section_warnings = 0;
2467 break; 2462 break;
2468 case 'S':
2469 sec_mismatch_verbose = 0;
2470 break;
2471 case 'T': 2463 case 'T':
2472 files_source = optarg; 2464 files_source = optarg;
2473 break; 2465 break;
@@ -2525,18 +2517,9 @@ int main(int argc, char **argv)
2525 } 2517 }
2526 if (dump_write) 2518 if (dump_write)
2527 write_dump(dump_write); 2519 write_dump(dump_write);
2528 if (sec_mismatch_count) { 2520 if (sec_mismatch_count && sec_mismatch_fatal)
2529 if (!sec_mismatch_verbose) { 2521 fatal("modpost: Section mismatches detected.\n"
2530 warn("modpost: Found %d section mismatch(es).\n" 2522 "Set CONFIG_SECTION_MISMATCH_WARN_ONLY=y to allow them.\n");
2531 "To see full details build your kernel with:\n"
2532 "'make CONFIG_DEBUG_SECTION_MISMATCH=y'\n",
2533 sec_mismatch_count);
2534 }
2535 if (sec_mismatch_fatal) {
2536 fatal("modpost: Section mismatches detected.\n"
2537 "Set CONFIG_SECTION_MISMATCH_WARN_ONLY=y to allow them.\n");
2538 }
2539 }
2540 free(buf.p); 2523 free(buf.p);
2541 2524
2542 return err; 2525 return err;
diff --git a/scripts/package/Makefile b/scripts/package/Makefile
index 453fecee62f0..2c6de21e5152 100644
--- a/scripts/package/Makefile
+++ b/scripts/package/Makefile
@@ -59,7 +59,7 @@ rpm-pkg: FORCE
59# binrpm-pkg 59# binrpm-pkg
60# --------------------------------------------------------------------------- 60# ---------------------------------------------------------------------------
61binrpm-pkg: FORCE 61binrpm-pkg: FORCE
62 $(MAKE) KBUILD_SRC= 62 $(MAKE) -f $(srctree)/Makefile
63 $(CONFIG_SHELL) $(MKSPEC) prebuilt > $(objtree)/binkernel.spec 63 $(CONFIG_SHELL) $(MKSPEC) prebuilt > $(objtree)/binkernel.spec
64 +rpmbuild $(RPMOPTS) --define "_builddir $(objtree)" --target \ 64 +rpmbuild $(RPMOPTS) --define "_builddir $(objtree)" --target \
65 $(UTS_MACHINE) -bb $(objtree)/binkernel.spec 65 $(UTS_MACHINE) -bb $(objtree)/binkernel.spec
@@ -72,11 +72,11 @@ deb-pkg: FORCE
72 $(call cmd,src_tar,$(KDEB_SOURCENAME)) 72 $(call cmd,src_tar,$(KDEB_SOURCENAME))
73 origversion=$$(dpkg-parsechangelog -SVersion |sed 's/-[^-]*$$//');\ 73 origversion=$$(dpkg-parsechangelog -SVersion |sed 's/-[^-]*$$//');\
74 mv $(KDEB_SOURCENAME).tar.gz ../$(KDEB_SOURCENAME)_$${origversion}.orig.tar.gz 74 mv $(KDEB_SOURCENAME).tar.gz ../$(KDEB_SOURCENAME)_$${origversion}.orig.tar.gz
75 +dpkg-buildpackage -r$(KBUILD_PKG_ROOTCMD) -a$$(cat debian/arch) -i.git -us -uc 75 +dpkg-buildpackage -r$(KBUILD_PKG_ROOTCMD) -a$$(cat debian/arch) $(DPKG_FLAGS) -i.git -us -uc
76 76
77bindeb-pkg: FORCE 77bindeb-pkg: FORCE
78 $(CONFIG_SHELL) $(srctree)/scripts/package/mkdebian 78 $(CONFIG_SHELL) $(srctree)/scripts/package/mkdebian
79 +dpkg-buildpackage -r$(KBUILD_PKG_ROOTCMD) -a$$(cat debian/arch) -b -nc -uc 79 +dpkg-buildpackage -r$(KBUILD_PKG_ROOTCMD) -a$$(cat debian/arch) $(DPKG_FLAGS) -b -nc -uc
80 80
81intdeb-pkg: FORCE 81intdeb-pkg: FORCE
82 +$(CONFIG_SHELL) $(srctree)/scripts/package/builddeb 82 +$(CONFIG_SHELL) $(srctree)/scripts/package/builddeb
@@ -102,7 +102,7 @@ clean-dirs += $(objtree)/snap/
102# tarball targets 102# tarball targets
103# --------------------------------------------------------------------------- 103# ---------------------------------------------------------------------------
104tar%pkg: FORCE 104tar%pkg: FORCE
105 $(MAKE) KBUILD_SRC= 105 $(MAKE) -f $(srctree)/Makefile
106 $(CONFIG_SHELL) $(srctree)/scripts/package/buildtar $@ 106 $(CONFIG_SHELL) $(srctree)/scripts/package/buildtar $@
107 107
108clean-dirs += $(objtree)/tar-install/ 108clean-dirs += $(objtree)/tar-install/
diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index f43a274f4f1d..b03dd56a4782 100755
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -12,6 +12,18 @@
12 12
13set -e 13set -e
14 14
15is_enabled() {
16 grep -q "^$1=y" include/config/auto.conf
17}
18
19if_enabled_echo() {
20 if is_enabled "$1"; then
21 echo -n "$2"
22 elif [ $# -ge 3 ]; then
23 echo -n "$3"
24 fi
25}
26
15create_package() { 27create_package() {
16 local pname="$1" pdir="$2" 28 local pname="$1" pdir="$2"
17 29
@@ -62,7 +74,7 @@ parisc|mips|powerpc)
62 installed_image_path="boot/vmlinuz-$version" 74 installed_image_path="boot/vmlinuz-$version"
63esac 75esac
64 76
65BUILD_DEBUG="$(grep -s '^CONFIG_DEBUG_INFO=y' $KCONFIG_CONFIG || true)" 77BUILD_DEBUG=$(if_enabled_echo CONFIG_DEBUG_INFO Yes)
66 78
67# Setup the directory structure 79# Setup the directory structure
68rm -rf "$tmpdir" "$kernel_headers_dir" "$libc_headers_dir" "$dbg_dir" $objtree/debian/files 80rm -rf "$tmpdir" "$kernel_headers_dir" "$libc_headers_dir" "$dbg_dir" $objtree/debian/files
@@ -83,15 +95,15 @@ else
83fi 95fi
84cp "$($MAKE -s -f $srctree/Makefile image_name)" "$tmpdir/$installed_image_path" 96cp "$($MAKE -s -f $srctree/Makefile image_name)" "$tmpdir/$installed_image_path"
85 97
86if grep -q "^CONFIG_OF_EARLY_FLATTREE=y" $KCONFIG_CONFIG ; then 98if is_enabled CONFIG_OF_EARLY_FLATTREE; then
87 # Only some architectures with OF support have this target 99 # Only some architectures with OF support have this target
88 if [ -d "${srctree}/arch/$SRCARCH/boot/dts" ]; then 100 if [ -d "${srctree}/arch/$SRCARCH/boot/dts" ]; then
89 $MAKE KBUILD_SRC= INSTALL_DTBS_PATH="$tmpdir/usr/lib/$packagename" dtbs_install 101 $MAKE -f $srctree/Makefile INSTALL_DTBS_PATH="$tmpdir/usr/lib/$packagename" dtbs_install
90 fi 102 fi
91fi 103fi
92 104
93if grep -q '^CONFIG_MODULES=y' $KCONFIG_CONFIG ; then 105if is_enabled CONFIG_MODULES; then
94 INSTALL_MOD_PATH="$tmpdir" $MAKE KBUILD_SRC= modules_install 106 INSTALL_MOD_PATH="$tmpdir" $MAKE -f $srctree/Makefile modules_install
95 rm -f "$tmpdir/lib/modules/$version/build" 107 rm -f "$tmpdir/lib/modules/$version/build"
96 rm -f "$tmpdir/lib/modules/$version/source" 108 rm -f "$tmpdir/lib/modules/$version/source"
97 if [ "$ARCH" = "um" ] ; then 109 if [ "$ARCH" = "um" ] ; then
@@ -111,16 +123,15 @@ if grep -q '^CONFIG_MODULES=y' $KCONFIG_CONFIG ; then
111 done 123 done
112 124
113 # resign stripped modules 125 # resign stripped modules
114 MODULE_SIG_ALL="$(grep -s '^CONFIG_MODULE_SIG_ALL=y' $KCONFIG_CONFIG || true)" 126 if is_enabled CONFIG_MODULE_SIG_ALL; then
115 if [ -n "$MODULE_SIG_ALL" ]; then 127 INSTALL_MOD_PATH="$tmpdir" $MAKE -f $srctree/Makefile modules_sign
116 INSTALL_MOD_PATH="$tmpdir" $MAKE KBUILD_SRC= modules_sign
117 fi 128 fi
118 fi 129 fi
119fi 130fi
120 131
121if [ "$ARCH" != "um" ]; then 132if [ "$ARCH" != "um" ]; then
122 $MAKE headers_check KBUILD_SRC= 133 $MAKE -f $srctree/Makefile headers_check
123 $MAKE headers_install KBUILD_SRC= INSTALL_HDR_PATH="$libc_headers_dir/usr" 134 $MAKE -f $srctree/Makefile headers_install INSTALL_HDR_PATH="$libc_headers_dir/usr"
124fi 135fi
125 136
126# Install the maintainer scripts 137# Install the maintainer scripts
@@ -129,11 +140,6 @@ fi
129# make-kpkg sets $INITRD to indicate whether an initramfs is wanted, and 140# make-kpkg sets $INITRD to indicate whether an initramfs is wanted, and
130# so do we; recent versions of dracut and initramfs-tools will obey this. 141# so do we; recent versions of dracut and initramfs-tools will obey this.
131debhookdir=${KDEB_HOOKDIR:-/etc/kernel} 142debhookdir=${KDEB_HOOKDIR:-/etc/kernel}
132if grep -q '^CONFIG_BLK_DEV_INITRD=y' $KCONFIG_CONFIG; then
133 want_initrd=Yes
134else
135 want_initrd=No
136fi
137for script in postinst postrm preinst prerm ; do 143for script in postinst postrm preinst prerm ; do
138 mkdir -p "$tmpdir$debhookdir/$script.d" 144 mkdir -p "$tmpdir$debhookdir/$script.d"
139 cat <<EOF > "$tmpdir/DEBIAN/$script" 145 cat <<EOF > "$tmpdir/DEBIAN/$script"
@@ -145,7 +151,7 @@ set -e
145export DEB_MAINT_PARAMS="\$*" 151export DEB_MAINT_PARAMS="\$*"
146 152
147# Tell initramfs builder whether it's wanted 153# Tell initramfs builder whether it's wanted
148export INITRD=$want_initrd 154export INITRD=$(if_enabled_echo CONFIG_BLK_DEV_INITRD Yes No)
149 155
150test -d $debhookdir/$script.d && run-parts --arg="$version" --arg="/$installed_image_path" $debhookdir/$script.d 156test -d $debhookdir/$script.d && run-parts --arg="$version" --arg="/$installed_image_path" $debhookdir/$script.d
151exit 0 157exit 0
@@ -158,11 +164,11 @@ done
158(cd $srctree; find arch/*/include include scripts -type f -o -type l) >> "$objtree/debian/hdrsrcfiles" 164(cd $srctree; find arch/*/include include scripts -type f -o -type l) >> "$objtree/debian/hdrsrcfiles"
159(cd $srctree; find arch/$SRCARCH -name module.lds -o -name Kbuild.platforms -o -name Platform) >> "$objtree/debian/hdrsrcfiles" 165(cd $srctree; find arch/$SRCARCH -name module.lds -o -name Kbuild.platforms -o -name Platform) >> "$objtree/debian/hdrsrcfiles"
160(cd $srctree; find $(find arch/$SRCARCH -name include -o -name scripts -type d) -type f) >> "$objtree/debian/hdrsrcfiles" 166(cd $srctree; find $(find arch/$SRCARCH -name include -o -name scripts -type d) -type f) >> "$objtree/debian/hdrsrcfiles"
161if grep -q '^CONFIG_STACK_VALIDATION=y' $KCONFIG_CONFIG ; then 167if is_enabled CONFIG_STACK_VALIDATION; then
162 (cd $objtree; find tools/objtool -type f -executable) >> "$objtree/debian/hdrobjfiles" 168 (cd $objtree; find tools/objtool -type f -executable) >> "$objtree/debian/hdrobjfiles"
163fi 169fi
164(cd $objtree; find arch/$SRCARCH/include Module.symvers include scripts -type f) >> "$objtree/debian/hdrobjfiles" 170(cd $objtree; find arch/$SRCARCH/include Module.symvers include scripts -type f) >> "$objtree/debian/hdrobjfiles"
165if grep -q '^CONFIG_GCC_PLUGINS=y' $KCONFIG_CONFIG ; then 171if is_enabled CONFIG_GCC_PLUGINS; then
166 (cd $objtree; find scripts/gcc-plugins -name \*.so -o -name gcc-common.h) >> "$objtree/debian/hdrobjfiles" 172 (cd $objtree; find scripts/gcc-plugins -name \*.so -o -name gcc-common.h) >> "$objtree/debian/hdrobjfiles"
167fi 173fi
168destdir=$kernel_headers_dir/usr/src/linux-headers-$version 174destdir=$kernel_headers_dir/usr/src/linux-headers-$version
diff --git a/scripts/package/buildtar b/scripts/package/buildtar
index d624a07a4e77..2f66c81e4021 100755
--- a/scripts/package/buildtar
+++ b/scripts/package/buildtar
@@ -56,8 +56,8 @@ dirs=boot
56# 56#
57# Try to install modules 57# Try to install modules
58# 58#
59if grep -q '^CONFIG_MODULES=y' "${KCONFIG_CONFIG}"; then 59if grep -q '^CONFIG_MODULES=y' include/config/auto.conf; then
60 make ARCH="${ARCH}" O="${objtree}" KBUILD_SRC= INSTALL_MOD_PATH="${tmpdir}" modules_install 60 make ARCH="${ARCH}" -f ${srctree}/Makefile INSTALL_MOD_PATH="${tmpdir}" modules_install
61 dirs="$dirs lib" 61 dirs="$dirs lib"
62fi 62fi
63 63
diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian
index edcad61fe3cd..8351584cb24e 100755
--- a/scripts/package/mkdebian
+++ b/scripts/package/mkdebian
@@ -7,7 +7,7 @@
7set -e 7set -e
8 8
9is_enabled() { 9is_enabled() {
10 grep -q "^CONFIG_$1=y" $KCONFIG_CONFIG 10 grep -q "^$1=y" include/config/auto.conf
11} 11}
12 12
13if_enabled_echo() { 13if_enabled_echo() {
@@ -31,23 +31,23 @@ set_debarch() {
31 x86_64) 31 x86_64)
32 debarch=amd64 ;; 32 debarch=amd64 ;;
33 sparc*) 33 sparc*)
34 debarch=sparc$(if_enabled_echo 64BIT 64) ;; 34 debarch=sparc$(if_enabled_echo CONFIG_64BIT 64) ;;
35 s390*) 35 s390*)
36 debarch=s390x ;; 36 debarch=s390x ;;
37 ppc*) 37 ppc*)
38 if is_enabled 64BIT; then 38 if is_enabled CONFIG_64BIT; then
39 debarch=ppc64$(if_enabled_echo CPU_LITTLE_ENDIAN el) 39 debarch=ppc64$(if_enabled_echo CONFIG_CPU_LITTLE_ENDIAN el)
40 else 40 else
41 debarch=powerpc$(if_enabled_echo SPE spe) 41 debarch=powerpc$(if_enabled_echo CONFIG_SPE spe)
42 fi 42 fi
43 ;; 43 ;;
44 parisc*) 44 parisc*)
45 debarch=hppa ;; 45 debarch=hppa ;;
46 mips*) 46 mips*)
47 if is_enabled CPU_LITTLE_ENDIAN; then 47 if is_enabled CONFIG_CPU_LITTLE_ENDIAN; then
48 debarch=mips$(if_enabled_echo 64BIT 64)$(if_enabled_echo CPU_MIPSR6 r6)el 48 debarch=mips$(if_enabled_echo CONFIG_64BIT 64)$(if_enabled_echo CONFIG_CPU_MIPSR6 r6)el
49 elif is_enabled CPU_MIPSR6; then 49 elif is_enabled CONFIG_CPU_MIPSR6; then
50 debarch=mips$(if_enabled_echo 64BIT 64)r6 50 debarch=mips$(if_enabled_echo CONFIG_64BIT 64)r6
51 else 51 else
52 debarch=mips 52 debarch=mips
53 fi 53 fi
@@ -55,8 +55,8 @@ set_debarch() {
55 aarch64|arm64) 55 aarch64|arm64)
56 debarch=arm64 ;; 56 debarch=arm64 ;;
57 arm*) 57 arm*)
58 if is_enabled AEABI; then 58 if is_enabled CONFIG_AEABI; then
59 debarch=arm$(if_enabled_echo VFP hf el) 59 debarch=arm$(if_enabled_echo CONFIG_VFP hf el)
60 else 60 else
61 debarch=arm 61 debarch=arm
62 fi 62 fi
@@ -64,10 +64,10 @@ set_debarch() {
64 openrisc) 64 openrisc)
65 debarch=or1k ;; 65 debarch=or1k ;;
66 sh) 66 sh)
67 if is_enabled CPU_SH3; then 67 if is_enabled CONFIG_CPU_SH3; then
68 debarch=sh3$(if_enabled_echo CPU_BIG_ENDIAN eb) 68 debarch=sh3$(if_enabled_echo CONFIG_CPU_BIG_ENDIAN eb)
69 elif is_enabled CPU_SH4; then 69 elif is_enabled CONFIG_CPU_SH4; then
70 debarch=sh4$(if_enabled_echo CPU_BIG_ENDIAN eb) 70 debarch=sh4$(if_enabled_echo CONFIG_CPU_BIG_ENDIAN eb)
71 fi 71 fi
72 ;; 72 ;;
73 esac 73 esac
@@ -132,8 +132,12 @@ else
132 echo >&2 "Install lsb-release or set \$KDEB_CHANGELOG_DIST explicitly" 132 echo >&2 "Install lsb-release or set \$KDEB_CHANGELOG_DIST explicitly"
133fi 133fi
134 134
135mkdir -p debian/ 135mkdir -p debian/source/
136echo "1.0" > debian/source/format
137
136echo $debarch > debian/arch 138echo $debarch > debian/arch
139extra_build_depends=", $(if_enabled_echo CONFIG_UNWINDER_ORC libelf-dev)"
140extra_build_depends="$extra_build_depends, $(if_enabled_echo CONFIG_SYSTEM_TRUSTED_KEYRING libssl-dev:native)"
137 141
138# Generate a simple changelog template 142# Generate a simple changelog template
139cat <<EOF > debian/changelog 143cat <<EOF > debian/changelog
@@ -170,7 +174,7 @@ Source: $sourcename
170Section: kernel 174Section: kernel
171Priority: optional 175Priority: optional
172Maintainer: $maintainer 176Maintainer: $maintainer
173Build-Depends: bc, kmod, cpio 177Build-Depends: bc, kmod, cpio, bison, flex | flex:native $extra_build_depends
174Homepage: http://www.kernel.org/ 178Homepage: http://www.kernel.org/
175 179
176Package: $packagename 180Package: $packagename
@@ -205,13 +209,15 @@ EOF
205cat <<EOF > debian/rules 209cat <<EOF > debian/rules
206#!$(command -v $MAKE) -f 210#!$(command -v $MAKE) -f
207 211
212srctree ?= .
213
208build: 214build:
209 \$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} \ 215 \$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} \
210 KBUILD_BUILD_VERSION=${revision} KBUILD_SRC= 216 KBUILD_BUILD_VERSION=${revision} -f \$(srctree)/Makefile
211 217
212binary-arch: 218binary-arch:
213 \$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} \ 219 \$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} \
214 KBUILD_BUILD_VERSION=${revision} KBUILD_SRC= intdeb-pkg 220 KBUILD_BUILD_VERSION=${revision} -f \$(srctree)/Makefile intdeb-pkg
215 221
216clean: 222clean:
217 rm -rf debian/*tmp debian/files 223 rm -rf debian/*tmp debian/files
@@ -219,5 +225,6 @@ clean:
219 225
220binary: binary-arch 226binary: binary-arch
221EOF 227EOF
228chmod +x debian/rules
222 229
223exit 0 230exit 0
diff --git a/scripts/spdxcheck.py b/scripts/spdxcheck.py
index e559c6294c39..4fe392e507fb 100755
--- a/scripts/spdxcheck.py
+++ b/scripts/spdxcheck.py
@@ -175,7 +175,13 @@ class id_parser(object):
175 self.lines_checked += 1 175 self.lines_checked += 1
176 if line.find("SPDX-License-Identifier:") < 0: 176 if line.find("SPDX-License-Identifier:") < 0:
177 continue 177 continue
178 expr = line.split(':')[1].replace('*/', '').strip() 178 expr = line.split(':')[1].strip()
179 # Remove trailing comment closure
180 if line.strip().endswith('*/'):
181 expr = expr.rstrip('*/').strip()
182 # Special case for SH magic boot code files
183 if line.startswith('LIST \"'):
184 expr = expr.rstrip('\"').strip()
179 self.parse(expr) 185 self.parse(expr)
180 self.spdx_valid += 1 186 self.spdx_valid += 1
181 # 187 #
diff --git a/scripts/spelling.txt b/scripts/spelling.txt
index 517d0c3f83df..86b87332b9e5 100644
--- a/scripts/spelling.txt
+++ b/scripts/spelling.txt
@@ -10,6 +10,8 @@
10abandonning||abandoning 10abandonning||abandoning
11abigious||ambiguous 11abigious||ambiguous
12abitrate||arbitrate 12abitrate||arbitrate
13abnornally||abnormally
14abnrormal||abnormal
13abord||abort 15abord||abort
14aboslute||absolute 16aboslute||absolute
15abov||above 17abov||above
@@ -107,6 +109,7 @@ ambigious||ambiguous
107amoung||among 109amoung||among
108amout||amount 110amout||amount
109amplifer||amplifier 111amplifer||amplifier
112amplifyer||amplifier
110an union||a union 113an union||a union
111an user||a user 114an user||a user
112an userspace||a userspace 115an userspace||a userspace
@@ -145,6 +148,7 @@ artillary||artillery
145asign||assign 148asign||assign
146asser||assert 149asser||assert
147assertation||assertion 150assertation||assertion
151assertting||asserting
148assiged||assigned 152assiged||assigned
149assigment||assignment 153assigment||assignment
150assigments||assignments 154assigments||assignments
@@ -168,6 +172,8 @@ attachement||attachment
168attched||attached 172attched||attached
169attemps||attempts 173attemps||attempts
170attemping||attempting 174attemping||attempting
175attepmpt||attempt
176attnetion||attention
171attruibutes||attributes 177attruibutes||attributes
172authentification||authentication 178authentification||authentication
173automaticaly||automatically 179automaticaly||automatically
@@ -217,6 +223,7 @@ boardcast||broadcast
217borad||board 223borad||board
218boundry||boundary 224boundry||boundary
219brievely||briefly 225brievely||briefly
226broadcase||broadcast
220broadcat||broadcast 227broadcat||broadcast
221bufufer||buffer 228bufufer||buffer
222cacluated||calculated 229cacluated||calculated
@@ -234,6 +241,7 @@ cancle||cancel
234capabilites||capabilities 241capabilites||capabilities
235capabilty||capability 242capabilty||capability
236capabitilies||capabilities 243capabitilies||capabilities
244capablity||capability
237capatibilities||capabilities 245capatibilities||capabilities
238capapbilities||capabilities 246capapbilities||capabilities
239caputure||capture 247caputure||capture
@@ -274,6 +282,7 @@ clared||cleared
274closeing||closing 282closeing||closing
275clustred||clustered 283clustred||clustered
276coexistance||coexistence 284coexistance||coexistence
285colescing||coalescing
277collapsable||collapsible 286collapsable||collapsible
278colorfull||colorful 287colorfull||colorful
279comand||command 288comand||command
@@ -290,6 +299,7 @@ comsumer||consumer
290comsuming||consuming 299comsuming||consuming
291compability||compatibility 300compability||compatibility
292compaibility||compatibility 301compaibility||compatibility
302comparsion||comparison
293compatability||compatibility 303compatability||compatibility
294compatable||compatible 304compatable||compatible
295compatibiliy||compatibility 305compatibiliy||compatibility
@@ -303,6 +313,7 @@ completly||completely
303complient||compliant 313complient||compliant
304componnents||components 314componnents||components
305compoment||component 315compoment||component
316comppatible||compatible
306compres||compress 317compres||compress
307compresion||compression 318compresion||compression
308comression||compression 319comression||compression
@@ -368,6 +379,8 @@ decsribed||described
368decription||description 379decription||description
369dectected||detected 380dectected||detected
370defailt||default 381defailt||default
382deferal||deferral
383deffered||deferred
371defferred||deferred 384defferred||deferred
372definate||definite 385definate||definite
373definately||definitely 386definately||definitely
@@ -400,6 +413,7 @@ descritptor||descriptor
400desctiptor||descriptor 413desctiptor||descriptor
401desriptor||descriptor 414desriptor||descriptor
402desriptors||descriptors 415desriptors||descriptors
416desination||destination
403destionation||destination 417destionation||destination
404destoried||destroyed 418destoried||destroyed
405destory||destroy 419destory||destroy
@@ -426,7 +440,9 @@ diffrent||different
426differenciate||differentiate 440differenciate||differentiate
427diffrentiate||differentiate 441diffrentiate||differentiate
428difinition||definition 442difinition||definition
443dimention||dimension
429dimesions||dimensions 444dimesions||dimensions
445dispalying||displaying
430diplay||display 446diplay||display
431directon||direction 447directon||direction
432direectly||directly 448direectly||directly
@@ -442,6 +458,7 @@ disbled||disabled
442disconnet||disconnect 458disconnet||disconnect
443discontinous||discontinuous 459discontinous||discontinuous
444disharge||discharge 460disharge||discharge
461disnabled||disabled
445dispertion||dispersion 462dispertion||dispersion
446dissapears||disappears 463dissapears||disappears
447distiction||distinction 464distiction||distinction
@@ -456,6 +473,7 @@ dorp||drop
456dosen||doesn 473dosen||doesn
457downlad||download 474downlad||download
458downlads||downloads 475downlads||downloads
476droped||dropped
459druing||during 477druing||during
460dynmaic||dynamic 478dynmaic||dynamic
461eanable||enable 479eanable||enable
@@ -471,6 +489,7 @@ elementry||elementary
471eletronic||electronic 489eletronic||electronic
472embeded||embedded 490embeded||embedded
473enabledi||enabled 491enabledi||enabled
492enble||enable
474enchanced||enhanced 493enchanced||enhanced
475encorporating||incorporating 494encorporating||incorporating
476encrupted||encrypted 495encrupted||encrypted
@@ -479,6 +498,9 @@ encryptio||encryption
479endianess||endianness 498endianess||endianness
480enhaced||enhanced 499enhaced||enhanced
481enlightnment||enlightenment 500enlightnment||enlightenment
501enqueing||enqueuing
502entires||entries
503entites||entities
482entrys||entries 504entrys||entries
483enocded||encoded 505enocded||encoded
484enterily||entirely 506enterily||entirely
@@ -498,6 +520,8 @@ etsbalishment||establishment
498excecutable||executable 520excecutable||executable
499exceded||exceeded 521exceded||exceeded
500excellant||excellent 522excellant||excellent
523execeeded||exceeded
524execeeds||exceeds
501exeed||exceed 525exeed||exceed
502existance||existence 526existance||existence
503existant||existent 527existant||existent
@@ -506,6 +530,7 @@ exlcude||exclude
506exlcusive||exclusive 530exlcusive||exclusive
507exmaple||example 531exmaple||example
508expecially||especially 532expecially||especially
533experies||expires
509explicite||explicit 534explicite||explicit
510explicitely||explicitly 535explicitely||explicitly
511explict||explicit 536explict||explicit
@@ -521,6 +546,7 @@ extracter||extractor
521faield||failed 546faield||failed
522falied||failed 547falied||failed
523faild||failed 548faild||failed
549failded||failed
524failer||failure 550failer||failure
525faill||fail 551faill||fail
526failied||failed 552failied||failed
@@ -540,6 +566,7 @@ fetaure||feature
540fetaures||features 566fetaures||features
541fileystem||filesystem 567fileystem||filesystem
542fimware||firmware 568fimware||firmware
569firmare||firmware
543firware||firmware 570firware||firmware
544finanize||finalize 571finanize||finalize
545findn||find 572findn||find
@@ -574,6 +601,7 @@ funtions||functions
574furthur||further 601furthur||further
575futhermore||furthermore 602futhermore||furthermore
576futrue||future 603futrue||future
604gauage||gauge
577gaurenteed||guaranteed 605gaurenteed||guaranteed
578generiously||generously 606generiously||generously
579genereate||generate 607genereate||generate
@@ -645,6 +673,7 @@ independed||independent
645indiate||indicate 673indiate||indicate
646indicat||indicate 674indicat||indicate
647inexpect||inexpected 675inexpect||inexpected
676inferface||interface
648infomation||information 677infomation||information
649informatiom||information 678informatiom||information
650informations||information 679informations||information
@@ -662,14 +691,17 @@ initialiazation||initialization
662initializiation||initialization 691initializiation||initialization
663initialze||initialize 692initialze||initialize
664initialzed||initialized 693initialzed||initialized
694initialzing||initializing
665initilization||initialization 695initilization||initialization
666initilize||initialize 696initilize||initialize
667inofficial||unofficial 697inofficial||unofficial
668inrerface||interface 698inrerface||interface
669insititute||institute 699insititute||institute
700instace||instance
670instal||install 701instal||install
671instanciate||instantiate 702instanciate||instantiate
672instanciated||instantiated 703instanciated||instantiated
704insufficent||insufficient
673inteface||interface 705inteface||interface
674integreated||integrated 706integreated||integrated
675integrety||integrity 707integrety||integrity
@@ -684,6 +716,8 @@ intermittant||intermittent
684internel||internal 716internel||internal
685interoprability||interoperability 717interoprability||interoperability
686interuupt||interrupt 718interuupt||interrupt
719interupt||interrupt
720interupts||interrupts
687interrface||interface 721interrface||interface
688interrrupt||interrupt 722interrrupt||interrupt
689interrup||interrupt 723interrup||interrupt
@@ -699,11 +733,14 @@ intialization||initialization
699intialized||initialized 733intialized||initialized
700intialize||initialize 734intialize||initialize
701intregral||integral 735intregral||integral
736intrerrupt||interrupt
702intrrupt||interrupt 737intrrupt||interrupt
703intterrupt||interrupt 738intterrupt||interrupt
704intuative||intuitive 739intuative||intuitive
705inavlid||invalid 740inavlid||invalid
706invaid||invalid 741invaid||invalid
742invaild||invalid
743invailid||invalid
707invald||invalid 744invald||invalid
708invalde||invalid 745invalde||invalid
709invalide||invalid 746invalide||invalid
@@ -712,6 +749,7 @@ invalud||invalid
712invididual||individual 749invididual||individual
713invokation||invocation 750invokation||invocation
714invokations||invocations 751invokations||invocations
752ireelevant||irrelevant
715irrelevent||irrelevant 753irrelevent||irrelevant
716isnt||isn't 754isnt||isn't
717isssue||issue 755isssue||issue
@@ -747,6 +785,7 @@ loobpack||loopback
747loosing||losing 785loosing||losing
748losted||lost 786losted||lost
749machinary||machinery 787machinary||machinery
788maibox||mailbox
750maintainance||maintenance 789maintainance||maintenance
751maintainence||maintenance 790maintainence||maintenance
752maintan||maintain 791maintan||maintain
@@ -758,14 +797,19 @@ managable||manageable
758managment||management 797managment||management
759mangement||management 798mangement||management
760manoeuvering||maneuvering 799manoeuvering||maneuvering
800manufaucturing||manufacturing
761mappping||mapping 801mappping||mapping
762matchs||matches 802matchs||matches
763mathimatical||mathematical 803mathimatical||mathematical
764mathimatic||mathematic 804mathimatic||mathematic
765mathimatics||mathematics 805mathimatics||mathematics
806maximium||maximum
766maxium||maximum 807maxium||maximum
767mechamism||mechanism 808mechamism||mechanism
768meetign||meeting 809meetign||meeting
810memeory||memory
811memmber||member
812memoery||memory
769ment||meant 813ment||meant
770mergable||mergeable 814mergable||mergeable
771mesage||message 815mesage||message
@@ -779,6 +823,7 @@ migrateable||migratable
779milliseonds||milliseconds 823milliseonds||milliseconds
780minium||minimum 824minium||minimum
781minimam||minimum 825minimam||minimum
826miniumum||minimum
782minumum||minimum 827minumum||minimum
783misalinged||misaligned 828misalinged||misaligned
784miscelleneous||miscellaneous 829miscelleneous||miscellaneous
@@ -839,6 +884,7 @@ occurence||occurrence
839occure||occurred 884occure||occurred
840occured||occurred 885occured||occurred
841occuring||occurring 886occuring||occurring
887offser||offset
842offet||offset 888offet||offset
843offloded||offloaded 889offloded||offloaded
844omited||omitted 890omited||omitted
@@ -855,6 +901,7 @@ optmizations||optimizations
855orientatied||orientated 901orientatied||orientated
856orientied||oriented 902orientied||oriented
857orignal||original 903orignal||original
904originial||original
858otherise||otherwise 905otherise||otherwise
859ouput||output 906ouput||output
860oustanding||outstanding 907oustanding||outstanding
@@ -874,6 +921,7 @@ packege||package
874packge||package 921packge||package
875packtes||packets 922packtes||packets
876pakage||package 923pakage||package
924paket||packet
877pallette||palette 925pallette||palette
878paln||plan 926paln||plan
879paramameters||parameters 927paramameters||parameters
@@ -886,6 +934,8 @@ paramters||parameters
886parmaters||parameters 934parmaters||parameters
887particuarly||particularly 935particuarly||particularly
888particularily||particularly 936particularily||particularly
937partion||partition
938partions||partitions
889partiton||partition 939partiton||partition
890pased||passed 940pased||passed
891passin||passing 941passin||passing
@@ -897,10 +947,12 @@ peice||piece
897pendantic||pedantic 947pendantic||pedantic
898peprocessor||preprocessor 948peprocessor||preprocessor
899perfoming||performing 949perfoming||performing
950peripherial||peripheral
900permissons||permissions 951permissons||permissions
901peroid||period 952peroid||period
902persistance||persistence 953persistance||persistence
903persistant||persistent 954persistant||persistent
955phoneticly||phonetically
904plalform||platform 956plalform||platform
905platfoem||platform 957platfoem||platform
906platfrom||platform 958platfrom||platform
@@ -915,6 +967,7 @@ posible||possible
915positon||position 967positon||position
916possibilites||possibilities 968possibilites||possibilities
917powerfull||powerful 969powerfull||powerful
970pramater||parameter
918preamle||preamble 971preamle||preamble
919preample||preamble 972preample||preamble
920preapre||prepare 973preapre||prepare
@@ -976,6 +1029,7 @@ psudo||pseudo
976psuedo||pseudo 1029psuedo||pseudo
977psychadelic||psychedelic 1030psychadelic||psychedelic
978pwoer||power 1031pwoer||power
1032queing||queuing
979quering||querying 1033quering||querying
980randomally||randomly 1034randomally||randomly
981raoming||roaming 1035raoming||roaming
@@ -1004,6 +1058,7 @@ refering||referring
1004refernces||references 1058refernces||references
1005refernnce||reference 1059refernnce||reference
1006refrence||reference 1060refrence||reference
1061registed||registered
1007registerd||registered 1062registerd||registered
1008registeration||registration 1063registeration||registration
1009registeresd||registered 1064registeresd||registered
@@ -1018,6 +1073,7 @@ regulamentations||regulations
1018reigstration||registration 1073reigstration||registration
1019releated||related 1074releated||related
1020relevent||relevant 1075relevent||relevant
1076reloade||reload
1021remoote||remote 1077remoote||remote
1022remore||remote 1078remore||remote
1023removeable||removable 1079removeable||removable
@@ -1036,19 +1092,23 @@ requried||required
1036requst||request 1092requst||request
1037reregisteration||reregistration 1093reregisteration||reregistration
1038reseting||resetting 1094reseting||resetting
1095reseved||reserved
1039reseverd||reserved 1096reseverd||reserved
1040resizeable||resizable 1097resizeable||resizable
1041resouce||resource 1098resouce||resource
1042resouces||resources 1099resouces||resources
1043resoures||resources 1100resoures||resources
1044responce||response 1101responce||response
1102resrouce||resource
1045ressizes||resizes 1103ressizes||resizes
1046ressource||resource 1104ressource||resource
1047ressources||resources 1105ressources||resources
1048restesting||retesting 1106restesting||retesting
1107resumbmitting||resubmitting
1049retransmited||retransmitted 1108retransmited||retransmitted
1050retreived||retrieved 1109retreived||retrieved
1051retreive||retrieve 1110retreive||retrieve
1111retreiving||retrieving
1052retrive||retrieve 1112retrive||retrieve
1053retuned||returned 1113retuned||returned
1054reudce||reduce 1114reudce||reduce
@@ -1120,6 +1180,7 @@ sleeped||slept
1120softwares||software 1180softwares||software
1121speach||speech 1181speach||speech
1122specfic||specific 1182specfic||specific
1183specfield||specified
1123speciefied||specified 1184speciefied||specified
1124specifc||specific 1185specifc||specific
1125specifed||specified 1186specifed||specified
@@ -1142,7 +1203,10 @@ staion||station
1142standardss||standards 1203standardss||standards
1143standartization||standardization 1204standartization||standardization
1144standart||standard 1205standart||standard
1206standy||standby
1207stardard||standard
1145staticly||statically 1208staticly||statically
1209statuss||status
1146stoped||stopped 1210stoped||stopped
1147stoping||stopping 1211stoping||stopping
1148stoppped||stopped 1212stoppped||stopped
@@ -1227,12 +1291,14 @@ tipically||typically
1227timeing||timing 1291timeing||timing
1228timout||timeout 1292timout||timeout
1229tmis||this 1293tmis||this
1294toogle||toggle
1230torerable||tolerable 1295torerable||tolerable
1231traking||tracking 1296traking||tracking
1232tramsmitted||transmitted 1297tramsmitted||transmitted
1233tramsmit||transmit 1298tramsmit||transmit
1234tranasction||transaction 1299tranasction||transaction
1235tranfer||transfer 1300tranfer||transfer
1301transcevier||transceiver
1236transciever||transceiver 1302transciever||transceiver
1237transferd||transferred 1303transferd||transferred
1238transfered||transferred 1304transfered||transferred
@@ -1267,6 +1333,7 @@ unfortunatelly||unfortunately
1267unifiy||unify 1333unifiy||unify
1268uniterrupted||uninterrupted 1334uniterrupted||uninterrupted
1269unintialized||uninitialized 1335unintialized||uninitialized
1336unitialized||uninitialized
1270unkmown||unknown 1337unkmown||unknown
1271unknonw||unknown 1338unknonw||unknown
1272unknow||unknown 1339unknow||unknown
@@ -1291,7 +1358,9 @@ unsuccessfull||unsuccessful
1291unsuported||unsupported 1358unsuported||unsupported
1292untill||until 1359untill||until
1293unuseful||useless 1360unuseful||useless
1361unvalid||invalid
1294upate||update 1362upate||update
1363upsupported||unsupported
1295usefule||useful 1364usefule||useful
1296usefull||useful 1365usefull||useful
1297usege||usage 1366usege||usage
diff --git a/scripts/ver_linux b/scripts/ver_linux
index a6c728db05ce..810e608baa24 100755
--- a/scripts/ver_linux
+++ b/scripts/ver_linux
@@ -13,6 +13,8 @@ BEGIN {
13 system("uname -a") 13 system("uname -a")
14 printf("\n") 14 printf("\n")
15 15
16 vernum = "[0-9]+([.]?[0-9]+)+"
17
16 printversion("GNU C", version("gcc -dumpversion")) 18 printversion("GNU C", version("gcc -dumpversion"))
17 printversion("GNU Make", version("make --version")) 19 printversion("GNU Make", version("make --version"))
18 printversion("Binutils", version("ld -v")) 20 printversion("Binutils", version("ld -v"))
@@ -34,7 +36,7 @@ BEGIN {
34 while (getline <"/proc/self/maps" > 0) { 36 while (getline <"/proc/self/maps" > 0) {
35 if (/libc.*\.so$/) { 37 if (/libc.*\.so$/) {
36 n = split($0, procmaps, "/") 38 n = split($0, procmaps, "/")
37 if (match(procmaps[n], /[0-9]+([.]?[0-9]+)+/)) { 39 if (match(procmaps[n], vernum)) {
38 ver = substr(procmaps[n], RSTART, RLENGTH) 40 ver = substr(procmaps[n], RSTART, RLENGTH)
39 printversion("Linux C Library", ver) 41 printversion("Linux C Library", ver)
40 break 42 break
@@ -70,7 +72,7 @@ BEGIN {
70function version(cmd, ver) { 72function version(cmd, ver) {
71 cmd = cmd " 2>&1" 73 cmd = cmd " 2>&1"
72 while (cmd | getline > 0) { 74 while (cmd | getline > 0) {
73 if (match($0, /[0-9]+([.]?[0-9]+)+/)) { 75 if (match($0, vernum)) {
74 ver = substr($0, RSTART, RLENGTH) 76 ver = substr($0, RSTART, RLENGTH)
75 break 77 break
76 } 78 }