History

Merge tag 'kbuild-v5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild

Pull Kbuild updates from Masahiro Yamada: - remove headers_{install,check}_all targets - remove unreasonable 'depends on !UML' from CONFIG_SAMPLES - re-implement 'make headers_install' more cleanly - add new header-test-y syntax to compile-test headers - compile-test exported headers to ensure they are compilable in user-space - compile-test headers under include/ to ensure they are self-contained - remove -Waggregate-return, -Wno-uninitialized, -Wno-unused-value flags - add -Werror=unknown-warning-option for Clang - add 128-bit built-in types support to genksyms - fix missed rebuild of modules.builtin - propagate 'No space left on device' error in fixdep to Make - allow Clang to use its integrated assembler - improve some coccinelle scripts - add a new flag KBUILD_ABS_SRCTREE to request Kbuild to use absolute path for $(srctree). - do not ignore errors when compression utility is missing - misc cleanups * tag 'kbuild-v5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (49 commits) kbuild: use -- separater intead of $(filter-out ...) for cc-cross-prefix kbuild: Inform user to pass ARCH= for make mrproper kbuild: fix compression errors getting ignored kbuild: add a flag to force absolute path for srctree kbuild: replace KBUILD_SRCTREE with boolean building_out_of_srctree kbuild: remove src and obj from the top Makefile scripts/tags.sh: remove unused environment variables from comments scripts/tags.sh: drop SUBARCH support for ARM kbuild: compile-test kernel headers to ensure they are self-contained kheaders: include only headers into kheaders_data.tar.xz kheaders: remove meaningless -R option of 'ls' kbuild: support header-test-pattern-y kbuild: do not create wrappers for header-test-y kbuild: compile-test exported headers to ensure they are self-contained init/Kconfig: add CONFIG_CC_CAN_LINK kallsyms: exclude kasan local symbols on s390 kbuild: add more hints about SUBDIRS replacement coccinelle: api/stream_open: treat all wait_.*() calls as blocking coccinelle: put_device: Add a cast to an expression for an assignment coccinelle: put_device: Adjust a message construction ...

Linus Torvalds committed 7 years ago

Commit 39ceda52 parents 5f26f11 d4a74bb53 files · +1805 −458Browse files

Showing the changes to scripts (21 of 53 files). Show all

Unified · Split

21 files
  1. scripts/Kbuild.include +11 −17
  2. scripts/Makefile +0 −5
  3. scripts/Makefile.build +10 −1
  4. scripts/Makefile.extrawarn +0 −3
  5. scripts/Makefile.headersinst +57 −77
  6. scripts/Makefile.host +1 −1
  7. scripts/Makefile.lib +20 −6
  8. scripts/Makefile.modbuiltin +1 −1
  9. scripts/basic/fixdep.c +41 −10
  10. scripts/coccinelle/api/kstrdup.cocci +4 −4
  11. scripts/coccinelle/api/stream_open.cocci +4 −4
  12. scripts/coccinelle/free/put_device.cocci +5 −6
  13. scripts/gdb/linux/Makefile +1 −1
  14. scripts/genksyms/keywords.c +4 −0
  15. scripts/genksyms/parse.y +2 −0
  16. scripts/headers.sh +0 −29
  17. scripts/headers_install.sh +20 −28
  18. scripts/kallsyms.c +3 −0
  19. scripts/package/builddeb +1 −1
  20. scripts/package/mkspec +1 −1
  21. scripts/tags.sh +5 −38
