aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/kbuild/kbuild.txt16
-rw-r--r--Documentation/kbuild/makefiles.txt8
-rw-r--r--Documentation/process/changes.rst19
-rw-r--r--Makefile24
-rw-r--r--arch/alpha/boot/Makefile2
-rw-r--r--arch/arm/Makefile3
-rw-r--r--arch/arm/mach-at91/Makefile25
-rw-r--r--arch/arm64/kernel/vdso/note.S3
-rw-r--r--arch/openrisc/Makefile1
-rw-r--r--arch/powerpc/kernel/vdso32/note.S3
-rw-r--r--arch/powerpc/purgatory/Makefile3
-rw-r--r--arch/riscv/Makefile1
-rw-r--r--arch/s390/kernel/syscalls/Makefile6
-rw-r--r--arch/s390/purgatory/Makefile3
-rw-r--r--arch/um/Makefile11
-rw-r--r--arch/um/drivers/Makefile4
-rw-r--r--arch/x86/Makefile.um2
-rw-r--r--arch/x86/entry/vdso/vdso-note.S3
-rw-r--r--arch/x86/entry/vdso/vdso32/note.S3
-rw-r--r--arch/x86/purgatory/Makefile3
-rw-r--r--arch/xtensa/boot/Makefile3
-rw-r--r--include/linux/build-salt.h20
-rw-r--r--init/Kconfig9
-rw-r--r--init/version.c3
-rw-r--r--kernel/Makefile2
-rw-r--r--net/bpfilter/Makefile4
-rw-r--r--samples/bpf/Makefile22
-rw-r--r--samples/seccomp/Makefile6
-rw-r--r--scripts/.gitignore1
-rw-r--r--scripts/Kbuild.include4
-rw-r--r--scripts/Makefile5
-rw-r--r--scripts/Makefile.build7
-rw-r--r--scripts/Makefile.clean1
-rw-r--r--scripts/Makefile.host24
-rw-r--r--scripts/Makefile.lib7
-rw-r--r--scripts/basic/.gitignore1
-rw-r--r--scripts/basic/Makefile1
-rw-r--r--scripts/bin2c.c (renamed from scripts/basic/bin2c.c)0
-rwxr-xr-xscripts/coccicheck5
-rw-r--r--scripts/coccinelle/api/atomic_as_refcounter.cocci129
-rw-r--r--scripts/coccinelle/tests/doubletest.cocci34
-rwxr-xr-xscripts/depmod.sh8
-rw-r--r--scripts/kconfig/Makefile8
-rw-r--r--scripts/mod/modpost.c3
-rwxr-xr-xscripts/package/buildtar12
-rwxr-xr-xscripts/package/mkdebian68
-rwxr-xr-xscripts/tracing/draw_functrace.py2
-rw-r--r--security/tomoyo/Makefile2
-rw-r--r--tools/build/Build.include2
-rw-r--r--tools/build/Makefile2
-rw-r--r--tools/objtool/Makefile4
51 files changed, 373 insertions, 169 deletions
diff --git a/Documentation/kbuild/kbuild.txt b/Documentation/kbuild/kbuild.txt
index 114c7ce7b58d..8390c360d4b3 100644
--- a/Documentation/kbuild/kbuild.txt
+++ b/Documentation/kbuild/kbuild.txt
@@ -50,6 +50,22 @@ LDFLAGS_MODULE
50-------------------------------------------------- 50--------------------------------------------------
51Additional options used for $(LD) when linking modules. 51Additional options used for $(LD) when linking modules.
52 52
53HOSTCFLAGS
54--------------------------------------------------
55Additional flags to be passed to $(HOSTCC) when building host programs.
56
57HOSTCXXFLAGS
58--------------------------------------------------
59Additional flags to be passed to $(HOSTCXX) when building host programs.
60
61HOSTLDFLAGS
62--------------------------------------------------
63Additional flags to be passed when linking host programs.
64
65HOSTLDLIBS
66--------------------------------------------------
67Additional libraries to link against when building host programs.
68
53KBUILD_KCONFIG 69KBUILD_KCONFIG
54-------------------------------------------------- 70--------------------------------------------------
55Set the top-level Kconfig file to the value of this environment 71Set the top-level Kconfig file to the value of this environment
diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt
index 048fc39a6b91..766355b1d221 100644
--- a/Documentation/kbuild/makefiles.txt
+++ b/Documentation/kbuild/makefiles.txt
@@ -661,7 +661,7 @@ Both possibilities are described in the following.
661 661
662 When compiling host programs, it is possible to set specific flags. 662 When compiling host programs, it is possible to set specific flags.
663 The programs will always be compiled utilising $(HOSTCC) passed 663 The programs will always be compiled utilising $(HOSTCC) passed
664 the options specified in $(HOSTCFLAGS). 664 the options specified in $(KBUILD_HOSTCFLAGS).
665 To set flags that will take effect for all host programs created 665 To set flags that will take effect for all host programs created
666 in that Makefile, use the variable HOST_EXTRACFLAGS. 666 in that Makefile, use the variable HOST_EXTRACFLAGS.
667 667
@@ -1105,6 +1105,12 @@ When kbuild executes, the following steps are followed (roughly):
1105 target: source(s) FORCE 1105 target: source(s) FORCE
1106 #WRONG!# $(call if_changed, ld/objcopy/gzip/...) 1106 #WRONG!# $(call if_changed, ld/objcopy/gzip/...)
1107 1107
1108 Note: if_changed should not be used more than once per target.
1109 It stores the executed command in a corresponding .cmd
1110 file and multiple calls would result in overwrites and
1111 unwanted results when the target is up to date and only the
1112 tests on changed commands trigger execution of commands.
1113
1108 ld 1114 ld
1109 Link target. Often, LDFLAGS_$@ is used to set specific options to ld. 1115 Link target. Often, LDFLAGS_$@ is used to set specific options to ld.
1110 1116
diff --git a/Documentation/process/changes.rst b/Documentation/process/changes.rst
index ddc029734b25..005d8842a503 100644
--- a/Documentation/process/changes.rst
+++ b/Documentation/process/changes.rst
@@ -35,7 +35,7 @@ binutils 2.20 ld -v
35flex 2.5.35 flex --version 35flex 2.5.35 flex --version
36bison 2.0 bison --version 36bison 2.0 bison --version
37util-linux 2.10o fdformat --version 37util-linux 2.10o fdformat --version
38module-init-tools 0.9.10 depmod -V 38kmod 13 depmod -V
39e2fsprogs 1.41.4 e2fsck -V 39e2fsprogs 1.41.4 e2fsck -V
40jfsutils 1.1.3 fsck.jfs -V 40jfsutils 1.1.3 fsck.jfs -V
41reiserfsprogs 3.6.3 reiserfsck -V 41reiserfsprogs 3.6.3 reiserfsck -V
@@ -156,12 +156,6 @@ is not build with ``CONFIG_KALLSYMS`` and you have no way to rebuild and
156reproduce the Oops with that option, then you can still decode that Oops 156reproduce the Oops with that option, then you can still decode that Oops
157with ksymoops. 157with ksymoops.
158 158
159Module-Init-Tools
160-----------------
161
162A new module loader is now in the kernel that requires ``module-init-tools``
163to use. It is backward compatible with the 2.4.x series kernels.
164
165Mkinitrd 159Mkinitrd
166-------- 160--------
167 161
@@ -371,16 +365,17 @@ Util-linux
371 365
372- <https://www.kernel.org/pub/linux/utils/util-linux/> 366- <https://www.kernel.org/pub/linux/utils/util-linux/>
373 367
368Kmod
369----
370
371- <https://www.kernel.org/pub/linux/utils/kernel/kmod/>
372- <https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git>
373
374Ksymoops 374Ksymoops
375-------- 375--------
376 376
377- <https://www.kernel.org/pub/linux/utils/kernel/ksymoops/v2.4/> 377- <https://www.kernel.org/pub/linux/utils/kernel/ksymoops/v2.4/>
378 378
379Module-Init-Tools
380-----------------
381
382- <https://www.kernel.org/pub/linux/utils/kernel/module-init-tools/>
383
384Mkinitrd 379Mkinitrd
385-------- 380--------
386 381
diff --git a/Makefile b/Makefile
index 863f58503bee..cc4875d5caca 100644
--- a/Makefile
+++ b/Makefile
@@ -224,7 +224,7 @@ clean-targets := %clean mrproper cleandocs
224no-dot-config-targets := $(clean-targets) \ 224no-dot-config-targets := $(clean-targets) \
225 cscope gtags TAGS tags help% %docs check% coccicheck \ 225 cscope gtags TAGS tags help% %docs check% coccicheck \
226 $(version_h) headers_% archheaders archscripts \ 226 $(version_h) headers_% archheaders archscripts \
227 kernelversion %src-pkg 227 %asm-generic kernelversion %src-pkg
228 228
229config-targets := 0 229config-targets := 0
230mixed-targets := 0 230mixed-targets := 0
@@ -359,11 +359,12 @@ HOST_LFS_LIBS := $(shell getconf LFS_LIBS 2>/dev/null)
359 359
360HOSTCC = gcc 360HOSTCC = gcc
361HOSTCXX = g++ 361HOSTCXX = g++
362HOSTCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 \ 362KBUILD_HOSTCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 \
363 -fomit-frame-pointer -std=gnu89 $(HOST_LFS_CFLAGS) 363 -fomit-frame-pointer -std=gnu89 $(HOST_LFS_CFLAGS) \
364HOSTCXXFLAGS := -O2 $(HOST_LFS_CFLAGS) 364 $(HOSTCFLAGS)
365HOSTLDFLAGS := $(HOST_LFS_LDFLAGS) 365KBUILD_HOSTCXXFLAGS := -O2 $(HOST_LFS_CFLAGS) $(HOSTCXXFLAGS)
366HOST_LOADLIBES := $(HOST_LFS_LIBS) 366KBUILD_HOSTLDFLAGS := $(HOST_LFS_LDFLAGS) $(HOSTLDFLAGS)
367KBUILD_HOSTLDLIBS := $(HOST_LFS_LIBS) $(HOSTLDLIBS)
367 368
368# Make variables (CC, etc...) 369# Make variables (CC, etc...)
369AS = $(CROSS_COMPILE)as 370AS = $(CROSS_COMPILE)as
@@ -429,10 +430,10 @@ KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds
429LDFLAGS := 430LDFLAGS :=
430GCC_PLUGINS_CFLAGS := 431GCC_PLUGINS_CFLAGS :=
431 432
432export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC 433export ARCH SRCARCH CONFIG_SHELL HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE AS LD CC
433export CPP AR NM STRIP OBJCOPY OBJDUMP HOSTLDFLAGS HOST_LOADLIBES 434export CPP AR NM STRIP OBJCOPY OBJDUMP KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS
434export MAKE LEX YACC AWK GENKSYMS INSTALLKERNEL PERL PYTHON PYTHON2 PYTHON3 UTS_MACHINE 435export MAKE LEX YACC AWK GENKSYMS INSTALLKERNEL PERL PYTHON PYTHON2 PYTHON3 UTS_MACHINE
435export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS 436export HOSTCXX KBUILD_HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS
436 437
437export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS 438export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS
438export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE 439export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE
@@ -1009,9 +1010,10 @@ ifdef CONFIG_GDB_SCRIPTS
1009endif 1010endif
1010 +$(call if_changed,link-vmlinux) 1011 +$(call if_changed,link-vmlinux)
1011 1012
1012# Build samples along the rest of the kernel 1013# Build samples along the rest of the kernel. This needs headers_install.
1013ifdef CONFIG_SAMPLES 1014ifdef CONFIG_SAMPLES
1014vmlinux-dirs += samples 1015vmlinux-dirs += samples
1016samples: headers_install
1015endif 1017endif
1016 1018
1017# The actual objects are generated when descending, 1019# The actual objects are generated when descending,
@@ -1116,7 +1118,7 @@ define filechk_version.h
1116 echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))';) 1118 echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))';)
1117endef 1119endef
1118 1120
1119$(version_h): $(srctree)/Makefile FORCE 1121$(version_h): FORCE
1120 $(call filechk,version.h) 1122 $(call filechk,version.h)
1121 $(Q)rm -f $(old_version_h) 1123 $(Q)rm -f $(old_version_h)
1122 1124
diff --git a/arch/alpha/boot/Makefile b/arch/alpha/boot/Makefile
index 0cbe4c59d3ce..991e023a6fc4 100644
--- a/arch/alpha/boot/Makefile
+++ b/arch/alpha/boot/Makefile
@@ -14,7 +14,7 @@ targets := vmlinux.gz vmlinux \
14 tools/bootpzh bootloader bootpheader bootpzheader 14 tools/bootpzh bootloader bootpheader bootpzheader
15OBJSTRIP := $(obj)/tools/objstrip 15OBJSTRIP := $(obj)/tools/objstrip
16 16
17HOSTCFLAGS := -Wall -I$(objtree)/usr/include 17KBUILD_HOSTCFLAGS := -Wall -I$(objtree)/usr/include
18BOOTCFLAGS += -I$(objtree)/$(obj) -I$(srctree)/$(obj) 18BOOTCFLAGS += -I$(objtree)/$(obj) -I$(srctree)/$(obj)
19 19
20# SRM bootable image. Copy to offset 512 of a partition. 20# SRM bootable image. Copy to offset 512 of a partition.
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 62ebeae9f837..e7d703d8fac3 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -10,9 +10,6 @@
10# 10#
11# Copyright (C) 1995-2001 by Russell King 11# Copyright (C) 1995-2001 by Russell King
12 12
13# Ensure linker flags are correct
14LDFLAGS :=
15
16LDFLAGS_vmlinux :=-p --no-undefined -X --pic-veneer 13LDFLAGS_vmlinux :=-p --no-undefined -X --pic-veneer
17ifeq ($(CONFIG_CPU_ENDIAN_BE8),y) 14ifeq ($(CONFIG_CPU_ENDIAN_BE8),y)
18LDFLAGS_vmlinux += --be8 15LDFLAGS_vmlinux += --be8
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index 4ea93c9df77b..7415f181907b 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -19,31 +19,6 @@ ifeq ($(CONFIG_PM_DEBUG),y)
19CFLAGS_pm.o += -DDEBUG 19CFLAGS_pm.o += -DDEBUG
20endif 20endif
21 21
22# Default sed regexp - multiline due to syntax constraints
23define sed-y
24 "/^->/{s:->#\(.*\):/* \1 */:; \
25 s:^->\([^ ]*\) [\$$#]*\([-0-9]*\) \(.*\):#define \1 \2 /* \3 */:; \
26 s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \
27 s:->::; p;}"
28endef
29
30# Use filechk to avoid rebuilds when a header changes, but the resulting file
31# does not
32define filechk_offsets
33 (set -e; \
34 echo "#ifndef $2"; \
35 echo "#define $2"; \
36 echo "/*"; \
37 echo " * DO NOT MODIFY."; \
38 echo " *"; \
39 echo " * This file was generated by Kbuild"; \
40 echo " */"; \
41 echo ""; \
42 sed -ne $(sed-y); \
43 echo ""; \
44 echo "#endif" )
45endef
46
47arch/arm/mach-at91/pm_data-offsets.s: arch/arm/mach-at91/pm_data-offsets.c 22arch/arm/mach-at91/pm_data-offsets.s: arch/arm/mach-at91/pm_data-offsets.c
48 $(call if_changed_dep,cc_s_c) 23 $(call if_changed_dep,cc_s_c)
49 24
diff --git a/arch/arm64/kernel/vdso/note.S b/arch/arm64/kernel/vdso/note.S
index b82c85e5d972..e20483b104d9 100644
--- a/arch/arm64/kernel/vdso/note.S
+++ b/arch/arm64/kernel/vdso/note.S
@@ -22,7 +22,10 @@
22#include <linux/uts.h> 22#include <linux/uts.h>
23#include <linux/version.h> 23#include <linux/version.h>
24#include <linux/elfnote.h> 24#include <linux/elfnote.h>
25#include <linux/build-salt.h>
25 26
26ELFNOTE_START(Linux, 0, "a") 27ELFNOTE_START(Linux, 0, "a")
27 .long LINUX_VERSION_CODE 28 .long LINUX_VERSION_CODE
28ELFNOTE_END 29ELFNOTE_END
30
31BUILD_SALT
diff --git a/arch/openrisc/Makefile b/arch/openrisc/Makefile
index 89076a66eee2..70e06d34006c 100644
--- a/arch/openrisc/Makefile
+++ b/arch/openrisc/Makefile
@@ -19,7 +19,6 @@
19 19
20KBUILD_DEFCONFIG := or1ksim_defconfig 20KBUILD_DEFCONFIG := or1ksim_defconfig
21 21
22LDFLAGS :=
23OBJCOPYFLAGS := -O binary -R .note -R .comment -S 22OBJCOPYFLAGS := -O binary -R .note -R .comment -S
24LDFLAGS_vmlinux := 23LDFLAGS_vmlinux :=
25LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) 24LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
diff --git a/arch/powerpc/kernel/vdso32/note.S b/arch/powerpc/kernel/vdso32/note.S
index d4b5be4f3d5f..227a7327399e 100644
--- a/arch/powerpc/kernel/vdso32/note.S
+++ b/arch/powerpc/kernel/vdso32/note.S
@@ -5,6 +5,7 @@
5 5
6#include <linux/uts.h> 6#include <linux/uts.h>
7#include <linux/version.h> 7#include <linux/version.h>
8#include <linux/build-salt.h>
8 9
9#define ASM_ELF_NOTE_BEGIN(name, flags, vendor, type) \ 10#define ASM_ELF_NOTE_BEGIN(name, flags, vendor, type) \
10 .section name, flags; \ 11 .section name, flags; \
@@ -23,3 +24,5 @@
23 ASM_ELF_NOTE_BEGIN(".note.kernel-version", "a", UTS_SYSNAME, 0) 24 ASM_ELF_NOTE_BEGIN(".note.kernel-version", "a", UTS_SYSNAME, 0)
24 .long LINUX_VERSION_CODE 25 .long LINUX_VERSION_CODE
25 ASM_ELF_NOTE_END 26 ASM_ELF_NOTE_END
27
28BUILD_SALT
diff --git a/arch/powerpc/purgatory/Makefile b/arch/powerpc/purgatory/Makefile
index 30e05decbb4c..4314ba5baf43 100644
--- a/arch/powerpc/purgatory/Makefile
+++ b/arch/powerpc/purgatory/Makefile
@@ -6,9 +6,8 @@ LDFLAGS_purgatory.ro := -e purgatory_start -r --no-undefined
6$(obj)/purgatory.ro: $(obj)/trampoline.o FORCE 6$(obj)/purgatory.ro: $(obj)/trampoline.o FORCE
7 $(call if_changed,ld) 7 $(call if_changed,ld)
8 8
9CMD_BIN2C = $(objtree)/scripts/basic/bin2c
10quiet_cmd_bin2c = BIN2C $@ 9quiet_cmd_bin2c = BIN2C $@
11 cmd_bin2c = $(CMD_BIN2C) kexec_purgatory < $< > $@ 10 cmd_bin2c = $(objtree)/scripts/bin2c kexec_purgatory < $< > $@
12 11
13$(obj)/kexec-purgatory.c: $(obj)/purgatory.ro FORCE 12$(obj)/kexec-purgatory.c: $(obj)/purgatory.ro FORCE
14 $(call if_changed,bin2c) 13 $(call if_changed,bin2c)
diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile
index 6d4a5f6c3f4f..2627e4813edf 100644
--- a/arch/riscv/Makefile
+++ b/arch/riscv/Makefile
@@ -8,7 +8,6 @@
8# for more details. 8# for more details.
9# 9#
10 10
11LDFLAGS :=
12OBJCOPYFLAGS := -O binary 11OBJCOPYFLAGS := -O binary
13LDFLAGS_vmlinux := 12LDFLAGS_vmlinux :=
14ifeq ($(CONFIG_DYNAMIC_FTRACE),y) 13ifeq ($(CONFIG_DYNAMIC_FTRACE),y)
diff --git a/arch/s390/kernel/syscalls/Makefile b/arch/s390/kernel/syscalls/Makefile
index 8ff96c08955f..4d929edc80a6 100644
--- a/arch/s390/kernel/syscalls/Makefile
+++ b/arch/s390/kernel/syscalls/Makefile
@@ -25,15 +25,15 @@ _dummy := $(shell [ -d '$(uapi)' ] || mkdir -p '$(uapi)') \
25 $(shell [ -d '$(kapi)' ] || mkdir -p '$(kapi)') 25 $(shell [ -d '$(kapi)' ] || mkdir -p '$(kapi)')
26 26
27define filechk_syshdr 27define filechk_syshdr
28 $(CONFIG_SHELL) '$(systbl)' -H -a $(syshdr_abi_$(basetarget)) -f "$2" 28 $(CONFIG_SHELL) '$(systbl)' -H -a $(syshdr_abi_$(basetarget)) -f "$2" < $<
29endef 29endef
30 30
31define filechk_sysnr 31define filechk_sysnr
32 $(CONFIG_SHELL) '$(systbl)' -N -a $(sysnr_abi_$(basetarget)) 32 $(CONFIG_SHELL) '$(systbl)' -N -a $(sysnr_abi_$(basetarget)) < $<
33endef 33endef
34 34
35define filechk_syscalls 35define filechk_syscalls
36 $(CONFIG_SHELL) '$(systbl)' -S 36 $(CONFIG_SHELL) '$(systbl)' -S < $<
37endef 37endef
38 38
39syshdr_abi_unistd_32 := common,32 39syshdr_abi_unistd_32 := common,32
diff --git a/arch/s390/purgatory/Makefile b/arch/s390/purgatory/Makefile
index 8d61218a71aa..ce6a3f75065b 100644
--- a/arch/s390/purgatory/Makefile
+++ b/arch/s390/purgatory/Makefile
@@ -28,9 +28,8 @@ KBUILD_AFLAGS := $(filter-out -DCC_USING_EXPOLINE,$(KBUILD_AFLAGS))
28$(obj)/purgatory.ro: $(PURGATORY_OBJS) FORCE 28$(obj)/purgatory.ro: $(PURGATORY_OBJS) FORCE
29 $(call if_changed,ld) 29 $(call if_changed,ld)
30 30
31CMD_BIN2C = $(objtree)/scripts/basic/bin2c
32quiet_cmd_bin2c = BIN2C $@ 31quiet_cmd_bin2c = BIN2C $@
33 cmd_bin2c = $(CMD_BIN2C) kexec_purgatory < $< > $@ 32 cmd_bin2c = $(objtree)/scripts/bin2c kexec_purgatory < $< > $@
34 33
35$(obj)/kexec-purgatory.c: $(obj)/purgatory.ro FORCE 34$(obj)/kexec-purgatory.c: $(obj)/purgatory.ro FORCE
36 $(call if_changed,bin2c) 35 $(call if_changed,bin2c)
diff --git a/arch/um/Makefile b/arch/um/Makefile
index e54dda8a0363..306ee51c189f 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -116,14 +116,7 @@ endef
116KBUILD_KCONFIG := $(HOST_DIR)/um/Kconfig 116KBUILD_KCONFIG := $(HOST_DIR)/um/Kconfig
117 117
118archheaders: 118archheaders:
119 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.asm-generic \ 119 $(Q)$(MAKE) -f $(srctree)/Makefile ARCH=$(HEADER_ARCH) asm-generic archheaders
120 kbuild-file=$(HOST_DIR)/include/asm/Kbuild \
121 obj=$(HOST_DIR)/include/generated/asm
122 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.asm-generic \
123 kbuild-file=$(HOST_DIR)/include/uapi/asm/Kbuild \
124 obj=$(HOST_DIR)/include/generated/uapi/asm
125 $(Q)$(MAKE) KBUILD_SRC= ARCH=$(HEADER_ARCH) archheaders
126
127 120
128archprepare: include/generated/user_constants.h 121archprepare: include/generated/user_constants.h
129 122
@@ -169,7 +162,7 @@ define filechk_gen-asm-offsets
169 echo " *"; \ 162 echo " *"; \
170 echo " */"; \ 163 echo " */"; \
171 echo ""; \ 164 echo ""; \
172 sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"; \ 165 sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}" < $<; \
173 echo ""; ) 166 echo ""; )
174endef 167endef
175 168
diff --git a/arch/um/drivers/Makefile b/arch/um/drivers/Makefile
index 16b3cebddafb..693319839f69 100644
--- a/arch/um/drivers/Makefile
+++ b/arch/um/drivers/Makefile
@@ -25,10 +25,10 @@ LDFLAGS_vde.o := -r $(shell $(CC) $(CFLAGS) -print-file-name=libvdeplug.a)
25targets := pcap_kern.o pcap_user.o vde_kern.o vde_user.o 25targets := pcap_kern.o pcap_user.o vde_kern.o vde_user.o
26 26
27$(obj)/pcap.o: $(obj)/pcap_kern.o $(obj)/pcap_user.o 27$(obj)/pcap.o: $(obj)/pcap_kern.o $(obj)/pcap_user.o
28 $(LD) -r -dp -o $@ $^ $(LDFLAGS) $(LDFLAGS_pcap.o) 28 $(LD) -r -dp -o $@ $^ $(ld_flags)
29 29
30$(obj)/vde.o: $(obj)/vde_kern.o $(obj)/vde_user.o 30$(obj)/vde.o: $(obj)/vde_kern.o $(obj)/vde_user.o
31 $(LD) -r -dp -o $@ $^ $(LDFLAGS) $(LDFLAGS_vde.o) 31 $(LD) -r -dp -o $@ $^ $(ld_flags)
32 32
33#XXX: The call below does not work because the flags are added before the 33#XXX: The call below does not work because the flags are added before the
34# object name, so nothing from the library gets linked. 34# object name, so nothing from the library gets linked.
diff --git a/arch/x86/Makefile.um b/arch/x86/Makefile.um
index 45af19921ebd..5296f8c9e7f0 100644
--- a/arch/x86/Makefile.um
+++ b/arch/x86/Makefile.um
@@ -13,8 +13,6 @@ KBUILD_CFLAGS += $(call cc-option,-m32)
13KBUILD_AFLAGS += $(call cc-option,-m32) 13KBUILD_AFLAGS += $(call cc-option,-m32)
14LINK-y += $(call cc-option,-m32) 14LINK-y += $(call cc-option,-m32)
15 15
16export LDFLAGS
17
18LDS_EXTRA := -Ui386 16LDS_EXTRA := -Ui386
19export LDS_EXTRA 17export LDS_EXTRA
20 18
diff --git a/arch/x86/entry/vdso/vdso-note.S b/arch/x86/entry/vdso/vdso-note.S
index 79a071e4357e..79423170118f 100644
--- a/arch/x86/entry/vdso/vdso-note.S
+++ b/arch/x86/entry/vdso/vdso-note.S
@@ -3,6 +3,7 @@
3 * Here we can supply some information useful to userland. 3 * Here we can supply some information useful to userland.
4 */ 4 */
5 5
6#include <linux/build-salt.h>
6#include <linux/uts.h> 7#include <linux/uts.h>
7#include <linux/version.h> 8#include <linux/version.h>
8#include <linux/elfnote.h> 9#include <linux/elfnote.h>
@@ -10,3 +11,5 @@
10ELFNOTE_START(Linux, 0, "a") 11ELFNOTE_START(Linux, 0, "a")
11 .long LINUX_VERSION_CODE 12 .long LINUX_VERSION_CODE
12ELFNOTE_END 13ELFNOTE_END
14
15BUILD_SALT
diff --git a/arch/x86/entry/vdso/vdso32/note.S b/arch/x86/entry/vdso/vdso32/note.S
index 9fd51f206314..e78047d119f6 100644
--- a/arch/x86/entry/vdso/vdso32/note.S
+++ b/arch/x86/entry/vdso/vdso32/note.S
@@ -4,6 +4,7 @@
4 * Here we can supply some information useful to userland. 4 * Here we can supply some information useful to userland.
5 */ 5 */
6 6
7#include <linux/build-salt.h>
7#include <linux/version.h> 8#include <linux/version.h>
8#include <linux/elfnote.h> 9#include <linux/elfnote.h>
9 10
@@ -14,6 +15,8 @@ ELFNOTE_START(Linux, 0, "a")
14 .long LINUX_VERSION_CODE 15 .long LINUX_VERSION_CODE
15ELFNOTE_END 16ELFNOTE_END
16 17
18BUILD_SALT
19
17#ifdef CONFIG_XEN 20#ifdef CONFIG_XEN
18/* 21/*
19 * Add a special note telling glibc's dynamic linker a fake hardware 22 * Add a special note telling glibc's dynamic linker a fake hardware
diff --git a/arch/x86/purgatory/Makefile b/arch/x86/purgatory/Makefile
index 81a8e33115ad..3cf302b26332 100644
--- a/arch/x86/purgatory/Makefile
+++ b/arch/x86/purgatory/Makefile
@@ -28,9 +28,8 @@ $(obj)/purgatory.ro: $(PURGATORY_OBJS) FORCE
28 28
29targets += kexec-purgatory.c 29targets += kexec-purgatory.c
30 30
31CMD_BIN2C = $(objtree)/scripts/basic/bin2c
32quiet_cmd_bin2c = BIN2C $@ 31quiet_cmd_bin2c = BIN2C $@
33 cmd_bin2c = $(CMD_BIN2C) kexec_purgatory < $< > $@ 32 cmd_bin2c = $(objtree)/scripts/bin2c kexec_purgatory < $< > $@
34 33
35$(obj)/kexec-purgatory.c: $(obj)/purgatory.ro FORCE 34$(obj)/kexec-purgatory.c: $(obj)/purgatory.ro FORCE
36 $(call if_changed,bin2c) 35 $(call if_changed,bin2c)
diff --git a/arch/xtensa/boot/Makefile b/arch/xtensa/boot/Makefile
index 53e4178711e6..dc9e0ba7122c 100644
--- a/arch/xtensa/boot/Makefile
+++ b/arch/xtensa/boot/Makefile
@@ -30,8 +30,7 @@ Image: boot-elf
30zImage: boot-redboot 30zImage: boot-redboot
31uImage: $(obj)/uImage 31uImage: $(obj)/uImage
32 32
33boot-elf boot-redboot: $(addprefix $(obj)/,$(subdir-y)) \ 33boot-elf boot-redboot: $(addprefix $(obj)/,$(subdir-y))
34 $(addprefix $(obj)/,$(host-progs))
35 $(Q)$(MAKE) $(build)=$(obj)/$@ $(MAKECMDGOALS) 34 $(Q)$(MAKE) $(build)=$(obj)/$@ $(MAKECMDGOALS)
36 35
37OBJCOPYFLAGS = --strip-all -R .comment -R .note.gnu.build-id -O binary 36OBJCOPYFLAGS = --strip-all -R .comment -R .note.gnu.build-id -O binary
diff --git a/include/linux/build-salt.h b/include/linux/build-salt.h
new file mode 100644
index 000000000000..bb007bd05e7a
--- /dev/null
+++ b/include/linux/build-salt.h
@@ -0,0 +1,20 @@
1#ifndef __BUILD_SALT_H
2#define __BUILD_SALT_H
3
4#include <linux/elfnote.h>
5
6#define LINUX_ELFNOTE_BUILD_SALT 0x100
7
8#ifdef __ASSEMBLER__
9
10#define BUILD_SALT \
11 ELFNOTE(Linux, LINUX_ELFNOTE_BUILD_SALT, .asciz CONFIG_BUILD_SALT)
12
13#else
14
15#define BUILD_SALT \
16 ELFNOTE32("Linux", LINUX_ELFNOTE_BUILD_SALT, CONFIG_BUILD_SALT)
17
18#endif
19
20#endif /* __BUILD_SALT_H */
diff --git a/init/Kconfig b/init/Kconfig
index 8b1ab81ecda8..570190477e30 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -107,6 +107,15 @@ config LOCALVERSION_AUTO
107 107
108 which is done within the script "scripts/setlocalversion".) 108 which is done within the script "scripts/setlocalversion".)
109 109
110config BUILD_SALT
111 string "Build ID Salt"
112 default ""
113 help
114 The build ID is used to link binaries and their debug info. Setting
115 this option will use the value in the calculation of the build id.
116 This is mostly useful for distributions which want to ensure the
117 build is unique between builds. It's safe to leave the default.
118
110config HAVE_KERNEL_GZIP 119config HAVE_KERNEL_GZIP
111 bool 120 bool
112 121
diff --git a/init/version.c b/init/version.c
index bfb4e3f4955e..ef4012ec4375 100644
--- a/init/version.c
+++ b/init/version.c
@@ -7,6 +7,7 @@
7 */ 7 */
8 8
9#include <generated/compile.h> 9#include <generated/compile.h>
10#include <linux/build-salt.h>
10#include <linux/export.h> 11#include <linux/export.h>
11#include <linux/uts.h> 12#include <linux/uts.h>
12#include <linux/utsname.h> 13#include <linux/utsname.h>
@@ -49,3 +50,5 @@ const char linux_proc_banner[] =
49 "%s version %s" 50 "%s version %s"
50 " (" LINUX_COMPILE_BY "@" LINUX_COMPILE_HOST ")" 51 " (" LINUX_COMPILE_BY "@" LINUX_COMPILE_HOST ")"
51 " (" LINUX_COMPILER ") %s\n"; 52 " (" LINUX_COMPILER ") %s\n";
53
54BUILD_SALT;
diff --git a/kernel/Makefile b/kernel/Makefile
index 04bc07c2b42a..7a63d567fdb5 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -123,7 +123,7 @@ targets += config_data.gz
123$(obj)/config_data.gz: $(KCONFIG_CONFIG) FORCE 123$(obj)/config_data.gz: $(KCONFIG_CONFIG) FORCE
124 $(call if_changed,gzip) 124 $(call if_changed,gzip)
125 125
126 filechk_ikconfiggz = (echo "static const char kernel_config_data[] __used = MAGIC_START"; cat $< | scripts/basic/bin2c; echo "MAGIC_END;") 126 filechk_ikconfiggz = (echo "static const char kernel_config_data[] __used = MAGIC_START"; cat $< | scripts/bin2c; echo "MAGIC_END;")
127targets += config_data.h 127targets += config_data.h
128$(obj)/config_data.h: $(obj)/config_data.gz FORCE 128$(obj)/config_data.h: $(obj)/config_data.gz FORCE
129 $(call filechk,ikconfiggz) 129 $(call filechk,ikconfiggz)
diff --git a/net/bpfilter/Makefile b/net/bpfilter/Makefile
index 39c6980b5d99..0947ee7f70d5 100644
--- a/net/bpfilter/Makefile
+++ b/net/bpfilter/Makefile
@@ -5,14 +5,14 @@
5 5
6hostprogs-y := bpfilter_umh 6hostprogs-y := bpfilter_umh
7bpfilter_umh-objs := main.o 7bpfilter_umh-objs := main.o
8HOSTCFLAGS += -I. -Itools/include/ -Itools/include/uapi 8KBUILD_HOSTCFLAGS += -I. -Itools/include/ -Itools/include/uapi
9HOSTCC := $(CC) 9HOSTCC := $(CC)
10 10
11ifeq ($(CONFIG_BPFILTER_UMH), y) 11ifeq ($(CONFIG_BPFILTER_UMH), y)
12# builtin bpfilter_umh should be compiled with -static 12# builtin bpfilter_umh should be compiled with -static
13# since rootfs isn't mounted at the time of __init 13# since rootfs isn't mounted at the time of __init
14# function is called and do_execv won't find elf interpreter 14# function is called and do_execv won't find elf interpreter
15HOSTLDFLAGS += -static 15KBUILD_HOSTLDFLAGS += -static
16endif 16endif
17 17
18$(obj)/bpfilter_umh_blob.o: $(obj)/bpfilter_umh 18$(obj)/bpfilter_umh_blob.o: $(obj)/bpfilter_umh
diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
index 1303af10e54d..bd9f6c2a808e 100644
--- a/samples/bpf/Makefile
+++ b/samples/bpf/Makefile
@@ -164,11 +164,11 @@ always += xdpsock_kern.o
164always += xdp_fwd_kern.o 164always += xdp_fwd_kern.o
165always += task_fd_query_kern.o 165always += task_fd_query_kern.o
166 166
167HOSTCFLAGS += -I$(objtree)/usr/include 167KBUILD_HOSTCFLAGS += -I$(objtree)/usr/include
168HOSTCFLAGS += -I$(srctree)/tools/lib/ 168KBUILD_HOSTCFLAGS += -I$(srctree)/tools/lib/
169HOSTCFLAGS += -I$(srctree)/tools/testing/selftests/bpf/ 169KBUILD_HOSTCFLAGS += -I$(srctree)/tools/testing/selftests/bpf/
170HOSTCFLAGS += -I$(srctree)/tools/lib/ -I$(srctree)/tools/include 170KBUILD_HOSTCFLAGS += -I$(srctree)/tools/lib/ -I$(srctree)/tools/include
171HOSTCFLAGS += -I$(srctree)/tools/perf 171KBUILD_HOSTCFLAGS += -I$(srctree)/tools/perf
172 172
173HOSTCFLAGS_bpf_load.o += -I$(objtree)/usr/include -Wno-unused-variable 173HOSTCFLAGS_bpf_load.o += -I$(objtree)/usr/include -Wno-unused-variable
174HOSTCFLAGS_trace_helpers.o += -I$(srctree)/tools/lib/bpf/ 174HOSTCFLAGS_trace_helpers.o += -I$(srctree)/tools/lib/bpf/
@@ -180,12 +180,12 @@ HOSTCFLAGS_trace_event_user.o += -I$(srctree)/tools/lib/bpf/
180HOSTCFLAGS_sampleip_user.o += -I$(srctree)/tools/lib/bpf/ 180HOSTCFLAGS_sampleip_user.o += -I$(srctree)/tools/lib/bpf/
181HOSTCFLAGS_task_fd_query_user.o += -I$(srctree)/tools/lib/bpf/ 181HOSTCFLAGS_task_fd_query_user.o += -I$(srctree)/tools/lib/bpf/
182 182
183HOST_LOADLIBES += $(LIBBPF) -lelf 183KBUILD_HOSTLDLIBS += $(LIBBPF) -lelf
184HOSTLOADLIBES_tracex4 += -lrt 184HOSTLDLIBS_tracex4 += -lrt
185HOSTLOADLIBES_trace_output += -lrt 185HOSTLDLIBS_trace_output += -lrt
186HOSTLOADLIBES_map_perf_test += -lrt 186HOSTLDLIBS_map_perf_test += -lrt
187HOSTLOADLIBES_test_overhead += -lrt 187HOSTLDLIBS_test_overhead += -lrt
188HOSTLOADLIBES_xdpsock += -pthread 188HOSTLDLIBS_xdpsock += -pthread
189 189
190# Allows pointing LLC/CLANG to a LLVM backend with bpf support, redefine on cmdline: 190# Allows pointing LLC/CLANG to a LLVM backend with bpf support, redefine on cmdline:
191# make samples/bpf/ LLC=~/git/llvm/build/bin/llc CLANG=~/git/llvm/build/bin/clang 191# make samples/bpf/ LLC=~/git/llvm/build/bin/llc CLANG=~/git/llvm/build/bin/clang
diff --git a/samples/seccomp/Makefile b/samples/seccomp/Makefile
index ba942e3ead89..cf34ff6b4065 100644
--- a/samples/seccomp/Makefile
+++ b/samples/seccomp/Makefile
@@ -30,9 +30,9 @@ HOSTCFLAGS_bpf-direct.o += $(MFLAG)
30HOSTCFLAGS_dropper.o += $(MFLAG) 30HOSTCFLAGS_dropper.o += $(MFLAG)
31HOSTCFLAGS_bpf-helper.o += $(MFLAG) 31HOSTCFLAGS_bpf-helper.o += $(MFLAG)
32HOSTCFLAGS_bpf-fancy.o += $(MFLAG) 32HOSTCFLAGS_bpf-fancy.o += $(MFLAG)
33HOSTLOADLIBES_bpf-direct += $(MFLAG) 33HOSTLDLIBS_bpf-direct += $(MFLAG)
34HOSTLOADLIBES_bpf-fancy += $(MFLAG) 34HOSTLDLIBS_bpf-fancy += $(MFLAG)
35HOSTLOADLIBES_dropper += $(MFLAG) 35HOSTLDLIBS_dropper += $(MFLAG)
36endif 36endif
37always := $(hostprogs-m) 37always := $(hostprogs-m)
38endif 38endif
diff --git a/scripts/.gitignore b/scripts/.gitignore
index 0442c06eefcb..12d302d70128 100644
--- a/scripts/.gitignore
+++ b/scripts/.gitignore
@@ -1,6 +1,7 @@
1# 1#
2# Generated files 2# Generated files
3# 3#
4bin2c
4conmakehash 5conmakehash
5kallsyms 6kallsyms
6pnmtologo 7pnmtologo
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index d52db4279aa5..1d0665e83bf9 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -56,7 +56,7 @@ kecho := $($(quiet)kecho)
56define filechk 56define filechk
57 $(Q)set -e; \ 57 $(Q)set -e; \
58 mkdir -p $(dir $@); \ 58 mkdir -p $(dir $@); \
59 $(filechk_$(1)) < $< > $@.tmp; \ 59 $(filechk_$(1)) > $@.tmp; \
60 if [ -r $@ ] && cmp -s $@ $@.tmp; then \ 60 if [ -r $@ ] && cmp -s $@ $@.tmp; then \
61 rm -f $@.tmp; \ 61 rm -f $@.tmp; \
62 else \ 62 else \
@@ -126,7 +126,7 @@ cc-option = $(call __cc-option, $(CC),\
126# hostcc-option 126# hostcc-option
127# Usage: cflags-y += $(call hostcc-option,-march=winchip-c6,-march=i586) 127# Usage: cflags-y += $(call hostcc-option,-march=winchip-c6,-march=i586)
128hostcc-option = $(call __cc-option, $(HOSTCC),\ 128hostcc-option = $(call __cc-option, $(HOSTCC),\
129 $(HOSTCFLAGS) $(HOST_EXTRACFLAGS),$(1),$(2)) 129 $(KBUILD_HOSTCFLAGS) $(HOST_EXTRACFLAGS),$(1),$(2))
130 130
131# cc-option-yn 131# cc-option-yn
132# Usage: flag := $(call cc-option-yn,-march=winchip-c6) 132# Usage: flag := $(call cc-option-yn,-march=winchip-c6)
diff --git a/scripts/Makefile b/scripts/Makefile
index 25ab143cbe14..61affa300d25 100644
--- a/scripts/Makefile
+++ b/scripts/Makefile
@@ -10,6 +10,7 @@
10 10
11HOST_EXTRACFLAGS += -I$(srctree)/tools/include 11HOST_EXTRACFLAGS += -I$(srctree)/tools/include
12 12
13hostprogs-$(CONFIG_BUILD_BIN2C) += bin2c
13hostprogs-$(CONFIG_KALLSYMS) += kallsyms 14hostprogs-$(CONFIG_KALLSYMS) += kallsyms
14hostprogs-$(CONFIG_LOGO) += pnmtologo 15hostprogs-$(CONFIG_LOGO) += pnmtologo
15hostprogs-$(CONFIG_VT) += conmakehash 16hostprogs-$(CONFIG_VT) += conmakehash
@@ -22,8 +23,8 @@ hostprogs-$(CONFIG_SYSTEM_EXTRA_CERTIFICATE) += insert-sys-cert
22 23
23HOSTCFLAGS_sortextable.o = -I$(srctree)/tools/include 24HOSTCFLAGS_sortextable.o = -I$(srctree)/tools/include
24HOSTCFLAGS_asn1_compiler.o = -I$(srctree)/include 25HOSTCFLAGS_asn1_compiler.o = -I$(srctree)/include
25HOSTLOADLIBES_sign-file = -lcrypto 26HOSTLDLIBS_sign-file = -lcrypto
26HOSTLOADLIBES_extract-cert = -lcrypto 27HOSTLDLIBS_extract-cert = -lcrypto
27 28
28always := $(hostprogs-y) $(hostprogs-m) 29always := $(hostprogs-y) $(hostprogs-m)
29 30
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 514ed63ff571..1adaac4e10d8 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -53,13 +53,6 @@ endif
53 53
54include scripts/Makefile.lib 54include scripts/Makefile.lib
55 55
56ifdef host-progs
57ifneq ($(hostprogs-y),$(host-progs))
58$(warning kbuild: $(obj)/Makefile - Usage of host-progs is deprecated. Please replace with hostprogs-y!)
59hostprogs-y += $(host-progs)
60endif
61endif
62
63# Do not include host rules unless needed 56# Do not include host rules unless needed
64ifneq ($(hostprogs-y)$(hostprogs-m)$(hostlibs-y)$(hostlibs-m)$(hostcxxlibs-y)$(hostcxxlibs-m),) 57ifneq ($(hostprogs-y)$(hostprogs-m)$(hostlibs-y)$(hostlibs-m)$(hostcxxlibs-y)$(hostcxxlibs-m),)
65include scripts/Makefile.host 58include scripts/Makefile.host
diff --git a/scripts/Makefile.clean b/scripts/Makefile.clean
index 17ef94c635cd..0b80e3207b20 100644
--- a/scripts/Makefile.clean
+++ b/scripts/Makefile.clean
@@ -38,7 +38,6 @@ subdir-ymn := $(addprefix $(obj)/,$(subdir-ymn))
38 38
39__clean-files := $(extra-y) $(extra-m) $(extra-) \ 39__clean-files := $(extra-y) $(extra-m) $(extra-) \
40 $(always) $(targets) $(clean-files) \ 40 $(always) $(targets) $(clean-files) \
41 $(host-progs) \
42 $(hostprogs-y) $(hostprogs-m) $(hostprogs-) \ 41 $(hostprogs-y) $(hostprogs-m) $(hostprogs-) \
43 $(hostlibs-y) $(hostlibs-m) $(hostlibs-) \ 42 $(hostlibs-y) $(hostlibs-m) $(hostlibs-) \
44 $(hostcxxlibs-y) $(hostcxxlibs-m) 43 $(hostcxxlibs-y) $(hostcxxlibs-m)
diff --git a/scripts/Makefile.host b/scripts/Makefile.host
index aa971cc3f339..0393f75db4d4 100644
--- a/scripts/Makefile.host
+++ b/scripts/Makefile.host
@@ -62,9 +62,9 @@ host-cxxshobjs := $(addprefix $(obj)/,$(host-cxxshobjs))
62##### 62#####
63# Handle options to gcc. Support building with separate output directory 63# Handle options to gcc. Support building with separate output directory
64 64
65_hostc_flags = $(HOSTCFLAGS) $(HOST_EXTRACFLAGS) \ 65_hostc_flags = $(KBUILD_HOSTCFLAGS) $(HOST_EXTRACFLAGS) \
66 $(HOSTCFLAGS_$(basetarget).o) 66 $(HOSTCFLAGS_$(basetarget).o)
67_hostcxx_flags = $(HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) \ 67_hostcxx_flags = $(KBUILD_HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) \
68 $(HOSTCXXFLAGS_$(basetarget).o) 68 $(HOSTCXXFLAGS_$(basetarget).o)
69 69
70ifeq ($(KBUILD_SRC),) 70ifeq ($(KBUILD_SRC),)
@@ -84,17 +84,17 @@ hostcxx_flags = -Wp,-MD,$(depfile) $(__hostcxx_flags)
84# Create executable from a single .c file 84# Create executable from a single .c file
85# host-csingle -> Executable 85# host-csingle -> Executable
86quiet_cmd_host-csingle = HOSTCC $@ 86quiet_cmd_host-csingle = HOSTCC $@
87 cmd_host-csingle = $(HOSTCC) $(hostc_flags) $(HOSTLDFLAGS) -o $@ $< \ 87 cmd_host-csingle = $(HOSTCC) $(hostc_flags) $(KBUILD_HOSTLDFLAGS) -o $@ $< \
88 $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) 88 $(KBUILD_HOSTLDLIBS) $(HOSTLDLIBS_$(@F))
89$(host-csingle): $(obj)/%: $(src)/%.c FORCE 89$(host-csingle): $(obj)/%: $(src)/%.c FORCE
90 $(call if_changed_dep,host-csingle) 90 $(call if_changed_dep,host-csingle)
91 91
92# Link an executable based on list of .o files, all plain c 92# Link an executable based on list of .o files, all plain c
93# host-cmulti -> executable 93# host-cmulti -> executable
94quiet_cmd_host-cmulti = HOSTLD $@ 94quiet_cmd_host-cmulti = HOSTLD $@
95 cmd_host-cmulti = $(HOSTCC) $(HOSTLDFLAGS) -o $@ \ 95 cmd_host-cmulti = $(HOSTCC) $(KBUILD_HOSTLDFLAGS) -o $@ \
96 $(addprefix $(obj)/,$($(@F)-objs)) \ 96 $(addprefix $(obj)/,$($(@F)-objs)) \
97 $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) 97 $(KBUILD_HOSTLDLIBS) $(HOSTLDLIBS_$(@F))
98$(host-cmulti): FORCE 98$(host-cmulti): FORCE
99 $(call if_changed,host-cmulti) 99 $(call if_changed,host-cmulti)
100$(call multi_depend, $(host-cmulti), , -objs) 100$(call multi_depend, $(host-cmulti), , -objs)
@@ -109,10 +109,10 @@ $(host-cobjs): $(obj)/%.o: $(src)/%.c FORCE
109# Link an executable based on list of .o files, a mixture of .c and .cc 109# Link an executable based on list of .o files, a mixture of .c and .cc
110# host-cxxmulti -> executable 110# host-cxxmulti -> executable
111quiet_cmd_host-cxxmulti = HOSTLD $@ 111quiet_cmd_host-cxxmulti = HOSTLD $@
112 cmd_host-cxxmulti = $(HOSTCXX) $(HOSTLDFLAGS) -o $@ \ 112 cmd_host-cxxmulti = $(HOSTCXX) $(KBUILD_HOSTLDFLAGS) -o $@ \
113 $(foreach o,objs cxxobjs,\ 113 $(foreach o,objs cxxobjs,\
114 $(addprefix $(obj)/,$($(@F)-$(o)))) \ 114 $(addprefix $(obj)/,$($(@F)-$(o)))) \
115 $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) 115 $(KBUILD_HOSTLDLIBS) $(HOSTLDLIBS_$(@F))
116$(host-cxxmulti): FORCE 116$(host-cxxmulti): FORCE
117 $(call if_changed,host-cxxmulti) 117 $(call if_changed,host-cxxmulti)
118$(call multi_depend, $(host-cxxmulti), , -objs -cxxobjs) 118$(call multi_depend, $(host-cxxmulti), , -objs -cxxobjs)
@@ -143,9 +143,9 @@ $(host-cxxshobjs): $(obj)/%.o: $(src)/%.c FORCE
143# Link a shared library, based on position independent .o files 143# Link a shared library, based on position independent .o files
144# *.o -> .so shared library (host-cshlib) 144# *.o -> .so shared library (host-cshlib)
145quiet_cmd_host-cshlib = HOSTLLD -shared $@ 145quiet_cmd_host-cshlib = HOSTLLD -shared $@
146 cmd_host-cshlib = $(HOSTCC) $(HOSTLDFLAGS) -shared -o $@ \ 146 cmd_host-cshlib = $(HOSTCC) $(KBUILD_HOSTLDFLAGS) -shared -o $@ \
147 $(addprefix $(obj)/,$($(@F:.so=-objs))) \ 147 $(addprefix $(obj)/,$($(@F:.so=-objs))) \
148 $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) 148 $(KBUILD_HOSTLDLIBS) $(HOSTLDLIBS_$(@F))
149$(host-cshlib): FORCE 149$(host-cshlib): FORCE
150 $(call if_changed,host-cshlib) 150 $(call if_changed,host-cshlib)
151$(call multi_depend, $(host-cshlib), .so, -objs) 151$(call multi_depend, $(host-cshlib), .so, -objs)
@@ -153,9 +153,9 @@ $(call multi_depend, $(host-cshlib), .so, -objs)
153# Link a shared library, based on position independent .o files 153# Link a shared library, based on position independent .o files
154# *.o -> .so shared library (host-cxxshlib) 154# *.o -> .so shared library (host-cxxshlib)
155quiet_cmd_host-cxxshlib = HOSTLLD -shared $@ 155quiet_cmd_host-cxxshlib = HOSTLLD -shared $@
156 cmd_host-cxxshlib = $(HOSTCXX) $(HOSTLDFLAGS) -shared -o $@ \ 156 cmd_host-cxxshlib = $(HOSTCXX) $(KBUILD_HOSTLDFLAGS) -shared -o $@ \
157 $(addprefix $(obj)/,$($(@F:.so=-objs))) \ 157 $(addprefix $(obj)/,$($(@F:.so=-objs))) \
158 $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) 158 $(KBUILD_HOSTLDLIBS) $(HOSTLDLIBS_$(@F))
159$(host-cxxshlib): FORCE 159$(host-cxxshlib): FORCE
160 $(call if_changed,host-cxxshlib) 160 $(call if_changed,host-cxxshlib)
161$(call multi_depend, $(host-cxxshlib), .so, -objs) 161$(call multi_depend, $(host-cxxshlib), .so, -objs)
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 1bb594fcfe12..df0fff252619 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -162,7 +162,7 @@ a_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \
162cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \ 162cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \
163 $(__cpp_flags) 163 $(__cpp_flags)
164 164
165ld_flags = $(LDFLAGS) $(ldflags-y) 165ld_flags = $(LDFLAGS) $(ldflags-y) $(LDFLAGS_$(@F))
166 166
167DTC_INCLUDE := $(srctree)/scripts/dtc/include-prefixes 167DTC_INCLUDE := $(srctree)/scripts/dtc/include-prefixes
168 168
@@ -225,8 +225,7 @@ $(obj)/%: $(src)/%_shipped
225# --------------------------------------------------------------------------- 225# ---------------------------------------------------------------------------
226 226
227quiet_cmd_ld = LD $@ 227quiet_cmd_ld = LD $@
228cmd_ld = $(LD) $(LDFLAGS) $(ldflags-y) $(LDFLAGS_$(@F)) \ 228cmd_ld = $(LD) $(ld_flags) $(filter-out FORCE,$^) -o $@
229 $(filter-out FORCE,$^) -o $@
230 229
231# Objcopy 230# Objcopy
232# --------------------------------------------------------------------------- 231# ---------------------------------------------------------------------------
@@ -416,7 +415,7 @@ define filechk_offsets
416 echo " * This file was generated by Kbuild"; \ 415 echo " * This file was generated by Kbuild"; \
417 echo " */"; \ 416 echo " */"; \
418 echo ""; \ 417 echo ""; \
419 sed -ne $(sed-offsets); \ 418 sed -ne $(sed-offsets) < $<; \
420 echo ""; \ 419 echo ""; \
421 echo "#endif" ) 420 echo "#endif" )
422endef 421endef
diff --git a/scripts/basic/.gitignore b/scripts/basic/.gitignore
index 9528ec9e5adc..a776371a3502 100644
--- a/scripts/basic/.gitignore
+++ b/scripts/basic/.gitignore
@@ -1,2 +1 @@
1fixdep fixdep
2bin2c
diff --git a/scripts/basic/Makefile b/scripts/basic/Makefile
index 0372b33febe5..af49b446f17d 100644
--- a/scripts/basic/Makefile
+++ b/scripts/basic/Makefile
@@ -9,7 +9,6 @@
9# fixdep: Used to generate dependency information during build process 9# fixdep: Used to generate dependency information during build process
10 10
11hostprogs-y := fixdep 11hostprogs-y := fixdep
12hostprogs-$(CONFIG_BUILD_BIN2C) += bin2c
13always := $(hostprogs-y) 12always := $(hostprogs-y)
14 13
15# fixdep is needed to compile other host programs 14# fixdep is needed to compile other host programs
diff --git a/scripts/basic/bin2c.c b/scripts/bin2c.c
index c3d7eef3ad06..c3d7eef3ad06 100644
--- a/scripts/basic/bin2c.c
+++ b/scripts/bin2c.c
diff --git a/scripts/coccicheck b/scripts/coccicheck
index 9fedca611b7f..e04d328210ac 100755
--- a/scripts/coccicheck
+++ b/scripts/coccicheck
@@ -128,9 +128,10 @@ run_cmd_parmap() {
128 fi 128 fi
129 echo $@ >>$DEBUG_FILE 129 echo $@ >>$DEBUG_FILE
130 $@ 2>>$DEBUG_FILE 130 $@ 2>>$DEBUG_FILE
131 if [[ $? -ne 0 ]]; then 131 err=$?
132 if [[ $err -ne 0 ]]; then
132 echo "coccicheck failed" 133 echo "coccicheck failed"
133 exit $? 134 exit $err
134 fi 135 fi
135} 136}
136 137
diff --git a/scripts/coccinelle/api/atomic_as_refcounter.cocci b/scripts/coccinelle/api/atomic_as_refcounter.cocci
new file mode 100644
index 000000000000..988120e0fd67
--- /dev/null
+++ b/scripts/coccinelle/api/atomic_as_refcounter.cocci
@@ -0,0 +1,129 @@
1// Check if refcount_t type and API should be used
2// instead of atomic_t type when dealing with refcounters
3//
4// Copyright (c) 2016-2017, Elena Reshetova, Intel Corporation
5//
6// Confidence: Moderate
7// URL: http://coccinelle.lip6.fr/
8// Options: --include-headers --very-quiet
9
10virtual report
11
12@r1 exists@
13identifier a, x;
14position p1, p2;
15identifier fname =~ ".*free.*";
16identifier fname2 =~ ".*destroy.*";
17identifier fname3 =~ ".*del.*";
18identifier fname4 =~ ".*queue_work.*";
19identifier fname5 =~ ".*schedule_work.*";
20identifier fname6 =~ ".*call_rcu.*";
21
22@@
23
24(
25 atomic_dec_and_test@p1(&(a)->x)
26|
27 atomic_dec_and_lock@p1(&(a)->x, ...)
28|
29 atomic_long_dec_and_lock@p1(&(a)->x, ...)
30|
31 atomic_long_dec_and_test@p1(&(a)->x)
32|
33 atomic64_dec_and_test@p1(&(a)->x)
34|
35 local_dec_and_test@p1(&(a)->x)
36)
37...
38(
39 fname@p2(a, ...);
40|
41 fname2@p2(...);
42|
43 fname3@p2(...);
44|
45 fname4@p2(...);
46|
47 fname5@p2(...);
48|
49 fname6@p2(...);
50)
51
52
53@script:python depends on report@
54p1 << r1.p1;
55p2 << r1.p2;
56@@
57msg = "atomic_dec_and_test variation before object free at line %s."
58coccilib.report.print_report(p1[0], msg % (p2[0].line))
59
60@r4 exists@
61identifier a, x, y;
62position p1, p2;
63identifier fname =~ ".*free.*";
64
65@@
66
67(
68 atomic_dec_and_test@p1(&(a)->x)
69|
70 atomic_dec_and_lock@p1(&(a)->x, ...)
71|
72 atomic_long_dec_and_lock@p1(&(a)->x, ...)
73|
74 atomic_long_dec_and_test@p1(&(a)->x)
75|
76 atomic64_dec_and_test@p1(&(a)->x)
77|
78 local_dec_and_test@p1(&(a)->x)
79)
80...
81y=a
82...
83fname@p2(y, ...);
84
85
86@script:python depends on report@
87p1 << r4.p1;
88p2 << r4.p2;
89@@
90msg = "atomic_dec_and_test variation before object free at line %s."
91coccilib.report.print_report(p1[0], msg % (p2[0].line))
92
93@r2 exists@
94identifier a, x;
95position p1;
96@@
97
98(
99atomic_add_unless(&(a)->x,-1,1)@p1
100|
101atomic_long_add_unless(&(a)->x,-1,1)@p1
102|
103atomic64_add_unless(&(a)->x,-1,1)@p1
104)
105
106@script:python depends on report@
107p1 << r2.p1;
108@@
109msg = "atomic_add_unless"
110coccilib.report.print_report(p1[0], msg)
111
112@r3 exists@
113identifier x;
114position p1;
115@@
116
117(
118x = atomic_add_return@p1(-1, ...);
119|
120x = atomic_long_add_return@p1(-1, ...);
121|
122x = atomic64_add_return@p1(-1, ...);
123)
124
125@script:python depends on report@
126p1 << r3.p1;
127@@
128msg = "x = atomic_add_return(-1, ...)"
129coccilib.report.print_report(p1[0], msg)
diff --git a/scripts/coccinelle/tests/doubletest.cocci b/scripts/coccinelle/tests/doubletest.cocci
index 78d74c22ca12..7af2ce7eb9bf 100644
--- a/scripts/coccinelle/tests/doubletest.cocci
+++ b/scripts/coccinelle/tests/doubletest.cocci
@@ -1,6 +1,7 @@
1/// Find &&/|| operations that include the same argument more than once 1/// Find &&/|| operations that include the same argument more than once
2//# A common source of false positives is when the argument performs a side 2//# A common source of false positives is when the expression, or
3//# effect. 3//# another expresssion in the same && or || operation, performs a
4//# side effect.
4/// 5///
5// Confidence: Moderate 6// Confidence: Moderate
6// Copyright: (C) 2010 Nicolas Palix, DIKU. GPLv2. 7// Copyright: (C) 2010 Nicolas Palix, DIKU. GPLv2.
@@ -20,20 +21,37 @@ position p;
20@@ 21@@
21 22
22( 23(
23* E@p 24 E@p || ... || E
24 || ... || E
25| 25|
26* E@p 26 E@p && ... && E
27 && ... && E
28) 27)
29 28
30@script:python depends on org@ 29@bad@
30expression r.E,e1,e2,fn;
31position r.p;
32assignment operator op;
33@@
34
35(
36E@p
37&
38 <+... \(fn(...)\|e1 op e2\|e1++\|e1--\|++e1\|--e1\) ...+>
39)
40
41@depends on context && !bad@
42expression r.E;
43position r.p;
44@@
45
46*E@p
47
48@script:python depends on org && !bad@
31p << r.p; 49p << r.p;
32@@ 50@@
33 51
34cocci.print_main("duplicated argument to && or ||",p) 52cocci.print_main("duplicated argument to && or ||",p)
35 53
36@script:python depends on report@ 54@script:python depends on report && !bad@
37p << r.p; 55p << r.p;
38@@ 56@@
39 57
diff --git a/scripts/depmod.sh b/scripts/depmod.sh
index 1a6f85e0e6e1..999d585eaa73 100755
--- a/scripts/depmod.sh
+++ b/scripts/depmod.sh
@@ -10,10 +10,16 @@ fi
10DEPMOD=$1 10DEPMOD=$1
11KERNELRELEASE=$2 11KERNELRELEASE=$2
12 12
13if ! test -r System.map -a -x "$DEPMOD"; then 13if ! test -r System.map ; then
14 exit 0 14 exit 0
15fi 15fi
16 16
17if [ -z $(command -v $DEPMOD) ]; then
18 echo "'make modules_install' requires $DEPMOD. Please install it." >&2
19 echo "This is probably in the kmod package." >&2
20 exit 1
21fi
22
17# older versions of depmod require the version string to start with three 23# older versions of depmod require the version string to start with three
18# numbers, so we cheat with a symlink here 24# numbers, so we cheat with a symlink here
19depmod_hack_needed=true 25depmod_hack_needed=true
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index a3ac2c91331c..f3c0e6261e2a 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -169,7 +169,7 @@ HOSTCFLAGS_zconf.tab.o := -I$(src)
169hostprogs-y += nconf 169hostprogs-y += nconf
170nconf-objs := nconf.o zconf.tab.o nconf.gui.o 170nconf-objs := nconf.o zconf.tab.o nconf.gui.o
171 171
172HOSTLOADLIBES_nconf = $(shell . $(obj)/.nconf-cfg && echo $$libs) 172HOSTLDLIBS_nconf = $(shell . $(obj)/.nconf-cfg && echo $$libs)
173HOSTCFLAGS_nconf.o = $(shell . $(obj)/.nconf-cfg && echo $$cflags) 173HOSTCFLAGS_nconf.o = $(shell . $(obj)/.nconf-cfg && echo $$cflags)
174HOSTCFLAGS_nconf.gui.o = $(shell . $(obj)/.nconf-cfg && echo $$cflags) 174HOSTCFLAGS_nconf.gui.o = $(shell . $(obj)/.nconf-cfg && echo $$cflags)
175 175
@@ -180,7 +180,7 @@ hostprogs-y += mconf
180lxdialog := checklist.o inputbox.o menubox.o textbox.o util.o yesno.o 180lxdialog := checklist.o inputbox.o menubox.o textbox.o util.o yesno.o
181mconf-objs := mconf.o zconf.tab.o $(addprefix lxdialog/, $(lxdialog)) 181mconf-objs := mconf.o zconf.tab.o $(addprefix lxdialog/, $(lxdialog))
182 182
183HOSTLOADLIBES_mconf = $(shell . $(obj)/.mconf-cfg && echo $$libs) 183HOSTLDLIBS_mconf = $(shell . $(obj)/.mconf-cfg && echo $$libs)
184$(foreach f, mconf.o $(lxdialog), \ 184$(foreach f, mconf.o $(lxdialog), \
185 $(eval HOSTCFLAGS_$f = $$(shell . $(obj)/.mconf-cfg && echo $$$$cflags))) 185 $(eval HOSTCFLAGS_$f = $$(shell . $(obj)/.mconf-cfg && echo $$$$cflags)))
186 186
@@ -191,7 +191,7 @@ hostprogs-y += qconf
191qconf-cxxobjs := qconf.o 191qconf-cxxobjs := qconf.o
192qconf-objs := zconf.tab.o 192qconf-objs := zconf.tab.o
193 193
194HOSTLOADLIBES_qconf = $(shell . $(obj)/.qconf-cfg && echo $$libs) 194HOSTLDLIBS_qconf = $(shell . $(obj)/.qconf-cfg && echo $$libs)
195HOSTCXXFLAGS_qconf.o = $(shell . $(obj)/.qconf-cfg && echo $$cflags) 195HOSTCXXFLAGS_qconf.o = $(shell . $(obj)/.qconf-cfg && echo $$cflags)
196 196
197$(obj)/qconf.o: $(obj)/.qconf-cfg $(obj)/qconf.moc 197$(obj)/qconf.o: $(obj)/.qconf-cfg $(obj)/qconf.moc
@@ -206,7 +206,7 @@ $(obj)/%.moc: $(src)/%.h $(obj)/.qconf-cfg
206hostprogs-y += gconf 206hostprogs-y += gconf
207gconf-objs := gconf.o zconf.tab.o 207gconf-objs := gconf.o zconf.tab.o
208 208
209HOSTLOADLIBES_gconf = $(shell . $(obj)/.gconf-cfg && echo $$libs) 209HOSTLDLIBS_gconf = $(shell . $(obj)/.gconf-cfg && echo $$libs)
210HOSTCFLAGS_gconf.o = $(shell . $(obj)/.gconf-cfg && echo $$cflags) 210HOSTCFLAGS_gconf.o = $(shell . $(obj)/.gconf-cfg && echo $$cflags)
211 211
212$(obj)/gconf.o: $(obj)/.gconf-cfg 212$(obj)/gconf.o: $(obj)/.gconf-cfg
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 1663fb19343a..dc6d714e4dcb 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -2125,10 +2125,13 @@ static int check_modname_len(struct module *mod)
2125 **/ 2125 **/
2126static void add_header(struct buffer *b, struct module *mod) 2126static void add_header(struct buffer *b, struct module *mod)
2127{ 2127{
2128 buf_printf(b, "#include <linux/build-salt.h>\n");
2128 buf_printf(b, "#include <linux/module.h>\n"); 2129 buf_printf(b, "#include <linux/module.h>\n");
2129 buf_printf(b, "#include <linux/vermagic.h>\n"); 2130 buf_printf(b, "#include <linux/vermagic.h>\n");
2130 buf_printf(b, "#include <linux/compiler.h>\n"); 2131 buf_printf(b, "#include <linux/compiler.h>\n");
2131 buf_printf(b, "\n"); 2132 buf_printf(b, "\n");
2133 buf_printf(b, "BUILD_SALT;\n");
2134 buf_printf(b, "\n");
2132 buf_printf(b, "MODULE_INFO(vermagic, VERMAGIC_STRING);\n"); 2135 buf_printf(b, "MODULE_INFO(vermagic, VERMAGIC_STRING);\n");
2133 buf_printf(b, "MODULE_INFO(name, KBUILD_MODNAME);\n"); 2136 buf_printf(b, "MODULE_INFO(name, KBUILD_MODNAME);\n");
2134 buf_printf(b, "\n"); 2137 buf_printf(b, "\n");
diff --git a/scripts/package/buildtar b/scripts/package/buildtar
index e8cc72a51b32..d624a07a4e77 100755
--- a/scripts/package/buildtar
+++ b/scripts/package/buildtar
@@ -84,10 +84,6 @@ case "${ARCH}" in
84 [ -f "${KBUILD_IMAGE}" ] && cp -v -- "${KBUILD_IMAGE}" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}" 84 [ -f "${KBUILD_IMAGE}" ] && cp -v -- "${KBUILD_IMAGE}" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}"
85 [ -f "${objtree}/lifimage" ] && cp -v -- "${objtree}/lifimage" "${tmpdir}/boot/lifimage-${KERNELRELEASE}" 85 [ -f "${objtree}/lifimage" ] && cp -v -- "${objtree}/lifimage" "${tmpdir}/boot/lifimage-${KERNELRELEASE}"
86 ;; 86 ;;
87 vax)
88 [ -f "${objtree}/vmlinux.SYS" ] && cp -v -- "${objtree}/vmlinux.SYS" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}.SYS"
89 [ -f "${objtree}/vmlinux.dsk" ] && cp -v -- "${objtree}/vmlinux.dsk" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}.dsk"
90 ;;
91 mips) 87 mips)
92 if [ -f "${objtree}/arch/mips/boot/compressed/vmlinux.bin" ]; then 88 if [ -f "${objtree}/arch/mips/boot/compressed/vmlinux.bin" ]; then
93 cp -v -- "${objtree}/arch/mips/boot/compressed/vmlinux.bin" "${tmpdir}/boot/vmlinuz-${KERNELRELEASE}" 89 cp -v -- "${objtree}/arch/mips/boot/compressed/vmlinux.bin" "${tmpdir}/boot/vmlinuz-${KERNELRELEASE}"
@@ -109,6 +105,14 @@ case "${ARCH}" in
109 cp -v -- "${objtree}/vmlinux" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}" 105 cp -v -- "${objtree}/vmlinux" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}"
110 fi 106 fi
111 ;; 107 ;;
108 arm64)
109 for i in Image.bz2 Image.gz Image.lz4 Image.lzma Image.lzo ; do
110 if [ -f "${objtree}/arch/arm64/boot/${i}" ] ; then
111 cp -v -- "${objtree}/arch/arm64/boot/${i}" "${tmpdir}/boot/vmlinuz-${KERNELRELEASE}"
112 break
113 fi
114 done
115 ;;
112 *) 116 *)
113 [ -f "${KBUILD_IMAGE}" ] && cp -v -- "${KBUILD_IMAGE}" "${tmpdir}/boot/vmlinux-kbuild-${KERNELRELEASE}" 117 [ -f "${KBUILD_IMAGE}" ] && cp -v -- "${KBUILD_IMAGE}" "${tmpdir}/boot/vmlinux-kbuild-${KERNELRELEASE}"
114 echo "" >&2 118 echo "" >&2
diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian
index 985d72d1ab34..663a7f343b42 100755
--- a/scripts/package/mkdebian
+++ b/scripts/package/mkdebian
@@ -6,49 +6,81 @@
6 6
7set -e 7set -e
8 8
9is_enabled() {
10 grep -q "^CONFIG_$1=y" $KCONFIG_CONFIG
11}
12
13if_enabled_echo() {
14 if is_enabled "$1"; then
15 echo -n "$2"
16 elif [ $# -ge 3 ]; then
17 echo -n "$3"
18 fi
19}
20
9set_debarch() { 21set_debarch() {
22 if [ -n "$KBUILD_DEBARCH" ] ; then
23 debarch="$KBUILD_DEBARCH"
24 return
25 fi
26
10 # Attempt to find the correct Debian architecture 27 # Attempt to find the correct Debian architecture
11 case "$UTS_MACHINE" in 28 case "$UTS_MACHINE" in
12 i386|ia64|alpha) 29 i386|ia64|alpha|m68k|riscv*)
13 debarch="$UTS_MACHINE" ;; 30 debarch="$UTS_MACHINE" ;;
14 x86_64) 31 x86_64)
15 debarch=amd64 ;; 32 debarch=amd64 ;;
16 sparc*) 33 sparc*)
17 debarch=sparc ;; 34 debarch=sparc$(if_enabled_echo 64BIT 64) ;;
18 s390*) 35 s390*)
19 debarch=s390$(grep -q CONFIG_64BIT=y $KCONFIG_CONFIG && echo x || true) ;; 36 debarch=s390x ;;
20 ppc*) 37 ppc*)
21 debarch=$(grep -q CPU_LITTLE_ENDIAN=y $KCONFIG_CONFIG && echo ppc64el || echo powerpc) ;; 38 if is_enabled 64BIT; then
39 debarch=ppc64$(if_enabled_echo CPU_LITTLE_ENDIAN el)
40 else
41 debarch=powerpc$(if_enabled_echo SPE spe)
42 fi
43 ;;
22 parisc*) 44 parisc*)
23 debarch=hppa ;; 45 debarch=hppa ;;
24 mips*) 46 mips*)
25 debarch=mips$(grep -q CPU_LITTLE_ENDIAN=y $KCONFIG_CONFIG && echo el || true) ;; 47 if is_enabled CPU_LITTLE_ENDIAN; then
48 debarch=mips$(if_enabled_echo 64BIT 64)$(if_enabled_echo CPU_MIPSR6 r6)el
49 elif is_enabled CPU_MIPSR6; then
50 debarch=mips$(if_enabled_echo 64BIT 64)r6
51 else
52 debarch=mips
53 fi
54 ;;
26 aarch64|arm64) 55 aarch64|arm64)
27 debarch=arm64 ;; 56 debarch=arm64 ;;
28 arm*) 57 arm*)
29 if grep -q CONFIG_AEABI=y $KCONFIG_CONFIG; then 58 if is_enabled AEABI; then
30 if grep -q CONFIG_VFP=y $KCONFIG_CONFIG; then 59 debarch=arm$(if_enabled_echo VFP hf el)
31 debarch=armhf
32 else
33 debarch=armel
34 fi
35 else 60 else
36 debarch=arm 61 debarch=arm
62 fi
63 ;;
64 openrisc)
65 debarch=or1k ;;
66 sh)
67 if is_enabled CPU_SH3; then
68 debarch=sh3$(if_enabled_echo CPU_BIG_ENDIAN eb)
69 elif is_enabled CPU_SH4; then
70 debarch=sh4$(if_enabled_echo CPU_BIG_ENDIAN eb)
37 fi 71 fi
38 ;; 72 ;;
39 *) 73 esac
40 debarch=$(dpkg --print-architecture) 74 if [ -z "$debarch" ]; then
75 debarch=$(dpkg-architecture -qDEB_HOST_ARCH)
41 echo "" >&2 76 echo "" >&2
42 echo "** ** ** WARNING ** ** **" >&2 77 echo "** ** ** WARNING ** ** **" >&2
43 echo "" >&2 78 echo "" >&2
44 echo "Your architecture doesn't have its equivalent" >&2 79 echo "Your architecture doesn't have its equivalent" >&2
45 echo "Debian userspace architecture defined!" >&2 80 echo "Debian userspace architecture defined!" >&2
46 echo "Falling back to using your current userspace instead!" >&2 81 echo "Falling back to the current host architecture ($debarch)." >&2
47 echo "Please add support for $UTS_MACHINE to ${0} ..." >&2 82 echo "Please add support for $UTS_MACHINE to ${0} ..." >&2
48 echo "" >&2 83 echo "" >&2
49 esac
50 if [ -n "$KBUILD_DEBARCH" ] ; then
51 debarch="$KBUILD_DEBARCH"
52 fi 84 fi
53} 85}
54 86
diff --git a/scripts/tracing/draw_functrace.py b/scripts/tracing/draw_functrace.py
index db40fa04cd51..9b6dd4f36335 100755
--- a/scripts/tracing/draw_functrace.py
+++ b/scripts/tracing/draw_functrace.py
@@ -123,7 +123,7 @@ def main():
123 tree = tree.getParent(caller) 123 tree = tree.getParent(caller)
124 tree = tree.calls(callee, calltime) 124 tree = tree.calls(callee, calltime)
125 125
126 print CallTree.ROOT 126 print(CallTree.ROOT)
127 127
128if __name__ == "__main__": 128if __name__ == "__main__":
129 main() 129 main()
diff --git a/security/tomoyo/Makefile b/security/tomoyo/Makefile
index b7c6a7ffc058..cca5a3012fee 100644
--- a/security/tomoyo/Makefile
+++ b/security/tomoyo/Makefile
@@ -4,7 +4,7 @@ obj-y = audit.o common.o condition.o domain.o environ.o file.o gc.o group.o load
4targets += builtin-policy.h 4targets += builtin-policy.h
5define do_policy 5define do_policy
6echo "static char tomoyo_builtin_$(1)[] __initdata ="; \ 6echo "static char tomoyo_builtin_$(1)[] __initdata ="; \
7$(objtree)/scripts/basic/bin2c <$(firstword $(wildcard $(obj)/policy/$(1).conf $(srctree)/$(src)/policy/$(1).conf.default) /dev/null); \ 7$(objtree)/scripts/bin2c <$(firstword $(wildcard $(obj)/policy/$(1).conf $(srctree)/$(src)/policy/$(1).conf.default) /dev/null); \
8echo ";" 8echo ";"
9endef 9endef
10quiet_cmd_policy = POLICY $@ 10quiet_cmd_policy = POLICY $@
diff --git a/tools/build/Build.include b/tools/build/Build.include
index 950c1504ca37..9ec01f4454f9 100644
--- a/tools/build/Build.include
+++ b/tools/build/Build.include
@@ -98,4 +98,4 @@ cxx_flags = -Wp,-MD,$(depfile) -Wp,-MT,$@ $(CXXFLAGS) -D"BUILD_STR(s)=\#s" $(CXX
98### 98###
99## HOSTCC C flags 99## HOSTCC C flags
100 100
101host_c_flags = -Wp,-MD,$(depfile) -Wp,-MT,$@ $(HOSTCFLAGS) -D"BUILD_STR(s)=\#s" $(HOSTCFLAGS_$(basetarget).o) $(HOSTCFLAGS_$(obj)) 101host_c_flags = -Wp,-MD,$(depfile) -Wp,-MT,$@ $(KBUILD_HOSTCFLAGS) -D"BUILD_STR(s)=\#s" $(HOSTCFLAGS_$(basetarget).o) $(HOSTCFLAGS_$(obj))
diff --git a/tools/build/Makefile b/tools/build/Makefile
index 5edf65e684ab..727050c40f09 100644
--- a/tools/build/Makefile
+++ b/tools/build/Makefile
@@ -43,7 +43,7 @@ $(OUTPUT)fixdep-in.o: FORCE
43 $(Q)$(MAKE) $(build)=fixdep 43 $(Q)$(MAKE) $(build)=fixdep
44 44
45$(OUTPUT)fixdep: $(OUTPUT)fixdep-in.o 45$(OUTPUT)fixdep: $(OUTPUT)fixdep-in.o
46 $(QUIET_LINK)$(HOSTCC) $(HOSTLDFLAGS) -o $@ $< 46 $(QUIET_LINK)$(HOSTCC) $(KBUILD_HOSTLDFLAGS) -o $@ $<
47 47
48FORCE: 48FORCE:
49 49
diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile
index f76d9914686a..c9d038f91af6 100644
--- a/tools/objtool/Makefile
+++ b/tools/objtool/Makefile
@@ -31,8 +31,8 @@ INCLUDES := -I$(srctree)/tools/include \
31 -I$(srctree)/tools/arch/$(HOSTARCH)/include/uapi \ 31 -I$(srctree)/tools/arch/$(HOSTARCH)/include/uapi \
32 -I$(srctree)/tools/objtool/arch/$(ARCH)/include 32 -I$(srctree)/tools/objtool/arch/$(ARCH)/include
33WARNINGS := $(EXTRA_WARNINGS) -Wno-switch-default -Wno-switch-enum -Wno-packed 33WARNINGS := $(EXTRA_WARNINGS) -Wno-switch-default -Wno-switch-enum -Wno-packed
34CFLAGS += -Werror $(WARNINGS) $(HOSTCFLAGS) -g $(INCLUDES) 34CFLAGS += -Werror $(WARNINGS) $(KBUILD_HOSTCFLAGS) -g $(INCLUDES)
35LDFLAGS += -lelf $(LIBSUBCMD) $(HOSTLDFLAGS) 35LDFLAGS += -lelf $(LIBSUBCMD) $(KBUILD_HOSTLDFLAGS)
36 36
37# Allow old libelf to be used: 37# Allow old libelf to be used:
38elfshdr := $(shell echo '$(pound)include <libelf.h>' | $(CC) $(CFLAGS) -x c -E - | grep elf_getshdr) 38elfshdr := $(shell echo '$(pound)include <libelf.h>' | $(CC) $(CFLAGS) -x c -E - | grep elf_getshdr)