aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/early-userspace/README6
-rw-r--r--Documentation/filesystems/ramfs-rootfs-initramfs.txt2
-rw-r--r--Documentation/kbuild/kconfig-language.txt3
-rw-r--r--Documentation/kbuild/makefiles.txt2
-rw-r--r--Makefile18
-rw-r--r--arch/arc/Makefile2
-rw-r--r--arch/arm/Makefile4
-rw-r--r--arch/arm64/Makefile4
-rw-r--r--arch/c6x/Makefile3
-rw-r--r--arch/h8300/Makefile2
-rw-r--r--arch/hexagon/Makefile4
-rw-r--r--arch/m68k/Makefile2
-rw-r--r--arch/microblaze/Makefile4
-rw-r--r--arch/mips/Makefile2
-rw-r--r--arch/mips/boot/compressed/Makefile2
-rw-r--r--arch/mips/lasat/image/Makefile2
-rw-r--r--arch/nds32/Makefile4
-rw-r--r--arch/powerpc/Makefile6
-rw-r--r--arch/riscv/Makefile4
-rw-r--r--arch/s390/Makefile2
-rw-r--r--arch/sh/Makefile4
-rw-r--r--arch/sparc/Makefile4
-rw-r--r--arch/um/Makefile2
-rw-r--r--arch/x86/Makefile4
-rw-r--r--arch/x86/Makefile.um4
-rw-r--r--arch/x86/boot/compressed/Makefile6
-rw-r--r--arch/xtensa/Makefile2
-rw-r--r--arch/xtensa/boot/boot-elf/Makefile2
-rw-r--r--certs/system_certificates.S16
-rw-r--r--include/asm-generic/vmlinux.lds.h2
-rw-r--r--include/linux/export.h7
-rw-r--r--init/Kconfig2
-rw-r--r--scripts/Kbuild.include4
-rw-r--r--scripts/Makefile.build6
-rw-r--r--scripts/Makefile.lib2
-rw-r--r--scripts/Makefile.modpost2
-rwxr-xr-xscripts/clang-version.sh2
-rw-r--r--scripts/coccinelle/api/alloc/zalloc-simple.cocci41
-rw-r--r--scripts/dtc/Makefile18
-rw-r--r--scripts/kconfig/Makefile16
-rw-r--r--scripts/kconfig/conf.c5
-rw-r--r--scripts/kconfig/symbol.c58
-rw-r--r--scripts/kconfig/tests/err_recursive_dep/Kconfig (renamed from scripts/kconfig/tests/warn_recursive_dep/Kconfig)3
-rw-r--r--scripts/kconfig/tests/err_recursive_dep/__init__.py10
-rw-r--r--scripts/kconfig/tests/err_recursive_dep/expected_stderr38
-rw-r--r--scripts/kconfig/tests/warn_recursive_dep/__init__.py9
-rw-r--r--scripts/kconfig/tests/warn_recursive_dep/expected_stderr30
-rwxr-xr-xscripts/link-vmlinux.sh4
-rw-r--r--scripts/mod/modpost.c8
-rw-r--r--usr/Makefile2
-rwxr-xr-xusr/gen_initramfs_list.sh (renamed from scripts/gen_initramfs_list.sh)2
-rw-r--r--usr/initramfs_data.S4
52 files changed, 188 insertions, 209 deletions
diff --git a/Documentation/early-userspace/README b/Documentation/early-userspace/README
index 2c00b072a4c8..1e1057958dd3 100644
--- a/Documentation/early-userspace/README
+++ b/Documentation/early-userspace/README
@@ -66,17 +66,17 @@ early userspace image can be built by an unprivileged user.
66 66
67As a technical note, when directories and files are specified, the 67As a technical note, when directories and files are specified, the
68entire CONFIG_INITRAMFS_SOURCE is passed to 68entire CONFIG_INITRAMFS_SOURCE is passed to
69scripts/gen_initramfs_list.sh. This means that CONFIG_INITRAMFS_SOURCE 69usr/gen_initramfs_list.sh. This means that CONFIG_INITRAMFS_SOURCE
70can really be interpreted as any legal argument to 70can really be interpreted as any legal argument to
71gen_initramfs_list.sh. If a directory is specified as an argument then 71gen_initramfs_list.sh. If a directory is specified as an argument then
72the contents are scanned, uid/gid translation is performed, and 72the contents are scanned, uid/gid translation is performed, and
73usr/gen_init_cpio file directives are output. If a directory is 73usr/gen_init_cpio file directives are output. If a directory is
74specified as an argument to scripts/gen_initramfs_list.sh then the 74specified as an argument to usr/gen_initramfs_list.sh then the
75contents of the file are simply copied to the output. All of the output 75contents of the file are simply copied to the output. All of the output
76directives from directory scanning and file contents copying are 76directives from directory scanning and file contents copying are
77processed by usr/gen_init_cpio. 77processed by usr/gen_init_cpio.
78 78
79See also 'scripts/gen_initramfs_list.sh -h'. 79See also 'usr/gen_initramfs_list.sh -h'.
80 80
81Where's this all leading? 81Where's this all leading?
82========================= 82=========================
diff --git a/Documentation/filesystems/ramfs-rootfs-initramfs.txt b/Documentation/filesystems/ramfs-rootfs-initramfs.txt
index b176928e6963..79637d227e85 100644
--- a/Documentation/filesystems/ramfs-rootfs-initramfs.txt
+++ b/Documentation/filesystems/ramfs-rootfs-initramfs.txt
@@ -164,7 +164,7 @@ Documentation/early-userspace/README for more details.)
164The kernel does not depend on external cpio tools. If you specify a 164The kernel does not depend on external cpio tools. If you specify a
165directory instead of a configuration file, the kernel's build infrastructure 165directory instead of a configuration file, the kernel's build infrastructure
166creates a configuration file from that directory (usr/Makefile calls 166creates a configuration file from that directory (usr/Makefile calls
167scripts/gen_initramfs_list.sh), and proceeds to package up that directory 167usr/gen_initramfs_list.sh), and proceeds to package up that directory
168using the config file (by feeding it to usr/gen_init_cpio, which is created 168using the config file (by feeding it to usr/gen_init_cpio, which is created
169from usr/gen_init_cpio.c). The kernel's build-time cpio creation code is 169from usr/gen_init_cpio.c). The kernel's build-time cpio creation code is
170entirely self-contained, and the kernel's boot-time extractor is also 170entirely self-contained, and the kernel's boot-time extractor is also
diff --git a/Documentation/kbuild/kconfig-language.txt b/Documentation/kbuild/kconfig-language.txt
index c54cb7cb9ff4..864e740811da 100644
--- a/Documentation/kbuild/kconfig-language.txt
+++ b/Documentation/kbuild/kconfig-language.txt
@@ -545,7 +545,7 @@ make KBUILD_KCONFIG=Documentation/kbuild/Kconfig.recursion-issue-02 allnoconfig
545Practical solutions to kconfig recursive issue 545Practical solutions to kconfig recursive issue
546~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 546~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
547 547
548Developers who run into the recursive Kconfig issue have three options 548Developers who run into the recursive Kconfig issue have two options
549at their disposal. We document them below and also provide a list of 549at their disposal. We document them below and also provide a list of
550historical issues resolved through these different solutions. 550historical issues resolved through these different solutions.
551 551
@@ -553,7 +553,6 @@ historical issues resolved through these different solutions.
553 b) Match dependency semantics: 553 b) Match dependency semantics:
554 b1) Swap all "select FOO" to "depends on FOO" or, 554 b1) Swap all "select FOO" to "depends on FOO" or,
555 b2) Swap all "depends on FOO" to "select FOO" 555 b2) Swap all "depends on FOO" to "select FOO"
556 c) Consider the use of "imply" instead of "select"
557 556
558The resolution to a) can be tested with the sample Kconfig file 557The resolution to a) can be tested with the sample Kconfig file
559Documentation/kbuild/Kconfig.recursion-issue-01 through the removal 558Documentation/kbuild/Kconfig.recursion-issue-01 through the removal
diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt
index 766355b1d221..7b6a2b2bdc98 100644
--- a/Documentation/kbuild/makefiles.txt
+++ b/Documentation/kbuild/makefiles.txt
@@ -680,7 +680,7 @@ Both possibilities are described in the following.
680 680
681 Example: 681 Example:
682 #scripts/kconfig/Makefile 682 #scripts/kconfig/Makefile
683 HOSTLOADLIBES_qconf := -L$(QTDIR)/lib 683 HOSTLDLIBS_qconf := -L$(QTDIR)/lib
684 684
685 When linking qconf, it will be passed the extra option 685 When linking qconf, it will be passed the extra option
686 "-L$(QTDIR)/lib". 686 "-L$(QTDIR)/lib".
diff --git a/Makefile b/Makefile
index c13f8b85ba60..2e2b0095131c 100644
--- a/Makefile
+++ b/Makefile
@@ -440,7 +440,7 @@ KBUILD_CFLAGS_KERNEL :=
440KBUILD_AFLAGS_MODULE := -DMODULE 440KBUILD_AFLAGS_MODULE := -DMODULE
441KBUILD_CFLAGS_MODULE := -DMODULE 441KBUILD_CFLAGS_MODULE := -DMODULE
442KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds 442KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds
443LDFLAGS := 443KBUILD_LDFLAGS :=
444GCC_PLUGINS_CFLAGS := 444GCC_PLUGINS_CFLAGS :=
445 445
446export ARCH SRCARCH CONFIG_SHELL HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE AS LD CC 446export ARCH SRCARCH CONFIG_SHELL HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE AS LD CC
@@ -448,7 +448,7 @@ export CPP AR NM STRIP OBJCOPY OBJDUMP KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS
448export MAKE LEX YACC AWK GENKSYMS INSTALLKERNEL PERL PYTHON PYTHON2 PYTHON3 UTS_MACHINE 448export MAKE LEX YACC AWK GENKSYMS INSTALLKERNEL PERL PYTHON PYTHON2 PYTHON3 UTS_MACHINE
449export HOSTCXX KBUILD_HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS 449export HOSTCXX KBUILD_HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS
450 450
451export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS 451export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS KBUILD_LDFLAGS
452export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE 452export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE
453export CFLAGS_KASAN CFLAGS_KASAN_NOSANITIZE CFLAGS_UBSAN 453export CFLAGS_KASAN CFLAGS_KASAN_NOSANITIZE CFLAGS_UBSAN
454export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE 454export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
@@ -790,8 +790,8 @@ KBUILD_CFLAGS += $(call cc-option, -fno-inline-functions-called-once)
790endif 790endif
791 791
792ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION 792ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
793KBUILD_CFLAGS_KERNEL += $(call cc-option,-ffunction-sections,) 793KBUILD_CFLAGS_KERNEL += -ffunction-sections -fdata-sections
794KBUILD_CFLAGS_KERNEL += $(call cc-option,-fdata-sections,) 794LDFLAGS_vmlinux += --gc-sections
795endif 795endif
796 796
797# arch Makefile may override CC so keep this after arch Makefile is included 797# arch Makefile may override CC so keep this after arch Makefile is included
@@ -857,10 +857,6 @@ LDFLAGS_BUILD_ID := $(call ld-option, --build-id)
857KBUILD_LDFLAGS_MODULE += $(LDFLAGS_BUILD_ID) 857KBUILD_LDFLAGS_MODULE += $(LDFLAGS_BUILD_ID)
858LDFLAGS_vmlinux += $(LDFLAGS_BUILD_ID) 858LDFLAGS_vmlinux += $(LDFLAGS_BUILD_ID)
859 859
860ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
861LDFLAGS_vmlinux += $(call ld-option, --gc-sections,)
862endif
863
864ifeq ($(CONFIG_STRIP_ASM_SYMS),y) 860ifeq ($(CONFIG_STRIP_ASM_SYMS),y)
865LDFLAGS_vmlinux += $(call ld-option, -X,) 861LDFLAGS_vmlinux += $(call ld-option, -X,)
866endif 862endif
@@ -1024,7 +1020,7 @@ ARCH_POSTLINK := $(wildcard $(srctree)/arch/$(SRCARCH)/Makefile.postlink)
1024 1020
1025# Final link of vmlinux with optional arch pass after final link 1021# Final link of vmlinux with optional arch pass after final link
1026cmd_link-vmlinux = \ 1022cmd_link-vmlinux = \
1027 $(CONFIG_SHELL) $< $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) ; \ 1023 $(CONFIG_SHELL) $< $(LD) $(KBUILD_LDFLAGS) $(LDFLAGS_vmlinux) ; \
1028 $(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true) 1024 $(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true)
1029 1025
1030vmlinux: scripts/link-vmlinux.sh autoksyms_recursive $(vmlinux-deps) FORCE 1026vmlinux: scripts/link-vmlinux.sh autoksyms_recursive $(vmlinux-deps) FORCE
@@ -1354,16 +1350,12 @@ distclean: mrproper
1354 1350
1355# Packaging of the kernel to various formats 1351# Packaging of the kernel to various formats
1356# --------------------------------------------------------------------------- 1352# ---------------------------------------------------------------------------
1357# rpm target kept for backward compatibility
1358package-dir := scripts/package 1353package-dir := scripts/package
1359 1354
1360%src-pkg: FORCE 1355%src-pkg: FORCE
1361 $(Q)$(MAKE) $(build)=$(package-dir) $@ 1356 $(Q)$(MAKE) $(build)=$(package-dir) $@
1362%pkg: include/config/kernel.release FORCE 1357%pkg: include/config/kernel.release FORCE
1363 $(Q)$(MAKE) $(build)=$(package-dir) $@ 1358 $(Q)$(MAKE) $(build)=$(package-dir) $@
1364rpm: rpm-pkg
1365 @echo " WARNING: \"rpm\" target will be removed after Linux 4.18"
1366 @echo " Please use \"rpm-pkg\" instead."
1367 1359
1368 1360
1369# Brief documentation of the typical targets used 1361# Brief documentation of the typical targets used
diff --git a/arch/arc/Makefile b/arch/arc/Makefile
index 6c1b20dd76ad..fb026196aaab 100644
--- a/arch/arc/Makefile
+++ b/arch/arc/Makefile
@@ -95,7 +95,7 @@ KBUILD_CFLAGS_MODULE += -mlong-calls -mno-millicode
95# Finally dump eveything into kernel build system 95# Finally dump eveything into kernel build system
96KBUILD_CFLAGS += $(cflags-y) 96KBUILD_CFLAGS += $(cflags-y)
97KBUILD_AFLAGS += $(KBUILD_CFLAGS) 97KBUILD_AFLAGS += $(KBUILD_CFLAGS)
98LDFLAGS += $(ldflags-y) 98KBUILD_LDFLAGS += $(ldflags-y)
99 99
100head-y := arch/arc/kernel/head.o 100head-y := arch/arc/kernel/head.o
101 101
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index ed94cf7e3157..d1516f85f25d 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -43,12 +43,12 @@ ifeq ($(CONFIG_CPU_BIG_ENDIAN),y)
43KBUILD_CPPFLAGS += -mbig-endian 43KBUILD_CPPFLAGS += -mbig-endian
44CHECKFLAGS += -D__ARMEB__ 44CHECKFLAGS += -D__ARMEB__
45AS += -EB 45AS += -EB
46LDFLAGS += -EB 46KBUILD_LDFLAGS += -EB
47else 47else
48KBUILD_CPPFLAGS += -mlittle-endian 48KBUILD_CPPFLAGS += -mlittle-endian
49CHECKFLAGS += -D__ARMEL__ 49CHECKFLAGS += -D__ARMEL__
50AS += -EL 50AS += -EL
51LDFLAGS += -EL 51KBUILD_LDFLAGS += -EL
52endif 52endif
53 53
54# 54#
diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index efe61a2e4b5e..106039d25e2f 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -62,14 +62,14 @@ CHECKFLAGS += -D__AARCH64EB__
62AS += -EB 62AS += -EB
63# Prefer the baremetal ELF build target, but not all toolchains include 63# Prefer the baremetal ELF build target, but not all toolchains include
64# it so fall back to the standard linux version if needed. 64# it so fall back to the standard linux version if needed.
65LDFLAGS += -EB $(call ld-option, -maarch64elfb, -maarch64linuxb) 65KBUILD_LDFLAGS += -EB $(call ld-option, -maarch64elfb, -maarch64linuxb)
66UTS_MACHINE := aarch64_be 66UTS_MACHINE := aarch64_be
67else 67else
68KBUILD_CPPFLAGS += -mlittle-endian 68KBUILD_CPPFLAGS += -mlittle-endian
69CHECKFLAGS += -D__AARCH64EL__ 69CHECKFLAGS += -D__AARCH64EL__
70AS += -EL 70AS += -EL
71# Same as above, prefer ELF but fall back to linux target if needed. 71# Same as above, prefer ELF but fall back to linux target if needed.
72LDFLAGS += -EL $(call ld-option, -maarch64elf, -maarch64linux) 72KBUILD_LDFLAGS += -EL $(call ld-option, -maarch64elf, -maarch64linux)
73UTS_MACHINE := aarch64 73UTS_MACHINE := aarch64
74endif 74endif
75 75
diff --git a/arch/c6x/Makefile b/arch/c6x/Makefile
index 6ab942e6c534..3fe8a948e94c 100644
--- a/arch/c6x/Makefile
+++ b/arch/c6x/Makefile
@@ -23,8 +23,7 @@ ifdef CONFIG_CPU_BIG_ENDIAN
23KBUILD_CFLAGS += -mbig-endian 23KBUILD_CFLAGS += -mbig-endian
24KBUILD_AFLAGS += -mbig-endian 24KBUILD_AFLAGS += -mbig-endian
25LINKFLAGS += -mbig-endian 25LINKFLAGS += -mbig-endian
26KBUILD_LDFLAGS += -mbig-endian 26KBUILD_LDFLAGS += -mbig-endian -EB
27LDFLAGS += -EB
28CHECKFLAGS += -D_BIG_ENDIAN 27CHECKFLAGS += -D_BIG_ENDIAN
29endif 28endif
30 29
diff --git a/arch/h8300/Makefile b/arch/h8300/Makefile
index cc12b162c222..58634e6bae92 100644
--- a/arch/h8300/Makefile
+++ b/arch/h8300/Makefile
@@ -22,7 +22,7 @@ KBUILD_CFLAGS += -mint32 -fno-builtin
22KBUILD_CFLAGS += -D__linux__ 22KBUILD_CFLAGS += -D__linux__
23KBUILD_CFLAGS += -DUTS_SYSNAME=\"uClinux\" 23KBUILD_CFLAGS += -DUTS_SYSNAME=\"uClinux\"
24KBUILD_AFLAGS += $(aflags-y) 24KBUILD_AFLAGS += $(aflags-y)
25LDFLAGS += $(ldflags-y) 25KBUILD_LDFLAGS += $(ldflags-y)
26 26
27CHECKFLAGS += -msize-long 27CHECKFLAGS += -msize-long
28 28
diff --git a/arch/hexagon/Makefile b/arch/hexagon/Makefile
index 2efaa18e995a..4c5858b80f0e 100644
--- a/arch/hexagon/Makefile
+++ b/arch/hexagon/Makefile
@@ -22,9 +22,7 @@ ldflags-y += $(call cc-option,-mv${CONFIG_HEXAGON_ARCH_VERSION})
22 22
23KBUILD_CFLAGS += $(cflags-y) 23KBUILD_CFLAGS += $(cflags-y)
24KBUILD_AFLAGS += $(aflags-y) 24KBUILD_AFLAGS += $(aflags-y)
25 25KBUILD_LDFLAGS += $(ldflags-y)
26# no KBUILD_LDFLAGS?
27LDFLAGS += $(ldflags-y)
28 26
29# Thread-info register will be r19. This value is not configureable; 27# Thread-info register will be r19. This value is not configureable;
30# it is hard-coded in several files. 28# it is hard-coded in several files.
diff --git a/arch/m68k/Makefile b/arch/m68k/Makefile
index f0dd9fc84002..997c9f20ea0f 100644
--- a/arch/m68k/Makefile
+++ b/arch/m68k/Makefile
@@ -69,7 +69,7 @@ KBUILD_CFLAGS += -D__uClinux__
69KBUILD_AFLAGS += -D__uClinux__ 69KBUILD_AFLAGS += -D__uClinux__
70endif 70endif
71 71
72LDFLAGS := -m m68kelf 72KBUILD_LDFLAGS := -m m68kelf
73KBUILD_LDFLAGS_MODULE += -T $(srctree)/arch/m68k/kernel/module.lds 73KBUILD_LDFLAGS_MODULE += -T $(srctree)/arch/m68k/kernel/module.lds
74 74
75ifdef CONFIG_SUN3 75ifdef CONFIG_SUN3
diff --git a/arch/microblaze/Makefile b/arch/microblaze/Makefile
index 73330360a8e6..4f3ab5707265 100644
--- a/arch/microblaze/Makefile
+++ b/arch/microblaze/Makefile
@@ -40,11 +40,11 @@ CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_PCMP_INSTR) += -mxl-pattern-compare
40ifdef CONFIG_CPU_BIG_ENDIAN 40ifdef CONFIG_CPU_BIG_ENDIAN
41KBUILD_CFLAGS += -mbig-endian 41KBUILD_CFLAGS += -mbig-endian
42KBUILD_AFLAGS += -mbig-endian 42KBUILD_AFLAGS += -mbig-endian
43LDFLAGS += -EB 43KBUILD_LDFLAGS += -EB
44else 44else
45KBUILD_CFLAGS += -mlittle-endian 45KBUILD_CFLAGS += -mlittle-endian
46KBUILD_AFLAGS += -mlittle-endian 46KBUILD_AFLAGS += -mlittle-endian
47LDFLAGS += -EL 47KBUILD_LDFLAGS += -EL
48endif 48endif
49 49
50CPUFLAGS-1 += $(call cc-option,-mcpu=v$(CPU_VER)) 50CPUFLAGS-1 += $(call cc-option,-mcpu=v$(CPU_VER))
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index 5425df002a6b..d74b3742fa5d 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -309,7 +309,7 @@ endif
309# instead of .eh_frame so we don't discard them. 309# instead of .eh_frame so we don't discard them.
310KBUILD_CFLAGS += -fno-asynchronous-unwind-tables 310KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
311 311
312LDFLAGS += -m $(ld-emul) 312KBUILD_LDFLAGS += -m $(ld-emul)
313 313
314ifdef CONFIG_MIPS 314ifdef CONFIG_MIPS
315CHECKFLAGS += $(shell $(CC) $(KBUILD_CFLAGS) -dM -E -x c /dev/null | \ 315CHECKFLAGS += $(shell $(CC) $(KBUILD_CFLAGS) -dM -E -x c /dev/null | \
diff --git a/arch/mips/boot/compressed/Makefile b/arch/mips/boot/compressed/Makefile
index abe77add8789..3c453a1f1ff1 100644
--- a/arch/mips/boot/compressed/Makefile
+++ b/arch/mips/boot/compressed/Makefile
@@ -92,7 +92,7 @@ UIMAGE_LOADADDR = $(VMLINUZ_LOAD_ADDRESS)
92vmlinuzobjs-y += $(obj)/piggy.o 92vmlinuzobjs-y += $(obj)/piggy.o
93 93
94quiet_cmd_zld = LD $@ 94quiet_cmd_zld = LD $@
95 cmd_zld = $(LD) $(LDFLAGS) -Ttext $(VMLINUZ_LOAD_ADDRESS) -T $< $(vmlinuzobjs-y) -o $@ 95 cmd_zld = $(LD) $(KBUILD_LDFLAGS) -Ttext $(VMLINUZ_LOAD_ADDRESS) -T $< $(vmlinuzobjs-y) -o $@
96quiet_cmd_strip = STRIP $@ 96quiet_cmd_strip = STRIP $@
97 cmd_strip = $(STRIP) -s $@ 97 cmd_strip = $(STRIP) -s $@
98vmlinuz: $(src)/ld.script $(vmlinuzobjs-y) $(obj)/calc_vmlinuz_load_addr 98vmlinuz: $(src)/ld.script $(vmlinuzobjs-y) $(obj)/calc_vmlinuz_load_addr
diff --git a/arch/mips/lasat/image/Makefile b/arch/mips/lasat/image/Makefile
index 9ab1326f57c9..78ce4cff1012 100644
--- a/arch/mips/lasat/image/Makefile
+++ b/arch/mips/lasat/image/Makefile
@@ -38,7 +38,7 @@ $(obj)/rom.bin: $(obj)/rom
38 38
39# Rule to make the bootloader 39# Rule to make the bootloader
40$(obj)/rom: $(addprefix $(obj)/,$(OBJECTS)) 40$(obj)/rom: $(addprefix $(obj)/,$(OBJECTS))
41 $(LD) $(LDFLAGS) $(LDSCRIPT) -o $@ $^ 41 $(LD) $(KBUILD_LDFLAGS) $(LDSCRIPT) -o $@ $^
42 42
43$(obj)/%.o: $(obj)/%.gz 43$(obj)/%.o: $(obj)/%.gz
44 $(LD) -r -o $@ -b binary $< 44 $(LD) -r -o $@ -b binary $<
diff --git a/arch/nds32/Makefile b/arch/nds32/Makefile
index 031c676821ff..63f4f173e5f4 100644
--- a/arch/nds32/Makefile
+++ b/arch/nds32/Makefile
@@ -33,12 +33,12 @@ endif
33ifdef CONFIG_CPU_LITTLE_ENDIAN 33ifdef CONFIG_CPU_LITTLE_ENDIAN
34KBUILD_CFLAGS += $(call cc-option, -EL) 34KBUILD_CFLAGS += $(call cc-option, -EL)
35KBUILD_AFLAGS += $(call cc-option, -EL) 35KBUILD_AFLAGS += $(call cc-option, -EL)
36LDFLAGS += $(call cc-option, -EL) 36KBUILD_LDFLAGS += $(call cc-option, -EL)
37CHECKFLAGS += -D__NDS32_EL__ 37CHECKFLAGS += -D__NDS32_EL__
38else 38else
39KBUILD_CFLAGS += $(call cc-option, -EB) 39KBUILD_CFLAGS += $(call cc-option, -EB)
40KBUILD_AFLAGS += $(call cc-option, -EB) 40KBUILD_AFLAGS += $(call cc-option, -EB)
41LDFLAGS += $(call cc-option, -EB) 41KBUILD_LDFLAGS += $(call cc-option, -EB)
42CHECKFLAGS += -D__NDS32_EB__ 42CHECKFLAGS += -D__NDS32_EB__
43endif 43endif
44 44
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 8397c7bd5880..11a1acba164a 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -76,14 +76,14 @@ endif
76 76
77ifdef CONFIG_CPU_LITTLE_ENDIAN 77ifdef CONFIG_CPU_LITTLE_ENDIAN
78KBUILD_CFLAGS += -mlittle-endian 78KBUILD_CFLAGS += -mlittle-endian
79LDFLAGS += -EL 79KBUILD_LDFLAGS += -EL
80LDEMULATION := lppc 80LDEMULATION := lppc
81GNUTARGET := powerpcle 81GNUTARGET := powerpcle
82MULTIPLEWORD := -mno-multiple 82MULTIPLEWORD := -mno-multiple
83KBUILD_CFLAGS_MODULE += $(call cc-option,-mno-save-toc-indirect) 83KBUILD_CFLAGS_MODULE += $(call cc-option,-mno-save-toc-indirect)
84else 84else
85KBUILD_CFLAGS += $(call cc-option,-mbig-endian) 85KBUILD_CFLAGS += $(call cc-option,-mbig-endian)
86LDFLAGS += -EB 86KBUILD_LDFLAGS += -EB
87LDEMULATION := ppc 87LDEMULATION := ppc
88GNUTARGET := powerpc 88GNUTARGET := powerpc
89MULTIPLEWORD := -mmultiple 89MULTIPLEWORD := -mmultiple
@@ -108,7 +108,7 @@ aflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mlittle-endian
108ifeq ($(HAS_BIARCH),y) 108ifeq ($(HAS_BIARCH),y)
109KBUILD_CFLAGS += -m$(BITS) 109KBUILD_CFLAGS += -m$(BITS)
110KBUILD_AFLAGS += -m$(BITS) -Wl,-a$(BITS) 110KBUILD_AFLAGS += -m$(BITS) -Wl,-a$(BITS)
111LDFLAGS += -m elf$(BITS)$(LDEMULATION) 111KBUILD_LDFLAGS += -m elf$(BITS)$(LDEMULATION)
112KBUILD_ARFLAGS += --target=elf$(BITS)-$(GNUTARGET) 112KBUILD_ARFLAGS += --target=elf$(BITS)-$(GNUTARGET)
113endif 113endif
114 114
diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile
index 9ddd88bb30b7..61ec42405ec9 100644
--- a/arch/riscv/Makefile
+++ b/arch/riscv/Makefile
@@ -29,7 +29,7 @@ ifeq ($(CONFIG_ARCH_RV64I),y)
29 KBUILD_CFLAGS += $(call cc-ifversion, -ge, 0500, -DCONFIG_ARCH_SUPPORTS_INT128) 29 KBUILD_CFLAGS += $(call cc-ifversion, -ge, 0500, -DCONFIG_ARCH_SUPPORTS_INT128)
30 30
31 KBUILD_MARCH = rv64im 31 KBUILD_MARCH = rv64im
32 LDFLAGS += -melf64lriscv 32 KBUILD_LDFLAGS += -melf64lriscv
33else 33else
34 BITS := 32 34 BITS := 32
35 UTS_MACHINE := riscv32 35 UTS_MACHINE := riscv32
@@ -37,7 +37,7 @@ else
37 KBUILD_CFLAGS += -mabi=ilp32 37 KBUILD_CFLAGS += -mabi=ilp32
38 KBUILD_AFLAGS += -mabi=ilp32 38 KBUILD_AFLAGS += -mabi=ilp32
39 KBUILD_MARCH = rv32im 39 KBUILD_MARCH = rv32im
40 LDFLAGS += -melf32lriscv 40 KBUILD_LDFLAGS += -melf32lriscv
41endif 41endif
42 42
43KBUILD_CFLAGS += -Wall 43KBUILD_CFLAGS += -Wall
diff --git a/arch/s390/Makefile b/arch/s390/Makefile
index ba6d122526fb..ee65185bbc80 100644
--- a/arch/s390/Makefile
+++ b/arch/s390/Makefile
@@ -11,7 +11,7 @@
11# 11#
12 12
13LD_BFD := elf64-s390 13LD_BFD := elf64-s390
14LDFLAGS := -m elf64_s390 14KBUILD_LDFLAGS := -m elf64_s390
15KBUILD_AFLAGS_MODULE += -fPIC 15KBUILD_AFLAGS_MODULE += -fPIC
16KBUILD_CFLAGS_MODULE += -fPIC 16KBUILD_CFLAGS_MODULE += -fPIC
17KBUILD_AFLAGS += -m64 17KBUILD_AFLAGS += -m64
diff --git a/arch/sh/Makefile b/arch/sh/Makefile
index 65300193b99f..c521ade2557c 100644
--- a/arch/sh/Makefile
+++ b/arch/sh/Makefile
@@ -122,11 +122,11 @@ endif
122ifdef CONFIG_CPU_LITTLE_ENDIAN 122ifdef CONFIG_CPU_LITTLE_ENDIAN
123ld-bfd := elf32-$(UTS_MACHINE)-linux 123ld-bfd := elf32-$(UTS_MACHINE)-linux
124LDFLAGS_vmlinux += --defsym jiffies=jiffies_64 --oformat $(ld-bfd) 124LDFLAGS_vmlinux += --defsym jiffies=jiffies_64 --oformat $(ld-bfd)
125LDFLAGS += -EL 125KBUILD_LDFLAGS += -EL
126else 126else
127ld-bfd := elf32-$(UTS_MACHINE)big-linux 127ld-bfd := elf32-$(UTS_MACHINE)big-linux
128LDFLAGS_vmlinux += --defsym jiffies=jiffies_64+4 --oformat $(ld-bfd) 128LDFLAGS_vmlinux += --defsym jiffies=jiffies_64+4 --oformat $(ld-bfd)
129LDFLAGS += -EB 129KBUILD_LDFLAGS += -EB
130endif 130endif
131 131
132export ld-bfd BITS 132export ld-bfd BITS
diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile
index e32ef20de567..048a033d6102 100644
--- a/arch/sparc/Makefile
+++ b/arch/sparc/Makefile
@@ -21,7 +21,7 @@ ifeq ($(CONFIG_SPARC32),y)
21# 21#
22 22
23CHECKFLAGS += -D__sparc__ 23CHECKFLAGS += -D__sparc__
24LDFLAGS := -m elf32_sparc 24KBUILD_LDFLAGS := -m elf32_sparc
25export BITS := 32 25export BITS := 32
26UTS_MACHINE := sparc 26UTS_MACHINE := sparc
27 27
@@ -40,7 +40,7 @@ else
40# 40#
41 41
42CHECKFLAGS += -D__sparc__ -D__sparc_v9__ -D__arch64__ 42CHECKFLAGS += -D__sparc__ -D__sparc_v9__ -D__arch64__
43LDFLAGS := -m elf64_sparc 43KBUILD_LDFLAGS := -m elf64_sparc
44export BITS := 64 44export BITS := 64
45UTS_MACHINE := sparc64 45UTS_MACHINE := sparc64
46 46
diff --git a/arch/um/Makefile b/arch/um/Makefile
index 44ddc3e8fa66..ab1066c38944 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -133,7 +133,7 @@ export LDS_ELF_FORMAT := $(ELF_FORMAT)
133# The wrappers will select whether using "malloc" or the kernel allocator. 133# The wrappers will select whether using "malloc" or the kernel allocator.
134LINK_WRAPS = -Wl,--wrap,malloc -Wl,--wrap,free -Wl,--wrap,calloc 134LINK_WRAPS = -Wl,--wrap,malloc -Wl,--wrap,free -Wl,--wrap,calloc
135 135
136LD_FLAGS_CMDLINE = $(foreach opt,$(LDFLAGS),-Wl,$(opt)) 136LD_FLAGS_CMDLINE = $(foreach opt,$(KBUILD_LDFLAGS),-Wl,$(opt))
137 137
138# Used by link-vmlinux.sh which has special support for um link 138# Used by link-vmlinux.sh which has special support for um link
139export CFLAGS_vmlinux := $(LINK-y) $(LINK_WRAPS) $(LD_FLAGS_CMDLINE) 139export CFLAGS_vmlinux := $(LINK-y) $(LINK_WRAPS) $(LD_FLAGS_CMDLINE)
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 7e3c07d6ad42..94859241bc3e 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -219,7 +219,7 @@ sha256_ni_instr :=$(call as-instr,sha256msg1 %xmm0$(comma)%xmm1,-DCONFIG_AS_SHA2
219KBUILD_AFLAGS += $(cfi) $(cfi-sigframe) $(cfi-sections) $(asinstr) $(avx_instr) $(avx2_instr) $(avx512_instr) $(sha1_ni_instr) $(sha256_ni_instr) 219KBUILD_AFLAGS += $(cfi) $(cfi-sigframe) $(cfi-sections) $(asinstr) $(avx_instr) $(avx2_instr) $(avx512_instr) $(sha1_ni_instr) $(sha256_ni_instr)
220KBUILD_CFLAGS += $(cfi) $(cfi-sigframe) $(cfi-sections) $(asinstr) $(avx_instr) $(avx2_instr) $(avx512_instr) $(sha1_ni_instr) $(sha256_ni_instr) 220KBUILD_CFLAGS += $(cfi) $(cfi-sigframe) $(cfi-sections) $(asinstr) $(avx_instr) $(avx2_instr) $(avx512_instr) $(sha1_ni_instr) $(sha256_ni_instr)
221 221
222LDFLAGS := -m elf_$(UTS_MACHINE) 222KBUILD_LDFLAGS := -m elf_$(UTS_MACHINE)
223 223
224# 224#
225# The 64-bit kernel must be aligned to 2MB. Pass -z max-page-size=0x200000 to 225# The 64-bit kernel must be aligned to 2MB. Pass -z max-page-size=0x200000 to
@@ -227,7 +227,7 @@ LDFLAGS := -m elf_$(UTS_MACHINE)
227# by the linker. 227# by the linker.
228# 228#
229ifdef CONFIG_X86_64 229ifdef CONFIG_X86_64
230LDFLAGS += $(call ld-option, -z max-page-size=0x200000) 230KBUILD_LDFLAGS += $(call ld-option, -z max-page-size=0x200000)
231endif 231endif
232 232
233# Speed up the build 233# Speed up the build
diff --git a/arch/x86/Makefile.um b/arch/x86/Makefile.um
index 5296f8c9e7f0..91085a08de6c 100644
--- a/arch/x86/Makefile.um
+++ b/arch/x86/Makefile.um
@@ -4,7 +4,7 @@ core-y += arch/x86/crypto/
4ifeq ($(CONFIG_X86_32),y) 4ifeq ($(CONFIG_X86_32),y)
5START := 0x8048000 5START := 0x8048000
6 6
7LDFLAGS += -m elf_i386 7KBUILD_LDFLAGS += -m elf_i386
8ELF_ARCH := i386 8ELF_ARCH := i386
9ELF_FORMAT := elf32-i386 9ELF_FORMAT := elf32-i386
10CHECKFLAGS += -D__i386__ 10CHECKFLAGS += -D__i386__
@@ -43,7 +43,7 @@ KBUILD_CFLAGS += -fno-builtin -m64
43 43
44CHECKFLAGS += -m64 -D__x86_64__ 44CHECKFLAGS += -m64 -D__x86_64__
45KBUILD_AFLAGS += -m64 45KBUILD_AFLAGS += -m64
46LDFLAGS += -m elf_x86_64 46KBUILD_LDFLAGS += -m elf_x86_64
47KBUILD_CPPFLAGS += -m64 47KBUILD_CPPFLAGS += -m64
48 48
49ELF_ARCH := i386:x86-64 49ELF_ARCH := i386:x86-64
diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
index 169c2feda14a..28764dacf018 100644
--- a/arch/x86/boot/compressed/Makefile
+++ b/arch/x86/boot/compressed/Makefile
@@ -42,16 +42,16 @@ KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__
42GCOV_PROFILE := n 42GCOV_PROFILE := n
43UBSAN_SANITIZE :=n 43UBSAN_SANITIZE :=n
44 44
45LDFLAGS := -m elf_$(UTS_MACHINE) 45KBUILD_LDFLAGS := -m elf_$(UTS_MACHINE)
46# Compressed kernel should be built as PIE since it may be loaded at any 46# Compressed kernel should be built as PIE since it may be loaded at any
47# address by the bootloader. 47# address by the bootloader.
48ifeq ($(CONFIG_X86_32),y) 48ifeq ($(CONFIG_X86_32),y)
49LDFLAGS += $(call ld-option, -pie) $(call ld-option, --no-dynamic-linker) 49KBUILD_LDFLAGS += $(call ld-option, -pie) $(call ld-option, --no-dynamic-linker)
50else 50else
51# To build 64-bit compressed kernel as PIE, we disable relocation 51# To build 64-bit compressed kernel as PIE, we disable relocation
52# overflow check to avoid relocation overflow error with a new linker 52# overflow check to avoid relocation overflow error with a new linker
53# command-line option, -z noreloc-overflow. 53# command-line option, -z noreloc-overflow.
54LDFLAGS += $(shell $(LD) --help 2>&1 | grep -q "\-z noreloc-overflow" \ 54KBUILD_LDFLAGS += $(shell $(LD) --help 2>&1 | grep -q "\-z noreloc-overflow" \
55 && echo "-z noreloc-overflow -pie --no-dynamic-linker") 55 && echo "-z noreloc-overflow -pie --no-dynamic-linker")
56endif 56endif
57LDFLAGS_vmlinux := -T 57LDFLAGS_vmlinux := -T
diff --git a/arch/xtensa/Makefile b/arch/xtensa/Makefile
index 3a934b72a272..295c120ed099 100644
--- a/arch/xtensa/Makefile
+++ b/arch/xtensa/Makefile
@@ -49,7 +49,7 @@ KBUILD_CFLAGS += $(call cc-option,-mno-serialize-volatile,)
49KBUILD_AFLAGS += -mlongcalls -mtext-section-literals 49KBUILD_AFLAGS += -mlongcalls -mtext-section-literals
50 50
51ifneq ($(CONFIG_LD_NO_RELAX),) 51ifneq ($(CONFIG_LD_NO_RELAX),)
52LDFLAGS := --no-relax 52KBUILD_LDFLAGS := --no-relax
53endif 53endif
54 54
55ifeq ($(shell echo __XTENSA_EB__ | $(CC) -E - | grep -v "\#"),1) 55ifeq ($(shell echo __XTENSA_EB__ | $(CC) -E - | grep -v "\#"),1)
diff --git a/arch/xtensa/boot/boot-elf/Makefile b/arch/xtensa/boot/boot-elf/Makefile
index 521471981356..12ae1e91cb75 100644
--- a/arch/xtensa/boot/boot-elf/Makefile
+++ b/arch/xtensa/boot/boot-elf/Makefile
@@ -25,7 +25,7 @@ $(obj)/Image.o: vmlinux.bin $(OBJS)
25 $(OBJS) $@ 25 $(OBJS) $@
26 26
27$(obj)/../Image.elf: $(obj)/Image.o $(obj)/boot.lds 27$(obj)/../Image.elf: $(obj)/Image.o $(obj)/boot.lds
28 $(Q)$(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) \ 28 $(Q)$(LD) $(KBUILD_LDFLAGS) $(LDFLAGS_vmlinux) \
29 -T $(obj)/boot.lds \ 29 -T $(obj)/boot.lds \
30 --build-id=none \ 30 --build-id=none \
31 -o $@ $(obj)/Image.o 31 -o $@ $(obj)/Image.o
diff --git a/certs/system_certificates.S b/certs/system_certificates.S
index 3918ff7235ed..8f29058adf93 100644
--- a/certs/system_certificates.S
+++ b/certs/system_certificates.S
@@ -5,8 +5,8 @@
5 __INITRODATA 5 __INITRODATA
6 6
7 .align 8 7 .align 8
8 .globl VMLINUX_SYMBOL(system_certificate_list) 8 .globl system_certificate_list
9VMLINUX_SYMBOL(system_certificate_list): 9system_certificate_list:
10__cert_list_start: 10__cert_list_start:
11#ifdef CONFIG_MODULE_SIG 11#ifdef CONFIG_MODULE_SIG
12 .incbin "certs/signing_key.x509" 12 .incbin "certs/signing_key.x509"
@@ -15,21 +15,21 @@ __cert_list_start:
15__cert_list_end: 15__cert_list_end:
16 16
17#ifdef CONFIG_SYSTEM_EXTRA_CERTIFICATE 17#ifdef CONFIG_SYSTEM_EXTRA_CERTIFICATE
18 .globl VMLINUX_SYMBOL(system_extra_cert) 18 .globl system_extra_cert
19 .size system_extra_cert, CONFIG_SYSTEM_EXTRA_CERTIFICATE_SIZE 19 .size system_extra_cert, CONFIG_SYSTEM_EXTRA_CERTIFICATE_SIZE
20VMLINUX_SYMBOL(system_extra_cert): 20system_extra_cert:
21 .fill CONFIG_SYSTEM_EXTRA_CERTIFICATE_SIZE, 1, 0 21 .fill CONFIG_SYSTEM_EXTRA_CERTIFICATE_SIZE, 1, 0
22 22
23 .align 4 23 .align 4
24 .globl VMLINUX_SYMBOL(system_extra_cert_used) 24 .globl system_extra_cert_used
25VMLINUX_SYMBOL(system_extra_cert_used): 25system_extra_cert_used:
26 .int 0 26 .int 0
27 27
28#endif /* CONFIG_SYSTEM_EXTRA_CERTIFICATE */ 28#endif /* CONFIG_SYSTEM_EXTRA_CERTIFICATE */
29 29
30 .align 8 30 .align 8
31 .globl VMLINUX_SYMBOL(system_certificate_list_size) 31 .globl system_certificate_list_size
32VMLINUX_SYMBOL(system_certificate_list_size): 32system_certificate_list_size:
33#ifdef CONFIG_64BIT 33#ifdef CONFIG_64BIT
34 .quad __cert_list_end - __cert_list_start 34 .quad __cert_list_end - __cert_list_start
35#else 35#else
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index f173b5f30dbe..7b75ff6e2fce 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -54,8 +54,6 @@
54#define LOAD_OFFSET 0 54#define LOAD_OFFSET 0
55#endif 55#endif
56 56
57#include <linux/export.h>
58
59/* Align . to a 8 byte boundary equals to maximum function alignment. */ 57/* Align . to a 8 byte boundary equals to maximum function alignment. */
60#define ALIGN_FUNCTION() . = ALIGN(8) 58#define ALIGN_FUNCTION() . = ALIGN(8)
61 59
diff --git a/include/linux/export.h b/include/linux/export.h
index ae072bc5aacf..ce764a5d2ee4 100644
--- a/include/linux/export.h
+++ b/include/linux/export.h
@@ -10,13 +10,6 @@
10 * hackers place grumpy comments in header files. 10 * hackers place grumpy comments in header files.
11 */ 11 */
12 12
13#define __VMLINUX_SYMBOL(x) x
14#define __VMLINUX_SYMBOL_STR(x) #x
15
16/* Indirect, so macros are expanded before pasting. */
17#define VMLINUX_SYMBOL(x) __VMLINUX_SYMBOL(x)
18#define VMLINUX_SYMBOL_STR(x) __VMLINUX_SYMBOL_STR(x)
19
20#ifndef __ASSEMBLY__ 13#ifndef __ASSEMBLY__
21#ifdef MODULE 14#ifdef MODULE
22extern struct module __this_module; 15extern struct module __this_module;
diff --git a/init/Kconfig b/init/Kconfig
index 641dd7dd7c8a..1e234e2f1cba 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1097,6 +1097,8 @@ config LD_DEAD_CODE_DATA_ELIMINATION
1097 bool "Dead code and data elimination (EXPERIMENTAL)" 1097 bool "Dead code and data elimination (EXPERIMENTAL)"
1098 depends on HAVE_LD_DEAD_CODE_DATA_ELIMINATION 1098 depends on HAVE_LD_DEAD_CODE_DATA_ELIMINATION
1099 depends on EXPERT 1099 depends on EXPERT
1100 depends on $(cc-option,-ffunction-sections -fdata-sections)
1101 depends on $(ld-option,--gc-sections)
1100 help 1102 help
1101 Enable this if you want to do dead code and data elimination with 1103 Enable this if you want to do dead code and data elimination with
1102 the linker by compiling with -ffunction-sections -fdata-sections, 1104 the linker by compiling with -ffunction-sections -fdata-sections,
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index 7c98f60e2266..c75413d05a63 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -163,8 +163,8 @@ cc-ldoption = $(call try-run,\
163 $(CC) $(1) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2)) 163 $(CC) $(1) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2))
164 164
165# ld-option 165# ld-option
166# Usage: LDFLAGS += $(call ld-option, -X, -Y) 166# Usage: KBUILD_LDFLAGS += $(call ld-option, -X, -Y)
167ld-option = $(call try-run, $(LD) $(LDFLAGS) $(1) -v,$(1),$(2),$(3)) 167ld-option = $(call try-run, $(LD) $(KBUILD_LDFLAGS) $(1) -v,$(1),$(2),$(3))
168 168
169# ar-option 169# ar-option
170# Usage: KBUILD_ARFLAGS := $(call ar-option,D) 170# Usage: KBUILD_ARFLAGS := $(call ar-option,D)
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 93b8e24b0e15..1c48572223d1 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -190,7 +190,7 @@ cmd_modversions_c = \
190 $(call cmd_gensymtypes_c,$(KBUILD_SYMTYPES),$(@:.o=.symtypes)) \ 190 $(call cmd_gensymtypes_c,$(KBUILD_SYMTYPES),$(@:.o=.symtypes)) \
191 > $(@D)/.tmp_$(@F:.o=.ver); \ 191 > $(@D)/.tmp_$(@F:.o=.ver); \
192 \ 192 \
193 $(LD) $(LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) \ 193 $(LD) $(KBUILD_LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) \
194 -T $(@D)/.tmp_$(@F:.o=.ver); \ 194 -T $(@D)/.tmp_$(@F:.o=.ver); \
195 rm -f $(@D)/.tmp_$(@F) $(@D)/.tmp_$(@F:.o=.ver); \ 195 rm -f $(@D)/.tmp_$(@F) $(@D)/.tmp_$(@F:.o=.ver); \
196 else \ 196 else \
@@ -220,7 +220,7 @@ sub_cmd_record_mcount = set -e ; perl $(srctree)/scripts/recordmcount.pl "$(ARCH
220 "$(if $(CONFIG_CPU_BIG_ENDIAN),big,little)" \ 220 "$(if $(CONFIG_CPU_BIG_ENDIAN),big,little)" \
221 "$(if $(CONFIG_64BIT),64,32)" \ 221 "$(if $(CONFIG_64BIT),64,32)" \
222 "$(OBJDUMP)" "$(OBJCOPY)" "$(CC) $(KBUILD_CFLAGS)" \ 222 "$(OBJDUMP)" "$(OBJCOPY)" "$(CC) $(KBUILD_CFLAGS)" \
223 "$(LD)" "$(NM)" "$(RM)" "$(MV)" \ 223 "$(LD) $(KBUILD_LDFLAGS)" "$(NM)" "$(RM)" "$(MV)" \
224 "$(if $(part-of-module),1,0)" "$(@)"; 224 "$(if $(part-of-module),1,0)" "$(@)";
225recordmcount_source := $(srctree)/scripts/recordmcount.pl 225recordmcount_source := $(srctree)/scripts/recordmcount.pl
226endif # BUILD_C_RECORDMCOUNT 226endif # BUILD_C_RECORDMCOUNT
@@ -394,7 +394,7 @@ cmd_modversions_S = \
394 $(call cmd_gensymtypes_S,$(KBUILD_SYMTYPES),$(@:.o=.symtypes)) \ 394 $(call cmd_gensymtypes_S,$(KBUILD_SYMTYPES),$(@:.o=.symtypes)) \
395 > $(@D)/.tmp_$(@F:.o=.ver); \ 395 > $(@D)/.tmp_$(@F:.o=.ver); \
396 \ 396 \
397 $(LD) $(LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) \ 397 $(LD) $(KBUILD_LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) \
398 -T $(@D)/.tmp_$(@F:.o=.ver); \ 398 -T $(@D)/.tmp_$(@F:.o=.ver); \
399 rm -f $(@D)/.tmp_$(@F) $(@D)/.tmp_$(@F:.o=.ver); \ 399 rm -f $(@D)/.tmp_$(@F) $(@D)/.tmp_$(@F:.o=.ver); \
400 else \ 400 else \
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index df0fff252619..61e596650ed3 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) $(LDFLAGS_$(@F)) 165ld_flags = $(KBUILD_LDFLAGS) $(ldflags-y) $(LDFLAGS_$(@F))
166 166
167DTC_INCLUDE := $(srctree)/scripts/dtc/include-prefixes 167DTC_INCLUDE := $(srctree)/scripts/dtc/include-prefixes
168 168
diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost
index dd92dbbbaa68..7d4af0d0accb 100644
--- a/scripts/Makefile.modpost
+++ b/scripts/Makefile.modpost
@@ -120,7 +120,7 @@ ARCH_POSTLINK := $(wildcard $(srctree)/arch/$(SRCARCH)/Makefile.postlink)
120# Step 6), final link of the modules with optional arch pass after final link 120# Step 6), final link of the modules with optional arch pass after final link
121quiet_cmd_ld_ko_o = LD [M] $@ 121quiet_cmd_ld_ko_o = LD [M] $@
122 cmd_ld_ko_o = \ 122 cmd_ld_ko_o = \
123 $(LD) -r $(LDFLAGS) \ 123 $(LD) -r $(KBUILD_LDFLAGS) \
124 $(KBUILD_LDFLAGS_MODULE) $(LDFLAGS_MODULE) \ 124 $(KBUILD_LDFLAGS_MODULE) $(LDFLAGS_MODULE) \
125 -o $@ $(filter-out FORCE,$^) ; \ 125 -o $@ $(filter-out FORCE,$^) ; \
126 $(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true) 126 $(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true)
diff --git a/scripts/clang-version.sh b/scripts/clang-version.sh
index dbf0a31eb111..e65fbc3079d4 100755
--- a/scripts/clang-version.sh
+++ b/scripts/clang-version.sh
@@ -12,7 +12,7 @@
12 12
13compiler="$*" 13compiler="$*"
14 14
15if !( $compiler --version | grep -q clang) ; then 15if ! ( $compiler --version | grep -q clang) ; then
16 echo 0 16 echo 0
17 exit 1 17 exit 1
18fi 18fi
diff --git a/scripts/coccinelle/api/alloc/zalloc-simple.cocci b/scripts/coccinelle/api/alloc/zalloc-simple.cocci
index 92b20913055f..d819275b7fde 100644
--- a/scripts/coccinelle/api/alloc/zalloc-simple.cocci
+++ b/scripts/coccinelle/api/alloc/zalloc-simple.cocci
@@ -35,8 +35,7 @@ statement S;
35 35
36* x = (T)\(kmalloc(E1, ...)\|vmalloc(E1)\|dma_alloc_coherent(...,E1,...)\| 36* x = (T)\(kmalloc(E1, ...)\|vmalloc(E1)\|dma_alloc_coherent(...,E1,...)\|
37 kmalloc_node(E1, ...)\|kmem_cache_alloc(...)\|kmem_alloc(E1, ...)\| 37 kmalloc_node(E1, ...)\|kmem_cache_alloc(...)\|kmem_alloc(E1, ...)\|
38 devm_kmalloc(...,E1,...)\|kvmalloc(E1, ...)\|pci_alloc_consistent(...,E1,...)\| 38 devm_kmalloc(...,E1,...)\|kvmalloc(E1, ...)\|kvmalloc_node(E1,...)\);
39 kvmalloc_node(E1,...)\);
40 if ((x==NULL) || ...) S 39 if ((x==NULL) || ...) S
41* memset((T2)x,0,E1); 40* memset((T2)x,0,E1);
42 41
@@ -124,15 +123,6 @@ statement S;
124- x = (T)kvmalloc(E1,E2); 123- x = (T)kvmalloc(E1,E2);
125+ x = (T)kvzalloc(E1,E2); 124+ x = (T)kvzalloc(E1,E2);
126| 125|
127- x = pci_alloc_consistent(E2,E1,E3);
128+ x = pci_zalloc_consistent(E2,E1,E3);
129|
130- x = (T *)pci_alloc_consistent(E2,E1,E3);
131+ x = pci_zalloc_consistent(E2,E1,E3);
132|
133- x = (T)pci_alloc_consistent(E2,E1,E3);
134+ x = (T)pci_zalloc_consistent(E2,E1,E3);
135|
136- x = kvmalloc_node(E1,E2,E3); 126- x = kvmalloc_node(E1,E2,E3);
137+ x = kvzalloc_node(E1,E2,E3); 127+ x = kvzalloc_node(E1,E2,E3);
138| 128|
@@ -389,35 +379,6 @@ msg="WARNING: kvzalloc should be used for %s, instead of kvmalloc/memset" % (x)
389coccilib.report.print_report(p[0], msg) 379coccilib.report.print_report(p[0], msg)
390 380
391//----------------------------------------------------------------- 381//-----------------------------------------------------------------
392@r8 depends on org || report@
393type T, T2;
394expression x;
395expression E1,E2,E3;
396statement S;
397position p;
398@@
399
400 x = (T)pci_alloc_consistent@p(E2,E1,E3);
401 if ((x==NULL) || ...) S
402 memset((T2)x,0,E1);
403
404@script:python depends on org@
405p << r8.p;
406x << r8.x;
407@@
408
409msg="%s" % (x)
410msg_safe=msg.replace("[","@(").replace("]",")")
411coccilib.org.print_todo(p[0], msg_safe)
412
413@script:python depends on report@
414p << r8.p;
415x << r8.x;
416@@
417
418msg="WARNING: pci_zalloc_consistent should be used for %s, instead of pci_alloc_consistent/memset" % (x)
419coccilib.report.print_report(p[0], msg)
420//-----------------------------------------------------------------
421@r9 depends on org || report@ 382@r9 depends on org || report@
422type T, T2; 383type T, T2;
423expression x; 384expression x;
diff --git a/scripts/dtc/Makefile b/scripts/dtc/Makefile
index 9cac65b7419c..1c943e03eaf2 100644
--- a/scripts/dtc/Makefile
+++ b/scripts/dtc/Makefile
@@ -9,21 +9,11 @@ dtc-objs := dtc.o flattree.o fstree.o data.o livetree.o treesource.o \
9dtc-objs += dtc-lexer.lex.o dtc-parser.tab.o 9dtc-objs += dtc-lexer.lex.o dtc-parser.tab.o
10 10
11# Source files need to get at the userspace version of libfdt_env.h to compile 11# Source files need to get at the userspace version of libfdt_env.h to compile
12HOST_EXTRACFLAGS := -I$(src)/libfdt
12 13
13HOSTCFLAGS_DTC := -I$(src) -I$(src)/libfdt 14# Generated files need one more search path to include headers in source tree
14 15HOSTCFLAGS_dtc-lexer.lex.o := -I$(src)
15HOSTCFLAGS_checks.o := $(HOSTCFLAGS_DTC) 16HOSTCFLAGS_dtc-parser.tab.o := -I$(src)
16HOSTCFLAGS_data.o := $(HOSTCFLAGS_DTC)
17HOSTCFLAGS_dtc.o := $(HOSTCFLAGS_DTC)
18HOSTCFLAGS_flattree.o := $(HOSTCFLAGS_DTC)
19HOSTCFLAGS_fstree.o := $(HOSTCFLAGS_DTC)
20HOSTCFLAGS_livetree.o := $(HOSTCFLAGS_DTC)
21HOSTCFLAGS_srcpos.o := $(HOSTCFLAGS_DTC)
22HOSTCFLAGS_treesource.o := $(HOSTCFLAGS_DTC)
23HOSTCFLAGS_util.o := $(HOSTCFLAGS_DTC)
24
25HOSTCFLAGS_dtc-lexer.lex.o := $(HOSTCFLAGS_DTC)
26HOSTCFLAGS_dtc-parser.tab.o := $(HOSTCFLAGS_DTC)
27 17
28# dependencies on generated files need to be listed explicitly 18# dependencies on generated files need to be listed explicitly
29$(obj)/dtc-lexer.lex.o: $(obj)/dtc-parser.tab.h 19$(obj)/dtc-lexer.lex.o: $(obj)/dtc-parser.tab.h
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 8d8791069abf..4a7bd2192073 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -3,7 +3,8 @@
3# Kernel configuration targets 3# Kernel configuration targets
4# These targets are used from top-level makefile 4# These targets are used from top-level makefile
5 5
6PHONY += xconfig gconfig menuconfig config localmodconfig localyesconfig 6PHONY += xconfig gconfig menuconfig config localmodconfig localyesconfig \
7 build_menuconfig build_nconfig build_gconfig build_xconfig
7 8
8ifdef KBUILD_KCONFIG 9ifdef KBUILD_KCONFIG
9Kconfig := $(KBUILD_KCONFIG) 10Kconfig := $(KBUILD_KCONFIG)
@@ -33,6 +34,14 @@ config: $(obj)/conf
33nconfig: $(obj)/nconf 34nconfig: $(obj)/nconf
34 $< $(silent) $(Kconfig) 35 $< $(silent) $(Kconfig)
35 36
37build_menuconfig: $(obj)/mconf
38
39build_nconfig: $(obj)/nconf
40
41build_gconfig: $(obj)/gconf
42
43build_xconfig: $(obj)/qconf
44
36localyesconfig localmodconfig: $(obj)/conf 45localyesconfig localmodconfig: $(obj)/conf
37 $(Q)perl $(srctree)/$(src)/streamline_config.pl --$@ $(srctree) $(Kconfig) > .tmp.config 46 $(Q)perl $(srctree)/$(src)/streamline_config.pl --$@ $(srctree) $(Kconfig) > .tmp.config
38 $(Q)if [ -f .config ]; then \ 47 $(Q)if [ -f .config ]; then \
@@ -169,7 +178,7 @@ HOSTLDLIBS_nconf = $(shell . $(obj)/.nconf-cfg && echo $$libs)
169HOSTCFLAGS_nconf.o = $(shell . $(obj)/.nconf-cfg && echo $$cflags) 178HOSTCFLAGS_nconf.o = $(shell . $(obj)/.nconf-cfg && echo $$cflags)
170HOSTCFLAGS_nconf.gui.o = $(shell . $(obj)/.nconf-cfg && echo $$cflags) 179HOSTCFLAGS_nconf.gui.o = $(shell . $(obj)/.nconf-cfg && echo $$cflags)
171 180
172$(obj)/nconf.o: $(obj)/.nconf-cfg 181$(obj)/nconf.o $(obj)/nconf.gui.o: $(obj)/.nconf-cfg
173 182
174# mconf: Used for the menuconfig target based on lxdialog 183# mconf: Used for the menuconfig target based on lxdialog
175hostprogs-y += mconf 184hostprogs-y += mconf
@@ -180,7 +189,8 @@ HOSTLDLIBS_mconf = $(shell . $(obj)/.mconf-cfg && echo $$libs)
180$(foreach f, mconf.o $(lxdialog), \ 189$(foreach f, mconf.o $(lxdialog), \
181 $(eval HOSTCFLAGS_$f = $$(shell . $(obj)/.mconf-cfg && echo $$$$cflags))) 190 $(eval HOSTCFLAGS_$f = $$(shell . $(obj)/.mconf-cfg && echo $$$$cflags)))
182 191
183$(addprefix $(obj)/, mconf.o $(lxdialog)): $(obj)/.mconf-cfg 192$(obj)/mconf.o: $(obj)/.mconf-cfg
193$(addprefix $(obj)/lxdialog/, $(lxdialog)): $(obj)/.mconf-cfg
184 194
185# qconf: Used for the xconfig target based on Qt 195# qconf: Used for the xconfig target based on Qt
186hostprogs-y += qconf 196hostprogs-y += qconf
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index b35cc9303979..7b2b37260669 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -508,6 +508,11 @@ int main(int ac, char **av)
508 input_mode = (enum input_mode)opt; 508 input_mode = (enum input_mode)opt;
509 switch (opt) { 509 switch (opt) {
510 case syncconfig: 510 case syncconfig:
511 /*
512 * syncconfig is invoked during the build stage.
513 * Suppress distracting "configuration written to ..."
514 */
515 conf_set_message_callback(NULL);
511 sync_kconfig = 1; 516 sync_kconfig = 1;
512 break; 517 break;
513 case defconfig: 518 case defconfig:
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index 4ec8b1f0d42c..703b9b899ee9 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -1011,7 +1011,7 @@ static struct dep_stack {
1011 struct dep_stack *prev, *next; 1011 struct dep_stack *prev, *next;
1012 struct symbol *sym; 1012 struct symbol *sym;
1013 struct property *prop; 1013 struct property *prop;
1014 struct expr *expr; 1014 struct expr **expr;
1015} *check_top; 1015} *check_top;
1016 1016
1017static void dep_stack_insert(struct dep_stack *stack, struct symbol *sym) 1017static void dep_stack_insert(struct dep_stack *stack, struct symbol *sym)
@@ -1076,31 +1076,42 @@ static void sym_check_print_recursive(struct symbol *last_sym)
1076 fprintf(stderr, "%s:%d:error: recursive dependency detected!\n", 1076 fprintf(stderr, "%s:%d:error: recursive dependency detected!\n",
1077 prop->file->name, prop->lineno); 1077 prop->file->name, prop->lineno);
1078 1078
1079 if (stack->expr) { 1079 if (sym_is_choice(sym)) {
1080 fprintf(stderr, "%s:%d:\tsymbol %s %s value contains %s\n", 1080 fprintf(stderr, "%s:%d:\tchoice %s contains symbol %s\n",
1081 prop->file->name, prop->lineno, 1081 menu->file->name, menu->lineno,
1082 sym->name ? sym->name : "<choice>", 1082 sym->name ? sym->name : "<choice>",
1083 prop_get_type_name(prop->type),
1084 next_sym->name ? next_sym->name : "<choice>"); 1083 next_sym->name ? next_sym->name : "<choice>");
1085 } else if (stack->prop) { 1084 } else if (sym_is_choice_value(sym)) {
1085 fprintf(stderr, "%s:%d:\tsymbol %s is part of choice %s\n",
1086 menu->file->name, menu->lineno,
1087 sym->name ? sym->name : "<choice>",
1088 next_sym->name ? next_sym->name : "<choice>");
1089 } else if (stack->expr == &sym->dir_dep.expr) {
1086 fprintf(stderr, "%s:%d:\tsymbol %s depends on %s\n", 1090 fprintf(stderr, "%s:%d:\tsymbol %s depends on %s\n",
1087 prop->file->name, prop->lineno, 1091 prop->file->name, prop->lineno,
1088 sym->name ? sym->name : "<choice>", 1092 sym->name ? sym->name : "<choice>",
1089 next_sym->name ? next_sym->name : "<choice>"); 1093 next_sym->name ? next_sym->name : "<choice>");
1090 } else if (sym_is_choice(sym)) { 1094 } else if (stack->expr == &sym->rev_dep.expr) {
1091 fprintf(stderr, "%s:%d:\tchoice %s contains symbol %s\n", 1095 fprintf(stderr, "%s:%d:\tsymbol %s is selected by %s\n",
1092 menu->file->name, menu->lineno, 1096 prop->file->name, prop->lineno,
1093 sym->name ? sym->name : "<choice>", 1097 sym->name ? sym->name : "<choice>",
1094 next_sym->name ? next_sym->name : "<choice>"); 1098 next_sym->name ? next_sym->name : "<choice>");
1095 } else if (sym_is_choice_value(sym)) { 1099 } else if (stack->expr == &sym->implied.expr) {
1096 fprintf(stderr, "%s:%d:\tsymbol %s is part of choice %s\n", 1100 fprintf(stderr, "%s:%d:\tsymbol %s is implied by %s\n",
1097 menu->file->name, menu->lineno, 1101 prop->file->name, prop->lineno,
1102 sym->name ? sym->name : "<choice>",
1103 next_sym->name ? next_sym->name : "<choice>");
1104 } else if (stack->expr) {
1105 fprintf(stderr, "%s:%d:\tsymbol %s %s value contains %s\n",
1106 prop->file->name, prop->lineno,
1098 sym->name ? sym->name : "<choice>", 1107 sym->name ? sym->name : "<choice>",
1108 prop_get_type_name(prop->type),
1099 next_sym->name ? next_sym->name : "<choice>"); 1109 next_sym->name ? next_sym->name : "<choice>");
1100 } else { 1110 } else {
1101 fprintf(stderr, "%s:%d:\tsymbol %s is selected by %s\n", 1111 fprintf(stderr, "%s:%d:\tsymbol %s %s is visible depending on %s\n",
1102 prop->file->name, prop->lineno, 1112 prop->file->name, prop->lineno,
1103 sym->name ? sym->name : "<choice>", 1113 sym->name ? sym->name : "<choice>",
1114 prop_get_type_name(prop->type),
1104 next_sym->name ? next_sym->name : "<choice>"); 1115 next_sym->name ? next_sym->name : "<choice>");
1105 } 1116 }
1106 } 1117 }
@@ -1157,12 +1168,26 @@ static struct symbol *sym_check_sym_deps(struct symbol *sym)
1157 1168
1158 dep_stack_insert(&stack, sym); 1169 dep_stack_insert(&stack, sym);
1159 1170
1171 stack.expr = &sym->dir_dep.expr;
1172 sym2 = sym_check_expr_deps(sym->dir_dep.expr);
1173 if (sym2)
1174 goto out;
1175
1176 stack.expr = &sym->rev_dep.expr;
1160 sym2 = sym_check_expr_deps(sym->rev_dep.expr); 1177 sym2 = sym_check_expr_deps(sym->rev_dep.expr);
1161 if (sym2) 1178 if (sym2)
1162 goto out; 1179 goto out;
1163 1180
1181 stack.expr = &sym->implied.expr;
1182 sym2 = sym_check_expr_deps(sym->implied.expr);
1183 if (sym2)
1184 goto out;
1185
1186 stack.expr = NULL;
1187
1164 for (prop = sym->prop; prop; prop = prop->next) { 1188 for (prop = sym->prop; prop; prop = prop->next) {
1165 if (prop->type == P_CHOICE || prop->type == P_SELECT) 1189 if (prop->type == P_CHOICE || prop->type == P_SELECT ||
1190 prop->type == P_IMPLY)
1166 continue; 1191 continue;
1167 stack.prop = prop; 1192 stack.prop = prop;
1168 sym2 = sym_check_expr_deps(prop->visible.expr); 1193 sym2 = sym_check_expr_deps(prop->visible.expr);
@@ -1170,7 +1195,7 @@ static struct symbol *sym_check_sym_deps(struct symbol *sym)
1170 break; 1195 break;
1171 if (prop->type != P_DEFAULT || sym_is_choice(sym)) 1196 if (prop->type != P_DEFAULT || sym_is_choice(sym))
1172 continue; 1197 continue;
1173 stack.expr = prop->expr; 1198 stack.expr = &prop->expr;
1174 sym2 = sym_check_expr_deps(prop->expr); 1199 sym2 = sym_check_expr_deps(prop->expr);
1175 if (sym2) 1200 if (sym2)
1176 break; 1201 break;
@@ -1248,9 +1273,6 @@ struct symbol *sym_check_deps(struct symbol *sym)
1248 sym->flags &= ~SYMBOL_CHECK; 1273 sym->flags &= ~SYMBOL_CHECK;
1249 } 1274 }
1250 1275
1251 if (sym2 && sym2 == sym)
1252 sym2 = NULL;
1253
1254 return sym2; 1276 return sym2;
1255} 1277}
1256 1278
diff --git a/scripts/kconfig/tests/warn_recursive_dep/Kconfig b/scripts/kconfig/tests/err_recursive_dep/Kconfig
index a65bfcb7137e..ebdb3ffd8717 100644
--- a/scripts/kconfig/tests/warn_recursive_dep/Kconfig
+++ b/scripts/kconfig/tests/err_recursive_dep/Kconfig
@@ -1,3 +1,5 @@
1# SPDX-License-Identifier: GPL-2.0
2
1# depends on itself 3# depends on itself
2 4
3config A 5config A
@@ -31,7 +33,6 @@ config D2
31 bool 33 bool
32 34
33# depends on and imply 35# depends on and imply
34# This is not recursive dependency
35 36
36config E1 37config E1
37 bool "E1" 38 bool "E1"
diff --git a/scripts/kconfig/tests/err_recursive_dep/__init__.py b/scripts/kconfig/tests/err_recursive_dep/__init__.py
new file mode 100644
index 000000000000..5f3821b43ce6
--- /dev/null
+++ b/scripts/kconfig/tests/err_recursive_dep/__init__.py
@@ -0,0 +1,10 @@
1# SPDX-License-Identifier: GPL-2.0
2"""
3Detect recursive dependency error.
4
5Recursive dependency should be treated as an error.
6"""
7
8def test(conf):
9 assert conf.oldaskconfig() == 1
10 assert conf.stderr_contains('expected_stderr')
diff --git a/scripts/kconfig/tests/err_recursive_dep/expected_stderr b/scripts/kconfig/tests/err_recursive_dep/expected_stderr
new file mode 100644
index 000000000000..84679b104655
--- /dev/null
+++ b/scripts/kconfig/tests/err_recursive_dep/expected_stderr
@@ -0,0 +1,38 @@
1Kconfig:11:error: recursive dependency detected!
2Kconfig:11: symbol B is selected by B
3For a resolution refer to Documentation/kbuild/kconfig-language.txt
4subsection "Kconfig recursive dependency limitations"
5
6Kconfig:5:error: recursive dependency detected!
7Kconfig:5: symbol A depends on A
8For a resolution refer to Documentation/kbuild/kconfig-language.txt
9subsection "Kconfig recursive dependency limitations"
10
11Kconfig:17:error: recursive dependency detected!
12Kconfig:17: symbol C1 depends on C2
13Kconfig:21: symbol C2 depends on C1
14For a resolution refer to Documentation/kbuild/kconfig-language.txt
15subsection "Kconfig recursive dependency limitations"
16
17Kconfig:32:error: recursive dependency detected!
18Kconfig:32: symbol D2 is selected by D1
19Kconfig:27: symbol D1 depends on D2
20For a resolution refer to Documentation/kbuild/kconfig-language.txt
21subsection "Kconfig recursive dependency limitations"
22
23Kconfig:37:error: recursive dependency detected!
24Kconfig:37: symbol E1 depends on E2
25Kconfig:42: symbol E2 is implied by E1
26For a resolution refer to Documentation/kbuild/kconfig-language.txt
27subsection "Kconfig recursive dependency limitations"
28
29Kconfig:60:error: recursive dependency detected!
30Kconfig:60: symbol G depends on G
31For a resolution refer to Documentation/kbuild/kconfig-language.txt
32subsection "Kconfig recursive dependency limitations"
33
34Kconfig:51:error: recursive dependency detected!
35Kconfig:51: symbol F2 depends on F1
36Kconfig:49: symbol F1 default value contains F2
37For a resolution refer to Documentation/kbuild/kconfig-language.txt
38subsection "Kconfig recursive dependency limitations"
diff --git a/scripts/kconfig/tests/warn_recursive_dep/__init__.py b/scripts/kconfig/tests/warn_recursive_dep/__init__.py
deleted file mode 100644
index adb21951ba41..000000000000
--- a/scripts/kconfig/tests/warn_recursive_dep/__init__.py
+++ /dev/null
@@ -1,9 +0,0 @@
1"""
2Warn recursive inclusion.
3
4Recursive dependency should be warned.
5"""
6
7def test(conf):
8 assert conf.oldaskconfig() == 0
9 assert conf.stderr_contains('expected_stderr')
diff --git a/scripts/kconfig/tests/warn_recursive_dep/expected_stderr b/scripts/kconfig/tests/warn_recursive_dep/expected_stderr
deleted file mode 100644
index 3de807dd9cb2..000000000000
--- a/scripts/kconfig/tests/warn_recursive_dep/expected_stderr
+++ /dev/null
@@ -1,30 +0,0 @@
1Kconfig:9:error: recursive dependency detected!
2Kconfig:9: symbol B is selected by B
3For a resolution refer to Documentation/kbuild/kconfig-language.txt
4subsection "Kconfig recursive dependency limitations"
5
6Kconfig:3:error: recursive dependency detected!
7Kconfig:3: symbol A depends on A
8For a resolution refer to Documentation/kbuild/kconfig-language.txt
9subsection "Kconfig recursive dependency limitations"
10
11Kconfig:15:error: recursive dependency detected!
12Kconfig:15: symbol C1 depends on C2
13Kconfig:19: symbol C2 depends on C1
14For a resolution refer to Documentation/kbuild/kconfig-language.txt
15subsection "Kconfig recursive dependency limitations"
16
17Kconfig:30:error: recursive dependency detected!
18Kconfig:30: symbol D2 is selected by D1
19Kconfig:25: symbol D1 depends on D2
20For a resolution refer to Documentation/kbuild/kconfig-language.txt
21subsection "Kconfig recursive dependency limitations"
22
23Kconfig:59:error: recursive dependency detected!
24Kconfig:59: symbol G depends on G
25For a resolution refer to Documentation/kbuild/kconfig-language.txt
26subsection "Kconfig recursive dependency limitations"
27
28Kconfig:50:error: recursive dependency detected!
29Kconfig:50: symbol F2 depends on F1
30Kconfig:48: symbol F1 default value contains F2
diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
index 4bf811c09f59..c8cf45362bd6 100755
--- a/scripts/link-vmlinux.sh
+++ b/scripts/link-vmlinux.sh
@@ -75,7 +75,7 @@ modpost_link()
75 ${KBUILD_VMLINUX_LIBS} \ 75 ${KBUILD_VMLINUX_LIBS} \
76 --end-group" 76 --end-group"
77 77
78 ${LD} ${LDFLAGS} -r -o ${1} ${objects} 78 ${LD} ${KBUILD_LDFLAGS} -r -o ${1} ${objects}
79} 79}
80 80
81# Link of vmlinux 81# Link of vmlinux
@@ -95,7 +95,7 @@ vmlinux_link()
95 --end-group \ 95 --end-group \
96 ${1}" 96 ${1}"
97 97
98 ${LD} ${LDFLAGS} ${LDFLAGS_vmlinux} -o ${2} \ 98 ${LD} ${KBUILD_LDFLAGS} ${LDFLAGS_vmlinux} -o ${2} \
99 -T ${lds} ${objects} 99 -T ${lds} ${objects}
100 else 100 else
101 objects="-Wl,--whole-archive \ 101 objects="-Wl,--whole-archive \
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index dc6d714e4dcb..0d998c54564d 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -672,7 +672,7 @@ static void handle_modversions(struct module *mod, struct elf_info *info,
672 if (ELF_ST_TYPE(sym->st_info) == STT_SPARC_REGISTER) 672 if (ELF_ST_TYPE(sym->st_info) == STT_SPARC_REGISTER)
673 break; 673 break;
674 if (symname[0] == '.') { 674 if (symname[0] == '.') {
675 char *munged = strdup(symname); 675 char *munged = NOFAIL(strdup(symname));
676 munged[0] = '_'; 676 munged[0] = '_';
677 munged[1] = toupper(munged[1]); 677 munged[1] = toupper(munged[1]);
678 symname = munged; 678 symname = munged;
@@ -1318,7 +1318,7 @@ static Elf_Sym *find_elf_symbol2(struct elf_info *elf, Elf_Addr addr,
1318static char *sec2annotation(const char *s) 1318static char *sec2annotation(const char *s)
1319{ 1319{
1320 if (match(s, init_exit_sections)) { 1320 if (match(s, init_exit_sections)) {
1321 char *p = malloc(20); 1321 char *p = NOFAIL(malloc(20));
1322 char *r = p; 1322 char *r = p;
1323 1323
1324 *p++ = '_'; 1324 *p++ = '_';
@@ -1338,7 +1338,7 @@ static char *sec2annotation(const char *s)
1338 strcat(p, " "); 1338 strcat(p, " ");
1339 return r; 1339 return r;
1340 } else { 1340 } else {
1341 return strdup(""); 1341 return NOFAIL(strdup(""));
1342 } 1342 }
1343} 1343}
1344 1344
@@ -2036,7 +2036,7 @@ void buf_write(struct buffer *buf, const char *s, int len)
2036{ 2036{
2037 if (buf->size - buf->pos < len) { 2037 if (buf->size - buf->pos < len) {
2038 buf->size += len + SZ; 2038 buf->size += len + SZ;
2039 buf->p = realloc(buf->p, buf->size); 2039 buf->p = NOFAIL(realloc(buf->p, buf->size));
2040 } 2040 }
2041 strncpy(buf->p + buf->pos, s, len); 2041 strncpy(buf->p + buf->pos, s, len);
2042 buf->pos += len; 2042 buf->pos += len;
diff --git a/usr/Makefile b/usr/Makefile
index 237a028693ce..748f6a60bb1e 100644
--- a/usr/Makefile
+++ b/usr/Makefile
@@ -24,7 +24,7 @@ $(obj)/initramfs_data.o: $(obj)/$(datafile_y) FORCE
24# Generate the initramfs cpio archive 24# Generate the initramfs cpio archive
25 25
26hostprogs-y := gen_init_cpio 26hostprogs-y := gen_init_cpio
27initramfs := $(CONFIG_SHELL) $(srctree)/scripts/gen_initramfs_list.sh 27initramfs := $(CONFIG_SHELL) $(srctree)/$(src)/gen_initramfs_list.sh
28ramfs-input := $(if $(filter-out "",$(CONFIG_INITRAMFS_SOURCE)), \ 28ramfs-input := $(if $(filter-out "",$(CONFIG_INITRAMFS_SOURCE)), \
29 $(shell echo $(CONFIG_INITRAMFS_SOURCE)),-d) 29 $(shell echo $(CONFIG_INITRAMFS_SOURCE)),-d)
30ramfs-args := \ 30ramfs-args := \
diff --git a/scripts/gen_initramfs_list.sh b/usr/gen_initramfs_list.sh
index 10e528b3a08f..0aad760fcd8c 100755
--- a/scripts/gen_initramfs_list.sh
+++ b/usr/gen_initramfs_list.sh
@@ -174,7 +174,7 @@ dir_filelist() {
174 ${dep_list}header "$1" 174 ${dep_list}header "$1"
175 175
176 srcdir=$(echo "$1" | sed -e 's://*:/:g') 176 srcdir=$(echo "$1" | sed -e 's://*:/:g')
177 dirlist=$(find "${srcdir}" -printf "%p %m %U %G\n" | sort) 177 dirlist=$(find "${srcdir}" -printf "%p %m %U %G\n" | LANG=C sort)
178 178
179 # If $dirlist is only one line, then the directory is empty 179 # If $dirlist is only one line, then the directory is empty
180 if [ "$(echo "${dirlist}" | wc -l)" -gt 1 ]; then 180 if [ "$(echo "${dirlist}" | wc -l)" -gt 1 ]; then
diff --git a/usr/initramfs_data.S b/usr/initramfs_data.S
index b28da799f6a6..d07648f05bbf 100644
--- a/usr/initramfs_data.S
+++ b/usr/initramfs_data.S
@@ -30,8 +30,8 @@ __irf_start:
30.incbin __stringify(INITRAMFS_IMAGE) 30.incbin __stringify(INITRAMFS_IMAGE)
31__irf_end: 31__irf_end:
32.section .init.ramfs.info,"a" 32.section .init.ramfs.info,"a"
33.globl VMLINUX_SYMBOL(__initramfs_size) 33.globl __initramfs_size
34VMLINUX_SYMBOL(__initramfs_size): 34__initramfs_size:
35#ifdef CONFIG_64BIT 35#ifdef CONFIG_64BIT
36 .quad __irf_end - __irf_start 36 .quad __irf_end - __irf_start
37#else 37#else