scripts/Kbuild.include+11−17
@@ -79,8 +79,8 @@ endef · 78 unmodified lines
7979 # would try to directly execute the shell builtin 'command'. This workaround
8080 # should be kept for a long time since this issue was fixed only after the
8181 # GNU Make 4.2.1 release.
82−cc-cross-prefix = $(firstword $(foreach c, $(filter-out -%, $(1)), \
83− $(if $(shell command -v $(c)gcc 2>/dev/null), $(c))))
82+cc-cross-prefix = $(firstword $(foreach c, $(1), \
83+ $(if $(shell command -v -- $(c)gcc 2>/dev/null), $(c))))
8484
8585 # output directory for tests below
8686 TMPOUT := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/)
@@ -187,12 +187,6 @@ dtbinst := -f $(srctree)/scripts/Makefile.dtbinst obj · 100 unmodified lines
187187 # $(Q)$(MAKE) $(clean)=dir
188188 clean := -f $(srctree)/scripts/Makefile.clean obj
189189
190−###
191−# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.headersinst obj=
192−# Usage:
193−# $(Q)$(MAKE) $(hdr-inst)=dir
194−hdr-inst := -f $(srctree)/scripts/Makefile.headersinst obj
195−
196190 # echo command.
197191 # Short version is used, if $(quiet) equals `quiet_', otherwise full one.
198192 echo-cmd = $(if $($(quiet)cmd_$(1)),\
@@ -213,12 +207,12 @@ objectify = $(foreach o,$(1),$(if $(filter /%,$(o)),$(o),$(obj)/$(o))) · 14 unmodified lines
213207 # See Documentation/kbuild/makefiles.rst for more info
214208
215209 ifneq ($(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
217211 # string if equal. User may override this check using make KBUILD_NOCMDDEP=1
218−arg-check = $(filter-out $(subst $(space),$(space_escape),$(strip $(cmd_$@))), \
212+cmd-check = $(filter-out $(subst $(space),$(space_escape),$(strip $(cmd_$@))), \
219213 $(subst $(space),$(space_escape),$(strip $(cmd_$1))))
220214 else
221−arg-check = $(if $(strip $(cmd_$@)),,1)
215+cmd-check = $(if $(strip $(cmd_$@)),,1)
222216 endif
223217
224218 # Replace >$< with >$$< to preserve $ when reloading the .cmd file
@@ -231,15 +225,15 @@ make-cmd = $(call escsq,$(subst $(pound),$$(pound),$(subst $$,$$$$,$(cmd_$(1)))) · 6 unmodified lines
231225
232226 # Find any prerequisites that is newer than target or that does not exist.
233227 # PHONY targets skipped in both cases.
234−any-prereq = $(filter-out $(PHONY),$?) $(filter-out $(PHONY) $(wildcard $^),$^)
228+any-prereq = $(filter-out $(PHONY),$?)$(filter-out $(PHONY) $(wildcard $^),$^)
235229
236230 # Execute command if command has changed or prerequisite(s) are updated.
237−if_changed = $(if $(strip $(any-prereq) $(arg-check)), \
231+if_changed = $(if $(any-prereq)$(cmd-check), \
238232 $(cmd); \
239233 printf '%s\n' 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd, @:)
240234
241235 # Execute the command and also postprocess generated .d dependencies file.
242−if_changed_dep = $(if $(strip $(any-prereq) $(arg-check)),$(cmd_and_fixdep),@:)
236+if_changed_dep = $(if $(any-prereq)$(cmd-check),$(cmd_and_fixdep),@:)
243237
244238 cmd_and_fixdep = \
245239 $(cmd); \
@@ -249,7 +243,7 @@ cmd_and_fixdep = \ · 3 unmodified lines
249243 # Usage: $(call if_changed_rule,foo)
250244 # Will check if $(cmd_foo) or any of the prerequisites changed,
251245 # and if so will execute $(rule_foo).
252−if_changed_rule = $(if $(strip $(any-prereq) $(arg-check)),$(rule_$(1)),@:)
246+if_changed_rule = $(if $(any-prereq)$(cmd-check),$(rule_$(1)),@:)
253247
254248 ###
255249 # why - tell why a target got built
@@ -274,8 +268,8 @@ ifeq ($(KBUILD_VERBOSE),2) · 18 unmodified lines
274268 why = \
275269 $(if $(filter $@, $(PHONY)),- due to target is PHONY, \
276270 $(if $(wildcard $@), \
277− $(if $(strip $(any-prereq)),- due to: $(any-prereq), \
278− $(if $(arg-check), \
271+ $(if $(any-prereq),- due to: $(any-prereq), \
272+ $(if $(cmd-check), \
279273 $(if $(cmd_$@),- due to command line change, \
280274 $(if $(filter $@, $(targets)), \
281275 - due to missing .cmd file, \
scripts/Makefile+0−5
@@ -31,11 +31,6 @@ always := $(hostprogs-y) $(hostprogs-m) · 30 unmodified lines
3131 # The following hostprogs-y programs are only build on demand
3232 hostprogs-y += unifdef
3333
34−# These targets are used internally to avoid "is up to date" messages
35−PHONY += build_unifdef
36−build_unifdef: $(obj)/unifdef
37− @:
38−
3934 subdir-$(CONFIG_GCC_PLUGINS) += gcc-plugins
4035 subdir-$(CONFIG_MODVERSIONS) += genksyms
4136 subdir-$(CONFIG_SECURITY_SELINUX) += selinux
scripts/Makefile.build+10−1
@@ -294,6 +294,15 @@ quiet_cmd_cc_lst_c = MKLST $@ · 293 unmodified lines
294294 $(obj)/%.lst: $(src)/%.c FORCE
295295 $(call if_changed_dep,cc_lst_c)
296296
297+# header test (header-test-y target)
298+# ---------------------------------------------------------------------------
299+
300+quiet_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+
297306 # Compile assembler sources (.S)
298307 # ---------------------------------------------------------------------------
299308
@@ -504,7 +513,7 @@ existing-targets := $(wildcard $(sort $(targets))) · 204 unmodified lines
504513
505514 -include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd)
506515
507−ifneq ($(srctree),.)
516+ifdef building_out_of_srctree
508517 # Create directories for object files if they do not exist
509518 obj-dirs := $(sort $(obj) $(patsubst %/,%, $(dir $(targets))))
510519 # If targets exist, their directories apparently exist. Skip mkdir.
scripts/Makefile.extrawarn+0−3
@@ -34,7 +34,6 @@ warning-1 += $(call cc-option, -Wstringop-truncation) · 33 unmodified lines
3434 warning-1 += -Wno-missing-field-initializers
3535 warning-1 += -Wno-sign-compare
3636
37−warning-2 := -Waggregate-return
3837 warning-2 += -Wcast-align
3938 warning-2 += -Wdisabled-optimization
4039 warning-2 += -Wnested-externs
@@ -68,10 +67,8 @@ else · 27 unmodified lines
6867
6968 ifdef CONFIG_CC_IS_CLANG
7069 KBUILD_CFLAGS += -Wno-initializer-overrides
71−KBUILD_CFLAGS += -Wno-unused-value
7270 KBUILD_CFLAGS += -Wno-format
7371 KBUILD_CFLAGS += -Wno-sign-compare
7472 KBUILD_CFLAGS += -Wno-format-zero-length
75−KBUILD_CFLAGS += -Wno-uninitialized
7673 endif
7774 endif
scripts/Makefile.headersinst+57−77
@@ -14,109 +14,89 @@ __headers: · 13 unmodified lines
1414
1515 include scripts/Kbuild.include
1616
17−srcdir := $(srctree)/$(obj)
17+src := $(srctree)/$(obj)
18+gen := $(objtree)/$(subst include/,include/generated/,$(obj))
19+dst := usr/include
1820
19−# When make is run under a fakechroot environment, the function
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.
23−subdirs := $(patsubst $(srcdir)/%/,%,\
24− $(filter-out $(srcdir)/,\
25− $(sort $(dir $(wildcard $(srcdir)/*/)))))
21+-include $(src)/Kbuild
2622
27−# Recursion
28−__headers: $(subdirs)
23+# $(filter %/, ...) is a workaround for GNU Make <= 4.2.1, where
24+# $(wildcard $(src)/*/) contains not only directories but also regular files.
25+src-subdirs := $(patsubst $(src)/%/,%,$(filter %/, $(wildcard $(src)/*/)))
26+gen-subdirs := $(patsubst $(gen)/%/,%,$(filter %/, $(wildcard $(gen)/*/)))
27+all-subdirs := $(sort $(src-subdirs) $(gen-subdirs))
2928
30−PHONY += $(subdirs)
31−$(subdirs):
32− $(Q)$(MAKE) $(hdr-inst)=$(obj)/$@ dst=$(dst)/$@
29+src-headers := $(if $(src-subdirs), $(shell cd $(src) && find $(src-subdirs) -name '*.h'))
30+src-headers := $(filter-out $(no-export-headers), $(src-headers))
31+gen-headers := $(if $(gen-subdirs), $(shell cd $(gen) && find $(gen-subdirs) -name '*.h'))
32+gen-headers := $(filter-out $(no-export-headers), $(gen-headers))
3333
34−# Skip header install/check for include/uapi and arch/$(SRCARCH)/include/uapi.
35−# We have only sub-directories there.
36−skip-inst := $(if $(filter %/uapi,$(obj)),1)
34+# If the same header is exported from source and generated directories,
35+# the former takes precedence, but this should be warned.
36+duplicated := $(filter $(gen-headers), $(src-headers))
37+$(if $(duplicated), $(warning duplicated header export: $(duplicated)))
3738
38−ifeq ($(skip-inst),)
39+gen-headers := $(filter-out $(duplicated), $(gen-headers))
3940
40−# Kbuild file is optional
41−kbuild-file := $(srctree)/$(obj)/Kbuild
42−-include $(kbuild-file)
41+# Add dst path prefix
42+all-subdirs := $(addprefix $(dst)/, $(all-subdirs))
43+src-headers := $(addprefix $(dst)/, $(src-headers))
44+gen-headers := $(addprefix $(dst)/, $(gen-headers))
45+all-headers := $(src-headers) $(gen-headers)
4346
44−installdir := $(INSTALL_HDR_PATH)/$(dst)
45−gendir := $(objtree)/$(subst include/,include/generated/,$(obj))
46−header-files := $(notdir $(wildcard $(srcdir)/*.h))
47−header-files := $(filter-out $(no-export-headers), $(header-files))
48−genhdr-files := $(notdir $(wildcard $(gendir)/*.h))
49−genhdr-files := $(filter-out $(header-files), $(genhdr-files))
47+# Work out what needs to be removed
48+old-subdirs := $(wildcard $(all-subdirs))
49+old-headers := $(if $(old-subdirs),$(shell find $(old-subdirs) -name '*.h'))
50+unwanted := $(filter-out $(all-headers), $(old-headers))
5051
51−# files used to track state of install/check
52−install-file := $(installdir)/.install
53−check-file := $(installdir)/.check
52+# Create directories
53+existing-dirs := $(sort $(dir $(old-headers)))
54+wanted-dirs := $(sort $(dir $(all-headers)))
55+new-dirs := $(filter-out $(existing-dirs), $(wanted-dirs))
56+$(if $(new-dirs), $(shell mkdir -p $(new-dirs)))
5457
55−# all headers files for this dir
56−all-files := $(header-files) $(genhdr-files)
57−output-files := $(addprefix $(installdir)/, $(all-files))
58+# Rules
5859
59−# Work out what needs to be removed
60−oldheaders := $(patsubst $(installdir)/%,%,$(wildcard $(installdir)/*.h))
61−unwanted := $(filter-out $(all-files),$(oldheaders))
60+ifndef HDRCHECK
6261
63−# Prefix unwanted with full paths to $(INSTALL_HDR_PATH)
64−unwanted-file := $(addprefix $(installdir)/, $(unwanted))
62+quiet_cmd_install = HDRINST $@
63+ cmd_install = $(CONFIG_SHELL) $(srctree)/scripts/headers_install.sh $< $@
6564
66−printdir = $(patsubst $(INSTALL_HDR_PATH)/%/,%,$(dir $@))
65+$(src-headers): $(dst)/%.h: $(src)/%.h $(srctree)/scripts/headers_install.sh FORCE
66+ $(call if_changed,install)
6767
68−quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\
69− file$(if $(word 2, $(all-files)),s))
70− cmd_install = \
71− $(CONFIG_SHELL) $< $(installdir) $(srcdir) $(header-files); \
72− $(CONFIG_SHELL) $< $(installdir) $(gendir) $(genhdr-files); \
73− touch $@
68+$(gen-headers): $(dst)/%.h: $(gen)/%.h $(srctree)/scripts/headers_install.sh FORCE
69+ $(call if_changed,install)
7470
7571 quiet_cmd_remove = REMOVE $(unwanted)
76− cmd_remove = rm -f $(unwanted-file)
77−
78−quiet_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 $@
72+ cmd_remove = rm -f $(unwanted)
8673
87−ifndef HDRCHECK
88−# Rules for installing headers
89−__headers: $(install-file)
74+__headers: $(all-headers)
75+ifneq ($(unwanted),)
76+ $(call cmd,remove)
77+endif
9078 @:
9179
92−targets += $(install-file)
93−$(install-file): scripts/headers_install.sh \
94− $(addprefix $(srcdir)/,$(header-files)) \
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)
80+existing-headers := $(filter $(old-headers), $(all-headers))
81+
82+-include $(foreach f,$(existing-headers),$(dir $(f)).$(notdir $(f)).cmd)
9983
10084 else
101−__headers: $(check-file)
102− @:
10385
104−targets += $(check-file)
105−$(check-file): scripts/headers_check.pl $(output-files) FORCE
106− $(call if_changed,check)
86+quiet_cmd_check = HDRCHK $<
87+ cmd_check = $(PERL) $(srctree)/scripts/headers_check.pl $(dst) $(SRCARCH) $<; touch $@
10788
108−endif
89+check-files := $(addsuffix .chk, $(all-headers))
10990
110−cmd_files := $(wildcard \
111− $(foreach f,$(sort $(targets)),$(dir $(f)).$(notdir $(f)).cmd))
91+$(check-files): $(dst)/%.chk : $(dst)/% $(srctree)/scripts/headers_check.pl
92+ $(call cmd,check)
11293
113−ifneq ($(cmd_files),)
114− include $(cmd_files)
115−endif
94+__headers: $(check-files)
95+ @:
11696
117−endif # skip-inst
97+endif
11898
11999 PHONY += FORCE
120−FORCE: ;
100+FORCE:
121101
122102 .PHONY: $(PHONY)
scripts/Makefile.host+1−1
@@ -69,7 +69,7 @@ _hostcxx_flags = $(KBUILD_HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) \ · 68 unmodified lines
6969
7070 # $(objtree)/$(obj) for including generated headers from checkin source files
7171 ifeq ($(KBUILD_EXTMOD),)
72−ifneq ($(srctree),.)
72+ifdef building_out_of_srctree
7373 _hostc_flags += -I $(objtree)/$(obj)
7474 _hostcxx_flags += -I $(objtree)/$(obj)
7575 endif
scripts/Makefile.lib+20−6
@@ -66,6 +66,20 @@ extra-y += $(patsubst %.dtb,%.dt.yaml, $(dtb-y)) · 65 unmodified lines
6666 extra-$(CONFIG_OF_ALL_DTBS) += $(patsubst %.dtb,%.dt.yaml, $(dtb-))
6767 endif
6868
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.
76+header-test-y += $(filter-out $(header-test-), \
77+ $(patsubst $(srctree)/$(src)/%, %, \
78+ $(wildcard $(addprefix $(srctree)/$(src)/, \
79+ $(header-test-pattern-y)))))
80+
81+extra-$(CONFIG_HEADER_TEST) += $(addsuffix .s, $(header-test-y))
82+
6983 # Add subdir path
7084
7185 extra-y := $(addprefix $(obj)/,$(extra-y))
@@ -140,7 +154,7 @@ endif · 68 unmodified lines
140154 # $(srctree)/$(src) for including checkin headers from generated source files
141155 # $(objtree)/$(obj) for including generated headers from checkin source files
142156 ifeq ($(KBUILD_EXTMOD),)
143−ifneq ($(srctree),.)
157+ifdef building_out_of_srctree
144158 _c_flags += -I $(srctree)/$(src) -I $(objtree)/$(obj)
145159 _a_flags += -I $(srctree)/$(src) -I $(objtree)/$(obj)
146160 _cpp_flags += -I $(srctree)/$(src) -I $(objtree)/$(obj)
@@ -331,19 +345,19 @@ printf "%08x\n" $$dec_size | \ · 184 unmodified lines
331345 )
332346
333347 quiet_cmd_bzip2 = BZIP2 $@
334− cmd_bzip2 = { cat $(real-prereqs) | bzip2 -9 && $(size_append); } > $@
348+ cmd_bzip2 = { cat $(real-prereqs) | bzip2 -9; $(size_append); } > $@
335349
336350 # Lzma
337351 # ---------------------------------------------------------------------------
338352
339353 quiet_cmd_lzma = LZMA $@
340− cmd_lzma = { cat $(real-prereqs) | lzma -9 && $(size_append); } > $@
354+ cmd_lzma = { cat $(real-prereqs) | lzma -9; $(size_append); } > $@
341355
342356 quiet_cmd_lzo = LZO $@
343− cmd_lzo = { cat $(real-prereqs) | lzop -9 && $(size_append); } > $@
357+ cmd_lzo = { cat $(real-prereqs) | lzop -9; $(size_append); } > $@
344358
345359 quiet_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; \
347361 $(size_append); } > $@
348362
349363 # U-Boot mkimage
@@ -386,7 +400,7 @@ quiet_cmd_uimage = UIMAGE $@ · 36 unmodified lines
386400 # big dictionary would increase the memory usage too much in the multi-call
387401 # decompression mode. A BCJ filter isn't used either.
388402 quiet_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; \
390404 $(size_append); } > $@
391405
392406 quiet_cmd_xzmisc = XZMISC $@
scripts/Makefile.modbuiltin+1−1
@@ -15,7 +15,7 @@ include include/config/tristate.conf · 14 unmodified lines
1515
1616 include scripts/Kbuild.include
1717
18−ifneq ($(srctree),.)
18+ifdef building_out_of_srctree
1919 # Create output directory if not already present
2020 _dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj))
2121 endif
scripts/basic/fixdep.c+41−10
@@ -99,6 +99,7 @@ · 98 unmodified lines
9999 #include <unistd.h>
100100 #include <fcntl.h>
101101 #include <string.h>
102+#include <stdarg.h>
102103 #include <stdlib.h>
103104 #include <stdio.h>
104105 #include <ctype.h>
@@ -109,6 +110,36 @@ static void usage(void) · 4 unmodified lines
109110 exit(1);
110111 }
111112
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+ */
118+static 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+
132+static 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+
112143 /*
113144 * Print out a dependency path from a symbol name
114145 */
@@ -116,7 +147,7 @@ static void print_dep(const char *m, int slen, const char *dir) · 1 unmodified line
116147 {
117148 int c, prev_c = '/', i;
118149
119− printf(" $(wildcard %s/", dir);
150+ xprintf(" $(wildcard %s/", dir);
120151 for (i = 0; i < slen; i++) {
121152 c = m[i];
122153 if (c == '_')
@@ -124,10 +155,10 @@ static void print_dep(const char *m, int slen, const char *dir) · 1 unmodified line
124155 else
125156 c = tolower(c);
126157 if (c != '/' || prev_c != '/')
127− putchar(c);
158+ xputchar(c);
128159 prev_c = c;
129160 }
130− printf(".h) \\\n");
161+ xprintf(".h) \\\n");
131162 }
132163
133164 struct item {
@@ -324,13 +355,13 @@ static void parse_dep_file(char *m, const char *target) · 190 unmodified lines
324355 */
325356 if (!saw_any_target) {
326357 saw_any_target = 1;
327− printf("source_%s := %s\n\n",
328− target, m);
329− printf("deps_%s := \\\n", target);
358+ xprintf("source_%s := %s\n\n",
359+ target, m);
360+ xprintf("deps_%s := \\\n", target);
330361 }
331362 is_first_dep = 0;
332363 } else {
333− printf(" %s \\\n", m);
364+ xprintf(" %s \\\n", m);
334365 }
335366
336367 buf = read_file(m);
@@ -353,8 +384,8 @@ static void parse_dep_file(char *m, const char *target) · 16 unmodified lines
353384 exit(1);
354385 }
355386
356− printf("\n%s: $(deps_%s)\n\n", target, target);
357− printf("$(deps_%s):\n", target);
387+ xprintf("\n%s: $(deps_%s)\n\n", target, target);
388+ xprintf("$(deps_%s):\n", target);
358389 }
359390
360391 int main(int argc, char *argv[])
@@ -369,7 +400,7 @@ int main(int argc, char *argv[]) · 8 unmodified lines
369400 target = argv[2];
370401 cmdline = argv[3];
371402
372− printf("cmd_%s := %s\n\n", target, cmdline);
403+ xprintf("cmd_%s := %s\n\n", target, cmdline);
373404
374405 buf = read_file(depfile);
375406 parse_dep_file(buf, target);
scripts/coccinelle/api/kstrdup.cocci+4−4
@@ -77,7 +77,7 @@ p1 << r1.p1; · 76 unmodified lines
7777 p2 << r1.p2;
7878 @@
7979
80−cocci.print_main("WARNING opportunity for kstrdep",p1)
80+cocci.print_main("WARNING opportunity for kstrdup",p1)
8181 cocci.print_secs("strcpy",p2)
8282
8383 @script:python depends on org@
@@ -85,7 +85,7 @@ p1 << r2.p1; · 1 unmodified line
8585 p2 << r2.p2;
8686 @@
8787
88−cocci.print_main("WARNING opportunity for kstrdep",p1)
88+cocci.print_main("WARNING opportunity for kstrdup",p1)
8989 cocci.print_secs("memcpy",p2)
9090
9191 @script:python depends on report@
@@ -93,7 +93,7 @@ p1 << r1.p1; · 1 unmodified line
9393 p2 << r1.p2;
9494 @@
9595
96−msg = "WARNING opportunity for kstrdep (strcpy on line %s)" % (p2[0].line)
96+msg = "WARNING opportunity for kstrdup (strcpy on line %s)" % (p2[0].line)
9797 coccilib.report.print_report(p1[0], msg)
9898
9999 @script:python depends on report@
@@ -101,5 +101,5 @@ p1 << r2.p1; · 1 unmodified line
101101 p2 << r2.p2;
102102 @@
103103
104−msg = "WARNING opportunity for kstrdep (memcpy on line %s)" % (p2[0].line)
104+msg = "WARNING opportunity for kstrdup (memcpy on line %s)" % (p2[0].line)
105105 coccilib.report.print_report(p1[0], msg)
scripts/coccinelle/api/stream_open.cocci+4−4
@@ -35,11 +35,11 @@ type loff_t; · 34 unmodified lines
3535 // a function that blocks
3636 @ blocks @
3737 identifier block_f;
38−identifier wait_event =~ "^wait_event_.*";
38+identifier wait =~ "^wait_.*";
3939 @@
4040 block_f(...) {
4141 ... when exists
42− wait_event(...)
42+ wait(...)
4343 ... when exists
4444 }
4545
@@ -49,12 +49,12 @@ identifier wait_event =~ "^wait_event_.*"; · 3 unmodified lines
4949 // XXX currently reader_blocks supports only direct and 1-level indirect cases.
5050 @ reader_blocks_direct @
5151 identifier stream_reader.readstream;
52−identifier wait_event =~ "^wait_event_.*";
52+identifier wait =~ "^wait_.*";
5353 @@
5454 readstream(...)
5555 {
5656 ... when exists
57− wait_event(...)
57+ wait(...)
5858 ... when exists
5959 }
6060
scripts/coccinelle/free/put_device.cocci+5−6
@@ -24,7 +24,7 @@ if (id == NULL || ...) { ... return ...; } · 23 unmodified lines
2424 when != of_dev_put(id)
2525 when != if (id) { ... put_device(&id->dev) ... }
2626 when != e1 = (T)id
27− when != e1 = &id->dev
27+ when != e1 = (T)(&id->dev)
2828 when != e1 = get_device(&id->dev)
2929 when != e1 = (T1)platform_get_drvdata(id)
3030 (
@@ -42,11 +42,10 @@ p1 << search.p1; · 11 unmodified lines
4242 p2 << search.p2;
4343 @@
4444
45−coccilib.report.print_report(p2[0], "ERROR: missing put_device; "
46− + "call of_find_device_by_node on line "
47− + p1[0].line
48− + ", but without a corresponding object release "
49− + "within this function.")
45+coccilib.report.print_report(p2[0],
46+ "ERROR: missing put_device; call of_find_device_by_node on line "
47+ + p1[0].line
48+ + ", but without a corresponding object release within this function.")
5049
5150 @script:python depends on org@
5251 p1 << search.p1;
scripts/gdb/linux/Makefile+1−1
@@ -1,6 +1,6 @@
11 # SPDX-License-Identifier: GPL-2.0
22
3−ifneq ($(srctree),.)
3+ifdef building_out_of_srctree
44
55 symlinks := $(patsubst $(srctree)/$(src)/%,%,$(wildcard $(srctree)/$(src)/*.py))
66
scripts/genksyms/keywords.c+4−0
@@ -25,6 +25,10 @@ static struct resword { · 24 unmodified lines
2525 { "__volatile__", VOLATILE_KEYW },
2626 { "__builtin_va_list", VA_LIST_KEYW },
2727
28+ { "__int128", BUILTIN_INT_KEYW },
29+ { "__int128_t", BUILTIN_INT_KEYW },
30+ { "__uint128_t", BUILTIN_INT_KEYW },
31+
2832 // According to rth, c99 defines "_Bool", __restrict", __restrict__", "restrict". KAO
2933 { "_Bool", BOOL_KEYW },
3034 { "_restrict", RESTRICT_KEYW },
scripts/genksyms/parse.y+2−0
@@ -76,6 +76,7 @@ static void record_compound(struct string_list **keyw, · 75 unmodified lines
7676 %token ATTRIBUTE_KEYW
7777 %token AUTO_KEYW
7878 %token BOOL_KEYW
79+%token BUILTIN_INT_KEYW
7980 %token CHAR_KEYW
8081 %token CONST_KEYW
8182 %token DOUBLE_KEYW
@@ -263,6 +264,7 @@ simple_type_specifier: · 181 unmodified lines
263264 | VOID_KEYW
264265 | BOOL_KEYW
265266 | VA_LIST_KEYW
267+ | BUILTIN_INT_KEYW
266268 | TYPE { (*$1)->tag = SYM_TYPEDEF; $$ = $1; }
267269 ;
268270
scripts/headers.sh+0−29
@@ -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
6−set -e
7−
8−do_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−
17−archs=${HDR_ARCH_LIST:-$(ls ${srctree}/arch)}
18−
19−for 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
29−done
scripts/headers_install.sh+20−28
@@ -1,47 +1,39 @@
11 #!/bin/sh
22 # SPDX-License-Identifier: GPL-2.0
33
4−if [ $# -lt 2 ]
4+if [ $# -ne 2 ]
55 then
6− echo "Usage: headers_install.sh OUTDIR SRCDIR [FILES...]"
6+ echo "Usage: headers_install.sh INFILE OUTFILE"
77 echo
88 echo "Prepares kernel header files for use by user space, by removing"
99 echo "all compiler.h definitions and #includes, removing any"
1010 echo "#ifdef __KERNEL__ sections, and putting __underscores__ around"
1111 echo "asm/inline/volatile keywords."
1212 echo
13− echo "OUTDIR: directory to write each userspace header FILE to."
14− echo "SRCDIR: source directory where files are picked."
15− echo "FILES: list of header files to operate on."
13+ echo "INFILE: header file to operate on"
14+ echo "OUTFILE: output file which the processed header is writen to"
1615
1716 exit 1
1817 fi
1918
2019 # Grab arguments
20+INFILE=$1
21+OUTFILE=$2
22+TMPFILE=$OUTFILE.tmp
2123
22−OUTDIR="$1"
23−shift
24−SRCDIR="$1"
25−shift
24+trap 'rm -f $OUTFILE $TMPFILE' EXIT
2625
27−# Iterate through files listed on command line
26+sed -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
2834
29−FILE=
30−trap 'rm -f "$OUTDIR/$FILE" "$OUTDIR/$FILE.sed"' EXIT
31−for i in "$@"
32−do
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"
46−done
35+scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__ $TMPFILE > $OUTFILE
36+[ $? -gt 1 ] && exit 1
37+
38+rm -f $TMPFILE
4739 trap - EXIT
scripts/kallsyms.c+3−0
@@ -150,6 +150,9 @@ static int read_symbol(FILE *in, struct sym_entry *s) · 149 unmodified lines
150150 /* exclude debugging symbols */
151151 else if (stype == 'N' || stype == 'n')
152152 return -1;
153+ /* exclude s390 kasan local symbols */
154+ else if (!strncmp(sym, ".LASANPC", 8))
155+ return -1;
153156
154157 /* include the type field in the symbol name, so that it gets
155158 * compressed together */
scripts/package/builddeb+1−1
@@ -130,7 +130,7 @@ if is_enabled CONFIG_MODULES; then · 129 unmodified lines
130130 fi
131131
132132 if [ "$ARCH" != "um" ]; then
133− $MAKE -f $srctree/Makefile headers_check
133+ $MAKE -f $srctree/Makefile headers
134134 $MAKE -f $srctree/Makefile headers_install INSTALL_HDR_PATH="$libc_headers_dir/usr"
135135 fi
136136
scripts/package/mkspec+1−1
@@ -31,7 +31,7 @@ PROVIDES="$PROVIDES kernel-$KERNELRELEASE" · 30 unmodified lines
3131 __KERNELRELEASE=$(echo $KERNELRELEASE | sed -e "s/-/_/g")
3232 EXCLUDES="$RCS_TAR_IGNORE --exclude=.tmp_versions --exclude=*vmlinux* \
3333 --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"
3535
3636 # We can label the here-doc lines for conditional output to the spec file
3737 #
scripts/tags.sh+5−38
@@ -6,7 +6,7 @@ · 5 unmodified lines
66 # mode may be any of: tags, TAGS, cscope
77 #
88 # Uses the following environment variables:
9−# ARCH, SUBARCH, SRCARCH, srctree, src, obj
9+# SUBARCH, SRCARCH, srctree
1010
1111 if [ "$KBUILD_VERBOSE" = "1" ]; then
1212 set -x
@@ -17,8 +17,7 @@ ignore="$(echo "$RCS_FIND_IGNORE" | sed 's|\\||g' )" · 4 unmodified lines
1717 # tags and cscope files should also ignore MODVERSION *.mod.c files
1818 ignore="$ignore ( -name *.mod.c ) -prune -o"
1919
20−# Do not use full path if we do not use O=.. builds
21−# Use make O=. {tags|cscope}
20+# Use make KBUILD_ABS_SRCTREE=1 {tags|cscope}
2221 # to force full paths for a non-O= build
2322 if [ "${srctree}" = "." -o -z "${srctree}" ]; then
2423 tree=
@@ -36,21 +35,19 @@ elif [ "${ALLSOURCE_ARCHS}" = "all" ]; then · 11 unmodified lines
3635 ALLSOURCE_ARCHS=$(find ${tree}arch/ -mindepth 1 -maxdepth 1 -type d -printf '%f ')
3736 fi
3837
39−# find sources in arch/$ARCH
38+# find sources in arch/$1
4039 find_arch_sources()
4140 {
4241 for i in $archincludedir; do
4342 prune="$prune -wholename $i -prune -o"
4443 done
45− find ${tree}arch/$1 $ignore $subarchprune $prune -name "$2" \
46− -not -type l -print;
44+ find ${tree}arch/$1 $ignore $prune -name "$2" -not -type l -print;
4745 }
4846
4947 # find sources in arch/$1/include
5048 find_arch_include_sources()
5149 {
52− include=$(find ${tree}arch/$1/ $subarchprune \
53− -name include -type d -print);
50+ include=$(find ${tree}arch/$1/ -name include -type d -print);
5451 if [ -n "$include" ]; then
5552 archincludedir="$archincludedir $include"
5653 find $include $ignore -name "$2" -not -type l -print;
@@ -306,36 +303,6 @@ if [ "${ARCH}" = "um" ]; then · 249 unmodified lines
306303 else
307304 archinclude=${SUBARCH}
308305 fi
309−elif [ "${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
339306 fi
340307
341308 remove_structs=

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t