aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-04-03 18:51:22 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-04-03 18:51:22 -0400
commit3b24b83763e72a6c1e728100104fd99aa83a7b3b (patch)
treebd493c47804a9fe1e85ee41c2532b4748fca0b25
parent0734e00ef9e48e78c5c3ce1648572f160d07e323 (diff)
parenta95b37e20db9a2b05354eec009b2188523a21c8e (diff)
Merge tag 'kbuild-v4.17' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
Pull Kbuild updates from Masahiro Yamada: - add a shell script to get Clang version - improve portability of build scripts - drop always-enabled CONFIG_THIN_ARCHIVE and remove unused code - rename built-in.o which is now thin archive to built-in.a - process clean/build targets one by one to get along with -j option - simplify ld-option - improve building with CONFIG_TRIM_UNUSED_KSYMS - define KBUILD_MODNAME even for objects shared among multiple modules - avoid linking multiple instances of same objects from composite objects - move <linux/compiler_types.h> to c_flags to include it only for C files - clean-up various Makefiles * tag 'kbuild-v4.17' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (29 commits) kbuild: get <linux/compiler_types.h> out of <linux/kconfig.h> kbuild: clean up link rule of composite modules kbuild: clean up archive rule of built-in.a kbuild: remove partial section mismatch detection for built-in.a net: liquidio: clean up Makefile for simpler composite object handling lib: zstd: clean up Makefile for simpler composite object handling kbuild: link $(real-obj-y) instead of $(obj-y) into built-in.a kbuild: rename real-objs-y/m to real-obj-y/m kbuild: move modname and modname-multi close to modname_flags kbuild: simplify modname calculation kbuild: fix modname for composite modules kbuild: define KBUILD_MODNAME even if multiple modules share objects kbuild: remove unnecessary $(subst $(obj)/, , ...) in modname-multi kbuild: Use ls(1) instead of stat(1) to obtain file size kbuild: link vmlinux only once for CONFIG_TRIM_UNUSED_KSYMS kbuild: move include/config/ksym/* to include/ksym/* kbuild: move CONFIG_TRIM_UNUSED_KSYMS code unneeded for external module kbuild: restore autoksyms.h touch to the top Makefile kbuild: move 'scripts' target below kbuild: remove wrong 'touch' in adjust_autoksyms.sh ...
-rw-r--r--.gitignore1
-rw-r--r--Documentation/kbuild/kbuild.txt4
-rw-r--r--Documentation/kbuild/makefiles.txt28
-rw-r--r--Documentation/process/changes.rst2
-rw-r--r--Makefile89
-rw-r--r--arch/Kconfig6
-rwxr-xr-xarch/arm/boot/deflate_xip_data.sh2
-rwxr-xr-xarch/powerpc/boot/wrapper2
-rw-r--r--arch/powerpc/kernel/Makefile2
-rw-r--r--drivers/net/ethernet/cavium/liquidio/Makefile51
-rw-r--r--drivers/s390/Makefile2
-rw-r--r--include/linux/kconfig.h3
-rw-r--r--lib/Kconfig.debug4
-rw-r--r--lib/zstd/Makefile17
-rw-r--r--scripts/Kbuild.include6
-rw-r--r--scripts/Makefile.build97
-rw-r--r--scripts/Makefile.lib47
-rwxr-xr-xscripts/adjust_autoksyms.sh9
-rw-r--r--scripts/basic/fixdep.c8
-rwxr-xr-xscripts/clang-version.sh33
-rwxr-xr-xscripts/file-size.sh4
-rwxr-xr-xscripts/gen_initramfs_list.sh2
-rwxr-xr-xscripts/headers_install.sh10
-rw-r--r--scripts/kconfig/Makefile2
-rwxr-xr-xscripts/link-vmlinux.sh103
-rwxr-xr-xscripts/namespace.pl2
-rw-r--r--usr/initramfs_data.S2
27 files changed, 234 insertions, 304 deletions
diff --git a/.gitignore b/.gitignore
index 1be78fd8163b..85bcc2696442 100644
--- a/.gitignore
+++ b/.gitignore
@@ -87,6 +87,7 @@ modules.builtin
87# 87#
88include/config 88include/config
89include/generated 89include/generated
90include/ksym
90arch/*/include/generated 91arch/*/include/generated
91 92
92# stgit generated dirs 93# stgit generated dirs
diff --git a/Documentation/kbuild/kbuild.txt b/Documentation/kbuild/kbuild.txt
index ac2363ea05c5..6c9c69ec3986 100644
--- a/Documentation/kbuild/kbuild.txt
+++ b/Documentation/kbuild/kbuild.txt
@@ -50,10 +50,6 @@ LDFLAGS_MODULE
50-------------------------------------------------- 50--------------------------------------------------
51Additional options used for $(LD) when linking modules. 51Additional options used for $(LD) when linking modules.
52 52
53LDFLAGS_vmlinux
54--------------------------------------------------
55Additional options passed to final link of vmlinux.
56
57KBUILD_VERBOSE 53KBUILD_VERBOSE
58-------------------------------------------------- 54--------------------------------------------------
59Set the kbuild verbosity. Can be assigned same values as "V=...". 55Set the kbuild verbosity. Can be assigned same values as "V=...".
diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt
index 71e9feefb63c..048fc39a6b91 100644
--- a/Documentation/kbuild/makefiles.txt
+++ b/Documentation/kbuild/makefiles.txt
@@ -153,12 +153,18 @@ more details, with real examples.
153 configuration. 153 configuration.
154 154
155 Kbuild compiles all the $(obj-y) files. It then calls 155 Kbuild compiles all the $(obj-y) files. It then calls
156 "$(LD) -r" to merge these files into one built-in.o file. 156 "$(AR) rcSTP" to merge these files into one built-in.a file.
157 built-in.o is later linked into vmlinux by the parent Makefile. 157 This is a thin archive without a symbol table, which makes it
158 unsuitable as a linker input.
159
160 The scripts/link-vmlinux.sh script later makes an aggregate
161 built-in.a with "${AR} rcsTP", which creates the thin archive
162 with a symbol table and an index, making it a valid input for
163 the final vmlinux link passes.
158 164
159 The order of files in $(obj-y) is significant. Duplicates in 165 The order of files in $(obj-y) is significant. Duplicates in
160 the lists are allowed: the first instance will be linked into 166 the lists are allowed: the first instance will be linked into
161 built-in.o and succeeding instances will be ignored. 167 built-in.a and succeeding instances will be ignored.
162 168
163 Link order is significant, because certain functions 169 Link order is significant, because certain functions
164 (module_init() / __initcall) will be called during boot in the 170 (module_init() / __initcall) will be called during boot in the
@@ -222,7 +228,7 @@ more details, with real examples.
222 Note: Of course, when you are building objects into the kernel, 228 Note: Of course, when you are building objects into the kernel,
223 the syntax above will also work. So, if you have CONFIG_EXT2_FS=y, 229 the syntax above will also work. So, if you have CONFIG_EXT2_FS=y,
224 kbuild will build an ext2.o file for you out of the individual 230 kbuild will build an ext2.o file for you out of the individual
225 parts and then link this into built-in.o, as you would expect. 231 parts and then link this into built-in.a, as you would expect.
226 232
227--- 3.4 Objects which export symbols 233--- 3.4 Objects which export symbols
228 234
@@ -232,7 +238,7 @@ more details, with real examples.
232--- 3.5 Library file goals - lib-y 238--- 3.5 Library file goals - lib-y
233 239
234 Objects listed with obj-* are used for modules, or 240 Objects listed with obj-* are used for modules, or
235 combined in a built-in.o for that specific directory. 241 combined in a built-in.a for that specific directory.
236 There is also the possibility to list objects that will 242 There is also the possibility to list objects that will
237 be included in a library, lib.a. 243 be included in a library, lib.a.
238 All objects listed with lib-y are combined in a single 244 All objects listed with lib-y are combined in a single
@@ -244,7 +250,7 @@ more details, with real examples.
244 250
245 Note that the same kbuild makefile may list files to be built-in 251 Note that the same kbuild makefile may list files to be built-in
246 and to be part of a library. Therefore the same directory 252 and to be part of a library. Therefore the same directory
247 may contain both a built-in.o and a lib.a file. 253 may contain both a built-in.a and a lib.a file.
248 254
249 Example: 255 Example:
250 #arch/x86/lib/Makefile 256 #arch/x86/lib/Makefile
@@ -831,12 +837,6 @@ When kbuild executes, the following steps are followed (roughly):
831 Note: ldflags-y can be used to further customise 837 Note: ldflags-y can be used to further customise
832 the flags used. See chapter 3.7. 838 the flags used. See chapter 3.7.
833 839
834 LDFLAGS_MODULE Options for $(LD) when linking modules
835
836 LDFLAGS_MODULE is used to set specific flags for $(LD) when
837 linking the .ko files used for modules.
838 Default is "-r", for relocatable output.
839
840 LDFLAGS_vmlinux Options for $(LD) when linking vmlinux 840 LDFLAGS_vmlinux Options for $(LD) when linking vmlinux
841 841
842 LDFLAGS_vmlinux is used to specify additional flags to pass to 842 LDFLAGS_vmlinux is used to specify additional flags to pass to
@@ -986,7 +986,7 @@ When kbuild executes, the following steps are followed (roughly):
986 986
987 $(head-y) lists objects to be linked first in vmlinux. 987 $(head-y) lists objects to be linked first in vmlinux.
988 $(libs-y) lists directories where a lib.a archive can be located. 988 $(libs-y) lists directories where a lib.a archive can be located.
989 The rest list directories where a built-in.o object file can be 989 The rest list directories where a built-in.a object file can be
990 located. 990 located.
991 991
992 $(init-y) objects will be located after $(head-y). 992 $(init-y) objects will be located after $(head-y).
@@ -1071,7 +1071,7 @@ When kbuild executes, the following steps are followed (roughly):
1071 extra-y := head.o init_task.o 1071 extra-y := head.o init_task.o
1072 1072
1073 In this example, extra-y is used to list object files that 1073 In this example, extra-y is used to list object files that
1074 shall be built, but shall not be linked as part of built-in.o. 1074 shall be built, but shall not be linked as part of built-in.a.
1075 1075
1076 1076
1077--- 6.7 Commands useful for building a boot image 1077--- 6.7 Commands useful for building a boot image
diff --git a/Documentation/process/changes.rst b/Documentation/process/changes.rst
index 5470f1b74375..ddc029734b25 100644
--- a/Documentation/process/changes.rst
+++ b/Documentation/process/changes.rst
@@ -78,7 +78,7 @@ Binutils
78-------- 78--------
79 79
80The build system has, as of 4.13, switched to using thin archives (`ar T`) 80The build system has, as of 4.13, switched to using thin archives (`ar T`)
81rather than incremental linking (`ld -r`) for built-in.o intermediate steps. 81rather than incremental linking (`ld -r`) for built-in.a intermediate steps.
82This requires binutils 2.20 or newer. 82This requires binutils 2.20 or newer.
83 83
84Flex 84Flex
diff --git a/Makefile b/Makefile
index d3300e46f925..65b61599b513 100644
--- a/Makefile
+++ b/Makefile
@@ -35,7 +35,7 @@ unexport GREP_OPTIONS
35# Most importantly: sub-Makefiles should only ever modify files in 35# Most importantly: sub-Makefiles should only ever modify files in
36# their own directory. If in some directory we have a dependency on 36# their own directory. If in some directory we have a dependency on
37# a file in another dir (which doesn't happen often, but it's often 37# a file in another dir (which doesn't happen often, but it's often
38# unavoidable when linking the built-in.o targets which finally 38# unavoidable when linking the built-in.a targets which finally
39# turn into vmlinux), we will call a sub make in that other dir, and 39# turn into vmlinux), we will call a sub make in that other dir, and
40# after that we are sure that everything which is in that other dir 40# after that we are sure that everything which is in that other dir
41# is now up to date. 41# is now up to date.
@@ -220,7 +220,8 @@ export srctree objtree VPATH
220version_h := include/generated/uapi/linux/version.h 220version_h := include/generated/uapi/linux/version.h
221old_version_h := include/linux/version.h 221old_version_h := include/linux/version.h
222 222
223no-dot-config-targets := clean mrproper distclean \ 223clean-targets := %clean mrproper cleandocs
224no-dot-config-targets := $(clean-targets) \
224 cscope gtags TAGS tags help% %docs check% coccicheck \ 225 cscope gtags TAGS tags help% %docs check% coccicheck \
225 $(version_h) headers_% archheaders archscripts \ 226 $(version_h) headers_% archheaders archscripts \
226 kernelversion %src-pkg 227 kernelversion %src-pkg
@@ -243,6 +244,14 @@ ifeq ($(KBUILD_EXTMOD),)
243 endif 244 endif
244 endif 245 endif
245endif 246endif
247
248# For "make -j clean all", "make -j mrproper defconfig all", etc.
249ifneq ($(filter $(clean-targets),$(MAKECMDGOALS)),)
250 ifneq ($(filter-out $(clean-targets),$(MAKECMDGOALS)),)
251 mixed-targets := 1
252 endif
253endif
254
246# install and modules_install need also be processed one by one 255# install and modules_install need also be processed one by one
247ifneq ($(filter install,$(MAKECMDGOALS)),) 256ifneq ($(filter install,$(MAKECMDGOALS)),)
248 ifneq ($(filter modules_install,$(MAKECMDGOALS)),) 257 ifneq ($(filter modules_install,$(MAKECMDGOALS)),)
@@ -418,6 +427,7 @@ KBUILD_CFLAGS_KERNEL :=
418KBUILD_AFLAGS_MODULE := -DMODULE 427KBUILD_AFLAGS_MODULE := -DMODULE
419KBUILD_CFLAGS_MODULE := -DMODULE 428KBUILD_CFLAGS_MODULE := -DMODULE
420KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds 429KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds
430LDFLAGS :=
421GCC_PLUGINS_CFLAGS := 431GCC_PLUGINS_CFLAGS :=
422 432
423export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC 433export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC
@@ -556,14 +566,6 @@ endif
556export KBUILD_MODULES KBUILD_BUILTIN 566export KBUILD_MODULES KBUILD_BUILTIN
557 567
558ifeq ($(KBUILD_EXTMOD),) 568ifeq ($(KBUILD_EXTMOD),)
559# Additional helpers built in scripts/
560# Carefully list dependencies so we do not try to build scripts twice
561# in parallel
562PHONY += scripts
563scripts: scripts_basic include/config/auto.conf include/config/tristate.conf \
564 asm-generic gcc-plugins
565 $(Q)$(MAKE) $(build)=$(@)
566
567# Objects we will link into vmlinux / subdirs we need to visit 569# Objects we will link into vmlinux / subdirs we need to visit
568init-y := init/ 570init-y := init/
569drivers-y := drivers/ sound/ firmware/ 571drivers-y := drivers/ sound/ firmware/
@@ -611,13 +613,6 @@ else
611include/config/auto.conf: ; 613include/config/auto.conf: ;
612endif # $(dot-config) 614endif # $(dot-config)
613 615
614# For the kernel to actually contain only the needed exported symbols,
615# we have to build modules as well to determine what those symbols are.
616# (this can be evaluated only once include/config/auto.conf has been included)
617ifdef CONFIG_TRIM_UNUSED_KSYMS
618 KBUILD_MODULES := 1
619endif
620
621# The all: target is the default when no target is given on the 616# The all: target is the default when no target is given on the
622# command line. 617# command line.
623# This allow a user to issue only 'make' to build a kernel including modules 618# This allow a user to issue only 'make' to build a kernel including modules
@@ -984,13 +979,13 @@ vmlinux-dirs := $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \
984vmlinux-alldirs := $(sort $(vmlinux-dirs) $(patsubst %/,%,$(filter %/, \ 979vmlinux-alldirs := $(sort $(vmlinux-dirs) $(patsubst %/,%,$(filter %/, \
985 $(init-) $(core-) $(drivers-) $(net-) $(libs-) $(virt-)))) 980 $(init-) $(core-) $(drivers-) $(net-) $(libs-) $(virt-))))
986 981
987init-y := $(patsubst %/, %/built-in.o, $(init-y)) 982init-y := $(patsubst %/, %/built-in.a, $(init-y))
988core-y := $(patsubst %/, %/built-in.o, $(core-y)) 983core-y := $(patsubst %/, %/built-in.a, $(core-y))
989drivers-y := $(patsubst %/, %/built-in.o, $(drivers-y)) 984drivers-y := $(patsubst %/, %/built-in.a, $(drivers-y))
990net-y := $(patsubst %/, %/built-in.o, $(net-y)) 985net-y := $(patsubst %/, %/built-in.a, $(net-y))
991libs-y1 := $(patsubst %/, %/lib.a, $(libs-y)) 986libs-y1 := $(patsubst %/, %/lib.a, $(libs-y))
992libs-y2 := $(filter-out %.a, $(patsubst %/, %/built-in.o, $(libs-y))) 987libs-y2 := $(patsubst %/, %/built-in.a, $(filter-out %.a, $(libs-y)))
993virt-y := $(patsubst %/, %/built-in.o, $(virt-y)) 988virt-y := $(patsubst %/, %/built-in.a, $(virt-y))
994 989
995# Externally visible symbols (used by link-vmlinux.sh) 990# Externally visible symbols (used by link-vmlinux.sh)
996export KBUILD_VMLINUX_INIT := $(head-y) $(init-y) 991export KBUILD_VMLINUX_INIT := $(head-y) $(init-y)
@@ -1003,25 +998,26 @@ export KBUILD_ALLDIRS := $(sort $(filter-out arch/%,$(vmlinux-alldirs)) arch Doc
1003 998
1004vmlinux-deps := $(KBUILD_LDS) $(KBUILD_VMLINUX_INIT) $(KBUILD_VMLINUX_MAIN) $(KBUILD_VMLINUX_LIBS) 999vmlinux-deps := $(KBUILD_LDS) $(KBUILD_VMLINUX_INIT) $(KBUILD_VMLINUX_MAIN) $(KBUILD_VMLINUX_LIBS)
1005 1000
1006# Include targets which we want to execute sequentially if the rest of the 1001# Recurse until adjust_autoksyms.sh is satisfied
1007# kernel build went well. If CONFIG_TRIM_UNUSED_KSYMS is set, this might be 1002PHONY += autoksyms_recursive
1008# evaluated more than once. 1003autoksyms_recursive: $(vmlinux-deps)
1009PHONY += vmlinux_prereq
1010vmlinux_prereq: $(vmlinux-deps) FORCE
1011ifdef CONFIG_HEADERS_CHECK
1012 $(Q)$(MAKE) -f $(srctree)/Makefile headers_check
1013endif
1014ifdef CONFIG_GDB_SCRIPTS
1015 $(Q)ln -fsn $(abspath $(srctree)/scripts/gdb/vmlinux-gdb.py)
1016endif
1017ifdef CONFIG_TRIM_UNUSED_KSYMS 1004ifdef CONFIG_TRIM_UNUSED_KSYMS
1018 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/adjust_autoksyms.sh \ 1005 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/adjust_autoksyms.sh \
1019 "$(MAKE) -f $(srctree)/Makefile vmlinux" 1006 "$(MAKE) -f $(srctree)/Makefile vmlinux"
1020endif 1007endif
1021 1008
1022# standalone target for easier testing 1009# For the kernel to actually contain only the needed exported symbols,
1023include/generated/autoksyms.h: FORCE 1010# we have to build modules as well to determine what those symbols are.
1024 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/adjust_autoksyms.sh true 1011# (this can be evaluated only once include/config/auto.conf has been included)
1012ifdef CONFIG_TRIM_UNUSED_KSYMS
1013 KBUILD_MODULES := 1
1014endif
1015
1016autoksyms_h := $(if $(CONFIG_TRIM_UNUSED_KSYMS), include/generated/autoksyms.h)
1017
1018$(autoksyms_h):
1019 $(Q)mkdir -p $(dir $@)
1020 $(Q)touch $@
1025 1021
1026ARCH_POSTLINK := $(wildcard $(srctree)/arch/$(SRCARCH)/Makefile.postlink) 1022ARCH_POSTLINK := $(wildcard $(srctree)/arch/$(SRCARCH)/Makefile.postlink)
1027 1023
@@ -1030,7 +1026,13 @@ cmd_link-vmlinux = \
1030 $(CONFIG_SHELL) $< $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) ; \ 1026 $(CONFIG_SHELL) $< $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) ; \
1031 $(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true) 1027 $(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true)
1032 1028
1033vmlinux: scripts/link-vmlinux.sh vmlinux_prereq $(vmlinux-deps) FORCE 1029vmlinux: scripts/link-vmlinux.sh autoksyms_recursive $(vmlinux-deps) FORCE
1030ifdef CONFIG_HEADERS_CHECK
1031 $(Q)$(MAKE) -f $(srctree)/Makefile headers_check
1032endif
1033ifdef CONFIG_GDB_SCRIPTS
1034 $(Q)ln -fsn $(abspath $(srctree)/scripts/gdb/vmlinux-gdb.py)
1035endif
1034 +$(call if_changed,link-vmlinux) 1036 +$(call if_changed,link-vmlinux)
1035 1037
1036# Build samples along the rest of the kernel 1038# Build samples along the rest of the kernel
@@ -1060,6 +1062,13 @@ endef
1060include/config/kernel.release: include/config/auto.conf FORCE 1062include/config/kernel.release: include/config/auto.conf FORCE
1061 $(call filechk,kernel.release) 1063 $(call filechk,kernel.release)
1062 1064
1065# Additional helpers built in scripts/
1066# Carefully list dependencies so we do not try to build scripts twice
1067# in parallel
1068PHONY += scripts
1069scripts: scripts_basic include/config/auto.conf include/config/tristate.conf \
1070 asm-generic gcc-plugins $(autoksyms_h)
1071 $(Q)$(MAKE) $(build)=$(@)
1063 1072
1064# Things we need to do before we recursively start building the kernel 1073# Things we need to do before we recursively start building the kernel
1065# or the modules are listed in "prepare". 1074# or the modules are listed in "prepare".
@@ -1088,7 +1097,7 @@ endif
1088# that need to depend on updated CONFIG_* values can be checked here. 1097# that need to depend on updated CONFIG_* values can be checked here.
1089prepare2: prepare3 prepare-compiler-check outputmakefile asm-generic 1098prepare2: prepare3 prepare-compiler-check outputmakefile asm-generic
1090 1099
1091prepare1: prepare2 $(version_h) include/generated/utsrelease.h \ 1100prepare1: prepare2 $(version_h) $(autoksyms_h) include/generated/utsrelease.h \
1092 include/config/auto.conf 1101 include/config/auto.conf
1093 $(cmd_crmodverdir) 1102 $(cmd_crmodverdir)
1094 1103
@@ -1327,7 +1336,7 @@ endif # CONFIG_MODULES
1327# make distclean Remove editor backup files, patch leftover files and the like 1336# make distclean Remove editor backup files, patch leftover files and the like
1328 1337
1329# Directories & files removed with 'make clean' 1338# Directories & files removed with 'make clean'
1330CLEAN_DIRS += $(MODVERDIR) 1339CLEAN_DIRS += $(MODVERDIR) include/ksym
1331 1340
1332# Directories & files removed with 'make mrproper' 1341# Directories & files removed with 'make mrproper'
1333MRPROPER_DIRS += include/config usr/include include/generated \ 1342MRPROPER_DIRS += include/config usr/include include/generated \
diff --git a/arch/Kconfig b/arch/Kconfig
index 76c0b54443b1..8e0d665c8d53 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -596,12 +596,6 @@ config CC_STACKPROTECTOR_AUTO
596 596
597endchoice 597endchoice
598 598
599config THIN_ARCHIVES
600 def_bool y
601 help
602 Select this if the architecture wants to use thin archives
603 instead of ld -r to create the built-in.o files.
604
605config LD_DEAD_CODE_DATA_ELIMINATION 599config LD_DEAD_CODE_DATA_ELIMINATION
606 bool 600 bool
607 help 601 help
diff --git a/arch/arm/boot/deflate_xip_data.sh b/arch/arm/boot/deflate_xip_data.sh
index 5e7d758ebdd6..b7fa67d2d9e3 100755
--- a/arch/arm/boot/deflate_xip_data.sh
+++ b/arch/arm/boot/deflate_xip_data.sh
@@ -45,7 +45,7 @@ data_start=$(($__data_loc - $base_offset))
45data_end=$(($_edata_loc - $base_offset)) 45data_end=$(($_edata_loc - $base_offset))
46 46
47# Make sure data occupies the last part of the file. 47# Make sure data occupies the last part of the file.
48file_end=$(stat -c "%s" "$XIPIMAGE") 48file_end=$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" "$XIPIMAGE")
49if [ "$file_end" != "$data_end" ]; then 49if [ "$file_end" != "$data_end" ]; then
50 printf "end of xipImage doesn't match with _edata_loc (%#x vs %#x)\n" \ 50 printf "end of xipImage doesn't match with _edata_loc (%#x vs %#x)\n" \
51 $(($file_end + $base_offset)) $_edata_loc 1>&2 51 $(($file_end + $base_offset)) $_edata_loc 1>&2
diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
index 76fe3ccfd381..f9141eaec6ff 100755
--- a/arch/powerpc/boot/wrapper
+++ b/arch/powerpc/boot/wrapper
@@ -355,7 +355,7 @@ vmz="$tmpdir/`basename \"$kernel\"`.$ext"
355 355
356# Calculate the vmlinux.strip size 356# Calculate the vmlinux.strip size
357${CROSS}objcopy $objflags "$kernel" "$vmz.$$" 357${CROSS}objcopy $objflags "$kernel" "$vmz.$$"
358strip_size=$(stat -c %s $vmz.$$) 358strip_size=$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" "$vmz.$$")
359 359
360if [ -z "$cacheit" -o ! -f "$vmz$compression" -o "$vmz$compression" -ot "$kernel" ]; then 360if [ -z "$cacheit" -o ! -f "$vmz$compression" -o "$vmz$compression" -ot "$kernel" ]; then
361 # recompress the image if we need to 361 # recompress the image if we need to
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index 1b6bc7fba996..2358f97d62ec 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -165,7 +165,7 @@ systbl_chk: $(src)/systbl_chk.sh $(obj)/systbl_chk.i
165 $(call cmd,systbl_chk) 165 $(call cmd,systbl_chk)
166 166
167ifeq ($(CONFIG_PPC_OF_BOOT_TRAMPOLINE),y) 167ifeq ($(CONFIG_PPC_OF_BOOT_TRAMPOLINE),y)
168$(obj)/built-in.o: prom_init_check 168$(obj)/built-in.a: prom_init_check
169 169
170quiet_cmd_prom_init_check = CALL $< 170quiet_cmd_prom_init_check = CALL $<
171 cmd_prom_init_check = $(CONFIG_SHELL) $< "$(NM)" "$(obj)/prom_init.o" 171 cmd_prom_init_check = $(CONFIG_SHELL) $< "$(NM)" "$(obj)/prom_init.o"
diff --git a/drivers/net/ethernet/cavium/liquidio/Makefile b/drivers/net/ethernet/cavium/liquidio/Makefile
index e3fc4645cd8a..bc9937502043 100644
--- a/drivers/net/ethernet/cavium/liquidio/Makefile
+++ b/drivers/net/ethernet/cavium/liquidio/Makefile
@@ -2,42 +2,23 @@
2# 2#
3# Cavium Liquidio ethernet device driver 3# Cavium Liquidio ethernet device driver
4# 4#
5obj-$(CONFIG_LIQUIDIO) += liquidio.o
6 5
7liquidio-$(CONFIG_LIQUIDIO) += lio_ethtool.o \ 6common-objs := lio_ethtool.o \
8 lio_core.o \ 7 lio_core.o \
9 request_manager.o \ 8 request_manager.o \
10 response_manager.o \ 9 response_manager.o \
11 octeon_device.o \ 10 octeon_device.o \
12 cn66xx_device.o \ 11 cn66xx_device.o \
13 cn68xx_device.o \ 12 cn68xx_device.o \
14 cn23xx_pf_device.o \ 13 cn23xx_pf_device.o \
15 cn23xx_vf_device.o \ 14 cn23xx_vf_device.o \
16 octeon_mailbox.o \ 15 octeon_mailbox.o \
17 octeon_mem_ops.o \ 16 octeon_mem_ops.o \
18 octeon_droq.o \ 17 octeon_droq.o \
19 octeon_nic.o 18 octeon_nic.o
20 19
21liquidio-objs := lio_main.o octeon_console.o lio_vf_rep.o $(liquidio-y) 20obj-$(CONFIG_LIQUIDIO) += liquidio.o
21liquidio-y := lio_main.o octeon_console.o lio_vf_rep.o $(common-objs)
22 22
23obj-$(CONFIG_LIQUIDIO_VF) += liquidio_vf.o 23obj-$(CONFIG_LIQUIDIO_VF) += liquidio_vf.o
24 24liquidio_vf-y := lio_vf_main.o $(common-objs)
25ifeq ($(CONFIG_LIQUIDIO)$(CONFIG_LIQUIDIO_VF), yy)
26 liquidio_vf-objs := lio_vf_main.o
27else
28liquidio_vf-$(CONFIG_LIQUIDIO_VF) += lio_ethtool.o \
29 lio_core.o \
30 request_manager.o \
31 response_manager.o \
32 octeon_device.o \
33 cn66xx_device.o \
34 cn68xx_device.o \
35 cn23xx_pf_device.o \
36 cn23xx_vf_device.o \
37 octeon_mailbox.o \
38 octeon_mem_ops.o \
39 octeon_droq.o \
40 octeon_nic.o
41
42liquidio_vf-objs := lio_vf_main.o $(liquidio_vf-y)
43endif
diff --git a/drivers/s390/Makefile b/drivers/s390/Makefile
index 2fdab400c1fe..a863b0462b43 100644
--- a/drivers/s390/Makefile
+++ b/drivers/s390/Makefile
@@ -5,5 +5,5 @@
5 5
6obj-y += cio/ block/ char/ crypto/ net/ scsi/ virtio/ 6obj-y += cio/ block/ char/ crypto/ net/ scsi/ virtio/
7 7
8drivers-y += drivers/s390/built-in.o 8drivers-y += drivers/s390/built-in.a
9 9
diff --git a/include/linux/kconfig.h b/include/linux/kconfig.h
index dcde9471897d..cc8fa109cfa3 100644
--- a/include/linux/kconfig.h
+++ b/include/linux/kconfig.h
@@ -70,7 +70,4 @@
70 */ 70 */
71#define IS_ENABLED(option) __or(IS_BUILTIN(option), IS_MODULE(option)) 71#define IS_ENABLED(option) __or(IS_BUILTIN(option), IS_MODULE(option))
72 72
73/* Make sure we always have all types and struct attributes defined. */
74#include <linux/compiler_types.h>
75
76#endif /* __LINUX_KCONFIG_H */ 73#endif /* __LINUX_KCONFIG_H */
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 00eeff94b357..51c6bf0d93c6 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -324,11 +324,11 @@ config DEBUG_SECTION_MISMATCH
324 the analysis would not catch the illegal reference. 324 the analysis would not catch the illegal reference.
325 This option tells gcc to inline less (but it does result in 325 This option tells gcc to inline less (but it does result in
326 a larger kernel). 326 a larger kernel).
327 - Run the section mismatch analysis for each module/built-in.o file. 327 - Run the section mismatch analysis for each module/built-in.a file.
328 When we run the section mismatch analysis on vmlinux.o, we 328 When we run the section mismatch analysis on vmlinux.o, we
329 lose valuable information about where the mismatch was 329 lose valuable information about where the mismatch was
330 introduced. 330 introduced.
331 Running the analysis for each module/built-in.o file 331 Running the analysis for each module/built-in.a file
332 tells where the mismatch happens much closer to the 332 tells where the mismatch happens much closer to the
333 source. The drawback is that the same mismatch is 333 source. The drawback is that the same mismatch is
334 reported at least twice. 334 reported at least twice.
diff --git a/lib/zstd/Makefile b/lib/zstd/Makefile
index dd0a359c135b..7920cbbfeae9 100644
--- a/lib/zstd/Makefile
+++ b/lib/zstd/Makefile
@@ -3,16 +3,7 @@ obj-$(CONFIG_ZSTD_DECOMPRESS) += zstd_decompress.o
3 3
4ccflags-y += -O3 4ccflags-y += -O3
5 5
6# Object files unique to zstd_compress and zstd_decompress 6zstd_compress-y := fse_compress.o huf_compress.o compress.o \
7zstd_compress-y := fse_compress.o huf_compress.o compress.o 7 entropy_common.o fse_decompress.o zstd_common.o
8zstd_decompress-y := huf_decompress.o decompress.o 8zstd_decompress-y := huf_decompress.o decompress.o \
9 9 entropy_common.o fse_decompress.o zstd_common.o
10# These object files are shared between the modules.
11# Always add them to zstd_compress.
12# Unless both zstd_compress and zstd_decompress are built in
13# then also add them to zstd_decompress.
14zstd_compress-y += entropy_common.o fse_decompress.o zstd_common.o
15
16ifneq ($(CONFIG_ZSTD_COMPRESS)$(CONFIG_ZSTD_DECOMPRESS),yy)
17 zstd_decompress-y += entropy_common.o fse_decompress.o zstd_common.o
18endif
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index 065324a8046f..cce31ee876b6 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -237,9 +237,7 @@ cc-ldoption = $(call try-run-cached,\
237 237
238# ld-option 238# ld-option
239# Usage: LDFLAGS += $(call ld-option, -X) 239# Usage: LDFLAGS += $(call ld-option, -X)
240ld-option = $(call try-run-cached,\ 240ld-option = $(call try-run-cached, $(LD) $(LDFLAGS) $(1) -v,$(1),$(2))
241 $(CC) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -x c /dev/null -c -o "$$TMPO"; \
242 $(LD) $(LDFLAGS) $(1) "$$TMPO" -o "$$TMP",$(1),$(2))
243 241
244# ar-option 242# ar-option
245# Usage: KBUILD_ARFLAGS := $(call ar-option,D) 243# Usage: KBUILD_ARFLAGS := $(call ar-option,D)
@@ -368,7 +366,7 @@ ksym_dep_filter = \
368 $(CPP) $(call flags_nodeps,a_flags) -D__KSYM_DEPS__ $< ;; \ 366 $(CPP) $(call flags_nodeps,a_flags) -D__KSYM_DEPS__ $< ;; \
369 boot*|build*|cpp_its_S|*cpp_lds_S|dtc|host*|vdso*) : ;; \ 367 boot*|build*|cpp_its_S|*cpp_lds_S|dtc|host*|vdso*) : ;; \
370 *) echo "Don't know how to preprocess $(1)" >&2; false ;; \ 368 *) echo "Don't know how to preprocess $(1)" >&2; false ;; \
371 esac | tr ";" "\n" | sed -rn 's/^.*=== __KSYM_(.*) ===.*$$/KSYM_\1/p' 369 esac | tr ";" "\n" | sed -n 's/^.*=== __KSYM_\(.*\) ===.*$$/_\1/p'
372 370
373cmd_and_fixdep = \ 371cmd_and_fixdep = \
374 $(echo-cmd) $(cmd_$(1)); \ 372 $(echo-cmd) $(cmd_$(1)); \
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 4f2b25d43ec9..77cce68c4d63 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -73,11 +73,11 @@ endif
73 73
74ifneq ($(strip $(lib-y) $(lib-m) $(lib-)),) 74ifneq ($(strip $(lib-y) $(lib-m) $(lib-)),)
75lib-target := $(obj)/lib.a 75lib-target := $(obj)/lib.a
76obj-y += $(obj)/lib-ksyms.o 76real-obj-y += $(obj)/lib-ksyms.o
77endif 77endif
78 78
79ifneq ($(strip $(obj-y) $(need-builtin)),) 79ifneq ($(strip $(real-obj-y) $(need-builtin)),)
80builtin-target := $(obj)/built-in.o 80builtin-target := $(obj)/built-in.a
81endif 81endif
82 82
83modorder-target := $(obj)/modules.order 83modorder-target := $(obj)/modules.order
@@ -104,7 +104,7 @@ ifneq ($(KBUILD_ENABLE_EXTRA_GCC_CHECKS),)
104 cmd_checkdoc = $(srctree)/scripts/kernel-doc -none $< ; 104 cmd_checkdoc = $(srctree)/scripts/kernel-doc -none $< ;
105endif 105endif
106 106
107# Do section mismatch analysis for each module/built-in.o 107# Do section mismatch analysis for each module/built-in.a
108ifdef CONFIG_DEBUG_SECTION_MISMATCH 108ifdef CONFIG_DEBUG_SECTION_MISMATCH
109 cmd_secanalysis = ; scripts/mod/modpost $@ 109 cmd_secanalysis = ; scripts/mod/modpost $@
110endif 110endif
@@ -119,29 +119,17 @@ modkern_cflags = \
119 $(KBUILD_CFLAGS_KERNEL) $(CFLAGS_KERNEL)) 119 $(KBUILD_CFLAGS_KERNEL) $(CFLAGS_KERNEL))
120quiet_modtag := $(empty) $(empty) 120quiet_modtag := $(empty) $(empty)
121 121
122$(real-objs-m) : part-of-module := y 122$(real-obj-m) : part-of-module := y
123$(real-objs-m:.o=.i) : part-of-module := y 123$(real-obj-m:.o=.i) : part-of-module := y
124$(real-objs-m:.o=.s) : part-of-module := y 124$(real-obj-m:.o=.s) : part-of-module := y
125$(real-objs-m:.o=.lst): part-of-module := y 125$(real-obj-m:.o=.lst): part-of-module := y
126 126
127$(real-objs-m) : quiet_modtag := [M] 127$(real-obj-m) : quiet_modtag := [M]
128$(real-objs-m:.o=.i) : quiet_modtag := [M] 128$(real-obj-m:.o=.i) : quiet_modtag := [M]
129$(real-objs-m:.o=.s) : quiet_modtag := [M] 129$(real-obj-m:.o=.s) : quiet_modtag := [M]
130$(real-objs-m:.o=.lst): quiet_modtag := [M] 130$(real-obj-m:.o=.lst): quiet_modtag := [M]
131 131
132$(obj-m) : quiet_modtag := [M] 132$(obj-m) : quiet_modtag := [M]
133
134# Default for not multi-part modules
135modname = $(basetarget)
136
137$(multi-objs-m) : modname = $(modname-multi)
138$(multi-objs-m:.o=.i) : modname = $(modname-multi)
139$(multi-objs-m:.o=.s) : modname = $(modname-multi)
140$(multi-objs-m:.o=.lst) : modname = $(modname-multi)
141$(multi-objs-y) : modname = $(modname-multi)
142$(multi-objs-y:.o=.i) : modname = $(modname-multi)
143$(multi-objs-y:.o=.s) : modname = $(modname-multi)
144$(multi-objs-y:.o=.lst) : modname = $(modname-multi)
145 133
146quiet_cmd_cc_s_c = CC $(quiet_modtag) $@ 134quiet_cmd_cc_s_c = CC $(quiet_modtag) $@
147cmd_cc_s_c = $(CC) $(c_flags) $(DISABLE_LTO) -fverbose-asm -S -o $@ $< 135cmd_cc_s_c = $(CC) $(c_flags) $(DISABLE_LTO) -fverbose-asm -S -o $@ $<
@@ -314,7 +302,7 @@ endef
314 302
315# List module undefined symbols (or empty line if not enabled) 303# List module undefined symbols (or empty line if not enabled)
316ifdef CONFIG_TRIM_UNUSED_KSYMS 304ifdef CONFIG_TRIM_UNUSED_KSYMS
317cmd_undef_syms = $(NM) $@ | sed -n 's/^ \+U //p' | xargs echo 305cmd_undef_syms = $(NM) $@ | sed -n 's/^ *U //p' | xargs echo
318else 306else
319cmd_undef_syms = echo 307cmd_undef_syms = echo
320endif 308endif
@@ -345,8 +333,8 @@ $(obj)/%.lst: $(src)/%.c FORCE
345 333
346modkern_aflags := $(KBUILD_AFLAGS_KERNEL) $(AFLAGS_KERNEL) 334modkern_aflags := $(KBUILD_AFLAGS_KERNEL) $(AFLAGS_KERNEL)
347 335
348$(real-objs-m) : modkern_aflags := $(KBUILD_AFLAGS_MODULE) $(AFLAGS_MODULE) 336$(real-obj-m) : modkern_aflags := $(KBUILD_AFLAGS_MODULE) $(AFLAGS_MODULE)
349$(real-objs-m:.o=.s): modkern_aflags := $(KBUILD_AFLAGS_MODULE) $(AFLAGS_MODULE) 337$(real-obj-m:.o=.s): modkern_aflags := $(KBUILD_AFLAGS_MODULE) $(AFLAGS_MODULE)
350 338
351# .S file exports must have their C prototypes defined in asm/asm-prototypes.h 339# .S file exports must have their C prototypes defined in asm/asm-prototypes.h
352# or a file that it includes, in order to get versioned symbols. We build a 340# or a file that it includes, in order to get versioned symbols. We build a
@@ -424,7 +412,7 @@ endif
424$(obj)/%.o: $(src)/%.S $(objtool_dep) FORCE 412$(obj)/%.o: $(src)/%.S $(objtool_dep) FORCE
425 $(call if_changed_rule,as_o_S) 413 $(call if_changed_rule,as_o_S)
426 414
427targets += $(real-objs-y) $(real-objs-m) $(lib-y) 415targets += $(filter-out $(subdir-obj-y), $(real-obj-y)) $(real-obj-m) $(lib-y)
428targets += $(extra-y) $(MAKECMDGOALS) $(always) 416targets += $(extra-y) $(MAKECMDGOALS) $(always)
429 417
430# Linker scripts preprocessor (.lds.S -> .lds) 418# Linker scripts preprocessor (.lds.S -> .lds)
@@ -458,24 +446,16 @@ $(sort $(subdir-obj-y)): $(subdir-ym) ;
458# 446#
459ifdef builtin-target 447ifdef builtin-target
460 448
461ifdef CONFIG_THIN_ARCHIVES 449# built-in.a archives are made with no symbol table or index which
462 cmd_make_builtin = rm -f $@; $(AR) rcSTP$(KBUILD_ARFLAGS) 450# makes them small and fast, but unable to be used by the linker.
463 cmd_make_empty_builtin = rm -f $@; $(AR) rcSTP$(KBUILD_ARFLAGS) 451# scripts/link-vmlinux.sh builds an aggregate built-in.a with a symbol
464 quiet_cmd_link_o_target = AR $@ 452# table and index.
465else 453quiet_cmd_ar_builtin = AR $@
466 cmd_make_builtin = $(LD) $(ld_flags) -r -o 454 cmd_ar_builtin = rm -f $@; \
467 cmd_make_empty_builtin = rm -f $@; $(AR) rcs$(KBUILD_ARFLAGS) 455 $(AR) rcSTP$(KBUILD_ARFLAGS) $@ $(filter $(real-obj-y), $^)
468 quiet_cmd_link_o_target = LD $@
469endif
470
471# If the list of objects to link is empty, just create an empty built-in.o
472cmd_link_o_target = $(if $(strip $(obj-y)),\
473 $(cmd_make_builtin) $@ $(filter $(obj-y), $^) \
474 $(cmd_secanalysis),\
475 $(cmd_make_empty_builtin) $@)
476 456
477$(builtin-target): $(obj-y) FORCE 457$(builtin-target): $(real-obj-y) FORCE
478 $(call if_changed,link_o_target) 458 $(call if_changed,ar_builtin)
479 459
480targets += $(builtin-target) 460targets += $(builtin-target)
481endif # builtin-target 461endif # builtin-target
@@ -499,11 +479,8 @@ $(modorder-target): $(subdir-ym) FORCE
499ifdef lib-target 479ifdef lib-target
500quiet_cmd_link_l_target = AR $@ 480quiet_cmd_link_l_target = AR $@
501 481
502ifdef CONFIG_THIN_ARCHIVES 482# lib target archives do get a symbol table and index
503 cmd_link_l_target = rm -f $@; $(AR) rcsTP$(KBUILD_ARFLAGS) $@ $(lib-y) 483cmd_link_l_target = rm -f $@; $(AR) rcsTP$(KBUILD_ARFLAGS) $@ $(lib-y)
504else
505 cmd_link_l_target = rm -f $@; $(AR) rcs$(KBUILD_ARFLAGS) $@ $(lib-y)
506endif
507 484
508$(lib-target): $(lib-y) FORCE 485$(lib-target): $(lib-y) FORCE
509 $(call if_changed,link_l_target) 486 $(call if_changed,link_l_target)
@@ -549,22 +526,8 @@ $($(subst $(obj)/,,$(@:.o=-objs))) \
549$($(subst $(obj)/,,$(@:.o=-y))) \ 526$($(subst $(obj)/,,$(@:.o=-y))) \
550$($(subst $(obj)/,,$(@:.o=-m)))), $^) 527$($(subst $(obj)/,,$(@:.o=-m)))), $^)
551 528
552cmd_link_multi-link = $(LD) $(ld_flags) -r -o $@ $(link_multi_deps) $(cmd_secanalysis)
553
554ifdef CONFIG_THIN_ARCHIVES
555 quiet_cmd_link_multi-y = AR $@
556 cmd_link_multi-y = rm -f $@; $(AR) rcSTP$(KBUILD_ARFLAGS) $@ $(link_multi_deps)
557else
558 quiet_cmd_link_multi-y = LD $@
559 cmd_link_multi-y = $(cmd_link_multi-link)
560endif
561
562quiet_cmd_link_multi-m = LD [M] $@ 529quiet_cmd_link_multi-m = LD [M] $@
563cmd_link_multi-m = $(cmd_link_multi-link) 530cmd_link_multi-m = $(LD) $(ld_flags) -r -o $@ $(link_multi_deps) $(cmd_secanalysis)
564
565$(multi-used-y): FORCE
566 $(call if_changed,link_multi-y)
567$(call multi_depend, $(multi-used-y), .o, -objs -y)
568 531
569$(multi-used-m): FORCE 532$(multi-used-m): FORCE
570 $(call if_changed,link_multi-m) 533 $(call if_changed,link_multi-m)
@@ -572,7 +535,7 @@ $(multi-used-m): FORCE
572 $(cmd_undef_syms); } > $(MODVERDIR)/$(@F:.o=.mod) 535 $(cmd_undef_syms); } > $(MODVERDIR)/$(@F:.o=.mod)
573$(call multi_depend, $(multi-used-m), .o, -objs -y -m) 536$(call multi_depend, $(multi-used-m), .o, -objs -y -m)
574 537
575targets += $(multi-used-y) $(multi-used-m) 538targets += $(multi-used-m)
576targets := $(filter-out $(PHONY), $(targets)) 539targets := $(filter-out $(PHONY), $(targets))
577 540
578# Descending 541# Descending
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index a6f538b31ad6..e3215b7652ee 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -27,7 +27,7 @@ modorder := $(patsubst %/,%/modules.order, $(filter %/, $(obj-y)) $(obj-m:.o=.ko
27 27
28# Handle objects in subdirs 28# Handle objects in subdirs
29# --------------------------------------------------------------------------- 29# ---------------------------------------------------------------------------
30# o if we encounter foo/ in $(obj-y), replace it by foo/built-in.o 30# o if we encounter foo/ in $(obj-y), replace it by foo/built-in.a
31# and add the directory to the list of dirs to descend into: $(subdir-y) 31# and add the directory to the list of dirs to descend into: $(subdir-y)
32# o if we encounter foo/ in $(obj-m), remove it from $(obj-m) 32# o if we encounter foo/ in $(obj-m), remove it from $(obj-m)
33# and add the directory to the list of dirs to descend into: $(subdir-m) 33# and add the directory to the list of dirs to descend into: $(subdir-m)
@@ -35,7 +35,7 @@ __subdir-y := $(patsubst %/,%,$(filter %/, $(obj-y)))
35subdir-y += $(__subdir-y) 35subdir-y += $(__subdir-y)
36__subdir-m := $(patsubst %/,%,$(filter %/, $(obj-m))) 36__subdir-m := $(patsubst %/,%,$(filter %/, $(obj-m)))
37subdir-m += $(__subdir-m) 37subdir-m += $(__subdir-m)
38obj-y := $(patsubst %/, %/built-in.o, $(obj-y)) 38obj-y := $(patsubst %/, %/built-in.a, $(obj-y))
39obj-m := $(filter-out %/, $(obj-m)) 39obj-m := $(filter-out %/, $(obj-m))
40 40
41# Subdirectories we need to descend into 41# Subdirectories we need to descend into
@@ -47,18 +47,14 @@ multi-used-m := $(sort $(foreach m,$(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m
47multi-used := $(multi-used-y) $(multi-used-m) 47multi-used := $(multi-used-y) $(multi-used-m)
48single-used-m := $(sort $(filter-out $(multi-used-m),$(obj-m))) 48single-used-m := $(sort $(filter-out $(multi-used-m),$(obj-m)))
49 49
50# Build list of the parts of our composite objects, our composite
51# objects depend on those (obviously)
52multi-objs-y := $(foreach m, $(multi-used-y), $($(m:.o=-objs)) $($(m:.o=-y)))
53multi-objs-m := $(foreach m, $(multi-used-m), $($(m:.o=-objs)) $($(m:.o=-y)))
54
55# $(subdir-obj-y) is the list of objects in $(obj-y) which uses dir/ to 50# $(subdir-obj-y) is the list of objects in $(obj-y) which uses dir/ to
56# tell kbuild to descend 51# tell kbuild to descend
57subdir-obj-y := $(filter %/built-in.o, $(obj-y)) 52subdir-obj-y := $(filter %/built-in.a, $(obj-y))
58 53
59# Replace multi-part objects by their individual parts, look at local dir only 54# Replace multi-part objects by their individual parts,
60real-objs-y := $(foreach m, $(filter-out $(subdir-obj-y), $(obj-y)), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) 55# including built-in.a from subdirectories
61real-objs-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))),$($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m)),$(m))) 56real-obj-y := $(foreach m, $(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m)))
57real-obj-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))),$($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m)),$(m)))
62 58
63# DTB 59# DTB
64# If CONFIG_OF_ALL_DTBS is enabled, all DT blobs are built 60# If CONFIG_OF_ALL_DTBS is enabled, all DT blobs are built
@@ -71,29 +67,29 @@ extra-y := $(addprefix $(obj)/,$(extra-y))
71always := $(addprefix $(obj)/,$(always)) 67always := $(addprefix $(obj)/,$(always))
72targets := $(addprefix $(obj)/,$(targets)) 68targets := $(addprefix $(obj)/,$(targets))
73modorder := $(addprefix $(obj)/,$(modorder)) 69modorder := $(addprefix $(obj)/,$(modorder))
74obj-y := $(addprefix $(obj)/,$(obj-y))
75obj-m := $(addprefix $(obj)/,$(obj-m)) 70obj-m := $(addprefix $(obj)/,$(obj-m))
76lib-y := $(addprefix $(obj)/,$(lib-y)) 71lib-y := $(addprefix $(obj)/,$(lib-y))
77subdir-obj-y := $(addprefix $(obj)/,$(subdir-obj-y)) 72subdir-obj-y := $(addprefix $(obj)/,$(subdir-obj-y))
78real-objs-y := $(addprefix $(obj)/,$(real-objs-y)) 73real-obj-y := $(addprefix $(obj)/,$(real-obj-y))
79real-objs-m := $(addprefix $(obj)/,$(real-objs-m)) 74real-obj-m := $(addprefix $(obj)/,$(real-obj-m))
80single-used-m := $(addprefix $(obj)/,$(single-used-m)) 75single-used-m := $(addprefix $(obj)/,$(single-used-m))
81multi-used-y := $(addprefix $(obj)/,$(multi-used-y))
82multi-used-m := $(addprefix $(obj)/,$(multi-used-m)) 76multi-used-m := $(addprefix $(obj)/,$(multi-used-m))
83multi-objs-y := $(addprefix $(obj)/,$(multi-objs-y))
84multi-objs-m := $(addprefix $(obj)/,$(multi-objs-m))
85subdir-ym := $(addprefix $(obj)/,$(subdir-ym)) 77subdir-ym := $(addprefix $(obj)/,$(subdir-ym))
86 78
79# Finds the multi-part object the current object will be linked into.
80# If the object belongs to two or more multi-part objects, all of them are
81# concatenated with a colon separator.
82modname-multi = $(subst $(space),:,$(sort $(foreach m,$(multi-used),\
83 $(if $(filter $*.o, $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))),$(m:.o=)))))
84
85modname = $(if $(modname-multi),$(modname-multi),$(basetarget))
86
87# These flags are needed for modversions and compiling, so we define them here 87# These flags are needed for modversions and compiling, so we define them here
88# $(modname_flags) defines KBUILD_MODNAME as the name of the module it will 88# $(modname_flags) defines KBUILD_MODNAME as the name of the module it will
89# end up in (or would, if it gets compiled in) 89# end up in (or would, if it gets compiled in)
90# Note: Files that end up in two or more modules are compiled without the
91# KBUILD_MODNAME definition. The reason is that any made-up name would
92# differ in different configs.
93name-fix = $(squote)$(quote)$(subst $(comma),_,$(subst -,_,$1))$(quote)$(squote) 90name-fix = $(squote)$(quote)$(subst $(comma),_,$(subst -,_,$1))$(quote)$(squote)
94basename_flags = -DKBUILD_BASENAME=$(call name-fix,$(basetarget)) 91basename_flags = -DKBUILD_BASENAME=$(call name-fix,$(basetarget))
95modname_flags = $(if $(filter 1,$(words $(modname))),\ 92modname_flags = -DKBUILD_MODNAME=$(call name-fix,$(modname))
96 -DKBUILD_MODNAME=$(call name-fix,$(modname)))
97 93
98orig_c_flags = $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) \ 94orig_c_flags = $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) \
99 $(ccflags-y) $(CFLAGS_$(basetarget).o) 95 $(ccflags-y) $(CFLAGS_$(basetarget).o)
@@ -156,6 +152,7 @@ __cpp_flags = $(call flags,_cpp_flags)
156endif 152endif
157 153
158c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \ 154c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \
155 -include $(srctree)/include/linux/compiler_types.h \
159 $(__c_flags) $(modkern_cflags) \ 156 $(__c_flags) $(modkern_cflags) \
160 $(basename_flags) $(modname_flags) 157 $(basename_flags) $(modname_flags)
161 158
@@ -173,10 +170,6 @@ dtc_cpp_flags = -Wp,-MD,$(depfile).pre.tmp -nostdinc \
173 $(addprefix -I,$(DTC_INCLUDE)) \ 170 $(addprefix -I,$(DTC_INCLUDE)) \
174 -undef -D__DTS__ 171 -undef -D__DTS__
175 172
176# Finds the multi-part object the current object will be linked into
177modname-multi = $(sort $(foreach m,$(multi-used),\
178 $(if $(filter $(subst $(obj)/,,$*.o), $($(m:.o=-objs)) $($(m:.o=-y))),$(m:.o=))))
179
180# Useful for describing the dependency of composite objects 173# Useful for describing the dependency of composite objects
181# Usage: 174# Usage:
182# $(call multi_depend, multi_used_targets, suffix_to_remove, suffix_to_add) 175# $(call multi_depend, multi_used_targets, suffix_to_remove, suffix_to_add)
@@ -329,7 +322,7 @@ dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp)
329size_append = printf $(shell \ 322size_append = printf $(shell \
330dec_size=0; \ 323dec_size=0; \
331for F in $1; do \ 324for F in $1; do \
332 fsize=$$(stat -c "%s" $$F); \ 325 fsize=$$($(CONFIG_SHELL) $(srctree)/scripts/file-size.sh $$F); \
333 dec_size=$$(expr $$dec_size + $$fsize); \ 326 dec_size=$$(expr $$dec_size + $$fsize); \
334done; \ 327done; \
335printf "%08x\n" $$dec_size | \ 328printf "%08x\n" $$dec_size | \
diff --git a/scripts/adjust_autoksyms.sh b/scripts/adjust_autoksyms.sh
index d67830e6e360..016b3c48a4ec 100755
--- a/scripts/adjust_autoksyms.sh
+++ b/scripts/adjust_autoksyms.sh
@@ -48,9 +48,6 @@ case "${KCONFIG_CONFIG}" in
48 . "./${KCONFIG_CONFIG}" 48 . "./${KCONFIG_CONFIG}"
49esac 49esac
50 50
51# In case it doesn't exist yet...
52if [ -e "$cur_ksyms_file" ]; then touch "$cur_ksyms_file"; fi
53
54# Generate a new ksym list file with symbols needed by the current 51# Generate a new ksym list file with symbols needed by the current
55# set of modules. 52# set of modules.
56cat > "$new_ksyms_file" << EOT 53cat > "$new_ksyms_file" << EOT
@@ -60,7 +57,9 @@ cat > "$new_ksyms_file" << EOT
60 57
61EOT 58EOT
62[ "$(ls -A "$MODVERDIR")" ] && 59[ "$(ls -A "$MODVERDIR")" ] &&
63sed -ns -e '3{s/ /\n/g;/^$/!p;}' "$MODVERDIR"/*.mod | sort -u | 60for mod in "$MODVERDIR"/*.mod; do
61 sed -n -e '3{s/ /\n/g;/^$/!p;}' "$mod"
62done | sort -u |
64while read sym; do 63while read sym; do
65 if [ -n "$CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX" ]; then 64 if [ -n "$CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX" ]; then
66 sym="${sym#_}" 65 sym="${sym#_}"
@@ -81,7 +80,7 @@ sort "$cur_ksyms_file" "$new_ksyms_file" | uniq -u |
81sed -n 's/^#define __KSYM_\(.*\) 1/\1/p' | tr "A-Z_" "a-z/" | 80sed -n 's/^#define __KSYM_\(.*\) 1/\1/p' | tr "A-Z_" "a-z/" |
82while read sympath; do 81while read sympath; do
83 if [ -z "$sympath" ]; then continue; fi 82 if [ -z "$sympath" ]; then continue; fi
84 depfile="include/config/ksym/${sympath}.h" 83 depfile="include/ksym/${sympath}.h"
85 mkdir -p "$(dirname "$depfile")" 84 mkdir -p "$(dirname "$depfile")"
86 touch "$depfile" 85 touch "$depfile"
87 # Filesystems with coarse time precision may create timestamps 86 # Filesystems with coarse time precision may create timestamps
diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c
index 449b68c4c90c..f387538c58bc 100644
--- a/scripts/basic/fixdep.c
+++ b/scripts/basic/fixdep.c
@@ -113,11 +113,11 @@ static void usage(void)
113/* 113/*
114 * Print out a dependency path from a symbol name 114 * Print out a dependency path from a symbol name
115 */ 115 */
116static void print_config(const char *m, int slen) 116static void print_dep(const char *m, int slen, const char *dir)
117{ 117{
118 int c, i; 118 int c, i;
119 119
120 printf(" $(wildcard include/config/"); 120 printf(" $(wildcard %s/", dir);
121 for (i = 0; i < slen; i++) { 121 for (i = 0; i < slen; i++) {
122 c = m[i]; 122 c = m[i];
123 if (c == '_') 123 if (c == '_')
@@ -140,7 +140,7 @@ static void do_extra_deps(void)
140 fprintf(stderr, "fixdep: bad data on stdin\n"); 140 fprintf(stderr, "fixdep: bad data on stdin\n");
141 exit(1); 141 exit(1);
142 } 142 }
143 print_config(buf, len - 1); 143 print_dep(buf, len - 1, "include/ksym");
144 } 144 }
145} 145}
146 146
@@ -208,7 +208,7 @@ static void use_config(const char *m, int slen)
208 return; 208 return;
209 209
210 define_config(m, slen, hash); 210 define_config(m, slen, hash);
211 print_config(m, slen); 211 print_dep(m, slen, "include/config");
212} 212}
213 213
214/* test if s ends in sub */ 214/* test if s ends in sub */
diff --git a/scripts/clang-version.sh b/scripts/clang-version.sh
new file mode 100755
index 000000000000..9780efa56980
--- /dev/null
+++ b/scripts/clang-version.sh
@@ -0,0 +1,33 @@
1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0
3#
4# clang-version [-p] clang-command
5#
6# Prints the compiler version of `clang-command' in a canonical 4-digit form
7# such as `0500' for clang-5.0 etc.
8#
9# With the -p option, prints the patchlevel as well, for example `050001' for
10# clang-5.0.1 etc.
11#
12
13if [ "$1" = "-p" ] ; then
14 with_patchlevel=1;
15 shift;
16fi
17
18compiler="$*"
19
20if [ ${#compiler} -eq 0 ]; then
21 echo "Error: No compiler specified."
22 printf "Usage:\n\t$0 <clang-command>\n"
23 exit 1
24fi
25
26MAJOR=$(echo __clang_major__ | $compiler -E -x c - | tail -n 1)
27MINOR=$(echo __clang_minor__ | $compiler -E -x c - | tail -n 1)
28if [ "x$with_patchlevel" != "x" ] ; then
29 PATCHLEVEL=$(echo __clang_patchlevel__ | $compiler -E -x c - | tail -n 1)
30 printf "%02d%02d%02d\\n" $MAJOR $MINOR $PATCHLEVEL
31else
32 printf "%02d%02d\\n" $MAJOR $MINOR
33fi
diff --git a/scripts/file-size.sh b/scripts/file-size.sh
new file mode 100755
index 000000000000..7eb7423416b5
--- /dev/null
+++ b/scripts/file-size.sh
@@ -0,0 +1,4 @@
1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0
3set -- $(ls -dn "$1")
4printf '%s\n' "$5"
diff --git a/scripts/gen_initramfs_list.sh b/scripts/gen_initramfs_list.sh
index 86a3c0e5cfbc..10e528b3a08f 100755
--- a/scripts/gen_initramfs_list.sh
+++ b/scripts/gen_initramfs_list.sh
@@ -194,7 +194,7 @@ input_file() {
194 source="$1" 194 source="$1"
195 if [ -f "$1" ]; then 195 if [ -f "$1" ]; then
196 ${dep_list}header "$1" 196 ${dep_list}header "$1"
197 is_cpio="$(echo "$1" | sed 's/^.*\.cpio\(\..*\)\?/cpio/')" 197 is_cpio="$(echo "$1" | sed 's/^.*\.cpio\(\..*\)\{0,1\}/cpio/')"
198 if [ $2 -eq 0 -a ${is_cpio} = "cpio" ]; then 198 if [ $2 -eq 0 -a ${is_cpio} = "cpio" ]; then
199 cpio_file=$1 199 cpio_file=$1
200 echo "$1" | grep -q '^.*\.cpio\..*' && is_cpio_compressed="compressed" 200 echo "$1" | grep -q '^.*\.cpio\..*' && is_cpio_compressed="compressed"
diff --git a/scripts/headers_install.sh b/scripts/headers_install.sh
index a18bca720995..593f8879c641 100755
--- a/scripts/headers_install.sh
+++ b/scripts/headers_install.sh
@@ -31,13 +31,13 @@ trap 'rm -f "$OUTDIR/$FILE" "$OUTDIR/$FILE.sed"' EXIT
31for i in "$@" 31for i in "$@"
32do 32do
33 FILE="$(basename "$i")" 33 FILE="$(basename "$i")"
34 sed -r \ 34 sed -E \
35 -e 's/([ \t(])(__user|__force|__iomem)[ \t]/\1/g' \ 35 -e 's/([[:space:](])(__user|__force|__iomem)[[:space:]]/\1/g' \
36 -e 's/__attribute_const__([ \t]|$)/\1/g' \ 36 -e 's/__attribute_const__([[:space:]]|$)/\1/g' \
37 -e 's@^#include <linux/compiler(|_types).h>@@' \ 37 -e 's@^#include <linux/compiler(|_types).h>@@' \
38 -e 's/(^|[^a-zA-Z0-9])__packed([^a-zA-Z0-9_]|$)/\1__attribute__((packed))\2/g' \ 38 -e 's/(^|[^a-zA-Z0-9])__packed([^a-zA-Z0-9_]|$)/\1__attribute__((packed))\2/g' \
39 -e 's/(^|[ \t(])(inline|asm|volatile)([ \t(]|$)/\1__\2__\3/g' \ 39 -e 's/(^|[[:space:](])(inline|asm|volatile)([[:space:](]|$)/\1__\2__\3/g' \
40 -e 's@#(ifndef|define|endif[ \t]*/[*])[ \t]*_UAPI@#\1 @' \ 40 -e 's@#(ifndef|define|endif[[:space:]]*/[*])[[:space:]]*_UAPI@#\1 @' \
41 "$SRCDIR/$i" > "$OUTDIR/$FILE.sed" || exit 1 41 "$SRCDIR/$i" > "$OUTDIR/$FILE.sed" || exit 1
42 scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__ "$OUTDIR/$FILE.sed" \ 42 scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__ "$OUTDIR/$FILE.sed" \
43 > "$OUTDIR/$FILE" 43 > "$OUTDIR/$FILE"
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index cb3ec53a7c29..eb139a17383c 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -38,8 +38,6 @@ nconfig: $(obj)/nconf
38# for external use. 38# for external use.
39silentoldconfig: $(obj)/conf 39silentoldconfig: $(obj)/conf
40 $(Q)mkdir -p include/config include/generated 40 $(Q)mkdir -p include/config include/generated
41 $(Q)test -e include/generated/autoksyms.h || \
42 touch include/generated/autoksyms.h
43 $< $(silent) --$@ $(Kconfig) 41 $< $(silent) --$@ $(Kconfig)
44 42
45localyesconfig localmodconfig: $(obj)/streamline_config.pl $(obj)/conf 43localyesconfig localmodconfig: $(obj)/streamline_config.pl $(obj)/conf
diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
index be56a1153014..9045823c7be7 100755
--- a/scripts/link-vmlinux.sh
+++ b/scripts/link-vmlinux.sh
@@ -4,7 +4,7 @@
4# link vmlinux 4# link vmlinux
5# 5#
6# vmlinux is linked from the objects selected by $(KBUILD_VMLINUX_INIT) and 6# vmlinux is linked from the objects selected by $(KBUILD_VMLINUX_INIT) and
7# $(KBUILD_VMLINUX_MAIN) and $(KBUILD_VMLINUX_LIBS). Most are built-in.o files 7# $(KBUILD_VMLINUX_MAIN) and $(KBUILD_VMLINUX_LIBS). Most are built-in.a files
8# from top-level directories in the kernel tree, others are specified in 8# from top-level directories in the kernel tree, others are specified in
9# arch/$(ARCH)/Makefile. Ordering when linking is important, and 9# arch/$(ARCH)/Makefile. Ordering when linking is important, and
10# $(KBUILD_VMLINUX_INIT) must be first. $(KBUILD_VMLINUX_LIBS) are archives 10# $(KBUILD_VMLINUX_INIT) must be first. $(KBUILD_VMLINUX_LIBS) are archives
@@ -18,7 +18,7 @@
18# | +--< init/version.o + more 18# | +--< init/version.o + more
19# | 19# |
20# +--< $(KBUILD_VMLINUX_MAIN) 20# +--< $(KBUILD_VMLINUX_MAIN)
21# | +--< drivers/built-in.o mm/built-in.o + more 21# | +--< drivers/built-in.a mm/built-in.a + more
22# | 22# |
23# +--< $(KBUILD_VMLINUX_LIBS) 23# +--< $(KBUILD_VMLINUX_LIBS)
24# | +--< lib/lib.a + more 24# | +--< lib/lib.a + more
@@ -51,17 +51,15 @@ info()
51# 51#
52# Traditional incremental style of link does not require this step 52# Traditional incremental style of link does not require this step
53# 53#
54# built-in.o output file 54# built-in.a output file
55# 55#
56archive_builtin() 56archive_builtin()
57{ 57{
58 if [ -n "${CONFIG_THIN_ARCHIVES}" ]; then 58 info AR built-in.a
59 info AR built-in.o 59 rm -f built-in.a;
60 rm -f built-in.o; 60 ${AR} rcsTP${KBUILD_ARFLAGS} built-in.a \
61 ${AR} rcsTP${KBUILD_ARFLAGS} built-in.o \ 61 ${KBUILD_VMLINUX_INIT} \
62 ${KBUILD_VMLINUX_INIT} \ 62 ${KBUILD_VMLINUX_MAIN}
63 ${KBUILD_VMLINUX_MAIN}
64 fi
65} 63}
66 64
67# Link of vmlinux.o used for section mismatch analysis 65# Link of vmlinux.o used for section mismatch analysis
@@ -70,20 +68,13 @@ modpost_link()
70{ 68{
71 local objects 69 local objects
72 70
73 if [ -n "${CONFIG_THIN_ARCHIVES}" ]; then 71 objects="--whole-archive \
74 objects="--whole-archive \ 72 built-in.a \
75 built-in.o \ 73 --no-whole-archive \
76 --no-whole-archive \ 74 --start-group \
77 --start-group \ 75 ${KBUILD_VMLINUX_LIBS} \
78 ${KBUILD_VMLINUX_LIBS} \ 76 --end-group"
79 --end-group" 77
80 else
81 objects="${KBUILD_VMLINUX_INIT} \
82 --start-group \
83 ${KBUILD_VMLINUX_MAIN} \
84 ${KBUILD_VMLINUX_LIBS} \
85 --end-group"
86 fi
87 ${LD} ${LDFLAGS} -r -o ${1} ${objects} 78 ${LD} ${LDFLAGS} -r -o ${1} ${objects}
88} 79}
89 80
@@ -96,46 +87,28 @@ vmlinux_link()
96 local objects 87 local objects
97 88
98 if [ "${SRCARCH}" != "um" ]; then 89 if [ "${SRCARCH}" != "um" ]; then
99 if [ -n "${CONFIG_THIN_ARCHIVES}" ]; then 90 objects="--whole-archive \
100 objects="--whole-archive \ 91 built-in.a \
101 built-in.o \ 92 --no-whole-archive \
102 --no-whole-archive \ 93 --start-group \
103 --start-group \ 94 ${KBUILD_VMLINUX_LIBS} \
104 ${KBUILD_VMLINUX_LIBS} \ 95 --end-group \
105 --end-group \ 96 ${1}"
106 ${1}" 97
107 else 98 ${LD} ${LDFLAGS} ${LDFLAGS_vmlinux} -o ${2} \
108 objects="${KBUILD_VMLINUX_INIT} \
109 --start-group \
110 ${KBUILD_VMLINUX_MAIN} \
111 ${KBUILD_VMLINUX_LIBS} \
112 --end-group \
113 ${1}"
114 fi
115
116 ${LD} ${LDFLAGS} ${LDFLAGS_vmlinux} -o ${2} \
117 -T ${lds} ${objects} 99 -T ${lds} ${objects}
118 else 100 else
119 if [ -n "${CONFIG_THIN_ARCHIVES}" ]; then 101 objects="-Wl,--whole-archive \
120 objects="-Wl,--whole-archive \ 102 built-in.a \
121 built-in.o \ 103 -Wl,--no-whole-archive \
122 -Wl,--no-whole-archive \ 104 -Wl,--start-group \
123 -Wl,--start-group \ 105 ${KBUILD_VMLINUX_LIBS} \
124 ${KBUILD_VMLINUX_LIBS} \ 106 -Wl,--end-group \
125 -Wl,--end-group \ 107 ${1}"
126 ${1}" 108
127 else 109 ${CC} ${CFLAGS_vmlinux} -o ${2} \
128 objects="${KBUILD_VMLINUX_INIT} \ 110 -Wl,-T,${lds} \
129 -Wl,--start-group \ 111 ${objects} \
130 ${KBUILD_VMLINUX_MAIN} \
131 ${KBUILD_VMLINUX_LIBS} \
132 -Wl,--end-group \
133 ${1}"
134 fi
135
136 ${CC} ${CFLAGS_vmlinux} -o ${2} \
137 -Wl,-T,${lds} \
138 ${objects} \
139 -lutil -lrt -lpthread 112 -lutil -lrt -lpthread
140 rm -f linux 113 rm -f linux
141 fi 114 fi
@@ -191,7 +164,7 @@ cleanup()
191 rm -f .tmp_System.map 164 rm -f .tmp_System.map
192 rm -f .tmp_kallsyms* 165 rm -f .tmp_kallsyms*
193 rm -f .tmp_vmlinux* 166 rm -f .tmp_vmlinux*
194 rm -f built-in.o 167 rm -f built-in.a
195 rm -f System.map 168 rm -f System.map
196 rm -f vmlinux 169 rm -f vmlinux
197 rm -f vmlinux.o 170 rm -f vmlinux.o
@@ -296,8 +269,8 @@ if [ -n "${CONFIG_KALLSYMS}" ]; then
296 kallsyms .tmp_vmlinux2 .tmp_kallsyms2.o 269 kallsyms .tmp_vmlinux2 .tmp_kallsyms2.o
297 270
298 # step 3 271 # step 3
299 size1=$(stat -c "%s" .tmp_kallsyms1.o) 272 size1=$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" .tmp_kallsyms1.o)
300 size2=$(stat -c "%s" .tmp_kallsyms2.o) 273 size2=$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" .tmp_kallsyms2.o)
301 274
302 if [ $size1 -ne $size2 ] || [ -n "${KALLSYMS_EXTRA_PASS}" ]; then 275 if [ $size1 -ne $size2 ] || [ -n "${KALLSYMS_EXTRA_PASS}" ]; then
303 kallsymso=.tmp_kallsyms3.o 276 kallsymso=.tmp_kallsyms3.o
diff --git a/scripts/namespace.pl b/scripts/namespace.pl
index 729c547fc9e1..6135574a6f39 100755
--- a/scripts/namespace.pl
+++ b/scripts/namespace.pl
@@ -164,7 +164,7 @@ sub linux_objects
164 s:^\./::; 164 s:^\./::;
165 if (/.*\.o$/ && 165 if (/.*\.o$/ &&
166 ! ( 166 ! (
167 m:/built-in.o$: 167 m:/built-in.a$:
168 || m:arch/x86/vdso/: 168 || m:arch/x86/vdso/:
169 || m:arch/x86/boot/: 169 || m:arch/x86/boot/:
170 || m:arch/ia64/ia32/ia32.o$: 170 || m:arch/ia64/ia32/ia32.o$:
diff --git a/usr/initramfs_data.S b/usr/initramfs_data.S
index 10d325e24566..b28da799f6a6 100644
--- a/usr/initramfs_data.S
+++ b/usr/initramfs_data.S
@@ -10,7 +10,7 @@
10 10
11 ld -m elf_i386 --format binary --oformat elf32-i386 -r \ 11 ld -m elf_i386 --format binary --oformat elf32-i386 -r \
12 -T initramfs_data.scr initramfs_data.cpio.gz -o initramfs_data.o 12 -T initramfs_data.scr initramfs_data.cpio.gz -o initramfs_data.o
13 ld -m elf_i386 -r -o built-in.o initramfs_data.o 13 ld -m elf_i386 -r -o built-in.a initramfs_data.o
14 14
15 For including the .init.ramfs sections, see include/asm-generic/vmlinux.lds. 15 For including the .init.ramfs sections, see include/asm-generic/vmlinux.lds.
16 16