diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-04-03 18:51:22 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-04-03 18:51:22 -0400 |
commit | 3b24b83763e72a6c1e728100104fd99aa83a7b3b (patch) | |
tree | bd493c47804a9fe1e85ee41c2532b4748fca0b25 | |
parent | 0734e00ef9e48e78c5c3ce1648572f160d07e323 (diff) | |
parent | a95b37e20db9a2b05354eec009b2188523a21c8e (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-- | .gitignore | 1 | ||||
-rw-r--r-- | Documentation/kbuild/kbuild.txt | 4 | ||||
-rw-r--r-- | Documentation/kbuild/makefiles.txt | 28 | ||||
-rw-r--r-- | Documentation/process/changes.rst | 2 | ||||
-rw-r--r-- | Makefile | 89 | ||||
-rw-r--r-- | arch/Kconfig | 6 | ||||
-rwxr-xr-x | arch/arm/boot/deflate_xip_data.sh | 2 | ||||
-rwxr-xr-x | arch/powerpc/boot/wrapper | 2 | ||||
-rw-r--r-- | arch/powerpc/kernel/Makefile | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/cavium/liquidio/Makefile | 51 | ||||
-rw-r--r-- | drivers/s390/Makefile | 2 | ||||
-rw-r--r-- | include/linux/kconfig.h | 3 | ||||
-rw-r--r-- | lib/Kconfig.debug | 4 | ||||
-rw-r--r-- | lib/zstd/Makefile | 17 | ||||
-rw-r--r-- | scripts/Kbuild.include | 6 | ||||
-rw-r--r-- | scripts/Makefile.build | 97 | ||||
-rw-r--r-- | scripts/Makefile.lib | 47 | ||||
-rwxr-xr-x | scripts/adjust_autoksyms.sh | 9 | ||||
-rw-r--r-- | scripts/basic/fixdep.c | 8 | ||||
-rwxr-xr-x | scripts/clang-version.sh | 33 | ||||
-rwxr-xr-x | scripts/file-size.sh | 4 | ||||
-rwxr-xr-x | scripts/gen_initramfs_list.sh | 2 | ||||
-rwxr-xr-x | scripts/headers_install.sh | 10 | ||||
-rw-r--r-- | scripts/kconfig/Makefile | 2 | ||||
-rwxr-xr-x | scripts/link-vmlinux.sh | 103 | ||||
-rwxr-xr-x | scripts/namespace.pl | 2 | ||||
-rw-r--r-- | usr/initramfs_data.S | 2 |
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 | # |
88 | include/config | 88 | include/config |
89 | include/generated | 89 | include/generated |
90 | include/ksym | ||
90 | arch/*/include/generated | 91 | arch/*/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 | -------------------------------------------------- |
51 | Additional options used for $(LD) when linking modules. | 51 | Additional options used for $(LD) when linking modules. |
52 | 52 | ||
53 | LDFLAGS_vmlinux | ||
54 | -------------------------------------------------- | ||
55 | Additional options passed to final link of vmlinux. | ||
56 | |||
57 | KBUILD_VERBOSE | 53 | KBUILD_VERBOSE |
58 | -------------------------------------------------- | 54 | -------------------------------------------------- |
59 | Set the kbuild verbosity. Can be assigned same values as "V=...". | 55 | Set 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 | ||
80 | The build system has, as of 4.13, switched to using thin archives (`ar T`) | 80 | The build system has, as of 4.13, switched to using thin archives (`ar T`) |
81 | rather than incremental linking (`ld -r`) for built-in.o intermediate steps. | 81 | rather than incremental linking (`ld -r`) for built-in.a intermediate steps. |
82 | This requires binutils 2.20 or newer. | 82 | This requires binutils 2.20 or newer. |
83 | 83 | ||
84 | Flex | 84 | Flex |
@@ -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 | |||
220 | version_h := include/generated/uapi/linux/version.h | 220 | version_h := include/generated/uapi/linux/version.h |
221 | old_version_h := include/linux/version.h | 221 | old_version_h := include/linux/version.h |
222 | 222 | ||
223 | no-dot-config-targets := clean mrproper distclean \ | 223 | clean-targets := %clean mrproper cleandocs |
224 | no-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 |
245 | endif | 246 | endif |
247 | |||
248 | # For "make -j clean all", "make -j mrproper defconfig all", etc. | ||
249 | ifneq ($(filter $(clean-targets),$(MAKECMDGOALS)),) | ||
250 | ifneq ($(filter-out $(clean-targets),$(MAKECMDGOALS)),) | ||
251 | mixed-targets := 1 | ||
252 | endif | ||
253 | endif | ||
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 |
247 | ifneq ($(filter install,$(MAKECMDGOALS)),) | 256 | ifneq ($(filter install,$(MAKECMDGOALS)),) |
248 | ifneq ($(filter modules_install,$(MAKECMDGOALS)),) | 257 | ifneq ($(filter modules_install,$(MAKECMDGOALS)),) |
@@ -418,6 +427,7 @@ KBUILD_CFLAGS_KERNEL := | |||
418 | KBUILD_AFLAGS_MODULE := -DMODULE | 427 | KBUILD_AFLAGS_MODULE := -DMODULE |
419 | KBUILD_CFLAGS_MODULE := -DMODULE | 428 | KBUILD_CFLAGS_MODULE := -DMODULE |
420 | KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds | 429 | KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds |
430 | LDFLAGS := | ||
421 | GCC_PLUGINS_CFLAGS := | 431 | GCC_PLUGINS_CFLAGS := |
422 | 432 | ||
423 | export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC | 433 | export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC |
@@ -556,14 +566,6 @@ endif | |||
556 | export KBUILD_MODULES KBUILD_BUILTIN | 566 | export KBUILD_MODULES KBUILD_BUILTIN |
557 | 567 | ||
558 | ifeq ($(KBUILD_EXTMOD),) | 568 | ifeq ($(KBUILD_EXTMOD),) |
559 | # Additional helpers built in scripts/ | ||
560 | # Carefully list dependencies so we do not try to build scripts twice | ||
561 | # in parallel | ||
562 | PHONY += scripts | ||
563 | scripts: 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 |
568 | init-y := init/ | 570 | init-y := init/ |
569 | drivers-y := drivers/ sound/ firmware/ | 571 | drivers-y := drivers/ sound/ firmware/ |
@@ -611,13 +613,6 @@ else | |||
611 | include/config/auto.conf: ; | 613 | include/config/auto.conf: ; |
612 | endif # $(dot-config) | 614 | endif # $(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) | ||
617 | ifdef CONFIG_TRIM_UNUSED_KSYMS | ||
618 | KBUILD_MODULES := 1 | ||
619 | endif | ||
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) \ | |||
984 | vmlinux-alldirs := $(sort $(vmlinux-dirs) $(patsubst %/,%,$(filter %/, \ | 979 | vmlinux-alldirs := $(sort $(vmlinux-dirs) $(patsubst %/,%,$(filter %/, \ |
985 | $(init-) $(core-) $(drivers-) $(net-) $(libs-) $(virt-)))) | 980 | $(init-) $(core-) $(drivers-) $(net-) $(libs-) $(virt-)))) |
986 | 981 | ||
987 | init-y := $(patsubst %/, %/built-in.o, $(init-y)) | 982 | init-y := $(patsubst %/, %/built-in.a, $(init-y)) |
988 | core-y := $(patsubst %/, %/built-in.o, $(core-y)) | 983 | core-y := $(patsubst %/, %/built-in.a, $(core-y)) |
989 | drivers-y := $(patsubst %/, %/built-in.o, $(drivers-y)) | 984 | drivers-y := $(patsubst %/, %/built-in.a, $(drivers-y)) |
990 | net-y := $(patsubst %/, %/built-in.o, $(net-y)) | 985 | net-y := $(patsubst %/, %/built-in.a, $(net-y)) |
991 | libs-y1 := $(patsubst %/, %/lib.a, $(libs-y)) | 986 | libs-y1 := $(patsubst %/, %/lib.a, $(libs-y)) |
992 | libs-y2 := $(filter-out %.a, $(patsubst %/, %/built-in.o, $(libs-y))) | 987 | libs-y2 := $(patsubst %/, %/built-in.a, $(filter-out %.a, $(libs-y))) |
993 | virt-y := $(patsubst %/, %/built-in.o, $(virt-y)) | 988 | virt-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) |
996 | export KBUILD_VMLINUX_INIT := $(head-y) $(init-y) | 991 | export KBUILD_VMLINUX_INIT := $(head-y) $(init-y) |
@@ -1003,25 +998,26 @@ export KBUILD_ALLDIRS := $(sort $(filter-out arch/%,$(vmlinux-alldirs)) arch Doc | |||
1003 | 998 | ||
1004 | vmlinux-deps := $(KBUILD_LDS) $(KBUILD_VMLINUX_INIT) $(KBUILD_VMLINUX_MAIN) $(KBUILD_VMLINUX_LIBS) | 999 | vmlinux-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 | 1002 | PHONY += autoksyms_recursive |
1008 | # evaluated more than once. | 1003 | autoksyms_recursive: $(vmlinux-deps) |
1009 | PHONY += vmlinux_prereq | ||
1010 | vmlinux_prereq: $(vmlinux-deps) FORCE | ||
1011 | ifdef CONFIG_HEADERS_CHECK | ||
1012 | $(Q)$(MAKE) -f $(srctree)/Makefile headers_check | ||
1013 | endif | ||
1014 | ifdef CONFIG_GDB_SCRIPTS | ||
1015 | $(Q)ln -fsn $(abspath $(srctree)/scripts/gdb/vmlinux-gdb.py) | ||
1016 | endif | ||
1017 | ifdef CONFIG_TRIM_UNUSED_KSYMS | 1004 | ifdef 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" |
1020 | endif | 1007 | endif |
1021 | 1008 | ||
1022 | # standalone target for easier testing | 1009 | # For the kernel to actually contain only the needed exported symbols, |
1023 | include/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) |
1012 | ifdef CONFIG_TRIM_UNUSED_KSYMS | ||
1013 | KBUILD_MODULES := 1 | ||
1014 | endif | ||
1015 | |||
1016 | autoksyms_h := $(if $(CONFIG_TRIM_UNUSED_KSYMS), include/generated/autoksyms.h) | ||
1017 | |||
1018 | $(autoksyms_h): | ||
1019 | $(Q)mkdir -p $(dir $@) | ||
1020 | $(Q)touch $@ | ||
1025 | 1021 | ||
1026 | ARCH_POSTLINK := $(wildcard $(srctree)/arch/$(SRCARCH)/Makefile.postlink) | 1022 | ARCH_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 | ||
1033 | vmlinux: scripts/link-vmlinux.sh vmlinux_prereq $(vmlinux-deps) FORCE | 1029 | vmlinux: scripts/link-vmlinux.sh autoksyms_recursive $(vmlinux-deps) FORCE |
1030 | ifdef CONFIG_HEADERS_CHECK | ||
1031 | $(Q)$(MAKE) -f $(srctree)/Makefile headers_check | ||
1032 | endif | ||
1033 | ifdef CONFIG_GDB_SCRIPTS | ||
1034 | $(Q)ln -fsn $(abspath $(srctree)/scripts/gdb/vmlinux-gdb.py) | ||
1035 | endif | ||
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 | |||
1060 | include/config/kernel.release: include/config/auto.conf FORCE | 1062 | include/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 | ||
1068 | PHONY += scripts | ||
1069 | scripts: 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. |
1089 | prepare2: prepare3 prepare-compiler-check outputmakefile asm-generic | 1098 | prepare2: prepare3 prepare-compiler-check outputmakefile asm-generic |
1090 | 1099 | ||
1091 | prepare1: prepare2 $(version_h) include/generated/utsrelease.h \ | 1100 | prepare1: 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' |
1330 | CLEAN_DIRS += $(MODVERDIR) | 1339 | CLEAN_DIRS += $(MODVERDIR) include/ksym |
1331 | 1340 | ||
1332 | # Directories & files removed with 'make mrproper' | 1341 | # Directories & files removed with 'make mrproper' |
1333 | MRPROPER_DIRS += include/config usr/include include/generated \ | 1342 | MRPROPER_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 | ||
597 | endchoice | 597 | endchoice |
598 | 598 | ||
599 | config 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 | |||
605 | config LD_DEAD_CODE_DATA_ELIMINATION | 599 | config 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)) | |||
45 | data_end=$(($_edata_loc - $base_offset)) | 45 | data_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. |
48 | file_end=$(stat -c "%s" "$XIPIMAGE") | 48 | file_end=$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" "$XIPIMAGE") |
49 | if [ "$file_end" != "$data_end" ]; then | 49 | if [ "$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.$$" |
358 | strip_size=$(stat -c %s $vmz.$$) | 358 | strip_size=$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" "$vmz.$$") |
359 | 359 | ||
360 | if [ -z "$cacheit" -o ! -f "$vmz$compression" -o "$vmz$compression" -ot "$kernel" ]; then | 360 | if [ -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 | ||
167 | ifeq ($(CONFIG_PPC_OF_BOOT_TRAMPOLINE),y) | 167 | ifeq ($(CONFIG_PPC_OF_BOOT_TRAMPOLINE),y) |
168 | $(obj)/built-in.o: prom_init_check | 168 | $(obj)/built-in.a: prom_init_check |
169 | 169 | ||
170 | quiet_cmd_prom_init_check = CALL $< | 170 | quiet_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 | # |
5 | obj-$(CONFIG_LIQUIDIO) += liquidio.o | ||
6 | 5 | ||
7 | liquidio-$(CONFIG_LIQUIDIO) += lio_ethtool.o \ | 6 | common-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 | ||
21 | liquidio-objs := lio_main.o octeon_console.o lio_vf_rep.o $(liquidio-y) | 20 | obj-$(CONFIG_LIQUIDIO) += liquidio.o |
21 | liquidio-y := lio_main.o octeon_console.o lio_vf_rep.o $(common-objs) | ||
22 | 22 | ||
23 | obj-$(CONFIG_LIQUIDIO_VF) += liquidio_vf.o | 23 | obj-$(CONFIG_LIQUIDIO_VF) += liquidio_vf.o |
24 | 24 | liquidio_vf-y := lio_vf_main.o $(common-objs) | |
25 | ifeq ($(CONFIG_LIQUIDIO)$(CONFIG_LIQUIDIO_VF), yy) | ||
26 | liquidio_vf-objs := lio_vf_main.o | ||
27 | else | ||
28 | liquidio_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 | |||
42 | liquidio_vf-objs := lio_vf_main.o $(liquidio_vf-y) | ||
43 | endif | ||
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 | ||
6 | obj-y += cio/ block/ char/ crypto/ net/ scsi/ virtio/ | 6 | obj-y += cio/ block/ char/ crypto/ net/ scsi/ virtio/ |
7 | 7 | ||
8 | drivers-y += drivers/s390/built-in.o | 8 | drivers-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 | ||
4 | ccflags-y += -O3 | 4 | ccflags-y += -O3 |
5 | 5 | ||
6 | # Object files unique to zstd_compress and zstd_decompress | 6 | zstd_compress-y := fse_compress.o huf_compress.o compress.o \ |
7 | zstd_compress-y := fse_compress.o huf_compress.o compress.o | 7 | entropy_common.o fse_decompress.o zstd_common.o |
8 | zstd_decompress-y := huf_decompress.o decompress.o | 8 | zstd_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. | ||
14 | zstd_compress-y += entropy_common.o fse_decompress.o zstd_common.o | ||
15 | |||
16 | ifneq ($(CONFIG_ZSTD_COMPRESS)$(CONFIG_ZSTD_DECOMPRESS),yy) | ||
17 | zstd_decompress-y += entropy_common.o fse_decompress.o zstd_common.o | ||
18 | endif | ||
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) |
240 | ld-option = $(call try-run-cached,\ | 240 | ld-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 | ||
373 | cmd_and_fixdep = \ | 371 | cmd_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 | ||
74 | ifneq ($(strip $(lib-y) $(lib-m) $(lib-)),) | 74 | ifneq ($(strip $(lib-y) $(lib-m) $(lib-)),) |
75 | lib-target := $(obj)/lib.a | 75 | lib-target := $(obj)/lib.a |
76 | obj-y += $(obj)/lib-ksyms.o | 76 | real-obj-y += $(obj)/lib-ksyms.o |
77 | endif | 77 | endif |
78 | 78 | ||
79 | ifneq ($(strip $(obj-y) $(need-builtin)),) | 79 | ifneq ($(strip $(real-obj-y) $(need-builtin)),) |
80 | builtin-target := $(obj)/built-in.o | 80 | builtin-target := $(obj)/built-in.a |
81 | endif | 81 | endif |
82 | 82 | ||
83 | modorder-target := $(obj)/modules.order | 83 | modorder-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 $< ; |
105 | endif | 105 | endif |
106 | 106 | ||
107 | # Do section mismatch analysis for each module/built-in.o | 107 | # Do section mismatch analysis for each module/built-in.a |
108 | ifdef CONFIG_DEBUG_SECTION_MISMATCH | 108 | ifdef CONFIG_DEBUG_SECTION_MISMATCH |
109 | cmd_secanalysis = ; scripts/mod/modpost $@ | 109 | cmd_secanalysis = ; scripts/mod/modpost $@ |
110 | endif | 110 | endif |
@@ -119,29 +119,17 @@ modkern_cflags = \ | |||
119 | $(KBUILD_CFLAGS_KERNEL) $(CFLAGS_KERNEL)) | 119 | $(KBUILD_CFLAGS_KERNEL) $(CFLAGS_KERNEL)) |
120 | quiet_modtag := $(empty) $(empty) | 120 | quiet_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 | ||
135 | modname = $(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 | ||
146 | quiet_cmd_cc_s_c = CC $(quiet_modtag) $@ | 134 | quiet_cmd_cc_s_c = CC $(quiet_modtag) $@ |
147 | cmd_cc_s_c = $(CC) $(c_flags) $(DISABLE_LTO) -fverbose-asm -S -o $@ $< | 135 | cmd_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) |
316 | ifdef CONFIG_TRIM_UNUSED_KSYMS | 304 | ifdef CONFIG_TRIM_UNUSED_KSYMS |
317 | cmd_undef_syms = $(NM) $@ | sed -n 's/^ \+U //p' | xargs echo | 305 | cmd_undef_syms = $(NM) $@ | sed -n 's/^ *U //p' | xargs echo |
318 | else | 306 | else |
319 | cmd_undef_syms = echo | 307 | cmd_undef_syms = echo |
320 | endif | 308 | endif |
@@ -345,8 +333,8 @@ $(obj)/%.lst: $(src)/%.c FORCE | |||
345 | 333 | ||
346 | modkern_aflags := $(KBUILD_AFLAGS_KERNEL) $(AFLAGS_KERNEL) | 334 | modkern_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 | ||
427 | targets += $(real-objs-y) $(real-objs-m) $(lib-y) | 415 | targets += $(filter-out $(subdir-obj-y), $(real-obj-y)) $(real-obj-m) $(lib-y) |
428 | targets += $(extra-y) $(MAKECMDGOALS) $(always) | 416 | targets += $(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 | # |
459 | ifdef builtin-target | 447 | ifdef builtin-target |
460 | 448 | ||
461 | ifdef 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. |
465 | else | 453 | quiet_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 $@ | ||
469 | endif | ||
470 | |||
471 | # If the list of objects to link is empty, just create an empty built-in.o | ||
472 | cmd_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 | ||
480 | targets += $(builtin-target) | 460 | targets += $(builtin-target) |
481 | endif # builtin-target | 461 | endif # builtin-target |
@@ -499,11 +479,8 @@ $(modorder-target): $(subdir-ym) FORCE | |||
499 | ifdef lib-target | 479 | ifdef lib-target |
500 | quiet_cmd_link_l_target = AR $@ | 480 | quiet_cmd_link_l_target = AR $@ |
501 | 481 | ||
502 | ifdef 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) | 483 | cmd_link_l_target = rm -f $@; $(AR) rcsTP$(KBUILD_ARFLAGS) $@ $(lib-y) |
504 | else | ||
505 | cmd_link_l_target = rm -f $@; $(AR) rcs$(KBUILD_ARFLAGS) $@ $(lib-y) | ||
506 | endif | ||
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 | ||
552 | cmd_link_multi-link = $(LD) $(ld_flags) -r -o $@ $(link_multi_deps) $(cmd_secanalysis) | ||
553 | |||
554 | ifdef CONFIG_THIN_ARCHIVES | ||
555 | quiet_cmd_link_multi-y = AR $@ | ||
556 | cmd_link_multi-y = rm -f $@; $(AR) rcSTP$(KBUILD_ARFLAGS) $@ $(link_multi_deps) | ||
557 | else | ||
558 | quiet_cmd_link_multi-y = LD $@ | ||
559 | cmd_link_multi-y = $(cmd_link_multi-link) | ||
560 | endif | ||
561 | |||
562 | quiet_cmd_link_multi-m = LD [M] $@ | 529 | quiet_cmd_link_multi-m = LD [M] $@ |
563 | cmd_link_multi-m = $(cmd_link_multi-link) | 530 | cmd_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 | ||
575 | targets += $(multi-used-y) $(multi-used-m) | 538 | targets += $(multi-used-m) |
576 | targets := $(filter-out $(PHONY), $(targets)) | 539 | targets := $(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))) | |||
35 | subdir-y += $(__subdir-y) | 35 | subdir-y += $(__subdir-y) |
36 | __subdir-m := $(patsubst %/,%,$(filter %/, $(obj-m))) | 36 | __subdir-m := $(patsubst %/,%,$(filter %/, $(obj-m))) |
37 | subdir-m += $(__subdir-m) | 37 | subdir-m += $(__subdir-m) |
38 | obj-y := $(patsubst %/, %/built-in.o, $(obj-y)) | 38 | obj-y := $(patsubst %/, %/built-in.a, $(obj-y)) |
39 | obj-m := $(filter-out %/, $(obj-m)) | 39 | obj-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 | |||
47 | multi-used := $(multi-used-y) $(multi-used-m) | 47 | multi-used := $(multi-used-y) $(multi-used-m) |
48 | single-used-m := $(sort $(filter-out $(multi-used-m),$(obj-m))) | 48 | single-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) | ||
52 | multi-objs-y := $(foreach m, $(multi-used-y), $($(m:.o=-objs)) $($(m:.o=-y))) | ||
53 | multi-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 |
57 | subdir-obj-y := $(filter %/built-in.o, $(obj-y)) | 52 | subdir-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, |
60 | real-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 |
61 | real-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))) | 56 | real-obj-y := $(foreach m, $(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) |
57 | real-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)) | |||
71 | always := $(addprefix $(obj)/,$(always)) | 67 | always := $(addprefix $(obj)/,$(always)) |
72 | targets := $(addprefix $(obj)/,$(targets)) | 68 | targets := $(addprefix $(obj)/,$(targets)) |
73 | modorder := $(addprefix $(obj)/,$(modorder)) | 69 | modorder := $(addprefix $(obj)/,$(modorder)) |
74 | obj-y := $(addprefix $(obj)/,$(obj-y)) | ||
75 | obj-m := $(addprefix $(obj)/,$(obj-m)) | 70 | obj-m := $(addprefix $(obj)/,$(obj-m)) |
76 | lib-y := $(addprefix $(obj)/,$(lib-y)) | 71 | lib-y := $(addprefix $(obj)/,$(lib-y)) |
77 | subdir-obj-y := $(addprefix $(obj)/,$(subdir-obj-y)) | 72 | subdir-obj-y := $(addprefix $(obj)/,$(subdir-obj-y)) |
78 | real-objs-y := $(addprefix $(obj)/,$(real-objs-y)) | 73 | real-obj-y := $(addprefix $(obj)/,$(real-obj-y)) |
79 | real-objs-m := $(addprefix $(obj)/,$(real-objs-m)) | 74 | real-obj-m := $(addprefix $(obj)/,$(real-obj-m)) |
80 | single-used-m := $(addprefix $(obj)/,$(single-used-m)) | 75 | single-used-m := $(addprefix $(obj)/,$(single-used-m)) |
81 | multi-used-y := $(addprefix $(obj)/,$(multi-used-y)) | ||
82 | multi-used-m := $(addprefix $(obj)/,$(multi-used-m)) | 76 | multi-used-m := $(addprefix $(obj)/,$(multi-used-m)) |
83 | multi-objs-y := $(addprefix $(obj)/,$(multi-objs-y)) | ||
84 | multi-objs-m := $(addprefix $(obj)/,$(multi-objs-m)) | ||
85 | subdir-ym := $(addprefix $(obj)/,$(subdir-ym)) | 77 | subdir-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. | ||
82 | modname-multi = $(subst $(space),:,$(sort $(foreach m,$(multi-used),\ | ||
83 | $(if $(filter $*.o, $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))),$(m:.o=))))) | ||
84 | |||
85 | modname = $(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. | ||
93 | name-fix = $(squote)$(quote)$(subst $(comma),_,$(subst -,_,$1))$(quote)$(squote) | 90 | name-fix = $(squote)$(quote)$(subst $(comma),_,$(subst -,_,$1))$(quote)$(squote) |
94 | basename_flags = -DKBUILD_BASENAME=$(call name-fix,$(basetarget)) | 91 | basename_flags = -DKBUILD_BASENAME=$(call name-fix,$(basetarget)) |
95 | modname_flags = $(if $(filter 1,$(words $(modname))),\ | 92 | modname_flags = -DKBUILD_MODNAME=$(call name-fix,$(modname)) |
96 | -DKBUILD_MODNAME=$(call name-fix,$(modname))) | ||
97 | 93 | ||
98 | orig_c_flags = $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) \ | 94 | orig_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) | |||
156 | endif | 152 | endif |
157 | 153 | ||
158 | c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \ | 154 | c_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 | ||
177 | modname-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) | |||
329 | size_append = printf $(shell \ | 322 | size_append = printf $(shell \ |
330 | dec_size=0; \ | 323 | dec_size=0; \ |
331 | for F in $1; do \ | 324 | for 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); \ |
334 | done; \ | 327 | done; \ |
335 | printf "%08x\n" $$dec_size | \ | 328 | printf "%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}" |
49 | esac | 49 | esac |
50 | 50 | ||
51 | # In case it doesn't exist yet... | ||
52 | if [ -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. |
56 | cat > "$new_ksyms_file" << EOT | 53 | cat > "$new_ksyms_file" << EOT |
@@ -60,7 +57,9 @@ cat > "$new_ksyms_file" << EOT | |||
60 | 57 | ||
61 | EOT | 58 | EOT |
62 | [ "$(ls -A "$MODVERDIR")" ] && | 59 | [ "$(ls -A "$MODVERDIR")" ] && |
63 | sed -ns -e '3{s/ /\n/g;/^$/!p;}' "$MODVERDIR"/*.mod | sort -u | | 60 | for mod in "$MODVERDIR"/*.mod; do |
61 | sed -n -e '3{s/ /\n/g;/^$/!p;}' "$mod" | ||
62 | done | sort -u | | ||
64 | while read sym; do | 63 | while 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 | | |||
81 | sed -n 's/^#define __KSYM_\(.*\) 1/\1/p' | tr "A-Z_" "a-z/" | | 80 | sed -n 's/^#define __KSYM_\(.*\) 1/\1/p' | tr "A-Z_" "a-z/" | |
82 | while read sympath; do | 81 | while 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 | */ |
116 | static void print_config(const char *m, int slen) | 116 | static 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 | |||
13 | if [ "$1" = "-p" ] ; then | ||
14 | with_patchlevel=1; | ||
15 | shift; | ||
16 | fi | ||
17 | |||
18 | compiler="$*" | ||
19 | |||
20 | if [ ${#compiler} -eq 0 ]; then | ||
21 | echo "Error: No compiler specified." | ||
22 | printf "Usage:\n\t$0 <clang-command>\n" | ||
23 | exit 1 | ||
24 | fi | ||
25 | |||
26 | MAJOR=$(echo __clang_major__ | $compiler -E -x c - | tail -n 1) | ||
27 | MINOR=$(echo __clang_minor__ | $compiler -E -x c - | tail -n 1) | ||
28 | if [ "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 | ||
31 | else | ||
32 | printf "%02d%02d\\n" $MAJOR $MINOR | ||
33 | fi | ||
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 | ||
3 | set -- $(ls -dn "$1") | ||
4 | printf '%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 | |||
31 | for i in "$@" | 31 | for i in "$@" |
32 | do | 32 | do |
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. |
39 | silentoldconfig: $(obj)/conf | 39 | silentoldconfig: $(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 | ||
45 | localyesconfig localmodconfig: $(obj)/streamline_config.pl $(obj)/conf | 43 | localyesconfig 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 | # |
56 | archive_builtin() | 56 | archive_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 | ||