Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f7bbf075 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

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
Loading
Loading
Loading
Loading
+7 −6
Original line number Original line Diff line number Diff line
@@ -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 \
# ===========================================================================
# ===========================================================================
# 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),)
                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-
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)
@@ -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


+0 −3
Original line number Original line Diff line number Diff line
@@ -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
+26 −12
Original line number Original line Diff line number Diff line
@@ -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 @@


/*
/*
 * .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 @@
		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 @@
		BSS_FIRST_SECTIONS					\
		BSS_FIRST_SECTIONS					\
		*(.bss..page_aligned)					\
		*(.bss..page_aligned)					\
		*(.dynbss)						\
		*(.dynbss)						\
		*(.bss .bss.[0-9a-zA-Z_]*)				\
		*(BSS_MAIN)						\
		*(COMMON)						\
		*(COMMON)						\
	}
	}


+3 −4
Original line number Original line Diff line number Diff line
@@ -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)))))
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) ), \
	$(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
+2 −2
Original line number Original line Diff line number Diff line
# 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)
Loading