Commit f7bbf075 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'kbuild-fixes-v4.13' of...

Merge tag 'kbuild-fixes-v4.13' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild

Pull Kbuild fixes from Masahiro Yamada:

 - fix linker script regression caused by dead code elimination support

 - fix typos and outdated comments

 - specify kselftest-clean as a PHONY target

 - fix "make dtbs_install" when $(srctree) includes shell special
   characters like '~'

 - Move -fshort-wchar to the global option list because defining it
   partially emits warnings

* tag 'kbuild-fixes-v4.13' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
  kbuild: update comments of Makefile.asm-generic
  kbuild: Do not use hyphen in exported variable name
  Makefile: add kselftest-clean to PHONY target list
  Kbuild: use -fshort-wchar globally
  fixdep: trivial: typo fix and correction
  kbuild: trivial cleanups on the comments
  kbuild: linker script do not match C names unless LD_DEAD_CODE_DATA_ELIMINATION is configured
parents b71a5e3f 64236e31
...@@ -396,7 +396,7 @@ LINUXINCLUDE := \ ...@@ -396,7 +396,7 @@ LINUXINCLUDE := \
KBUILD_CPPFLAGS := -D__KERNEL__ KBUILD_CPPFLAGS := -D__KERNEL__
KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
-fno-strict-aliasing -fno-common \ -fno-strict-aliasing -fno-common -fshort-wchar \
-Werror-implicit-function-declaration \ -Werror-implicit-function-declaration \
-Wno-format-security \ -Wno-format-security \
-std=gnu89 $(call cc-option,-fno-PIE) -std=gnu89 $(call cc-option,-fno-PIE)
...@@ -442,7 +442,7 @@ export RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn \ ...@@ -442,7 +442,7 @@ export RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn \
# =========================================================================== # ===========================================================================
# Rules shared between *config targets and build targets # Rules shared between *config targets and build targets
# Basic helpers built in scripts/ # Basic helpers built in scripts/basic/
PHONY += scripts_basic PHONY += scripts_basic
scripts_basic: scripts_basic:
$(Q)$(MAKE) $(build)=scripts/basic $(Q)$(MAKE) $(build)=scripts/basic
...@@ -505,7 +505,7 @@ ifeq ($(KBUILD_EXTMOD),) ...@@ -505,7 +505,7 @@ ifeq ($(KBUILD_EXTMOD),)
endif endif
endif endif
endif endif
# install and module_install need also be processed one by one # install and modules_install need also be processed one by one
ifneq ($(filter install,$(MAKECMDGOALS)),) ifneq ($(filter install,$(MAKECMDGOALS)),)
ifneq ($(filter modules_install,$(MAKECMDGOALS)),) ifneq ($(filter modules_install,$(MAKECMDGOALS)),)
mixed-targets := 1 mixed-targets := 1
...@@ -964,7 +964,7 @@ export KBUILD_VMLINUX_MAIN := $(core-y) $(libs-y2) $(drivers-y) $(net-y) $(virt- ...@@ -964,7 +964,7 @@ export KBUILD_VMLINUX_MAIN := $(core-y) $(libs-y2) $(drivers-y) $(net-y) $(virt-
export KBUILD_VMLINUX_LIBS := $(libs-y1) export KBUILD_VMLINUX_LIBS := $(libs-y1)
export KBUILD_LDS := arch/$(SRCARCH)/kernel/vmlinux.lds export KBUILD_LDS := arch/$(SRCARCH)/kernel/vmlinux.lds
export LDFLAGS_vmlinux export LDFLAGS_vmlinux
# used by scripts/pacmage/Makefile # used by scripts/package/Makefile
export KBUILD_ALLDIRS := $(sort $(filter-out arch/%,$(vmlinux-alldirs)) arch Documentation include samples scripts tools) export KBUILD_ALLDIRS := $(sort $(filter-out arch/%,$(vmlinux-alldirs)) arch Documentation include samples scripts tools)
vmlinux-deps := $(KBUILD_LDS) $(KBUILD_VMLINUX_INIT) $(KBUILD_VMLINUX_MAIN) $(KBUILD_VMLINUX_LIBS) vmlinux-deps := $(KBUILD_LDS) $(KBUILD_VMLINUX_INIT) $(KBUILD_VMLINUX_MAIN) $(KBUILD_VMLINUX_LIBS)
...@@ -992,7 +992,7 @@ include/generated/autoksyms.h: FORCE ...@@ -992,7 +992,7 @@ include/generated/autoksyms.h: FORCE
ARCH_POSTLINK := $(wildcard $(srctree)/arch/$(SRCARCH)/Makefile.postlink) ARCH_POSTLINK := $(wildcard $(srctree)/arch/$(SRCARCH)/Makefile.postlink)
# Final link of vmlinux with optional arch pass after final link # Final link of vmlinux with optional arch pass after final link
cmd_link-vmlinux = \ cmd_link-vmlinux = \
$(CONFIG_SHELL) $< $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) ; \ $(CONFIG_SHELL) $< $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) ; \
$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true) $(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true)
...@@ -1184,6 +1184,7 @@ PHONY += kselftest ...@@ -1184,6 +1184,7 @@ PHONY += kselftest
kselftest: kselftest:
$(Q)$(MAKE) -C tools/testing/selftests run_tests $(Q)$(MAKE) -C tools/testing/selftests run_tests
PHONY += kselftest-clean
kselftest-clean: kselftest-clean:
$(Q)$(MAKE) -C tools/testing/selftests clean $(Q)$(MAKE) -C tools/testing/selftests clean
......
...@@ -7,9 +7,6 @@ obj-y += xenbus/ ...@@ -7,9 +7,6 @@ obj-y += xenbus/
nostackp := $(call cc-option, -fno-stack-protector) nostackp := $(call cc-option, -fno-stack-protector)
CFLAGS_features.o := $(nostackp) CFLAGS_features.o := $(nostackp)
CFLAGS_efi.o += -fshort-wchar
LDFLAGS += $(call ld-option, --no-wchar-size-warning)
dom0-$(CONFIG_ARM64) += arm-device.o dom0-$(CONFIG_ARM64) += arm-device.o
dom0-$(CONFIG_PCI) += pci.o dom0-$(CONFIG_PCI) += pci.o
dom0-$(CONFIG_USB_SUPPORT) += dbgp.o dom0-$(CONFIG_USB_SUPPORT) += dbgp.o
......
...@@ -59,6 +59,22 @@ ...@@ -59,6 +59,22 @@
/* Align . to a 8 byte boundary equals to maximum function alignment. */ /* Align . to a 8 byte boundary equals to maximum function alignment. */
#define ALIGN_FUNCTION() . = ALIGN(8) #define ALIGN_FUNCTION() . = ALIGN(8)
/*
* LD_DEAD_CODE_DATA_ELIMINATION option enables -fdata-sections, which
* generates .data.identifier sections, which need to be pulled in with
* .data. We don't want to pull in .data..other sections, which Linux
* has defined. Same for text and bss.
*/
#ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
#define TEXT_MAIN .text .text.[0-9a-zA-Z_]*
#define DATA_MAIN .data .data.[0-9a-zA-Z_]*
#define BSS_MAIN .bss .bss.[0-9a-zA-Z_]*
#else
#define TEXT_MAIN .text
#define DATA_MAIN .data
#define BSS_MAIN .bss
#endif
/* /*
* Align to a 32 byte boundary equal to the * Align to a 32 byte boundary equal to the
* alignment gcc 4.5 uses for a struct * alignment gcc 4.5 uses for a struct
...@@ -198,12 +214,9 @@ ...@@ -198,12 +214,9 @@
/* /*
* .data section * .data section
* LD_DEAD_CODE_DATA_ELIMINATION option enables -fdata-sections generates
* .data.identifier which needs to be pulled in with .data, but don't want to
* pull in .data..stuff which has its own requirements. Same for bss.
*/ */
#define DATA_DATA \ #define DATA_DATA \
*(.data .data.[0-9a-zA-Z_]*) \ *(DATA_MAIN) \
*(.ref.data) \ *(.ref.data) \
*(.data..shared_aligned) /* percpu related */ \ *(.data..shared_aligned) /* percpu related */ \
MEM_KEEP(init.data) \ MEM_KEEP(init.data) \
...@@ -434,16 +447,17 @@ ...@@ -434,16 +447,17 @@
VMLINUX_SYMBOL(__security_initcall_end) = .; \ VMLINUX_SYMBOL(__security_initcall_end) = .; \
} }
/* .text section. Map to function alignment to avoid address changes /*
* .text section. Map to function alignment to avoid address changes
* during second ld run in second ld pass when generating System.map * during second ld run in second ld pass when generating System.map
* LD_DEAD_CODE_DATA_ELIMINATION option enables -ffunction-sections generates *
* .text.identifier which needs to be pulled in with .text , but some * TEXT_MAIN here will match .text.fixup and .text.unlikely if dead
* architectures define .text.foo which is not intended to be pulled in here. * code elimination is enabled, so these sections should be converted
* Those enabling LD_DEAD_CODE_DATA_ELIMINATION must ensure they don't have * to use ".." first.
* conflicting section names, and must pull in .text.[0-9a-zA-Z_]* */ */
#define TEXT_TEXT \ #define TEXT_TEXT \
ALIGN_FUNCTION(); \ ALIGN_FUNCTION(); \
*(.text.hot .text .text.fixup .text.unlikely) \ *(.text.hot TEXT_MAIN .text.fixup .text.unlikely) \
*(.ref.text) \ *(.ref.text) \
MEM_KEEP(init.text) \ MEM_KEEP(init.text) \
MEM_KEEP(exit.text) \ MEM_KEEP(exit.text) \
...@@ -613,7 +627,7 @@ ...@@ -613,7 +627,7 @@
BSS_FIRST_SECTIONS \ BSS_FIRST_SECTIONS \
*(.bss..page_aligned) \ *(.bss..page_aligned) \
*(.dynbss) \ *(.dynbss) \
*(.bss .bss.[0-9a-zA-Z_]*) \ *(BSS_MAIN) \
*(COMMON) \ *(COMMON) \
} }
......
...@@ -85,8 +85,8 @@ TMPOUT := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/) ...@@ -85,8 +85,8 @@ TMPOUT := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/)
# try-run # try-run
# Usage: option = $(call try-run, $(CC)...-o "$$TMP",option-ok,otherwise) # Usage: option = $(call try-run, $(CC)...-o "$$TMP",option-ok,otherwise)
# Exit code chooses option. "$$TMP" is can be used as temporary file and # Exit code chooses option. "$$TMP" serves as a temporary file and is
# is automatically cleaned up. # automatically cleaned up.
try-run = $(shell set -e; \ try-run = $(shell set -e; \
TMP="$(TMPOUT).$$$$.tmp"; \ TMP="$(TMPOUT).$$$$.tmp"; \
TMPO="$(TMPOUT).$$$$.o"; \ TMPO="$(TMPOUT).$$$$.o"; \
...@@ -261,7 +261,6 @@ make-cmd = $(call escsq,$(subst \#,\\\#,$(subst $$,$$$$,$(cmd_$(1))))) ...@@ -261,7 +261,6 @@ make-cmd = $(call escsq,$(subst \#,\\\#,$(subst $$,$$$$,$(cmd_$(1)))))
any-prereq = $(filter-out $(PHONY),$?) $(filter-out $(PHONY) $(wildcard $^),$^) any-prereq = $(filter-out $(PHONY),$?) $(filter-out $(PHONY) $(wildcard $^),$^)
# Execute command if command has changed or prerequisite(s) are updated. # Execute command if command has changed or prerequisite(s) are updated.
#
if_changed = $(if $(strip $(any-prereq) $(arg-check)), \ if_changed = $(if $(strip $(any-prereq) $(arg-check)), \
@set -e; \ @set -e; \
$(echo-cmd) $(cmd_$(1)); \ $(echo-cmd) $(cmd_$(1)); \
...@@ -315,7 +314,7 @@ if_changed_rule = $(if $(strip $(any-prereq) $(arg-check) ), \ ...@@ -315,7 +314,7 @@ if_changed_rule = $(if $(strip $(any-prereq) $(arg-check) ), \
$(rule_$(1)), @:) $(rule_$(1)), @:)
### ###
# why - tell why a a target got build # why - tell why a target got built
# enabled by make V=2 # enabled by make V=2
# Output (listed in the order they are checked): # Output (listed in the order they are checked):
# (1) - due to target is PHONY # (1) - due to target is PHONY
......
# include/asm-generic contains a lot of files that are used # include/asm-generic contains a lot of files that are used
# verbatim by several architectures. # verbatim by several architectures.
# #
# This Makefile reads the file arch/$(SRCARCH)/include/asm/Kbuild # This Makefile reads the file arch/$(SRCARCH)/include/$(src)/Kbuild
# and for each file listed in this file with generic-y creates # and for each file listed in this file with generic-y creates
# a small wrapper file in $(obj) (arch/$(SRCARCH)/include/generated/asm) # a small wrapper file in $(obj) (arch/$(SRCARCH)/include/generated/$(src))
kbuild-file := $(srctree)/arch/$(SRCARCH)/include/$(src)/Kbuild kbuild-file := $(srctree)/arch/$(SRCARCH)/include/$(src)/Kbuild
-include $(kbuild-file) -include $(kbuild-file)
......
...@@ -245,13 +245,13 @@ sub_cmd_record_mcount = set -e ; perl $(srctree)/scripts/recordmcount.pl "$(ARCH ...@@ -245,13 +245,13 @@ sub_cmd_record_mcount = set -e ; perl $(srctree)/scripts/recordmcount.pl "$(ARCH
"$(LD)" "$(NM)" "$(RM)" "$(MV)" \ "$(LD)" "$(NM)" "$(RM)" "$(MV)" \
"$(if $(part-of-module),1,0)" "$(@)"; "$(if $(part-of-module),1,0)" "$(@)";
recordmcount_source := $(srctree)/scripts/recordmcount.pl recordmcount_source := $(srctree)/scripts/recordmcount.pl
endif endif # BUILD_C_RECORDMCOUNT
cmd_record_mcount = \ cmd_record_mcount = \
if [ "$(findstring $(CC_FLAGS_FTRACE),$(_c_flags))" = \ if [ "$(findstring $(CC_FLAGS_FTRACE),$(_c_flags))" = \
"$(CC_FLAGS_FTRACE)" ]; then \ "$(CC_FLAGS_FTRACE)" ]; then \
$(sub_cmd_record_mcount) \ $(sub_cmd_record_mcount) \
fi; fi;
endif endif # CONFIG_FTRACE_MCOUNT_RECORD
ifdef CONFIG_STACK_VALIDATION ifdef CONFIG_STACK_VALIDATION
ifneq ($(SKIP_STACK_VALIDATION),1) ifneq ($(SKIP_STACK_VALIDATION),1)
......
...@@ -14,7 +14,7 @@ src := $(obj) ...@@ -14,7 +14,7 @@ src := $(obj)
PHONY := __dtbs_install PHONY := __dtbs_install
__dtbs_install: __dtbs_install:
export dtbinst-root ?= $(obj) export dtbinst_root ?= $(obj)
include include/config/auto.conf include include/config/auto.conf
include scripts/Kbuild.include include scripts/Kbuild.include
...@@ -27,7 +27,7 @@ dtbinst-dirs := $(dts-dirs) ...@@ -27,7 +27,7 @@ dtbinst-dirs := $(dts-dirs)
quiet_cmd_dtb_install = INSTALL $< quiet_cmd_dtb_install = INSTALL $<
cmd_dtb_install = mkdir -p $(2); cp $< $(2) cmd_dtb_install = mkdir -p $(2); cp $< $(2)
install-dir = $(patsubst $(dtbinst-root)%,$(INSTALL_DTBS_PATH)%,$(obj)) install-dir = $(patsubst $(dtbinst_root)%,$(INSTALL_DTBS_PATH)%,$(obj))
$(dtbinst-files): %.dtb: $(obj)/%.dtb $(dtbinst-files): %.dtb: $(obj)/%.dtb
$(call cmd,dtb_install,$(install-dir)) $(call cmd,dtb_install,$(install-dir))
......
### ###
# Makefile.basic lists the most basic programs used during the build process. # This Makefile lists the most basic programs used during the build process.
# The programs listed herein are what are needed to do the basic stuff, # The programs listed herein are what are needed to do the basic stuff,
# such as fix file dependencies. # such as fix file dependencies.
# This initial step is needed to avoid files to be recompiled # This initial step is needed to avoid files to be recompiled
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
* *
* So we play the same trick that "mkdep" played before. We replace * So we play the same trick that "mkdep" played before. We replace
* the dependency on autoconf.h by a dependency on every config * the dependency on autoconf.h by a dependency on every config
* option which is mentioned in any of the listed prequisites. * option which is mentioned in any of the listed prerequisites.
* *
* kconfig populates a tree in include/config/ with an empty file * kconfig populates a tree in include/config/ with an empty file
* for each config symbol and when the configuration is updated * for each config symbol and when the configuration is updated
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
* the config symbols are rebuilt. * the config symbols are rebuilt.
* *
* So if the user changes his CONFIG_HIS_DRIVER option, only the objects * So if the user changes his CONFIG_HIS_DRIVER option, only the objects
* which depend on "include/linux/config/his/driver.h" will be rebuilt, * which depend on "include/config/his/driver.h" will be rebuilt,
* so most likely only his driver ;-) * so most likely only his driver ;-)
* *
* The idea above dates, by the way, back to Michael E Chastain, AFAIK. * The idea above dates, by the way, back to Michael E Chastain, AFAIK.
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
* and then basically copies the .<target>.d file to stdout, in the * and then basically copies the .<target>.d file to stdout, in the
* process filtering out the dependency on autoconf.h and adding * process filtering out the dependency on autoconf.h and adding
* dependencies on include/config/my/option.h for every * dependencies on include/config/my/option.h for every
* CONFIG_MY_OPTION encountered in any of the prequisites. * CONFIG_MY_OPTION encountered in any of the prerequisites.
* *
* It will also filter out all the dependencies on *.ver. We need * It will also filter out all the dependencies on *.ver. We need
* to make sure that the generated version checksum are globally up * to make sure that the generated version checksum are globally up
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment