aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Kbuild.include28
-rw-r--r--scripts/Makefile5
-rw-r--r--scripts/Makefile.build11
-rw-r--r--scripts/Makefile.extrawarn3
-rw-r--r--scripts/Makefile.headersinst134
-rw-r--r--scripts/Makefile.host2
-rw-r--r--scripts/Makefile.lib26
-rw-r--r--scripts/Makefile.modbuiltin2
-rw-r--r--scripts/basic/fixdep.c51
-rw-r--r--scripts/coccinelle/api/kstrdup.cocci8
-rw-r--r--scripts/coccinelle/api/stream_open.cocci8
-rw-r--r--scripts/coccinelle/free/put_device.cocci11
-rw-r--r--scripts/gdb/linux/Makefile2
-rw-r--r--scripts/genksyms/keywords.c4
-rw-r--r--scripts/genksyms/parse.y2
-rwxr-xr-xscripts/headers.sh29
-rwxr-xr-xscripts/headers_install.sh48
-rw-r--r--scripts/kallsyms.c3
-rw-r--r--scripts/kconfig/Makefile8
-rw-r--r--scripts/kconfig/conf.c10
-rw-r--r--scripts/kconfig/confdata.c25
-rw-r--r--scripts/kconfig/lkc.h1
-rw-r--r--scripts/kconfig/lkc_proto.h3
-rw-r--r--scripts/kconfig/mconf.c10
-rw-r--r--scripts/kconfig/nconf.c10
-rw-r--r--scripts/kconfig/preprocess.c3
-rw-r--r--scripts/kconfig/qconf.cc2
-rw-r--r--scripts/kconfig/symbol.c2
-rwxr-xr-xscripts/package/builddeb2
-rwxr-xr-xscripts/package/mkspec2
-rw-r--r--scripts/recordmcount.h3
-rwxr-xr-xscripts/tags.sh43
32 files changed, 220 insertions, 281 deletions
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index ee58cde8ee3b..73e80b917f12 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -79,8 +79,8 @@ endef
79# would try to directly execute the shell builtin 'command'. This workaround 79# would try to directly execute the shell builtin 'command'. This workaround
80# should be kept for a long time since this issue was fixed only after the 80# should be kept for a long time since this issue was fixed only after the
81# GNU Make 4.2.1 release. 81# GNU Make 4.2.1 release.
82cc-cross-prefix = $(firstword $(foreach c, $(filter-out -%, $(1)), \ 82cc-cross-prefix = $(firstword $(foreach c, $(1), \
83 $(if $(shell command -v $(c)gcc 2>/dev/null), $(c)))) 83 $(if $(shell command -v -- $(c)gcc 2>/dev/null), $(c))))
84 84
85# output directory for tests below 85# output directory for tests below
86TMPOUT := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/) 86TMPOUT := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/)
@@ -187,12 +187,6 @@ dtbinst := -f $(srctree)/scripts/Makefile.dtbinst obj
187# $(Q)$(MAKE) $(clean)=dir 187# $(Q)$(MAKE) $(clean)=dir
188clean := -f $(srctree)/scripts/Makefile.clean obj 188clean := -f $(srctree)/scripts/Makefile.clean obj
189 189
190###
191# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.headersinst obj=
192# Usage:
193# $(Q)$(MAKE) $(hdr-inst)=dir
194hdr-inst := -f $(srctree)/scripts/Makefile.headersinst obj
195
196# echo command. 190# echo command.
197# Short version is used, if $(quiet) equals `quiet_', otherwise full one. 191# Short version is used, if $(quiet) equals `quiet_', otherwise full one.
198echo-cmd = $(if $($(quiet)cmd_$(1)),\ 192echo-cmd = $(if $($(quiet)cmd_$(1)),\
@@ -213,12 +207,12 @@ objectify = $(foreach o,$(1),$(if $(filter /%,$(o)),$(o),$(obj)/$(o)))
213# See Documentation/kbuild/makefiles.rst for more info 207# See Documentation/kbuild/makefiles.rst for more info
214 208
215ifneq ($(KBUILD_NOCMDDEP),1) 209ifneq ($(KBUILD_NOCMDDEP),1)
216# Check if both arguments are the same including their order. Result is empty 210# Check if both commands are the same including their order. Result is empty
217# string if equal. User may override this check using make KBUILD_NOCMDDEP=1 211# string if equal. User may override this check using make KBUILD_NOCMDDEP=1
218arg-check = $(filter-out $(subst $(space),$(space_escape),$(strip $(cmd_$@))), \ 212cmd-check = $(filter-out $(subst $(space),$(space_escape),$(strip $(cmd_$@))), \
219 $(subst $(space),$(space_escape),$(strip $(cmd_$1)))) 213 $(subst $(space),$(space_escape),$(strip $(cmd_$1))))
220else 214else
221arg-check = $(if $(strip $(cmd_$@)),,1) 215cmd-check = $(if $(strip $(cmd_$@)),,1)
222endif 216endif
223 217
224# Replace >$< with >$$< to preserve $ when reloading the .cmd file 218# Replace >$< with >$$< to preserve $ when reloading the .cmd file
@@ -231,15 +225,15 @@ make-cmd = $(call escsq,$(subst $(pound),$$(pound),$(subst $$,$$$$,$(cmd_$(1))))
231 225
232# Find any prerequisites that is newer than target or that does not exist. 226# Find any prerequisites that is newer than target or that does not exist.
233# PHONY targets skipped in both cases. 227# PHONY targets skipped in both cases.
234any-prereq = $(filter-out $(PHONY),$?) $(filter-out $(PHONY) $(wildcard $^),$^) 228any-prereq = $(filter-out $(PHONY),$?)$(filter-out $(PHONY) $(wildcard $^),$^)
235 229
236# Execute command if command has changed or prerequisite(s) are updated. 230# Execute command if command has changed or prerequisite(s) are updated.
237if_changed = $(if $(strip $(any-prereq) $(arg-check)), \ 231if_changed = $(if $(any-prereq)$(cmd-check), \
238 $(cmd); \ 232 $(cmd); \
239 printf '%s\n' 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd, @:) 233 printf '%s\n' 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd, @:)
240 234
241# Execute the command and also postprocess generated .d dependencies file. 235# Execute the command and also postprocess generated .d dependencies file.
242if_changed_dep = $(if $(strip $(any-prereq) $(arg-check)),$(cmd_and_fixdep),@:) 236if_changed_dep = $(if $(any-prereq)$(cmd-check),$(cmd_and_fixdep),@:)
243 237
244cmd_and_fixdep = \ 238cmd_and_fixdep = \
245 $(cmd); \ 239 $(cmd); \
@@ -249,7 +243,7 @@ cmd_and_fixdep = \
249# Usage: $(call if_changed_rule,foo) 243# Usage: $(call if_changed_rule,foo)
250# Will check if $(cmd_foo) or any of the prerequisites changed, 244# Will check if $(cmd_foo) or any of the prerequisites changed,
251# and if so will execute $(rule_foo). 245# and if so will execute $(rule_foo).
252if_changed_rule = $(if $(strip $(any-prereq) $(arg-check)),$(rule_$(1)),@:) 246if_changed_rule = $(if $(any-prereq)$(cmd-check),$(rule_$(1)),@:)
253 247
254### 248###
255# why - tell why a target got built 249# why - tell why a target got built
@@ -274,8 +268,8 @@ ifeq ($(KBUILD_VERBOSE),2)
274why = \ 268why = \
275 $(if $(filter $@, $(PHONY)),- due to target is PHONY, \ 269 $(if $(filter $@, $(PHONY)),- due to target is PHONY, \
276 $(if $(wildcard $@), \ 270 $(if $(wildcard $@), \
277 $(if $(strip $(any-prereq)),- due to: $(any-prereq), \ 271 $(if $(any-prereq),- due to: $(any-prereq), \
278 $(if $(arg-check), \ 272 $(if $(cmd-check), \
279 $(if $(cmd_$@),- due to command line change, \ 273 $(if $(cmd_$@),- due to command line change, \
280 $(if $(filter $@, $(targets)), \ 274 $(if $(filter $@, $(targets)), \
281 - due to missing .cmd file, \ 275 - due to missing .cmd file, \
diff --git a/scripts/Makefile b/scripts/Makefile
index 9d442ee050bd..16bcb8087899 100644
--- a/scripts/Makefile
+++ b/scripts/Makefile
@@ -31,11 +31,6 @@ always := $(hostprogs-y) $(hostprogs-m)
31# The following hostprogs-y programs are only build on demand 31# The following hostprogs-y programs are only build on demand
32hostprogs-y += unifdef 32hostprogs-y += unifdef
33 33
34# These targets are used internally to avoid "is up to date" messages
35PHONY += build_unifdef
36build_unifdef: $(obj)/unifdef
37 @:
38
39subdir-$(CONFIG_GCC_PLUGINS) += gcc-plugins 34subdir-$(CONFIG_GCC_PLUGINS) += gcc-plugins
40subdir-$(CONFIG_MODVERSIONS) += genksyms 35subdir-$(CONFIG_MODVERSIONS) += genksyms
41subdir-$(CONFIG_SECURITY_SELINUX) += selinux 36subdir-$(CONFIG_SECURITY_SELINUX) += selinux
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index ae9cf740633e..be38198d98b2 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -294,6 +294,15 @@ quiet_cmd_cc_lst_c = MKLST $@
294$(obj)/%.lst: $(src)/%.c FORCE 294$(obj)/%.lst: $(src)/%.c FORCE
295 $(call if_changed_dep,cc_lst_c) 295 $(call if_changed_dep,cc_lst_c)
296 296
297# header test (header-test-y target)
298# ---------------------------------------------------------------------------
299
300quiet_cmd_cc_s_h = CC $@
301 cmd_cc_s_h = $(CC) $(c_flags) -S -o $@ -x c /dev/null -include $<
302
303$(obj)/%.h.s: $(src)/%.h FORCE
304 $(call if_changed_dep,cc_s_h)
305
297# Compile assembler sources (.S) 306# Compile assembler sources (.S)
298# --------------------------------------------------------------------------- 307# ---------------------------------------------------------------------------
299 308
@@ -504,7 +513,7 @@ existing-targets := $(wildcard $(sort $(targets)))
504 513
505-include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd) 514-include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd)
506 515
507ifneq ($(srctree),.) 516ifdef building_out_of_srctree
508# Create directories for object files if they do not exist 517# Create directories for object files if they do not exist
509obj-dirs := $(sort $(obj) $(patsubst %/,%, $(dir $(targets)))) 518obj-dirs := $(sort $(obj) $(patsubst %/,%, $(dir $(targets))))
510# If targets exist, their directories apparently exist. Skip mkdir. 519# If targets exist, their directories apparently exist. Skip mkdir.
diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
index 3ab8d1a303cd..a74ce2e3c33e 100644
--- a/scripts/Makefile.extrawarn
+++ b/scripts/Makefile.extrawarn
@@ -34,7 +34,6 @@ warning-1 += $(call cc-option, -Wstringop-truncation)
34warning-1 += -Wno-missing-field-initializers 34warning-1 += -Wno-missing-field-initializers
35warning-1 += -Wno-sign-compare 35warning-1 += -Wno-sign-compare
36 36
37warning-2 := -Waggregate-return
38warning-2 += -Wcast-align 37warning-2 += -Wcast-align
39warning-2 += -Wdisabled-optimization 38warning-2 += -Wdisabled-optimization
40warning-2 += -Wnested-externs 39warning-2 += -Wnested-externs
@@ -68,10 +67,8 @@ else
68 67
69ifdef CONFIG_CC_IS_CLANG 68ifdef CONFIG_CC_IS_CLANG
70KBUILD_CFLAGS += -Wno-initializer-overrides 69KBUILD_CFLAGS += -Wno-initializer-overrides
71KBUILD_CFLAGS += -Wno-unused-value
72KBUILD_CFLAGS += -Wno-format 70KBUILD_CFLAGS += -Wno-format
73KBUILD_CFLAGS += -Wno-sign-compare 71KBUILD_CFLAGS += -Wno-sign-compare
74KBUILD_CFLAGS += -Wno-format-zero-length 72KBUILD_CFLAGS += -Wno-format-zero-length
75KBUILD_CFLAGS += -Wno-uninitialized
76endif 73endif
77endif 74endif
diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst
index 3d1ebaabd1b6..1b405a7ed14f 100644
--- a/scripts/Makefile.headersinst
+++ b/scripts/Makefile.headersinst
@@ -14,109 +14,89 @@ __headers:
14 14
15include scripts/Kbuild.include 15include scripts/Kbuild.include
16 16
17srcdir := $(srctree)/$(obj) 17src := $(srctree)/$(obj)
18gen := $(objtree)/$(subst include/,include/generated/,$(obj))
19dst := usr/include
18 20
19# When make is run under a fakechroot environment, the function 21-include $(src)/Kbuild
20# $(wildcard $(srcdir)/*/.) doesn't only return directories, but also regular
21# files. So, we are using a combination of sort/dir/wildcard which works
22# with fakechroot.
23subdirs := $(patsubst $(srcdir)/%/,%,\
24 $(filter-out $(srcdir)/,\
25 $(sort $(dir $(wildcard $(srcdir)/*/)))))
26 22
27# Recursion 23# $(filter %/, ...) is a workaround for GNU Make <= 4.2.1, where
28__headers: $(subdirs) 24# $(wildcard $(src)/*/) contains not only directories but also regular files.
25src-subdirs := $(patsubst $(src)/%/,%,$(filter %/, $(wildcard $(src)/*/)))
26gen-subdirs := $(patsubst $(gen)/%/,%,$(filter %/, $(wildcard $(gen)/*/)))
27all-subdirs := $(sort $(src-subdirs) $(gen-subdirs))
29 28
30PHONY += $(subdirs) 29src-headers := $(if $(src-subdirs), $(shell cd $(src) && find $(src-subdirs) -name '*.h'))
31$(subdirs): 30src-headers := $(filter-out $(no-export-headers), $(src-headers))
32 $(Q)$(MAKE) $(hdr-inst)=$(obj)/$@ dst=$(dst)/$@ 31gen-headers := $(if $(gen-subdirs), $(shell cd $(gen) && find $(gen-subdirs) -name '*.h'))
32gen-headers := $(filter-out $(no-export-headers), $(gen-headers))
33 33
34# Skip header install/check for include/uapi and arch/$(SRCARCH)/include/uapi. 34# If the same header is exported from source and generated directories,
35# We have only sub-directories there. 35# the former takes precedence, but this should be warned.
36skip-inst := $(if $(filter %/uapi,$(obj)),1) 36duplicated := $(filter $(gen-headers), $(src-headers))
37$(if $(duplicated), $(warning duplicated header export: $(duplicated)))
37 38
38ifeq ($(skip-inst),) 39gen-headers := $(filter-out $(duplicated), $(gen-headers))
39 40
40# Kbuild file is optional 41# Add dst path prefix
41kbuild-file := $(srctree)/$(obj)/Kbuild 42all-subdirs := $(addprefix $(dst)/, $(all-subdirs))
42-include $(kbuild-file) 43src-headers := $(addprefix $(dst)/, $(src-headers))
44gen-headers := $(addprefix $(dst)/, $(gen-headers))
45all-headers := $(src-headers) $(gen-headers)
43 46
44installdir := $(INSTALL_HDR_PATH)/$(dst) 47# Work out what needs to be removed
45gendir := $(objtree)/$(subst include/,include/generated/,$(obj)) 48old-subdirs := $(wildcard $(all-subdirs))
46header-files := $(notdir $(wildcard $(srcdir)/*.h)) 49old-headers := $(if $(old-subdirs),$(shell find $(old-subdirs) -name '*.h'))
47header-files := $(filter-out $(no-export-headers), $(header-files)) 50unwanted := $(filter-out $(all-headers), $(old-headers))
48genhdr-files := $(notdir $(wildcard $(gendir)/*.h))
49genhdr-files := $(filter-out $(header-files), $(genhdr-files))
50 51
51# files used to track state of install/check 52# Create directories
52install-file := $(installdir)/.install 53existing-dirs := $(sort $(dir $(old-headers)))
53check-file := $(installdir)/.check 54wanted-dirs := $(sort $(dir $(all-headers)))
55new-dirs := $(filter-out $(existing-dirs), $(wanted-dirs))
56$(if $(new-dirs), $(shell mkdir -p $(new-dirs)))
54 57
55# all headers files for this dir 58# Rules
56all-files := $(header-files) $(genhdr-files)
57output-files := $(addprefix $(installdir)/, $(all-files))
58 59
59# Work out what needs to be removed 60ifndef HDRCHECK
60oldheaders := $(patsubst $(installdir)/%,%,$(wildcard $(installdir)/*.h))
61unwanted := $(filter-out $(all-files),$(oldheaders))
62 61
63# Prefix unwanted with full paths to $(INSTALL_HDR_PATH) 62quiet_cmd_install = HDRINST $@
64unwanted-file := $(addprefix $(installdir)/, $(unwanted)) 63 cmd_install = $(CONFIG_SHELL) $(srctree)/scripts/headers_install.sh $< $@
65 64
66printdir = $(patsubst $(INSTALL_HDR_PATH)/%/,%,$(dir $@)) 65$(src-headers): $(dst)/%.h: $(src)/%.h $(srctree)/scripts/headers_install.sh FORCE
66 $(call if_changed,install)
67 67
68quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\ 68$(gen-headers): $(dst)/%.h: $(gen)/%.h $(srctree)/scripts/headers_install.sh FORCE
69 file$(if $(word 2, $(all-files)),s)) 69 $(call if_changed,install)
70 cmd_install = \
71 $(CONFIG_SHELL) $< $(installdir) $(srcdir) $(header-files); \
72 $(CONFIG_SHELL) $< $(installdir) $(gendir) $(genhdr-files); \
73 touch $@
74 70
75quiet_cmd_remove = REMOVE $(unwanted) 71quiet_cmd_remove = REMOVE $(unwanted)
76 cmd_remove = rm -f $(unwanted-file) 72 cmd_remove = rm -f $(unwanted)
77
78quiet_cmd_check = CHECK $(printdir) ($(words $(all-files)) files)
79# Headers list can be pretty long, xargs helps to avoid
80# the "Argument list too long" error.
81 cmd_check = for f in $(all-files); do \
82 echo "$(installdir)/$${f}"; done \
83 | xargs \
84 $(PERL) $< $(INSTALL_HDR_PATH)/include $(SRCARCH); \
85 touch $@
86 73
87ifndef HDRCHECK 74__headers: $(all-headers)
88# Rules for installing headers 75ifneq ($(unwanted),)
89__headers: $(install-file) 76 $(call cmd,remove)
77endif
90 @: 78 @:
91 79
92targets += $(install-file) 80existing-headers := $(filter $(old-headers), $(all-headers))
93$(install-file): scripts/headers_install.sh \ 81
94 $(addprefix $(srcdir)/,$(header-files)) \ 82-include $(foreach f,$(existing-headers),$(dir $(f)).$(notdir $(f)).cmd)
95 $(addprefix $(gendir)/,$(genhdr-files)) FORCE
96 $(if $(unwanted),$(call cmd,remove),)
97 $(if $(wildcard $(dir $@)),,$(shell mkdir -p $(dir $@)))
98 $(call if_changed,install)
99 83
100else 84else
101__headers: $(check-file)
102 @:
103 85
104targets += $(check-file) 86quiet_cmd_check = HDRCHK $<
105$(check-file): scripts/headers_check.pl $(output-files) FORCE 87 cmd_check = $(PERL) $(srctree)/scripts/headers_check.pl $(dst) $(SRCARCH) $<; touch $@
106 $(call if_changed,check)
107 88
108endif 89check-files := $(addsuffix .chk, $(all-headers))
109 90
110cmd_files := $(wildcard \ 91$(check-files): $(dst)/%.chk : $(dst)/% $(srctree)/scripts/headers_check.pl
111 $(foreach f,$(sort $(targets)),$(dir $(f)).$(notdir $(f)).cmd)) 92 $(call cmd,check)
112 93
113ifneq ($(cmd_files),) 94__headers: $(check-files)
114 include $(cmd_files) 95 @:
115endif
116 96
117endif # skip-inst 97endif
118 98
119PHONY += FORCE 99PHONY += FORCE
120FORCE: ; 100FORCE:
121 101
122.PHONY: $(PHONY) 102.PHONY: $(PHONY)
diff --git a/scripts/Makefile.host b/scripts/Makefile.host
index a316d368b697..2208ebbd8c4c 100644
--- a/scripts/Makefile.host
+++ b/scripts/Makefile.host
@@ -69,7 +69,7 @@ _hostcxx_flags = $(KBUILD_HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) \
69 69
70# $(objtree)/$(obj) for including generated headers from checkin source files 70# $(objtree)/$(obj) for including generated headers from checkin source files
71ifeq ($(KBUILD_EXTMOD),) 71ifeq ($(KBUILD_EXTMOD),)
72ifneq ($(srctree),.) 72ifdef building_out_of_srctree
73_hostc_flags += -I $(objtree)/$(obj) 73_hostc_flags += -I $(objtree)/$(obj)
74_hostcxx_flags += -I $(objtree)/$(obj) 74_hostcxx_flags += -I $(objtree)/$(obj)
75endif 75endif
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index f1f38c8cdc74..6cb3aa5cbc79 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -66,6 +66,20 @@ extra-y += $(patsubst %.dtb,%.dt.yaml, $(dtb-y))
66extra-$(CONFIG_OF_ALL_DTBS) += $(patsubst %.dtb,%.dt.yaml, $(dtb-)) 66extra-$(CONFIG_OF_ALL_DTBS) += $(patsubst %.dtb,%.dt.yaml, $(dtb-))
67endif 67endif
68 68
69# Test self-contained headers
70
71# Wildcard searches in $(srctree)/$(src)/, but not in $(objtree)/$(obj)/.
72# Stale generated headers are often left over, so pattern matching should
73# be avoided. Please notice $(srctree)/$(src)/ and $(objtree)/$(obj) point
74# to the same location for in-tree building. So, header-test-pattern-y should
75# be used with care.
76header-test-y += $(filter-out $(header-test-), \
77 $(patsubst $(srctree)/$(src)/%, %, \
78 $(wildcard $(addprefix $(srctree)/$(src)/, \
79 $(header-test-pattern-y)))))
80
81extra-$(CONFIG_HEADER_TEST) += $(addsuffix .s, $(header-test-y))
82
69# Add subdir path 83# Add subdir path
70 84
71extra-y := $(addprefix $(obj)/,$(extra-y)) 85extra-y := $(addprefix $(obj)/,$(extra-y))
@@ -140,7 +154,7 @@ endif
140# $(srctree)/$(src) for including checkin headers from generated source files 154# $(srctree)/$(src) for including checkin headers from generated source files
141# $(objtree)/$(obj) for including generated headers from checkin source files 155# $(objtree)/$(obj) for including generated headers from checkin source files
142ifeq ($(KBUILD_EXTMOD),) 156ifeq ($(KBUILD_EXTMOD),)
143ifneq ($(srctree),.) 157ifdef building_out_of_srctree
144_c_flags += -I $(srctree)/$(src) -I $(objtree)/$(obj) 158_c_flags += -I $(srctree)/$(src) -I $(objtree)/$(obj)
145_a_flags += -I $(srctree)/$(src) -I $(objtree)/$(obj) 159_a_flags += -I $(srctree)/$(src) -I $(objtree)/$(obj)
146_cpp_flags += -I $(srctree)/$(src) -I $(objtree)/$(obj) 160_cpp_flags += -I $(srctree)/$(src) -I $(objtree)/$(obj)
@@ -331,19 +345,19 @@ printf "%08x\n" $$dec_size | \
331) 345)
332 346
333quiet_cmd_bzip2 = BZIP2 $@ 347quiet_cmd_bzip2 = BZIP2 $@
334 cmd_bzip2 = { cat $(real-prereqs) | bzip2 -9 && $(size_append); } > $@ 348 cmd_bzip2 = { cat $(real-prereqs) | bzip2 -9; $(size_append); } > $@
335 349
336# Lzma 350# Lzma
337# --------------------------------------------------------------------------- 351# ---------------------------------------------------------------------------
338 352
339quiet_cmd_lzma = LZMA $@ 353quiet_cmd_lzma = LZMA $@
340 cmd_lzma = { cat $(real-prereqs) | lzma -9 && $(size_append); } > $@ 354 cmd_lzma = { cat $(real-prereqs) | lzma -9; $(size_append); } > $@
341 355
342quiet_cmd_lzo = LZO $@ 356quiet_cmd_lzo = LZO $@
343 cmd_lzo = { cat $(real-prereqs) | lzop -9 && $(size_append); } > $@ 357 cmd_lzo = { cat $(real-prereqs) | lzop -9; $(size_append); } > $@
344 358
345quiet_cmd_lz4 = LZ4 $@ 359quiet_cmd_lz4 = LZ4 $@
346 cmd_lz4 = { cat $(real-prereqs) | lz4c -l -c1 stdin stdout && \ 360 cmd_lz4 = { cat $(real-prereqs) | lz4c -l -c1 stdin stdout; \
347 $(size_append); } > $@ 361 $(size_append); } > $@
348 362
349# U-Boot mkimage 363# U-Boot mkimage
@@ -386,7 +400,7 @@ quiet_cmd_uimage = UIMAGE $@
386# big dictionary would increase the memory usage too much in the multi-call 400# big dictionary would increase the memory usage too much in the multi-call
387# decompression mode. A BCJ filter isn't used either. 401# decompression mode. A BCJ filter isn't used either.
388quiet_cmd_xzkern = XZKERN $@ 402quiet_cmd_xzkern = XZKERN $@
389 cmd_xzkern = { cat $(real-prereqs) | sh $(srctree)/scripts/xz_wrap.sh && \ 403 cmd_xzkern = { cat $(real-prereqs) | sh $(srctree)/scripts/xz_wrap.sh; \
390 $(size_append); } > $@ 404 $(size_append); } > $@
391 405
392quiet_cmd_xzmisc = XZMISC $@ 406quiet_cmd_xzmisc = XZMISC $@
diff --git a/scripts/Makefile.modbuiltin b/scripts/Makefile.modbuiltin
index ea90a90b41a0..50a9990760f3 100644
--- a/scripts/Makefile.modbuiltin
+++ b/scripts/Makefile.modbuiltin
@@ -15,7 +15,7 @@ include include/config/tristate.conf
15 15
16include scripts/Kbuild.include 16include scripts/Kbuild.include
17 17
18ifneq ($(srctree),.) 18ifdef building_out_of_srctree
19# Create output directory if not already present 19# Create output directory if not already present
20_dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj)) 20_dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj))
21endif 21endif
diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c
index facbd603adf6..9ba47b0a47b9 100644
--- a/scripts/basic/fixdep.c
+++ b/scripts/basic/fixdep.c
@@ -99,6 +99,7 @@
99#include <unistd.h> 99#include <unistd.h>
100#include <fcntl.h> 100#include <fcntl.h>
101#include <string.h> 101#include <string.h>
102#include <stdarg.h>
102#include <stdlib.h> 103#include <stdlib.h>
103#include <stdio.h> 104#include <stdio.h>
104#include <ctype.h> 105#include <ctype.h>
@@ -110,13 +111,43 @@ static void usage(void)
110} 111}
111 112
112/* 113/*
114 * In the intended usage of this program, the stdout is redirected to .*.cmd
115 * files. The return value of printf() and putchar() must be checked to catch
116 * any error, e.g. "No space left on device".
117 */
118static void xprintf(const char *format, ...)
119{
120 va_list ap;
121 int ret;
122
123 va_start(ap, format);
124 ret = vprintf(format, ap);
125 if (ret < 0) {
126 perror("fixdep");
127 exit(1);
128 }
129 va_end(ap);
130}
131
132static void xputchar(int c)
133{
134 int ret;
135
136 ret = putchar(c);
137 if (ret == EOF) {
138 perror("fixdep");
139 exit(1);
140 }
141}
142
143/*
113 * Print out a dependency path from a symbol name 144 * Print out a dependency path from a symbol name
114 */ 145 */
115static void print_dep(const char *m, int slen, const char *dir) 146static void print_dep(const char *m, int slen, const char *dir)
116{ 147{
117 int c, prev_c = '/', i; 148 int c, prev_c = '/', i;
118 149
119 printf(" $(wildcard %s/", dir); 150 xprintf(" $(wildcard %s/", dir);
120 for (i = 0; i < slen; i++) { 151 for (i = 0; i < slen; i++) {
121 c = m[i]; 152 c = m[i];
122 if (c == '_') 153 if (c == '_')
@@ -124,10 +155,10 @@ static void print_dep(const char *m, int slen, const char *dir)
124 else 155 else
125 c = tolower(c); 156 c = tolower(c);
126 if (c != '/' || prev_c != '/') 157 if (c != '/' || prev_c != '/')
127 putchar(c); 158 xputchar(c);
128 prev_c = c; 159 prev_c = c;
129 } 160 }
130 printf(".h) \\\n"); 161 xprintf(".h) \\\n");
131} 162}
132 163
133struct item { 164struct item {
@@ -324,13 +355,13 @@ static void parse_dep_file(char *m, const char *target)
324 */ 355 */
325 if (!saw_any_target) { 356 if (!saw_any_target) {
326 saw_any_target = 1; 357 saw_any_target = 1;
327 printf("source_%s := %s\n\n", 358 xprintf("source_%s := %s\n\n",
328 target, m); 359 target, m);
329 printf("deps_%s := \\\n", target); 360 xprintf("deps_%s := \\\n", target);
330 } 361 }
331 is_first_dep = 0; 362 is_first_dep = 0;
332 } else { 363 } else {
333 printf(" %s \\\n", m); 364 xprintf(" %s \\\n", m);
334 } 365 }
335 366
336 buf = read_file(m); 367 buf = read_file(m);
@@ -353,8 +384,8 @@ static void parse_dep_file(char *m, const char *target)
353 exit(1); 384 exit(1);
354 } 385 }
355 386
356 printf("\n%s: $(deps_%s)\n\n", target, target); 387 xprintf("\n%s: $(deps_%s)\n\n", target, target);
357 printf("$(deps_%s):\n", target); 388 xprintf("$(deps_%s):\n", target);
358} 389}
359 390
360int main(int argc, char *argv[]) 391int main(int argc, char *argv[])
@@ -369,7 +400,7 @@ int main(int argc, char *argv[])
369 target = argv[2]; 400 target = argv[2];
370 cmdline = argv[3]; 401 cmdline = argv[3];
371 402
372 printf("cmd_%s := %s\n\n", target, cmdline); 403 xprintf("cmd_%s := %s\n\n", target, cmdline);
373 404
374 buf = read_file(depfile); 405 buf = read_file(depfile);
375 parse_dep_file(buf, target); 406 parse_dep_file(buf, target);
diff --git a/scripts/coccinelle/api/kstrdup.cocci b/scripts/coccinelle/api/kstrdup.cocci
index 888bf43df07e..19f2645e6076 100644
--- a/scripts/coccinelle/api/kstrdup.cocci
+++ b/scripts/coccinelle/api/kstrdup.cocci
@@ -77,7 +77,7 @@ p1 << r1.p1;
77p2 << r1.p2; 77p2 << r1.p2;
78@@ 78@@
79 79
80cocci.print_main("WARNING opportunity for kstrdep",p1) 80cocci.print_main("WARNING opportunity for kstrdup",p1)
81cocci.print_secs("strcpy",p2) 81cocci.print_secs("strcpy",p2)
82 82
83@script:python depends on org@ 83@script:python depends on org@
@@ -85,7 +85,7 @@ p1 << r2.p1;
85p2 << r2.p2; 85p2 << r2.p2;
86@@ 86@@
87 87
88cocci.print_main("WARNING opportunity for kstrdep",p1) 88cocci.print_main("WARNING opportunity for kstrdup",p1)
89cocci.print_secs("memcpy",p2) 89cocci.print_secs("memcpy",p2)
90 90
91@script:python depends on report@ 91@script:python depends on report@
@@ -93,7 +93,7 @@ p1 << r1.p1;
93p2 << r1.p2; 93p2 << r1.p2;
94@@ 94@@
95 95
96msg = "WARNING opportunity for kstrdep (strcpy on line %s)" % (p2[0].line) 96msg = "WARNING opportunity for kstrdup (strcpy on line %s)" % (p2[0].line)
97coccilib.report.print_report(p1[0], msg) 97coccilib.report.print_report(p1[0], msg)
98 98
99@script:python depends on report@ 99@script:python depends on report@
@@ -101,5 +101,5 @@ p1 << r2.p1;
101p2 << r2.p2; 101p2 << r2.p2;
102@@ 102@@
103 103
104msg = "WARNING opportunity for kstrdep (memcpy on line %s)" % (p2[0].line) 104msg = "WARNING opportunity for kstrdup (memcpy on line %s)" % (p2[0].line)
105coccilib.report.print_report(p1[0], msg) 105coccilib.report.print_report(p1[0], msg)
diff --git a/scripts/coccinelle/api/stream_open.cocci b/scripts/coccinelle/api/stream_open.cocci
index 350145da7669..12ce18fa6b74 100644
--- a/scripts/coccinelle/api/stream_open.cocci
+++ b/scripts/coccinelle/api/stream_open.cocci
@@ -35,11 +35,11 @@ type loff_t;
35// a function that blocks 35// a function that blocks
36@ blocks @ 36@ blocks @
37identifier block_f; 37identifier block_f;
38identifier wait_event =~ "^wait_event_.*"; 38identifier wait =~ "^wait_.*";
39@@ 39@@
40 block_f(...) { 40 block_f(...) {
41 ... when exists 41 ... when exists
42 wait_event(...) 42 wait(...)
43 ... when exists 43 ... when exists
44 } 44 }
45 45
@@ -49,12 +49,12 @@ identifier wait_event =~ "^wait_event_.*";
49// XXX currently reader_blocks supports only direct and 1-level indirect cases. 49// XXX currently reader_blocks supports only direct and 1-level indirect cases.
50@ reader_blocks_direct @ 50@ reader_blocks_direct @
51identifier stream_reader.readstream; 51identifier stream_reader.readstream;
52identifier wait_event =~ "^wait_event_.*"; 52identifier wait =~ "^wait_.*";
53@@ 53@@
54 readstream(...) 54 readstream(...)
55 { 55 {
56 ... when exists 56 ... when exists
57 wait_event(...) 57 wait(...)
58 ... when exists 58 ... when exists
59 } 59 }
60 60
diff --git a/scripts/coccinelle/free/put_device.cocci b/scripts/coccinelle/free/put_device.cocci
index c9f071b0a0ab..120921366e84 100644
--- a/scripts/coccinelle/free/put_device.cocci
+++ b/scripts/coccinelle/free/put_device.cocci
@@ -24,7 +24,7 @@ if (id == NULL || ...) { ... return ...; }
24 when != of_dev_put(id) 24 when != of_dev_put(id)
25 when != if (id) { ... put_device(&id->dev) ... } 25 when != if (id) { ... put_device(&id->dev) ... }
26 when != e1 = (T)id 26 when != e1 = (T)id
27 when != e1 = &id->dev 27 when != e1 = (T)(&id->dev)
28 when != e1 = get_device(&id->dev) 28 when != e1 = get_device(&id->dev)
29 when != e1 = (T1)platform_get_drvdata(id) 29 when != e1 = (T1)platform_get_drvdata(id)
30( 30(
@@ -42,11 +42,10 @@ p1 << search.p1;
42p2 << search.p2; 42p2 << search.p2;
43@@ 43@@
44 44
45coccilib.report.print_report(p2[0], "ERROR: missing put_device; " 45coccilib.report.print_report(p2[0],
46 + "call of_find_device_by_node on line " 46 "ERROR: missing put_device; call of_find_device_by_node on line "
47 + p1[0].line 47 + p1[0].line
48 + ", but without a corresponding object release " 48 + ", but without a corresponding object release within this function.")
49 + "within this function.")
50 49
51@script:python depends on org@ 50@script:python depends on org@
52p1 << search.p1; 51p1 << search.p1;
diff --git a/scripts/gdb/linux/Makefile b/scripts/gdb/linux/Makefile
index 9fd3d8ed731a..124755087510 100644
--- a/scripts/gdb/linux/Makefile
+++ b/scripts/gdb/linux/Makefile
@@ -1,6 +1,6 @@
1# SPDX-License-Identifier: GPL-2.0 1# SPDX-License-Identifier: GPL-2.0
2 2
3ifneq ($(srctree),.) 3ifdef building_out_of_srctree
4 4
5symlinks := $(patsubst $(srctree)/$(src)/%,%,$(wildcard $(srctree)/$(src)/*.py)) 5symlinks := $(patsubst $(srctree)/$(src)/%,%,$(wildcard $(srctree)/$(src)/*.py))
6 6
diff --git a/scripts/genksyms/keywords.c b/scripts/genksyms/keywords.c
index e93336baaaed..c586d32dd2c3 100644
--- a/scripts/genksyms/keywords.c
+++ b/scripts/genksyms/keywords.c
@@ -25,6 +25,10 @@ static struct resword {
25 { "__volatile__", VOLATILE_KEYW }, 25 { "__volatile__", VOLATILE_KEYW },
26 { "__builtin_va_list", VA_LIST_KEYW }, 26 { "__builtin_va_list", VA_LIST_KEYW },
27 27
28 { "__int128", BUILTIN_INT_KEYW },
29 { "__int128_t", BUILTIN_INT_KEYW },
30 { "__uint128_t", BUILTIN_INT_KEYW },
31
28 // According to rth, c99 defines "_Bool", __restrict", __restrict__", "restrict". KAO 32 // According to rth, c99 defines "_Bool", __restrict", __restrict__", "restrict". KAO
29 { "_Bool", BOOL_KEYW }, 33 { "_Bool", BOOL_KEYW },
30 { "_restrict", RESTRICT_KEYW }, 34 { "_restrict", RESTRICT_KEYW },
diff --git a/scripts/genksyms/parse.y b/scripts/genksyms/parse.y
index 00a6d7e54971..1ebcf52cd0f9 100644
--- a/scripts/genksyms/parse.y
+++ b/scripts/genksyms/parse.y
@@ -76,6 +76,7 @@ static void record_compound(struct string_list **keyw,
76%token ATTRIBUTE_KEYW 76%token ATTRIBUTE_KEYW
77%token AUTO_KEYW 77%token AUTO_KEYW
78%token BOOL_KEYW 78%token BOOL_KEYW
79%token BUILTIN_INT_KEYW
79%token CHAR_KEYW 80%token CHAR_KEYW
80%token CONST_KEYW 81%token CONST_KEYW
81%token DOUBLE_KEYW 82%token DOUBLE_KEYW
@@ -263,6 +264,7 @@ simple_type_specifier:
263 | VOID_KEYW 264 | VOID_KEYW
264 | BOOL_KEYW 265 | BOOL_KEYW
265 | VA_LIST_KEYW 266 | VA_LIST_KEYW
267 | BUILTIN_INT_KEYW
266 | TYPE { (*$1)->tag = SYM_TYPEDEF; $$ = $1; } 268 | TYPE { (*$1)->tag = SYM_TYPEDEF; $$ = $1; }
267 ; 269 ;
268 270
diff --git a/scripts/headers.sh b/scripts/headers.sh
deleted file mode 100755
index e0f883eb39a2..000000000000
--- a/scripts/headers.sh
+++ /dev/null
@@ -1,29 +0,0 @@
1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0
3# Run headers_$1 command for all suitable architectures
4
5# Stop on error
6set -e
7
8do_command()
9{
10 if [ -f ${srctree}/arch/$2/include/asm/Kbuild ]; then
11 make ARCH=$2 KBUILD_HEADERS=$1 headers_$1
12 else
13 printf "Ignoring arch: %s\n" ${arch}
14 fi
15}
16
17archs=${HDR_ARCH_LIST:-$(ls ${srctree}/arch)}
18
19for arch in ${archs}; do
20 case ${arch} in
21 um) # no userspace export
22 ;;
23 *)
24 if [ -d ${srctree}/arch/${arch} ]; then
25 do_command $1 ${arch}
26 fi
27 ;;
28 esac
29done
diff --git a/scripts/headers_install.sh b/scripts/headers_install.sh
index 593f8879c641..47f6f3ea0771 100755
--- a/scripts/headers_install.sh
+++ b/scripts/headers_install.sh
@@ -1,47 +1,39 @@
1#!/bin/sh 1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0 2# SPDX-License-Identifier: GPL-2.0
3 3
4if [ $# -lt 2 ] 4if [ $# -ne 2 ]
5then 5then
6 echo "Usage: headers_install.sh OUTDIR SRCDIR [FILES...]" 6 echo "Usage: headers_install.sh INFILE OUTFILE"
7 echo 7 echo
8 echo "Prepares kernel header files for use by user space, by removing" 8 echo "Prepares kernel header files for use by user space, by removing"
9 echo "all compiler.h definitions and #includes, removing any" 9 echo "all compiler.h definitions and #includes, removing any"
10 echo "#ifdef __KERNEL__ sections, and putting __underscores__ around" 10 echo "#ifdef __KERNEL__ sections, and putting __underscores__ around"
11 echo "asm/inline/volatile keywords." 11 echo "asm/inline/volatile keywords."
12 echo 12 echo
13 echo "OUTDIR: directory to write each userspace header FILE to." 13 echo "INFILE: header file to operate on"
14 echo "SRCDIR: source directory where files are picked." 14 echo "OUTFILE: output file which the processed header is writen to"
15 echo "FILES: list of header files to operate on."
16 15
17 exit 1 16 exit 1
18fi 17fi
19 18
20# Grab arguments 19# Grab arguments
20INFILE=$1
21OUTFILE=$2
22TMPFILE=$OUTFILE.tmp
21 23
22OUTDIR="$1" 24trap 'rm -f $OUTFILE $TMPFILE' EXIT
23shift
24SRCDIR="$1"
25shift
26 25
27# Iterate through files listed on command line 26sed -E -e '
27 s/([[:space:](])(__user|__force|__iomem)[[:space:]]/\1/g
28 s/__attribute_const__([[:space:]]|$)/\1/g
29 s@^#include <linux/compiler(|_types).h>@@
30 s/(^|[^a-zA-Z0-9])__packed([^a-zA-Z0-9_]|$)/\1__attribute__((packed))\2/g
31 s/(^|[[:space:](])(inline|asm|volatile)([[:space:](]|$)/\1__\2__\3/g
32 s@#(ifndef|define|endif[[:space:]]*/[*])[[:space:]]*_UAPI@#\1 @
33' $INFILE > $TMPFILE || exit 1
28 34
29FILE= 35scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__ $TMPFILE > $OUTFILE
30trap 'rm -f "$OUTDIR/$FILE" "$OUTDIR/$FILE.sed"' EXIT 36[ $? -gt 1 ] && exit 1
31for i in "$@" 37
32do 38rm -f $TMPFILE
33 FILE="$(basename "$i")"
34 sed -E \
35 -e 's/([[:space:](])(__user|__force|__iomem)[[:space:]]/\1/g' \
36 -e 's/__attribute_const__([[:space:]]|$)/\1/g' \
37 -e 's@^#include <linux/compiler(|_types).h>@@' \
38 -e 's/(^|[^a-zA-Z0-9])__packed([^a-zA-Z0-9_]|$)/\1__attribute__((packed))\2/g' \
39 -e 's/(^|[[:space:](])(inline|asm|volatile)([[:space:](]|$)/\1__\2__\3/g' \
40 -e 's@#(ifndef|define|endif[[:space:]]*/[*])[[:space:]]*_UAPI@#\1 @' \
41 "$SRCDIR/$i" > "$OUTDIR/$FILE.sed" || exit 1
42 scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__ "$OUTDIR/$FILE.sed" \
43 > "$OUTDIR/$FILE"
44 [ $? -gt 1 ] && exit 1
45 rm -f "$OUTDIR/$FILE.sed"
46done
47trap - EXIT 39trap - EXIT
diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
index e17837f1d3f2..ae6504d07fd6 100644
--- a/scripts/kallsyms.c
+++ b/scripts/kallsyms.c
@@ -150,6 +150,9 @@ static int read_symbol(FILE *in, struct sym_entry *s)
150 /* exclude debugging symbols */ 150 /* exclude debugging symbols */
151 else if (stype == 'N' || stype == 'n') 151 else if (stype == 'N' || stype == 'n')
152 return -1; 152 return -1;
153 /* exclude s390 kasan local symbols */
154 else if (!strncmp(sym, ".LASANPC", 8))
155 return -1;
153 156
154 /* include the type field in the symbol name, so that it gets 157 /* include the type field in the symbol name, so that it gets
155 * compressed together */ 158 * compressed together */
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 3f327e21f60e..ab30fe724c43 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -12,6 +12,10 @@ else
12Kconfig := Kconfig 12Kconfig := Kconfig
13endif 13endif
14 14
15ifndef KBUILD_DEFCONFIG
16KBUILD_DEFCONFIG := defconfig
17endif
18
15ifeq ($(quiet),silent_) 19ifeq ($(quiet),silent_)
16silent := -s 20silent := -s
17endif 21endif
@@ -74,9 +78,7 @@ savedefconfig: $(obj)/conf
74 $< $(silent) --$@=defconfig $(Kconfig) 78 $< $(silent) --$@=defconfig $(Kconfig)
75 79
76defconfig: $(obj)/conf 80defconfig: $(obj)/conf
77ifeq ($(KBUILD_DEFCONFIG),) 81ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG)),)
78 $< $(silent) --defconfig $(Kconfig)
79else ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG)),)
80 @$(kecho) "*** Default configuration is based on '$(KBUILD_DEFCONFIG)'" 82 @$(kecho) "*** Default configuration is based on '$(KBUILD_DEFCONFIG)'"
81 $(Q)$< $(silent) --defconfig=arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) $(Kconfig) 83 $(Q)$< $(silent) --defconfig=arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) $(Kconfig)
82else 84else
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index ef3678c24bab..40e16e871ae2 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -90,7 +90,7 @@ static int conf_askvalue(struct symbol *sym, const char *def)
90 line[0] = '\n'; 90 line[0] = '\n';
91 line[1] = 0; 91 line[1] = 0;
92 92
93 if (!sym_is_changable(sym)) { 93 if (!sym_is_changeable(sym)) {
94 printf("%s\n", def); 94 printf("%s\n", def);
95 line[0] = '\n'; 95 line[0] = '\n';
96 line[1] = 0; 96 line[1] = 0;
@@ -234,7 +234,7 @@ static int conf_choice(struct menu *menu)
234 234
235 sym = menu->sym; 235 sym = menu->sym;
236 is_new = !sym_has_value(sym); 236 is_new = !sym_has_value(sym);
237 if (sym_is_changable(sym)) { 237 if (sym_is_changeable(sym)) {
238 conf_sym(menu); 238 conf_sym(menu);
239 sym_calc_value(sym); 239 sym_calc_value(sym);
240 switch (sym_get_tristate_value(sym)) { 240 switch (sym_get_tristate_value(sym)) {
@@ -418,7 +418,7 @@ static void check_conf(struct menu *menu)
418 418
419 sym = menu->sym; 419 sym = menu->sym;
420 if (sym && !sym_has_value(sym)) { 420 if (sym && !sym_has_value(sym)) {
421 if (sym_is_changable(sym) || 421 if (sym_is_changeable(sym) ||
422 (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)) { 422 (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)) {
423 if (input_mode == listnewconfig) { 423 if (input_mode == listnewconfig) {
424 if (sym->name) { 424 if (sym->name) {
@@ -451,7 +451,7 @@ static struct option long_opts[] = {
451 {"oldaskconfig", no_argument, NULL, oldaskconfig}, 451 {"oldaskconfig", no_argument, NULL, oldaskconfig},
452 {"oldconfig", no_argument, NULL, oldconfig}, 452 {"oldconfig", no_argument, NULL, oldconfig},
453 {"syncconfig", no_argument, NULL, syncconfig}, 453 {"syncconfig", no_argument, NULL, syncconfig},
454 {"defconfig", optional_argument, NULL, defconfig}, 454 {"defconfig", required_argument, NULL, defconfig},
455 {"savedefconfig", required_argument, NULL, savedefconfig}, 455 {"savedefconfig", required_argument, NULL, savedefconfig},
456 {"allnoconfig", no_argument, NULL, allnoconfig}, 456 {"allnoconfig", no_argument, NULL, allnoconfig},
457 {"allyesconfig", no_argument, NULL, allyesconfig}, 457 {"allyesconfig", no_argument, NULL, allyesconfig},
@@ -562,8 +562,6 @@ int main(int ac, char **av)
562 562
563 switch (input_mode) { 563 switch (input_mode) {
564 case defconfig: 564 case defconfig:
565 if (!defconfig_file)
566 defconfig_file = conf_get_default_confname();
567 if (conf_read(defconfig_file)) { 565 if (conf_read(defconfig_file)) {
568 fprintf(stderr, 566 fprintf(stderr,
569 "***\n" 567 "***\n"
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 6006154d36bd..501fdcc5e999 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -177,8 +177,6 @@ static void conf_message(const char *fmt, ...)
177static const char *conf_filename; 177static const char *conf_filename;
178static int conf_lineno, conf_warnings; 178static int conf_lineno, conf_warnings;
179 179
180const char conf_defname[] = "arch/$(ARCH)/defconfig";
181
182static void conf_warning(const char *fmt, ...) 180static void conf_warning(const char *fmt, ...)
183{ 181{
184 va_list ap; 182 va_list ap;
@@ -233,21 +231,6 @@ static const char *conf_get_autoconfig_name(void)
233 return name ? name : "include/config/auto.conf"; 231 return name ? name : "include/config/auto.conf";
234} 232}
235 233
236char *conf_get_default_confname(void)
237{
238 static char fullname[PATH_MAX+1];
239 char *env, *name;
240
241 name = expand_string(conf_defname);
242 env = getenv(SRCTREE);
243 if (env) {
244 snprintf(fullname, sizeof(fullname), "%s/%s", env, name);
245 if (is_present(fullname))
246 return fullname;
247 }
248 return name;
249}
250
251static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p) 234static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p)
252{ 235{
253 char *p2; 236 char *p2;
@@ -551,11 +534,9 @@ int conf_read(const char *name)
551 switch (sym->type) { 534 switch (sym->type) {
552 case S_BOOLEAN: 535 case S_BOOLEAN:
553 case S_TRISTATE: 536 case S_TRISTATE:
554 if (sym->def[S_DEF_USER].tri != sym_get_tristate_value(sym)) 537 if (sym->def[S_DEF_USER].tri == sym_get_tristate_value(sym))
555 break;
556 if (!sym_is_choice(sym))
557 continue; 538 continue;
558 /* fall through */ 539 break;
559 default: 540 default:
560 if (!strcmp(sym->curr.val, sym->def[S_DEF_USER].val)) 541 if (!strcmp(sym->curr.val, sym->def[S_DEF_USER].val))
561 continue; 542 continue;
@@ -813,7 +794,7 @@ int conf_write_defconfig(const char *filename)
813 goto next_menu; 794 goto next_menu;
814 sym->flags &= ~SYMBOL_WRITE; 795 sym->flags &= ~SYMBOL_WRITE;
815 /* If we cannot change the symbol - skip */ 796 /* If we cannot change the symbol - skip */
816 if (!sym_is_changable(sym)) 797 if (!sym_is_changeable(sym))
817 goto next_menu; 798 goto next_menu;
818 /* If symbol equals to default value - skip */ 799 /* If symbol equals to default value - skip */
819 if (strcmp(sym_get_string_value(sym), sym_get_string_default(sym)) == 0) 800 if (strcmp(sym_get_string_value(sym), sym_get_string_default(sym)) == 0)
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h
index cbc7658ee27d..4fb16f316626 100644
--- a/scripts/kconfig/lkc.h
+++ b/scripts/kconfig/lkc.h
@@ -49,7 +49,6 @@ const char *zconf_curname(void);
49 49
50/* confdata.c */ 50/* confdata.c */
51const char *conf_get_configname(void); 51const char *conf_get_configname(void);
52char *conf_get_default_confname(void);
53void sym_set_change_count(int count); 52void sym_set_change_count(int count);
54void sym_add_change_count(int count); 53void sym_add_change_count(int count);
55bool conf_set_all_new_symbols(enum conf_def_mode mode); 54bool conf_set_all_new_symbols(enum conf_def_mode mode);
diff --git a/scripts/kconfig/lkc_proto.h b/scripts/kconfig/lkc_proto.h
index 86c267540ccc..f9ab98238aef 100644
--- a/scripts/kconfig/lkc_proto.h
+++ b/scripts/kconfig/lkc_proto.h
@@ -42,7 +42,7 @@ tristate sym_toggle_tristate_value(struct symbol *sym);
42bool sym_string_valid(struct symbol *sym, const char *newval); 42bool sym_string_valid(struct symbol *sym, const char *newval);
43bool sym_string_within_range(struct symbol *sym, const char *str); 43bool sym_string_within_range(struct symbol *sym, const char *str);
44bool sym_set_string_value(struct symbol *sym, const char *newval); 44bool sym_set_string_value(struct symbol *sym, const char *newval);
45bool sym_is_changable(struct symbol *sym); 45bool sym_is_changeable(struct symbol *sym);
46struct property * sym_get_choice_prop(struct symbol *sym); 46struct property * sym_get_choice_prop(struct symbol *sym);
47const char * sym_get_string_value(struct symbol *sym); 47const char * sym_get_string_value(struct symbol *sym);
48 48
@@ -58,7 +58,6 @@ void env_write_dep(FILE *f, const char *auto_conf_name);
58void variable_add(const char *name, const char *value, 58void variable_add(const char *name, const char *value,
59 enum variable_flavor flavor); 59 enum variable_flavor flavor);
60void variable_all_del(void); 60void variable_all_del(void);
61char *expand_string(const char *in);
62char *expand_dollar(const char **str); 61char *expand_dollar(const char **str);
63char *expand_one_token(const char **str); 62char *expand_one_token(const char **str);
64 63
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
index 694091f3ef9d..49c26ea9dd98 100644
--- a/scripts/kconfig/mconf.c
+++ b/scripts/kconfig/mconf.c
@@ -536,7 +536,7 @@ static void build_conf(struct menu *menu)
536 } 536 }
537 537
538 val = sym_get_tristate_value(sym); 538 val = sym_get_tristate_value(sym);
539 if (sym_is_changable(sym)) { 539 if (sym_is_changeable(sym)) {
540 switch (type) { 540 switch (type) {
541 case S_BOOLEAN: 541 case S_BOOLEAN:
542 item_make("[%c]", val == no ? ' ' : '*'); 542 item_make("[%c]", val == no ? ' ' : '*');
@@ -587,7 +587,7 @@ static void build_conf(struct menu *menu)
587 } else { 587 } else {
588 switch (type) { 588 switch (type) {
589 case S_BOOLEAN: 589 case S_BOOLEAN:
590 if (sym_is_changable(sym)) 590 if (sym_is_changeable(sym))
591 item_make("[%c]", val == no ? ' ' : '*'); 591 item_make("[%c]", val == no ? ' ' : '*');
592 else 592 else
593 item_make("-%c-", val == no ? ' ' : '*'); 593 item_make("-%c-", val == no ? ' ' : '*');
@@ -600,7 +600,7 @@ static void build_conf(struct menu *menu)
600 case mod: ch = 'M'; break; 600 case mod: ch = 'M'; break;
601 default: ch = ' '; break; 601 default: ch = ' '; break;
602 } 602 }
603 if (sym_is_changable(sym)) { 603 if (sym_is_changeable(sym)) {
604 if (sym->rev_dep.tri == mod) 604 if (sym->rev_dep.tri == mod)
605 item_make("{%c}", ch); 605 item_make("{%c}", ch);
606 else 606 else
@@ -617,7 +617,7 @@ static void build_conf(struct menu *menu)
617 if (tmp < 0) 617 if (tmp < 0)
618 tmp = 0; 618 tmp = 0;
619 item_add_str("%*c%s%s", tmp, ' ', menu_get_prompt(menu), 619 item_add_str("%*c%s%s", tmp, ' ', menu_get_prompt(menu),
620 (sym_has_value(sym) || !sym_is_changable(sym)) ? 620 (sym_has_value(sym) || !sym_is_changeable(sym)) ?
621 "" : " (NEW)"); 621 "" : " (NEW)");
622 item_set_tag('s'); 622 item_set_tag('s');
623 item_set_data(menu); 623 item_set_data(menu);
@@ -625,7 +625,7 @@ static void build_conf(struct menu *menu)
625 } 625 }
626 } 626 }
627 item_add_str("%*c%s%s", indent + 1, ' ', menu_get_prompt(menu), 627 item_add_str("%*c%s%s", indent + 1, ' ', menu_get_prompt(menu),
628 (sym_has_value(sym) || !sym_is_changable(sym)) ? 628 (sym_has_value(sym) || !sym_is_changeable(sym)) ?
629 "" : " (NEW)"); 629 "" : " (NEW)");
630 if (menu->prompt->type == P_MENU) { 630 if (menu->prompt->type == P_MENU) {
631 item_add_str(" %s", menu_is_empty(menu) ? "----" : "--->"); 631 item_add_str(" %s", menu_is_empty(menu) ? "----" : "--->");
diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c
index cbafe3bf082e..b7c1ef757178 100644
--- a/scripts/kconfig/nconf.c
+++ b/scripts/kconfig/nconf.c
@@ -803,7 +803,7 @@ static void build_conf(struct menu *menu)
803 } 803 }
804 804
805 val = sym_get_tristate_value(sym); 805 val = sym_get_tristate_value(sym);
806 if (sym_is_changable(sym)) { 806 if (sym_is_changeable(sym)) {
807 switch (type) { 807 switch (type) {
808 case S_BOOLEAN: 808 case S_BOOLEAN:
809 item_make(menu, 't', "[%c]", 809 item_make(menu, 't', "[%c]",
@@ -857,7 +857,7 @@ static void build_conf(struct menu *menu)
857 } else { 857 } else {
858 switch (type) { 858 switch (type) {
859 case S_BOOLEAN: 859 case S_BOOLEAN:
860 if (sym_is_changable(sym)) 860 if (sym_is_changeable(sym))
861 item_make(menu, 't', "[%c]", 861 item_make(menu, 't', "[%c]",
862 val == no ? ' ' : '*'); 862 val == no ? ' ' : '*');
863 else 863 else
@@ -876,7 +876,7 @@ static void build_conf(struct menu *menu)
876 ch = ' '; 876 ch = ' ';
877 break; 877 break;
878 } 878 }
879 if (sym_is_changable(sym)) { 879 if (sym_is_changeable(sym)) {
880 if (sym->rev_dep.tri == mod) 880 if (sym->rev_dep.tri == mod)
881 item_make(menu, 881 item_make(menu,
882 't', "{%c}", ch); 882 't', "{%c}", ch);
@@ -896,14 +896,14 @@ static void build_conf(struct menu *menu)
896 item_add_str("%*c%s%s", tmp, ' ', 896 item_add_str("%*c%s%s", tmp, ' ',
897 menu_get_prompt(menu), 897 menu_get_prompt(menu),
898 (sym_has_value(sym) || 898 (sym_has_value(sym) ||
899 !sym_is_changable(sym)) ? "" : 899 !sym_is_changeable(sym)) ? "" :
900 " (NEW)"); 900 " (NEW)");
901 goto conf_childs; 901 goto conf_childs;
902 } 902 }
903 } 903 }
904 item_add_str("%*c%s%s", indent + 1, ' ', 904 item_add_str("%*c%s%s", indent + 1, ' ',
905 menu_get_prompt(menu), 905 menu_get_prompt(menu),
906 (sym_has_value(sym) || !sym_is_changable(sym)) ? 906 (sym_has_value(sym) || !sym_is_changeable(sym)) ?
907 "" : " (NEW)"); 907 "" : " (NEW)");
908 if (menu->prompt && menu->prompt->type == P_MENU) { 908 if (menu->prompt && menu->prompt->type == P_MENU) {
909 item_add_str(" %s", menu_is_empty(menu) ? "----" : "--->"); 909 item_add_str(" %s", menu_is_empty(menu) ? "----" : "--->");
diff --git a/scripts/kconfig/preprocess.c b/scripts/kconfig/preprocess.c
index 592dfbfa9fb3..0243086fb168 100644
--- a/scripts/kconfig/preprocess.c
+++ b/scripts/kconfig/preprocess.c
@@ -15,6 +15,7 @@
15#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) 15#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
16 16
17static char *expand_string_with_args(const char *in, int argc, char *argv[]); 17static char *expand_string_with_args(const char *in, int argc, char *argv[]);
18static char *expand_string(const char *in);
18 19
19static void __attribute__((noreturn)) pperror(const char *format, ...) 20static void __attribute__((noreturn)) pperror(const char *format, ...)
20{ 21{
@@ -550,7 +551,7 @@ static char *expand_string_with_args(const char *in, int argc, char *argv[])
550 return __expand_string(&in, is_end_of_str, argc, argv); 551 return __expand_string(&in, is_end_of_str, argc, argv);
551} 552}
552 553
553char *expand_string(const char *in) 554static char *expand_string(const char *in)
554{ 555{
555 return expand_string_with_args(in, 0, NULL); 556 return expand_string_with_args(in, 0, NULL);
556} 557}
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index ce7fc87a49a7..82773cc35d35 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -152,7 +152,7 @@ void ConfigItem::updateMenu(void)
152 case S_TRISTATE: 152 case S_TRISTATE:
153 char ch; 153 char ch;
154 154
155 if (!sym_is_changable(sym) && list->optMode == normalOpt) { 155 if (!sym_is_changeable(sym) && list->optMode == normalOpt) {
156 setPixmap(promptColIdx, QIcon()); 156 setPixmap(promptColIdx, QIcon());
157 setText(noColIdx, QString::null); 157 setText(noColIdx, QString::null);
158 setText(modColIdx, QString::null); 158 setText(modColIdx, QString::null);
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index 09fd6fa18e1a..f56eec5ea4c7 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -785,7 +785,7 @@ const char *sym_get_string_value(struct symbol *sym)
785 return (const char *)sym->curr.val; 785 return (const char *)sym->curr.val;
786} 786}
787 787
788bool sym_is_changable(struct symbol *sym) 788bool sym_is_changeable(struct symbol *sym)
789{ 789{
790 return sym->visible > sym->rev_dep.tri; 790 return sym->visible > sym->rev_dep.tri;
791} 791}
diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index b03dd56a4782..e8ca6dc97e96 100755
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -130,7 +130,7 @@ if is_enabled CONFIG_MODULES; then
130fi 130fi
131 131
132if [ "$ARCH" != "um" ]; then 132if [ "$ARCH" != "um" ]; then
133 $MAKE -f $srctree/Makefile headers_check 133 $MAKE -f $srctree/Makefile headers
134 $MAKE -f $srctree/Makefile headers_install INSTALL_HDR_PATH="$libc_headers_dir/usr" 134 $MAKE -f $srctree/Makefile headers_install INSTALL_HDR_PATH="$libc_headers_dir/usr"
135fi 135fi
136 136
diff --git a/scripts/package/mkspec b/scripts/package/mkspec
index 009147d4718e..2d29df4a0a53 100755
--- a/scripts/package/mkspec
+++ b/scripts/package/mkspec
@@ -31,7 +31,7 @@ PROVIDES="$PROVIDES kernel-$KERNELRELEASE"
31__KERNELRELEASE=$(echo $KERNELRELEASE | sed -e "s/-/_/g") 31__KERNELRELEASE=$(echo $KERNELRELEASE | sed -e "s/-/_/g")
32EXCLUDES="$RCS_TAR_IGNORE --exclude=.tmp_versions --exclude=*vmlinux* \ 32EXCLUDES="$RCS_TAR_IGNORE --exclude=.tmp_versions --exclude=*vmlinux* \
33--exclude=*.o --exclude=*.ko --exclude=*.cmd --exclude=Documentation \ 33--exclude=*.o --exclude=*.ko --exclude=*.cmd --exclude=Documentation \
34--exclude=.config.old --exclude=.missing-syscalls.d" 34--exclude=.config.old --exclude=.missing-syscalls.d --exclude=*.s"
35 35
36# We can label the here-doc lines for conditional output to the spec file 36# We can label the here-doc lines for conditional output to the spec file
37# 37#
diff --git a/scripts/recordmcount.h b/scripts/recordmcount.h
index 13c5e6c8829c..47fca2c69a73 100644
--- a/scripts/recordmcount.h
+++ b/scripts/recordmcount.h
@@ -325,7 +325,8 @@ static uint_t *sift_rel_mcount(uint_t *mlocp,
325 if (!mcountsym) 325 if (!mcountsym)
326 mcountsym = get_mcountsym(sym0, relp, str0); 326 mcountsym = get_mcountsym(sym0, relp, str0);
327 327
328 if (mcountsym == Elf_r_sym(relp) && !is_fake_mcount(relp)) { 328 if (mcountsym && mcountsym == Elf_r_sym(relp) &&
329 !is_fake_mcount(relp)) {
329 uint_t const addend = 330 uint_t const addend =
330 _w(_w(relp->r_offset) - recval + mcount_adjust); 331 _w(_w(relp->r_offset) - recval + mcount_adjust);
331 mrelp->r_offset = _w(offbase 332 mrelp->r_offset = _w(offbase
diff --git a/scripts/tags.sh b/scripts/tags.sh
index d46be47633af..4e18ae5282a6 100755
--- a/scripts/tags.sh
+++ b/scripts/tags.sh
@@ -6,7 +6,7 @@
6# mode may be any of: tags, TAGS, cscope 6# mode may be any of: tags, TAGS, cscope
7# 7#
8# Uses the following environment variables: 8# Uses the following environment variables:
9# ARCH, SUBARCH, SRCARCH, srctree, src, obj 9# SUBARCH, SRCARCH, srctree
10 10
11if [ "$KBUILD_VERBOSE" = "1" ]; then 11if [ "$KBUILD_VERBOSE" = "1" ]; then
12 set -x 12 set -x
@@ -17,8 +17,7 @@ ignore="$(echo "$RCS_FIND_IGNORE" | sed 's|\\||g' )"
17# tags and cscope files should also ignore MODVERSION *.mod.c files 17# tags and cscope files should also ignore MODVERSION *.mod.c files
18ignore="$ignore ( -name *.mod.c ) -prune -o" 18ignore="$ignore ( -name *.mod.c ) -prune -o"
19 19
20# Do not use full path if we do not use O=.. builds 20# Use make KBUILD_ABS_SRCTREE=1 {tags|cscope}
21# Use make O=. {tags|cscope}
22# to force full paths for a non-O= build 21# to force full paths for a non-O= build
23if [ "${srctree}" = "." -o -z "${srctree}" ]; then 22if [ "${srctree}" = "." -o -z "${srctree}" ]; then
24 tree= 23 tree=
@@ -36,21 +35,19 @@ elif [ "${ALLSOURCE_ARCHS}" = "all" ]; then
36 ALLSOURCE_ARCHS=$(find ${tree}arch/ -mindepth 1 -maxdepth 1 -type d -printf '%f ') 35 ALLSOURCE_ARCHS=$(find ${tree}arch/ -mindepth 1 -maxdepth 1 -type d -printf '%f ')
37fi 36fi
38 37
39# find sources in arch/$ARCH 38# find sources in arch/$1
40find_arch_sources() 39find_arch_sources()
41{ 40{
42 for i in $archincludedir; do 41 for i in $archincludedir; do
43 prune="$prune -wholename $i -prune -o" 42 prune="$prune -wholename $i -prune -o"
44 done 43 done
45 find ${tree}arch/$1 $ignore $subarchprune $prune -name "$2" \ 44 find ${tree}arch/$1 $ignore $prune -name "$2" -not -type l -print;
46 -not -type l -print;
47} 45}
48 46
49# find sources in arch/$1/include 47# find sources in arch/$1/include
50find_arch_include_sources() 48find_arch_include_sources()
51{ 49{
52 include=$(find ${tree}arch/$1/ $subarchprune \ 50 include=$(find ${tree}arch/$1/ -name include -type d -print);
53 -name include -type d -print);
54 if [ -n "$include" ]; then 51 if [ -n "$include" ]; then
55 archincludedir="$archincludedir $include" 52 archincludedir="$archincludedir $include"
56 find $include $ignore -name "$2" -not -type l -print; 53 find $include $ignore -name "$2" -not -type l -print;
@@ -306,36 +303,6 @@ if [ "${ARCH}" = "um" ]; then
306 else 303 else
307 archinclude=${SUBARCH} 304 archinclude=${SUBARCH}
308 fi 305 fi
309elif [ "${SRCARCH}" = "arm" -a "${SUBARCH}" != "" ]; then
310 subarchdir=$(find ${tree}arch/$SRCARCH/ -name "mach-*" -type d -o \
311 -name "plat-*" -type d);
312 mach_suffix=$SUBARCH
313 plat_suffix=$SUBARCH
314
315 # Special cases when $plat_suffix != $mach_suffix
316 case $mach_suffix in
317 "omap1" | "omap2")
318 plat_suffix="omap"
319 ;;
320 esac
321
322 if [ ! -d ${tree}arch/$SRCARCH/mach-$mach_suffix ]; then
323 echo "Warning: arch/arm/mach-$mach_suffix/ not found." >&2
324 echo " Fix your \$SUBARCH appropriately" >&2
325 fi
326
327 for i in $subarchdir; do
328 case "$i" in
329 *"mach-"${mach_suffix})
330 ;;
331 *"plat-"${plat_suffix})
332 ;;
333 *)
334 subarchprune="$subarchprune \
335 -wholename $i -prune -o"
336 ;;
337 esac
338 done
339fi 306fi
340 307
341remove_structs= 308remove_structs=