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 ...
Showing the changes to scripts (21 of 53 files). Show all
Unified · Split
| @@ -79,8 +79,8 @@ endef · 78 unmodified lines | |||
| 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. |
| 82 | cc-cross-prefix = $(firstword $(foreach c, $(filter-out -%, $(1)), \ | 82 | cc-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 |
| 86 | TMPOUT := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/) | 86 | TMPOUT := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/) |
| @@ -187,12 +187,6 @@ dtbinst := -f $(srctree)/scripts/Makefile.dtbinst obj · 100 unmodified lines | |||
| 187 | # $(Q)$(MAKE) $(clean)=dir | 187 | # $(Q)$(MAKE) $(clean)=dir |
| 188 | clean := -f $(srctree)/scripts/Makefile.clean obj | 188 | clean := -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 | ||
| 194 | hdr-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. |
| 198 | echo-cmd = $(if $($(quiet)cmd_$(1)),\ | 192 | echo-cmd = $(if $($(quiet)cmd_$(1)),\ |
| @@ -213,12 +207,12 @@ objectify = $(foreach o,$(1),$(if $(filter /%,$(o)),$(o),$(obj)/$(o))) · 14 unmodified lines | |||
| 213 | # See Documentation/kbuild/makefiles.rst for more info | 207 | # See Documentation/kbuild/makefiles.rst for more info |
| 214 | 208 | ||
| 215 | ifneq ($(KBUILD_NOCMDDEP),1) | 209 | 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 |
| 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 |
| 218 | arg-check = $(filter-out $(subst $(space),$(space_escape),$(strip $(cmd_$@))), \ | 212 | cmd-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)))) |
| 220 | else | 214 | else |
| 221 | arg-check = $(if $(strip $(cmd_$@)),,1) | 215 | cmd-check = $(if $(strip $(cmd_$@)),,1) |
| 222 | endif | 216 | endif |
| 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)))) · 6 unmodified lines | |||
| 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. |
| 234 | any-prereq = $(filter-out $(PHONY),$?) $(filter-out $(PHONY) $(wildcard $^),$^) | 228 | any-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. |
| 237 | if_changed = $(if $(strip $(any-prereq) $(arg-check)), \ | 231 | if_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. |
| 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),@:) |
| 243 | 237 | ||
| 244 | cmd_and_fixdep = \ | 238 | cmd_and_fixdep = \ |
| 245 | $(cmd); \ | 239 | $(cmd); \ |
| @@ -249,7 +243,7 @@ cmd_and_fixdep = \ · 3 unmodified lines | |||
| 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). |
| 252 | if_changed_rule = $(if $(strip $(any-prereq) $(arg-check)),$(rule_$(1)),@:) | 246 | if_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) · 18 unmodified lines | |||
| 274 | why = \ | 268 | why = \ |
| 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, \ |
| @@ -31,11 +31,6 @@ always := $(hostprogs-y) $(hostprogs-m) · 30 unmodified lines | |||
| 31 | # The following hostprogs-y programs are only build on demand | 31 | # The following hostprogs-y programs are only build on demand |
| 32 | hostprogs-y += unifdef | 32 | hostprogs-y += unifdef |
| 33 | 33 | ||
| 34 | # These targets are used internally to avoid "is up to date" messages | ||
| 35 | PHONY += build_unifdef | ||
| 36 | build_unifdef: $(obj)/unifdef | ||
| 37 | @: | ||
| 38 | |||
| 39 | subdir-$(CONFIG_GCC_PLUGINS) += gcc-plugins | 34 | subdir-$(CONFIG_GCC_PLUGINS) += gcc-plugins |
| 40 | subdir-$(CONFIG_MODVERSIONS) += genksyms | 35 | subdir-$(CONFIG_MODVERSIONS) += genksyms |
| 41 | subdir-$(CONFIG_SECURITY_SELINUX) += selinux | 36 | subdir-$(CONFIG_SECURITY_SELINUX) += selinux |
| @@ -294,6 +294,15 @@ quiet_cmd_cc_lst_c = MKLST $@ · 293 unmodified lines | |||
| 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 | |||
| 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 | |||
| 297 | # Compile assembler sources (.S) | 306 | # Compile assembler sources (.S) |
| 298 | # --------------------------------------------------------------------------- | 307 | # --------------------------------------------------------------------------- |
| 299 | 308 | ||
| @@ -504,7 +513,7 @@ existing-targets := $(wildcard $(sort $(targets))) · 204 unmodified lines | |||
| 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 | ||
| 507 | ifneq ($(srctree),.) | 516 | ifdef 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 |
| 509 | obj-dirs := $(sort $(obj) $(patsubst %/,%, $(dir $(targets)))) | 518 | obj-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. |
| @@ -34,7 +34,6 @@ warning-1 += $(call cc-option, -Wstringop-truncation) · 33 unmodified lines | |||
| 34 | warning-1 += -Wno-missing-field-initializers | 34 | warning-1 += -Wno-missing-field-initializers |
| 35 | warning-1 += -Wno-sign-compare | 35 | warning-1 += -Wno-sign-compare |
| 36 | 36 | ||
| 37 | warning-2 := -Waggregate-return | ||
| 38 | warning-2 += -Wcast-align | 37 | warning-2 += -Wcast-align |
| 39 | warning-2 += -Wdisabled-optimization | 38 | warning-2 += -Wdisabled-optimization |
| 40 | warning-2 += -Wnested-externs | 39 | warning-2 += -Wnested-externs |
| @@ -68,10 +67,8 @@ else · 27 unmodified lines | |||
| 68 | 67 | ||
| 69 | ifdef CONFIG_CC_IS_CLANG | 68 | ifdef CONFIG_CC_IS_CLANG |
| 70 | KBUILD_CFLAGS += -Wno-initializer-overrides | 69 | KBUILD_CFLAGS += -Wno-initializer-overrides |
| 71 | KBUILD_CFLAGS += -Wno-unused-value | ||
| 72 | KBUILD_CFLAGS += -Wno-format | 70 | KBUILD_CFLAGS += -Wno-format |
| 73 | KBUILD_CFLAGS += -Wno-sign-compare | 71 | KBUILD_CFLAGS += -Wno-sign-compare |
| 74 | KBUILD_CFLAGS += -Wno-format-zero-length | 72 | KBUILD_CFLAGS += -Wno-format-zero-length |
| 75 | KBUILD_CFLAGS += -Wno-uninitialized | ||
| 76 | endif | 73 | endif |
| 77 | endif | 74 | endif |
| @@ -14,109 +14,89 @@ __headers: · 13 unmodified lines | |||
| 14 | 14 | ||
| 15 | include scripts/Kbuild.include | 15 | include scripts/Kbuild.include |
| 16 | 16 | ||
| 17 | srcdir := $(srctree)/$(obj) | 17 | src := $(srctree)/$(obj) |
| 18 | gen := $(objtree)/$(subst include/,include/generated/,$(obj)) | ||
| 19 | dst := 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. | ||
| 23 | subdirs := $(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. |
| 25 | src-subdirs := $(patsubst $(src)/%/,%,$(filter %/, $(wildcard $(src)/*/))) | ||
| 26 | gen-subdirs := $(patsubst $(gen)/%/,%,$(filter %/, $(wildcard $(gen)/*/))) | ||
| 27 | all-subdirs := $(sort $(src-subdirs) $(gen-subdirs)) | ||
| 29 | 28 | ||
| 30 | PHONY += $(subdirs) | 29 | src-headers := $(if $(src-subdirs), $(shell cd $(src) && find $(src-subdirs) -name '*.h')) |
| 31 | $(subdirs): | 30 | src-headers := $(filter-out $(no-export-headers), $(src-headers)) |
| 32 | $(Q)$(MAKE) $(hdr-inst)=$(obj)/$@ dst=$(dst)/$@ | 31 | gen-headers := $(if $(gen-subdirs), $(shell cd $(gen) && find $(gen-subdirs) -name '*.h')) |
| 32 | gen-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. |
| 36 | skip-inst := $(if $(filter %/uapi,$(obj)),1) | 36 | duplicated := $(filter $(gen-headers), $(src-headers)) |
| 37 | $(if $(duplicated), $(warning duplicated header export: $(duplicated))) | ||
| 37 | 38 | ||
| 38 | ifeq ($(skip-inst),) | 39 | gen-headers := $(filter-out $(duplicated), $(gen-headers)) |
| 39 | 40 | ||
| 40 | # Kbuild file is optional | 41 | # Add dst path prefix |
| 41 | kbuild-file := $(srctree)/$(obj)/Kbuild | 42 | all-subdirs := $(addprefix $(dst)/, $(all-subdirs)) |
| 42 | -include $(kbuild-file) | 43 | src-headers := $(addprefix $(dst)/, $(src-headers)) |
| 44 | gen-headers := $(addprefix $(dst)/, $(gen-headers)) | ||
| 45 | all-headers := $(src-headers) $(gen-headers) | ||
| 43 | 46 | ||
| 44 | installdir := $(INSTALL_HDR_PATH)/$(dst) | 47 | # Work out what needs to be removed |
| 45 | gendir := $(objtree)/$(subst include/,include/generated/,$(obj)) | 48 | old-subdirs := $(wildcard $(all-subdirs)) |
| 46 | header-files := $(notdir $(wildcard $(srcdir)/*.h)) | 49 | old-headers := $(if $(old-subdirs),$(shell find $(old-subdirs) -name '*.h')) |
| 47 | header-files := $(filter-out $(no-export-headers), $(header-files)) | 50 | unwanted := $(filter-out $(all-headers), $(old-headers)) |
| 48 | genhdr-files := $(notdir $(wildcard $(gendir)/*.h)) | ||
| 49 | genhdr-files := $(filter-out $(header-files), $(genhdr-files)) | ||
| 50 | 51 | ||
| 51 | # files used to track state of install/check | 52 | # Create directories |
| 52 | install-file := $(installdir)/.install | 53 | existing-dirs := $(sort $(dir $(old-headers))) |
| 53 | check-file := $(installdir)/.check | 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))) | ||
| 54 | 57 | ||
| 55 | # all headers files for this dir | 58 | # Rules |
| 56 | all-files := $(header-files) $(genhdr-files) | ||
| 57 | output-files := $(addprefix $(installdir)/, $(all-files)) | ||
| 58 | 59 | ||
| 59 | # Work out what needs to be removed | 60 | ifndef HDRCHECK |
| 60 | oldheaders := $(patsubst $(installdir)/%,%,$(wildcard $(installdir)/*.h)) | ||
| 61 | unwanted := $(filter-out $(all-files),$(oldheaders)) | ||
| 62 | 61 | ||
| 63 | # Prefix unwanted with full paths to $(INSTALL_HDR_PATH) | 62 | quiet_cmd_install = HDRINST $@ |
| 64 | unwanted-file := $(addprefix $(installdir)/, $(unwanted)) | 63 | cmd_install = $(CONFIG_SHELL) $(srctree)/scripts/headers_install.sh $< $@ |
| 65 | 64 | ||
| 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) | ||
| 67 | 67 | ||
| 68 | quiet_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 | ||
| 75 | quiet_cmd_remove = REMOVE $(unwanted) | 71 | quiet_cmd_remove = REMOVE $(unwanted) |
| 76 | cmd_remove = rm -f $(unwanted-file) | 72 | cmd_remove = rm -f $(unwanted) |
| 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 $@ | ||
| 86 | 73 | ||
| 87 | ifndef HDRCHECK | 74 | __headers: $(all-headers) |
| 88 | # Rules for installing headers | 75 | ifneq ($(unwanted),) |
| 89 | __headers: $(install-file) | 76 | $(call cmd,remove) |
| 77 | endif | ||
| 90 | @: | 78 | @: |
| 91 | 79 | ||
| 92 | targets += $(install-file) | 80 | existing-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 | ||
| 100 | else | 84 | else |
| 101 | __headers: $(check-file) | ||
| 102 | @: | ||
| 103 | 85 | ||
| 104 | targets += $(check-file) | 86 | quiet_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 | ||
| 108 | endif | 89 | check-files := $(addsuffix .chk, $(all-headers)) |
| 109 | 90 | ||
| 110 | cmd_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 | ||
| 113 | ifneq ($(cmd_files),) | 94 | __headers: $(check-files) |
| 114 | include $(cmd_files) | 95 | @: |
| 115 | endif | ||
| 116 | 96 | ||
| 117 | endif # skip-inst | 97 | endif |
| 118 | 98 | ||
| 119 | PHONY += FORCE | 99 | PHONY += FORCE |
| 120 | FORCE: ; | 100 | FORCE: |
| 121 | 101 | ||
| 122 | .PHONY: $(PHONY) | 102 | .PHONY: $(PHONY) |
| @@ -69,7 +69,7 @@ _hostcxx_flags = $(KBUILD_HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) \ · 68 unmodified lines | |||
| 69 | 69 | ||
| 70 | # $(objtree)/$(obj) for including generated headers from checkin source files | 70 | # $(objtree)/$(obj) for including generated headers from checkin source files |
| 71 | ifeq ($(KBUILD_EXTMOD),) | 71 | ifeq ($(KBUILD_EXTMOD),) |
| 72 | ifneq ($(srctree),.) | 72 | ifdef 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) |
| 75 | endif | 75 | endif |
| @@ -66,6 +66,20 @@ extra-y += $(patsubst %.dtb,%.dt.yaml, $(dtb-y)) · 65 unmodified lines | |||
| 66 | extra-$(CONFIG_OF_ALL_DTBS) += $(patsubst %.dtb,%.dt.yaml, $(dtb-)) | 66 | extra-$(CONFIG_OF_ALL_DTBS) += $(patsubst %.dtb,%.dt.yaml, $(dtb-)) |
| 67 | endif | 67 | endif |
| 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. | ||
| 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 | |||
| 69 | # Add subdir path | 83 | # Add subdir path |
| 70 | 84 | ||
| 71 | extra-y := $(addprefix $(obj)/,$(extra-y)) | 85 | extra-y := $(addprefix $(obj)/,$(extra-y)) |
| @@ -140,7 +154,7 @@ endif · 68 unmodified lines | |||
| 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 |
| 142 | ifeq ($(KBUILD_EXTMOD),) | 156 | ifeq ($(KBUILD_EXTMOD),) |
| 143 | ifneq ($(srctree),.) | 157 | ifdef 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 | \ · 184 unmodified lines | |||
| 331 | ) | 345 | ) |
| 332 | 346 | ||
| 333 | quiet_cmd_bzip2 = BZIP2 $@ | 347 | quiet_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 | ||
| 339 | quiet_cmd_lzma = LZMA $@ | 353 | quiet_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 | ||
| 342 | quiet_cmd_lzo = LZO $@ | 356 | quiet_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 | ||
| 345 | quiet_cmd_lz4 = LZ4 $@ | 359 | 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; \ |
| 347 | $(size_append); } > $@ | 361 | $(size_append); } > $@ |
| 348 | 362 | ||
| 349 | # U-Boot mkimage | 363 | # U-Boot mkimage |
| @@ -386,7 +400,7 @@ quiet_cmd_uimage = UIMAGE $@ · 36 unmodified lines | |||
| 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. |
| 388 | quiet_cmd_xzkern = XZKERN $@ | 402 | 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; \ |
| 390 | $(size_append); } > $@ | 404 | $(size_append); } > $@ |
| 391 | 405 | ||
| 392 | quiet_cmd_xzmisc = XZMISC $@ | 406 | quiet_cmd_xzmisc = XZMISC $@ |
| @@ -15,7 +15,7 @@ include include/config/tristate.conf · 14 unmodified lines | |||
| 15 | 15 | ||
| 16 | include scripts/Kbuild.include | 16 | include scripts/Kbuild.include |
| 17 | 17 | ||
| 18 | ifneq ($(srctree),.) | 18 | ifdef 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)) |
| 21 | endif | 21 | endif |
| @@ -99,6 +99,7 @@ · 98 unmodified lines | |||
| 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> |
| @@ -109,6 +110,36 @@ static void usage(void) · 4 unmodified lines | |||
| 109 | exit(1); | 110 | exit(1); |
| 110 | } | 111 | } |
| 111 | 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 | */ | ||
| 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 | |||
| 112 | /* | 143 | /* |
| 113 | * Print out a dependency path from a symbol name | 144 | * Print out a dependency path from a symbol name |
| 114 | */ | 145 | */ |
| @@ -116,7 +147,7 @@ static void print_dep(const char *m, int slen, const char *dir) · 1 unmodified line | |||
| 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) · 1 unmodified line | |||
| 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 | ||
| 133 | struct item { | 164 | struct item { |
| @@ -324,13 +355,13 @@ static void parse_dep_file(char *m, const char *target) · 190 unmodified lines | |||
| 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) · 16 unmodified lines | |||
| 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 | ||
| 360 | int main(int argc, char *argv[]) | 391 | int main(int argc, char *argv[]) |
| @@ -369,7 +400,7 @@ int main(int argc, char *argv[]) · 8 unmodified lines | |||
| 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); |
| @@ -77,7 +77,7 @@ p1 << r1.p1; · 76 unmodified lines | |||
| 77 | p2 << r1.p2; | 77 | p2 << r1.p2; |
| 78 | @@ | 78 | @@ |
| 79 | 79 | ||
| 80 | cocci.print_main("WARNING opportunity for kstrdep",p1) | 80 | cocci.print_main("WARNING opportunity for kstrdup",p1) |
| 81 | cocci.print_secs("strcpy",p2) | 81 | cocci.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; · 1 unmodified line | |||
| 85 | p2 << r2.p2; | 85 | p2 << r2.p2; |
| 86 | @@ | 86 | @@ |
| 87 | 87 | ||
| 88 | cocci.print_main("WARNING opportunity for kstrdep",p1) | 88 | cocci.print_main("WARNING opportunity for kstrdup",p1) |
| 89 | cocci.print_secs("memcpy",p2) | 89 | cocci.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; · 1 unmodified line | |||
| 93 | p2 << r1.p2; | 93 | p2 << r1.p2; |
| 94 | @@ | 94 | @@ |
| 95 | 95 | ||
| 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) |
| 97 | coccilib.report.print_report(p1[0], msg) | 97 | coccilib.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; · 1 unmodified line | |||
| 101 | p2 << r2.p2; | 101 | p2 << r2.p2; |
| 102 | @@ | 102 | @@ |
| 103 | 103 | ||
| 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) |
| 105 | coccilib.report.print_report(p1[0], msg) | 105 | coccilib.report.print_report(p1[0], msg) |
| @@ -35,11 +35,11 @@ type loff_t; · 34 unmodified lines | |||
| 35 | // a function that blocks | 35 | // a function that blocks |
| 36 | @ blocks @ | 36 | @ blocks @ |
| 37 | identifier block_f; | 37 | identifier block_f; |
| 38 | identifier wait_event =~ "^wait_event_.*"; | 38 | identifier 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_.*"; · 3 unmodified lines | |||
| 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 @ |
| 51 | identifier stream_reader.readstream; | 51 | identifier stream_reader.readstream; |
| 52 | identifier wait_event =~ "^wait_event_.*"; | 52 | identifier 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 | ||
| @@ -24,7 +24,7 @@ if (id == NULL || ...) { ... return ...; } · 23 unmodified lines | |||
| 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; · 11 unmodified lines | |||
| 42 | p2 << search.p2; | 42 | p2 << search.p2; |
| 43 | @@ | 43 | @@ |
| 44 | 44 | ||
| 45 | coccilib.report.print_report(p2[0], "ERROR: missing put_device; " | 45 | coccilib.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@ |
| 52 | p1 << search.p1; | 51 | p1 << search.p1; |
| @@ -1,6 +1,6 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0 | 1 | # SPDX-License-Identifier: GPL-2.0 |
| 2 | 2 | ||
| 3 | ifneq ($(srctree),.) | 3 | ifdef building_out_of_srctree |
| 4 | 4 | ||
| 5 | symlinks := $(patsubst $(srctree)/$(src)/%,%,$(wildcard $(srctree)/$(src)/*.py)) | 5 | symlinks := $(patsubst $(srctree)/$(src)/%,%,$(wildcard $(srctree)/$(src)/*.py)) |
| 6 | 6 | ||
| @@ -25,6 +25,10 @@ static struct resword { · 24 unmodified lines | |||
| 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 }, |
| @@ -76,6 +76,7 @@ static void record_compound(struct string_list **keyw, · 75 unmodified lines | |||
| 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: · 181 unmodified lines | |||
| 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 | ||
| @@ -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 | ||
| @@ -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 | ||
| 4 | if [ $# -lt 2 ] | 4 | if [ $# -ne 2 ] |
| 5 | then | 5 | then |
| 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 |
| 18 | fi | 17 | fi |
| 19 | 18 | ||
| 20 | # Grab arguments | 19 | # Grab arguments |
| 20 | INFILE=$1 | ||
| 21 | OUTFILE=$2 | ||
| 22 | TMPFILE=$OUTFILE.tmp | ||
| 21 | 23 | ||
| 22 | OUTDIR="$1" | 24 | trap 'rm -f $OUTFILE $TMPFILE' EXIT |
| 23 | shift | ||
| 24 | SRCDIR="$1" | ||
| 25 | shift | ||
| 26 | 25 | ||
| 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 | ||
| 28 | 34 | ||
| 29 | FILE= | 35 | scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__ $TMPFILE > $OUTFILE |
| 30 | trap 'rm -f "$OUTDIR/$FILE" "$OUTDIR/$FILE.sed"' EXIT | 36 | [ $? -gt 1 ] && exit 1 |
| 31 | for i in "$@" | 37 | |
| 32 | do | 38 | rm -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" | ||
| 46 | done | ||
| 47 | trap - EXIT | 39 | trap - EXIT |
| @@ -150,6 +150,9 @@ static int read_symbol(FILE *in, struct sym_entry *s) · 149 unmodified lines | |||
| 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 */ |
| @@ -130,7 +130,7 @@ if is_enabled CONFIG_MODULES; then · 129 unmodified lines | |||
| 130 | fi | 130 | fi |
| 131 | 131 | ||
| 132 | if [ "$ARCH" != "um" ]; then | 132 | if [ "$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" |
| 135 | fi | 135 | fi |
| 136 | 136 | ||
| @@ -31,7 +31,7 @@ PROVIDES="$PROVIDES kernel-$KERNELRELEASE" · 30 unmodified lines | |||
| 31 | __KERNELRELEASE=$(echo $KERNELRELEASE | sed -e "s/-/_/g") | 31 | __KERNELRELEASE=$(echo $KERNELRELEASE | sed -e "s/-/_/g") |
| 32 | EXCLUDES="$RCS_TAR_IGNORE --exclude=.tmp_versions --exclude=*vmlinux* \ | 32 | EXCLUDES="$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 | # |
| @@ -6,7 +6,7 @@ · 5 unmodified lines | |||
| 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 | ||
| 11 | if [ "$KBUILD_VERBOSE" = "1" ]; then | 11 | if [ "$KBUILD_VERBOSE" = "1" ]; then |
| 12 | set -x | 12 | set -x |
| @@ -17,8 +17,7 @@ ignore="$(echo "$RCS_FIND_IGNORE" | sed 's|\\||g' )" · 4 unmodified lines | |||
| 17 | # tags and cscope files should also ignore MODVERSION *.mod.c files | 17 | # tags and cscope files should also ignore MODVERSION *.mod.c files |
| 18 | ignore="$ignore ( -name *.mod.c ) -prune -o" | 18 | ignore="$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 |
| 23 | if [ "${srctree}" = "." -o -z "${srctree}" ]; then | 22 | if [ "${srctree}" = "." -o -z "${srctree}" ]; then |
| 24 | tree= | 23 | tree= |
| @@ -36,21 +35,19 @@ elif [ "${ALLSOURCE_ARCHS}" = "all" ]; then · 11 unmodified lines | |||
| 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 ') |
| 37 | fi | 36 | fi |
| 38 | 37 | ||
| 39 | # find sources in arch/$ARCH | 38 | # find sources in arch/$1 |
| 40 | find_arch_sources() | 39 | find_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 |
| 50 | find_arch_include_sources() | 48 | find_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 · 249 unmodified lines | |||
| 306 | else | 303 | else |
| 307 | archinclude=${SUBARCH} | 304 | archinclude=${SUBARCH} |
| 308 | fi | 305 | 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 | ||
| 339 | fi | 306 | fi |
| 340 | 307 | ||
| 341 | remove_structs= | 308 | remove_structs= |