diff options
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 | -------------------------------------------------- |
51 | Additional options used for $(LD) when linking modules. | 51 | Additional options used for $(LD) when linking modules. |
52 | 52 | ||
53 | HOSTCFLAGS | ||
54 | -------------------------------------------------- | ||
55 | Additional flags to be passed to $(HOSTCC) when building host programs. | ||
56 | |||
57 | HOSTCXXFLAGS | ||
58 | -------------------------------------------------- | ||
59 | Additional flags to be passed to $(HOSTCXX) when building host programs. | ||
60 | |||
61 | HOSTLDFLAGS | ||
62 | -------------------------------------------------- | ||
63 | Additional flags to be passed when linking host programs. | ||
64 | |||
65 | HOSTLDLIBS | ||
66 | -------------------------------------------------- | ||
67 | Additional libraries to link against when building host programs. | ||
68 | |||
53 | KBUILD_KCONFIG | 69 | KBUILD_KCONFIG |
54 | -------------------------------------------------- | 70 | -------------------------------------------------- |
55 | Set the top-level Kconfig file to the value of this environment | 71 | Set 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 | |||
35 | flex 2.5.35 flex --version | 35 | flex 2.5.35 flex --version |
36 | bison 2.0 bison --version | 36 | bison 2.0 bison --version |
37 | util-linux 2.10o fdformat --version | 37 | util-linux 2.10o fdformat --version |
38 | module-init-tools 0.9.10 depmod -V | 38 | kmod 13 depmod -V |
39 | e2fsprogs 1.41.4 e2fsck -V | 39 | e2fsprogs 1.41.4 e2fsck -V |
40 | jfsutils 1.1.3 fsck.jfs -V | 40 | jfsutils 1.1.3 fsck.jfs -V |
41 | reiserfsprogs 3.6.3 reiserfsck -V | 41 | reiserfsprogs 3.6.3 reiserfsck -V |
@@ -156,12 +156,6 @@ is not build with ``CONFIG_KALLSYMS`` and you have no way to rebuild and | |||
156 | reproduce the Oops with that option, then you can still decode that Oops | 156 | reproduce the Oops with that option, then you can still decode that Oops |
157 | with ksymoops. | 157 | with ksymoops. |
158 | 158 | ||
159 | Module-Init-Tools | ||
160 | ----------------- | ||
161 | |||
162 | A new module loader is now in the kernel that requires ``module-init-tools`` | ||
163 | to use. It is backward compatible with the 2.4.x series kernels. | ||
164 | |||
165 | Mkinitrd | 159 | Mkinitrd |
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 | ||
368 | Kmod | ||
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 | |||
374 | Ksymoops | 374 | Ksymoops |
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 | ||
379 | Module-Init-Tools | ||
380 | ----------------- | ||
381 | |||
382 | - <https://www.kernel.org/pub/linux/utils/kernel/module-init-tools/> | ||
383 | |||
384 | Mkinitrd | 379 | Mkinitrd |
385 | -------- | 380 | -------- |
386 | 381 | ||
@@ -224,7 +224,7 @@ clean-targets := %clean mrproper cleandocs | |||
224 | no-dot-config-targets := $(clean-targets) \ | 224 | no-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 | ||
229 | config-targets := 0 | 229 | config-targets := 0 |
230 | mixed-targets := 0 | 230 | mixed-targets := 0 |
@@ -359,11 +359,12 @@ HOST_LFS_LIBS := $(shell getconf LFS_LIBS 2>/dev/null) | |||
359 | 359 | ||
360 | HOSTCC = gcc | 360 | HOSTCC = gcc |
361 | HOSTCXX = g++ | 361 | HOSTCXX = g++ |
362 | HOSTCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 \ | 362 | KBUILD_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) \ |
364 | HOSTCXXFLAGS := -O2 $(HOST_LFS_CFLAGS) | 364 | $(HOSTCFLAGS) |
365 | HOSTLDFLAGS := $(HOST_LFS_LDFLAGS) | 365 | KBUILD_HOSTCXXFLAGS := -O2 $(HOST_LFS_CFLAGS) $(HOSTCXXFLAGS) |
366 | HOST_LOADLIBES := $(HOST_LFS_LIBS) | 366 | KBUILD_HOSTLDFLAGS := $(HOST_LFS_LDFLAGS) $(HOSTLDFLAGS) |
367 | KBUILD_HOSTLDLIBS := $(HOST_LFS_LIBS) $(HOSTLDLIBS) | ||
367 | 368 | ||
368 | # Make variables (CC, etc...) | 369 | # Make variables (CC, etc...) |
369 | AS = $(CROSS_COMPILE)as | 370 | AS = $(CROSS_COMPILE)as |
@@ -429,10 +430,10 @@ KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds | |||
429 | LDFLAGS := | 430 | LDFLAGS := |
430 | GCC_PLUGINS_CFLAGS := | 431 | GCC_PLUGINS_CFLAGS := |
431 | 432 | ||
432 | export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC | 433 | export ARCH SRCARCH CONFIG_SHELL HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE AS LD CC |
433 | export CPP AR NM STRIP OBJCOPY OBJDUMP HOSTLDFLAGS HOST_LOADLIBES | 434 | export CPP AR NM STRIP OBJCOPY OBJDUMP KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS |
434 | export MAKE LEX YACC AWK GENKSYMS INSTALLKERNEL PERL PYTHON PYTHON2 PYTHON3 UTS_MACHINE | 435 | export MAKE LEX YACC AWK GENKSYMS INSTALLKERNEL PERL PYTHON PYTHON2 PYTHON3 UTS_MACHINE |
435 | export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS | 436 | export HOSTCXX KBUILD_HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS |
436 | 437 | ||
437 | export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS | 438 | export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS |
438 | export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE | 439 | export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE |
@@ -1009,9 +1010,10 @@ ifdef CONFIG_GDB_SCRIPTS | |||
1009 | endif | 1010 | endif |
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. |
1013 | ifdef CONFIG_SAMPLES | 1014 | ifdef CONFIG_SAMPLES |
1014 | vmlinux-dirs += samples | 1015 | vmlinux-dirs += samples |
1016 | samples: headers_install | ||
1015 | endif | 1017 | endif |
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))';) |
1117 | endef | 1119 | endef |
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 |
15 | OBJSTRIP := $(obj)/tools/objstrip | 15 | OBJSTRIP := $(obj)/tools/objstrip |
16 | 16 | ||
17 | HOSTCFLAGS := -Wall -I$(objtree)/usr/include | 17 | KBUILD_HOSTCFLAGS := -Wall -I$(objtree)/usr/include |
18 | BOOTCFLAGS += -I$(objtree)/$(obj) -I$(srctree)/$(obj) | 18 | BOOTCFLAGS += -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 | ||
14 | LDFLAGS := | ||
15 | |||
16 | LDFLAGS_vmlinux :=-p --no-undefined -X --pic-veneer | 13 | LDFLAGS_vmlinux :=-p --no-undefined -X --pic-veneer |
17 | ifeq ($(CONFIG_CPU_ENDIAN_BE8),y) | 14 | ifeq ($(CONFIG_CPU_ENDIAN_BE8),y) |
18 | LDFLAGS_vmlinux += --be8 | 15 | LDFLAGS_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) | |||
19 | CFLAGS_pm.o += -DDEBUG | 19 | CFLAGS_pm.o += -DDEBUG |
20 | endif | 20 | endif |
21 | 21 | ||
22 | # Default sed regexp - multiline due to syntax constraints | ||
23 | define sed-y | ||
24 | "/^->/{s:->#\(.*\):/* \1 */:; \ | ||
25 | s:^->\([^ ]*\) [\$$#]*\([-0-9]*\) \(.*\):#define \1 \2 /* \3 */:; \ | ||
26 | s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \ | ||
27 | s:->::; p;}" | ||
28 | endef | ||
29 | |||
30 | # Use filechk to avoid rebuilds when a header changes, but the resulting file | ||
31 | # does not | ||
32 | define 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" ) | ||
45 | endef | ||
46 | |||
47 | arch/arm/mach-at91/pm_data-offsets.s: arch/arm/mach-at91/pm_data-offsets.c | 22 | arch/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 | ||
26 | ELFNOTE_START(Linux, 0, "a") | 27 | ELFNOTE_START(Linux, 0, "a") |
27 | .long LINUX_VERSION_CODE | 28 | .long LINUX_VERSION_CODE |
28 | ELFNOTE_END | 29 | ELFNOTE_END |
30 | |||
31 | BUILD_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 | ||
20 | KBUILD_DEFCONFIG := or1ksim_defconfig | 20 | KBUILD_DEFCONFIG := or1ksim_defconfig |
21 | 21 | ||
22 | LDFLAGS := | ||
23 | OBJCOPYFLAGS := -O binary -R .note -R .comment -S | 22 | OBJCOPYFLAGS := -O binary -R .note -R .comment -S |
24 | LDFLAGS_vmlinux := | 23 | LDFLAGS_vmlinux := |
25 | LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) | 24 | LIBGCC := $(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 | |||
28 | BUILD_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 | ||
9 | CMD_BIN2C = $(objtree)/scripts/basic/bin2c | ||
10 | quiet_cmd_bin2c = BIN2C $@ | 9 | quiet_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 | ||
11 | LDFLAGS := | ||
12 | OBJCOPYFLAGS := -O binary | 11 | OBJCOPYFLAGS := -O binary |
13 | LDFLAGS_vmlinux := | 12 | LDFLAGS_vmlinux := |
14 | ifeq ($(CONFIG_DYNAMIC_FTRACE),y) | 13 | ifeq ($(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 | ||
27 | define filechk_syshdr | 27 | define filechk_syshdr |
28 | $(CONFIG_SHELL) '$(systbl)' -H -a $(syshdr_abi_$(basetarget)) -f "$2" | 28 | $(CONFIG_SHELL) '$(systbl)' -H -a $(syshdr_abi_$(basetarget)) -f "$2" < $< |
29 | endef | 29 | endef |
30 | 30 | ||
31 | define filechk_sysnr | 31 | define filechk_sysnr |
32 | $(CONFIG_SHELL) '$(systbl)' -N -a $(sysnr_abi_$(basetarget)) | 32 | $(CONFIG_SHELL) '$(systbl)' -N -a $(sysnr_abi_$(basetarget)) < $< |
33 | endef | 33 | endef |
34 | 34 | ||
35 | define filechk_syscalls | 35 | define filechk_syscalls |
36 | $(CONFIG_SHELL) '$(systbl)' -S | 36 | $(CONFIG_SHELL) '$(systbl)' -S < $< |
37 | endef | 37 | endef |
38 | 38 | ||
39 | syshdr_abi_unistd_32 := common,32 | 39 | syshdr_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 | ||
31 | CMD_BIN2C = $(objtree)/scripts/basic/bin2c | ||
32 | quiet_cmd_bin2c = BIN2C $@ | 31 | quiet_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 | |||
116 | KBUILD_KCONFIG := $(HOST_DIR)/um/Kconfig | 116 | KBUILD_KCONFIG := $(HOST_DIR)/um/Kconfig |
117 | 117 | ||
118 | archheaders: | 118 | archheaders: |
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 | ||
128 | archprepare: include/generated/user_constants.h | 121 | archprepare: 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 ""; ) |
174 | endef | 167 | endef |
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) | |||
25 | targets := pcap_kern.o pcap_user.o vde_kern.o vde_user.o | 25 | targets := 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) | |||
13 | KBUILD_AFLAGS += $(call cc-option,-m32) | 13 | KBUILD_AFLAGS += $(call cc-option,-m32) |
14 | LINK-y += $(call cc-option,-m32) | 14 | LINK-y += $(call cc-option,-m32) |
15 | 15 | ||
16 | export LDFLAGS | ||
17 | |||
18 | LDS_EXTRA := -Ui386 | 16 | LDS_EXTRA := -Ui386 |
19 | export LDS_EXTRA | 17 | export 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 @@ | |||
10 | ELFNOTE_START(Linux, 0, "a") | 11 | ELFNOTE_START(Linux, 0, "a") |
11 | .long LINUX_VERSION_CODE | 12 | .long LINUX_VERSION_CODE |
12 | ELFNOTE_END | 13 | ELFNOTE_END |
14 | |||
15 | BUILD_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 |
15 | ELFNOTE_END | 16 | ELFNOTE_END |
16 | 17 | ||
18 | BUILD_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 | ||
29 | targets += kexec-purgatory.c | 29 | targets += kexec-purgatory.c |
30 | 30 | ||
31 | CMD_BIN2C = $(objtree)/scripts/basic/bin2c | ||
32 | quiet_cmd_bin2c = BIN2C $@ | 31 | quiet_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 | |||
30 | zImage: boot-redboot | 30 | zImage: boot-redboot |
31 | uImage: $(obj)/uImage | 31 | uImage: $(obj)/uImage |
32 | 32 | ||
33 | boot-elf boot-redboot: $(addprefix $(obj)/,$(subdir-y)) \ | 33 | boot-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 | ||
37 | OBJCOPYFLAGS = --strip-all -R .comment -R .note.gnu.build-id -O binary | 36 | OBJCOPYFLAGS = --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 | ||
110 | config 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 | |||
110 | config HAVE_KERNEL_GZIP | 119 | config 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 | |||
54 | BUILD_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;") |
127 | targets += config_data.h | 127 | targets += 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 | ||
6 | hostprogs-y := bpfilter_umh | 6 | hostprogs-y := bpfilter_umh |
7 | bpfilter_umh-objs := main.o | 7 | bpfilter_umh-objs := main.o |
8 | HOSTCFLAGS += -I. -Itools/include/ -Itools/include/uapi | 8 | KBUILD_HOSTCFLAGS += -I. -Itools/include/ -Itools/include/uapi |
9 | HOSTCC := $(CC) | 9 | HOSTCC := $(CC) |
10 | 10 | ||
11 | ifeq ($(CONFIG_BPFILTER_UMH), y) | 11 | ifeq ($(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 |
15 | HOSTLDFLAGS += -static | 15 | KBUILD_HOSTLDFLAGS += -static |
16 | endif | 16 | endif |
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 | |||
164 | always += xdp_fwd_kern.o | 164 | always += xdp_fwd_kern.o |
165 | always += task_fd_query_kern.o | 165 | always += task_fd_query_kern.o |
166 | 166 | ||
167 | HOSTCFLAGS += -I$(objtree)/usr/include | 167 | KBUILD_HOSTCFLAGS += -I$(objtree)/usr/include |
168 | HOSTCFLAGS += -I$(srctree)/tools/lib/ | 168 | KBUILD_HOSTCFLAGS += -I$(srctree)/tools/lib/ |
169 | HOSTCFLAGS += -I$(srctree)/tools/testing/selftests/bpf/ | 169 | KBUILD_HOSTCFLAGS += -I$(srctree)/tools/testing/selftests/bpf/ |
170 | HOSTCFLAGS += -I$(srctree)/tools/lib/ -I$(srctree)/tools/include | 170 | KBUILD_HOSTCFLAGS += -I$(srctree)/tools/lib/ -I$(srctree)/tools/include |
171 | HOSTCFLAGS += -I$(srctree)/tools/perf | 171 | KBUILD_HOSTCFLAGS += -I$(srctree)/tools/perf |
172 | 172 | ||
173 | HOSTCFLAGS_bpf_load.o += -I$(objtree)/usr/include -Wno-unused-variable | 173 | HOSTCFLAGS_bpf_load.o += -I$(objtree)/usr/include -Wno-unused-variable |
174 | HOSTCFLAGS_trace_helpers.o += -I$(srctree)/tools/lib/bpf/ | 174 | HOSTCFLAGS_trace_helpers.o += -I$(srctree)/tools/lib/bpf/ |
@@ -180,12 +180,12 @@ HOSTCFLAGS_trace_event_user.o += -I$(srctree)/tools/lib/bpf/ | |||
180 | HOSTCFLAGS_sampleip_user.o += -I$(srctree)/tools/lib/bpf/ | 180 | HOSTCFLAGS_sampleip_user.o += -I$(srctree)/tools/lib/bpf/ |
181 | HOSTCFLAGS_task_fd_query_user.o += -I$(srctree)/tools/lib/bpf/ | 181 | HOSTCFLAGS_task_fd_query_user.o += -I$(srctree)/tools/lib/bpf/ |
182 | 182 | ||
183 | HOST_LOADLIBES += $(LIBBPF) -lelf | 183 | KBUILD_HOSTLDLIBS += $(LIBBPF) -lelf |
184 | HOSTLOADLIBES_tracex4 += -lrt | 184 | HOSTLDLIBS_tracex4 += -lrt |
185 | HOSTLOADLIBES_trace_output += -lrt | 185 | HOSTLDLIBS_trace_output += -lrt |
186 | HOSTLOADLIBES_map_perf_test += -lrt | 186 | HOSTLDLIBS_map_perf_test += -lrt |
187 | HOSTLOADLIBES_test_overhead += -lrt | 187 | HOSTLDLIBS_test_overhead += -lrt |
188 | HOSTLOADLIBES_xdpsock += -pthread | 188 | HOSTLDLIBS_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) | |||
30 | HOSTCFLAGS_dropper.o += $(MFLAG) | 30 | HOSTCFLAGS_dropper.o += $(MFLAG) |
31 | HOSTCFLAGS_bpf-helper.o += $(MFLAG) | 31 | HOSTCFLAGS_bpf-helper.o += $(MFLAG) |
32 | HOSTCFLAGS_bpf-fancy.o += $(MFLAG) | 32 | HOSTCFLAGS_bpf-fancy.o += $(MFLAG) |
33 | HOSTLOADLIBES_bpf-direct += $(MFLAG) | 33 | HOSTLDLIBS_bpf-direct += $(MFLAG) |
34 | HOSTLOADLIBES_bpf-fancy += $(MFLAG) | 34 | HOSTLDLIBS_bpf-fancy += $(MFLAG) |
35 | HOSTLOADLIBES_dropper += $(MFLAG) | 35 | HOSTLDLIBS_dropper += $(MFLAG) |
36 | endif | 36 | endif |
37 | always := $(hostprogs-m) | 37 | always := $(hostprogs-m) |
38 | endif | 38 | endif |
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 | # |
4 | bin2c | ||
4 | conmakehash | 5 | conmakehash |
5 | kallsyms | 6 | kallsyms |
6 | pnmtologo | 7 | pnmtologo |
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) | |||
56 | define filechk | 56 | define 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) |
128 | hostcc-option = $(call __cc-option, $(HOSTCC),\ | 128 | hostcc-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 | ||
11 | HOST_EXTRACFLAGS += -I$(srctree)/tools/include | 11 | HOST_EXTRACFLAGS += -I$(srctree)/tools/include |
12 | 12 | ||
13 | hostprogs-$(CONFIG_BUILD_BIN2C) += bin2c | ||
13 | hostprogs-$(CONFIG_KALLSYMS) += kallsyms | 14 | hostprogs-$(CONFIG_KALLSYMS) += kallsyms |
14 | hostprogs-$(CONFIG_LOGO) += pnmtologo | 15 | hostprogs-$(CONFIG_LOGO) += pnmtologo |
15 | hostprogs-$(CONFIG_VT) += conmakehash | 16 | hostprogs-$(CONFIG_VT) += conmakehash |
@@ -22,8 +23,8 @@ hostprogs-$(CONFIG_SYSTEM_EXTRA_CERTIFICATE) += insert-sys-cert | |||
22 | 23 | ||
23 | HOSTCFLAGS_sortextable.o = -I$(srctree)/tools/include | 24 | HOSTCFLAGS_sortextable.o = -I$(srctree)/tools/include |
24 | HOSTCFLAGS_asn1_compiler.o = -I$(srctree)/include | 25 | HOSTCFLAGS_asn1_compiler.o = -I$(srctree)/include |
25 | HOSTLOADLIBES_sign-file = -lcrypto | 26 | HOSTLDLIBS_sign-file = -lcrypto |
26 | HOSTLOADLIBES_extract-cert = -lcrypto | 27 | HOSTLDLIBS_extract-cert = -lcrypto |
27 | 28 | ||
28 | always := $(hostprogs-y) $(hostprogs-m) | 29 | always := $(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 | ||
54 | include scripts/Makefile.lib | 54 | include scripts/Makefile.lib |
55 | 55 | ||
56 | ifdef host-progs | ||
57 | ifneq ($(hostprogs-y),$(host-progs)) | ||
58 | $(warning kbuild: $(obj)/Makefile - Usage of host-progs is deprecated. Please replace with hostprogs-y!) | ||
59 | hostprogs-y += $(host-progs) | ||
60 | endif | ||
61 | endif | ||
62 | |||
63 | # Do not include host rules unless needed | 56 | # Do not include host rules unless needed |
64 | ifneq ($(hostprogs-y)$(hostprogs-m)$(hostlibs-y)$(hostlibs-m)$(hostcxxlibs-y)$(hostcxxlibs-m),) | 57 | ifneq ($(hostprogs-y)$(hostprogs-m)$(hostlibs-y)$(hostlibs-m)$(hostcxxlibs-y)$(hostcxxlibs-m),) |
65 | include scripts/Makefile.host | 58 | include 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 | ||
70 | ifeq ($(KBUILD_SRC),) | 70 | ifeq ($(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 |
86 | quiet_cmd_host-csingle = HOSTCC $@ | 86 | quiet_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 |
94 | quiet_cmd_host-cmulti = HOSTLD $@ | 94 | quiet_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 |
111 | quiet_cmd_host-cxxmulti = HOSTLD $@ | 111 | quiet_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) |
145 | quiet_cmd_host-cshlib = HOSTLLD -shared $@ | 145 | quiet_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) |
155 | quiet_cmd_host-cxxshlib = HOSTLLD -shared $@ | 155 | quiet_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) \ | |||
162 | cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \ | 162 | cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \ |
163 | $(__cpp_flags) | 163 | $(__cpp_flags) |
164 | 164 | ||
165 | ld_flags = $(LDFLAGS) $(ldflags-y) | 165 | ld_flags = $(LDFLAGS) $(ldflags-y) $(LDFLAGS_$(@F)) |
166 | 166 | ||
167 | DTC_INCLUDE := $(srctree)/scripts/dtc/include-prefixes | 167 | DTC_INCLUDE := $(srctree)/scripts/dtc/include-prefixes |
168 | 168 | ||
@@ -225,8 +225,7 @@ $(obj)/%: $(src)/%_shipped | |||
225 | # --------------------------------------------------------------------------- | 225 | # --------------------------------------------------------------------------- |
226 | 226 | ||
227 | quiet_cmd_ld = LD $@ | 227 | quiet_cmd_ld = LD $@ |
228 | cmd_ld = $(LD) $(LDFLAGS) $(ldflags-y) $(LDFLAGS_$(@F)) \ | 228 | cmd_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" ) |
422 | endef | 421 | endef |
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 @@ | |||
1 | fixdep | fixdep | |
2 | bin2c | ||
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 | ||
11 | hostprogs-y := fixdep | 11 | hostprogs-y := fixdep |
12 | hostprogs-$(CONFIG_BUILD_BIN2C) += bin2c | ||
13 | always := $(hostprogs-y) | 12 | always := $(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 | |||
10 | virtual report | ||
11 | |||
12 | @r1 exists@ | ||
13 | identifier a, x; | ||
14 | position p1, p2; | ||
15 | identifier fname =~ ".*free.*"; | ||
16 | identifier fname2 =~ ".*destroy.*"; | ||
17 | identifier fname3 =~ ".*del.*"; | ||
18 | identifier fname4 =~ ".*queue_work.*"; | ||
19 | identifier fname5 =~ ".*schedule_work.*"; | ||
20 | identifier 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@ | ||
54 | p1 << r1.p1; | ||
55 | p2 << r1.p2; | ||
56 | @@ | ||
57 | msg = "atomic_dec_and_test variation before object free at line %s." | ||
58 | coccilib.report.print_report(p1[0], msg % (p2[0].line)) | ||
59 | |||
60 | @r4 exists@ | ||
61 | identifier a, x, y; | ||
62 | position p1, p2; | ||
63 | identifier 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 | ... | ||
81 | y=a | ||
82 | ... | ||
83 | fname@p2(y, ...); | ||
84 | |||
85 | |||
86 | @script:python depends on report@ | ||
87 | p1 << r4.p1; | ||
88 | p2 << r4.p2; | ||
89 | @@ | ||
90 | msg = "atomic_dec_and_test variation before object free at line %s." | ||
91 | coccilib.report.print_report(p1[0], msg % (p2[0].line)) | ||
92 | |||
93 | @r2 exists@ | ||
94 | identifier a, x; | ||
95 | position p1; | ||
96 | @@ | ||
97 | |||
98 | ( | ||
99 | atomic_add_unless(&(a)->x,-1,1)@p1 | ||
100 | | | ||
101 | atomic_long_add_unless(&(a)->x,-1,1)@p1 | ||
102 | | | ||
103 | atomic64_add_unless(&(a)->x,-1,1)@p1 | ||
104 | ) | ||
105 | |||
106 | @script:python depends on report@ | ||
107 | p1 << r2.p1; | ||
108 | @@ | ||
109 | msg = "atomic_add_unless" | ||
110 | coccilib.report.print_report(p1[0], msg) | ||
111 | |||
112 | @r3 exists@ | ||
113 | identifier x; | ||
114 | position p1; | ||
115 | @@ | ||
116 | |||
117 | ( | ||
118 | x = atomic_add_return@p1(-1, ...); | ||
119 | | | ||
120 | x = atomic_long_add_return@p1(-1, ...); | ||
121 | | | ||
122 | x = atomic64_add_return@p1(-1, ...); | ||
123 | ) | ||
124 | |||
125 | @script:python depends on report@ | ||
126 | p1 << r3.p1; | ||
127 | @@ | ||
128 | msg = "x = atomic_add_return(-1, ...)" | ||
129 | coccilib.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@ |
30 | expression r.E,e1,e2,fn; | ||
31 | position r.p; | ||
32 | assignment operator op; | ||
33 | @@ | ||
34 | |||
35 | ( | ||
36 | E@p | ||
37 | & | ||
38 | <+... \(fn(...)\|e1 op e2\|e1++\|e1--\|++e1\|--e1\) ...+> | ||
39 | ) | ||
40 | |||
41 | @depends on context && !bad@ | ||
42 | expression r.E; | ||
43 | position r.p; | ||
44 | @@ | ||
45 | |||
46 | *E@p | ||
47 | |||
48 | @script:python depends on org && !bad@ | ||
31 | p << r.p; | 49 | p << r.p; |
32 | @@ | 50 | @@ |
33 | 51 | ||
34 | cocci.print_main("duplicated argument to && or ||",p) | 52 | cocci.print_main("duplicated argument to && or ||",p) |
35 | 53 | ||
36 | @script:python depends on report@ | 54 | @script:python depends on report && !bad@ |
37 | p << r.p; | 55 | p << 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 | |||
10 | DEPMOD=$1 | 10 | DEPMOD=$1 |
11 | KERNELRELEASE=$2 | 11 | KERNELRELEASE=$2 |
12 | 12 | ||
13 | if ! test -r System.map -a -x "$DEPMOD"; then | 13 | if ! test -r System.map ; then |
14 | exit 0 | 14 | exit 0 |
15 | fi | 15 | fi |
16 | 16 | ||
17 | if [ -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 | ||
21 | fi | ||
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 |
19 | depmod_hack_needed=true | 25 | depmod_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) | |||
169 | hostprogs-y += nconf | 169 | hostprogs-y += nconf |
170 | nconf-objs := nconf.o zconf.tab.o nconf.gui.o | 170 | nconf-objs := nconf.o zconf.tab.o nconf.gui.o |
171 | 171 | ||
172 | HOSTLOADLIBES_nconf = $(shell . $(obj)/.nconf-cfg && echo $$libs) | 172 | HOSTLDLIBS_nconf = $(shell . $(obj)/.nconf-cfg && echo $$libs) |
173 | HOSTCFLAGS_nconf.o = $(shell . $(obj)/.nconf-cfg && echo $$cflags) | 173 | HOSTCFLAGS_nconf.o = $(shell . $(obj)/.nconf-cfg && echo $$cflags) |
174 | HOSTCFLAGS_nconf.gui.o = $(shell . $(obj)/.nconf-cfg && echo $$cflags) | 174 | HOSTCFLAGS_nconf.gui.o = $(shell . $(obj)/.nconf-cfg && echo $$cflags) |
175 | 175 | ||
@@ -180,7 +180,7 @@ hostprogs-y += mconf | |||
180 | lxdialog := checklist.o inputbox.o menubox.o textbox.o util.o yesno.o | 180 | lxdialog := checklist.o inputbox.o menubox.o textbox.o util.o yesno.o |
181 | mconf-objs := mconf.o zconf.tab.o $(addprefix lxdialog/, $(lxdialog)) | 181 | mconf-objs := mconf.o zconf.tab.o $(addprefix lxdialog/, $(lxdialog)) |
182 | 182 | ||
183 | HOSTLOADLIBES_mconf = $(shell . $(obj)/.mconf-cfg && echo $$libs) | 183 | HOSTLDLIBS_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 | |||
191 | qconf-cxxobjs := qconf.o | 191 | qconf-cxxobjs := qconf.o |
192 | qconf-objs := zconf.tab.o | 192 | qconf-objs := zconf.tab.o |
193 | 193 | ||
194 | HOSTLOADLIBES_qconf = $(shell . $(obj)/.qconf-cfg && echo $$libs) | 194 | HOSTLDLIBS_qconf = $(shell . $(obj)/.qconf-cfg && echo $$libs) |
195 | HOSTCXXFLAGS_qconf.o = $(shell . $(obj)/.qconf-cfg && echo $$cflags) | 195 | HOSTCXXFLAGS_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 | |||
206 | hostprogs-y += gconf | 206 | hostprogs-y += gconf |
207 | gconf-objs := gconf.o zconf.tab.o | 207 | gconf-objs := gconf.o zconf.tab.o |
208 | 208 | ||
209 | HOSTLOADLIBES_gconf = $(shell . $(obj)/.gconf-cfg && echo $$libs) | 209 | HOSTLDLIBS_gconf = $(shell . $(obj)/.gconf-cfg && echo $$libs) |
210 | HOSTCFLAGS_gconf.o = $(shell . $(obj)/.gconf-cfg && echo $$cflags) | 210 | HOSTCFLAGS_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 | **/ |
2126 | static void add_header(struct buffer *b, struct module *mod) | 2126 | static 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 | ||
7 | set -e | 7 | set -e |
8 | 8 | ||
9 | is_enabled() { | ||
10 | grep -q "^CONFIG_$1=y" $KCONFIG_CONFIG | ||
11 | } | ||
12 | |||
13 | if_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 | |||
9 | set_debarch() { | 21 | set_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 | ||
128 | if __name__ == "__main__": | 128 | if __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 | |||
4 | targets += builtin-policy.h | 4 | targets += builtin-policy.h |
5 | define do_policy | 5 | define do_policy |
6 | echo "static char tomoyo_builtin_$(1)[] __initdata ="; \ | 6 | echo "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); \ |
8 | echo ";" | 8 | echo ";" |
9 | endef | 9 | endef |
10 | quiet_cmd_policy = POLICY $@ | 10 | quiet_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 | ||
101 | host_c_flags = -Wp,-MD,$(depfile) -Wp,-MT,$@ $(HOSTCFLAGS) -D"BUILD_STR(s)=\#s" $(HOSTCFLAGS_$(basetarget).o) $(HOSTCFLAGS_$(obj)) | 101 | host_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 | ||
48 | FORCE: | 48 | FORCE: |
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 |
33 | WARNINGS := $(EXTRA_WARNINGS) -Wno-switch-default -Wno-switch-enum -Wno-packed | 33 | WARNINGS := $(EXTRA_WARNINGS) -Wno-switch-default -Wno-switch-enum -Wno-packed |
34 | CFLAGS += -Werror $(WARNINGS) $(HOSTCFLAGS) -g $(INCLUDES) | 34 | CFLAGS += -Werror $(WARNINGS) $(KBUILD_HOSTCFLAGS) -g $(INCLUDES) |
35 | LDFLAGS += -lelf $(LIBSUBCMD) $(HOSTLDFLAGS) | 35 | LDFLAGS += -lelf $(LIBSUBCMD) $(KBUILD_HOSTLDFLAGS) |
36 | 36 | ||
37 | # Allow old libelf to be used: | 37 | # Allow old libelf to be used: |
38 | elfshdr := $(shell echo '$(pound)include <libelf.h>' | $(CC) $(CFLAGS) -x c -E - | grep elf_getshdr) | 38 | elfshdr := $(shell echo '$(pound)include <libelf.h>' | $(CC) $(CFLAGS) -x c -E - | grep elf_getshdr) |