Skip to content

Commit 41a77d4

Browse files
committed
kbuild: link lib-y objects to vmlinux forcibly even when CONFIG_MODULES=n
Since commit 7273ad2 ("kbuild: link lib-y objects to vmlinux forcibly when CONFIG_MODULES=y"), all objects from lib-y have been forcibly linked to vmlinux when CONFIG_MODULES=y. To simplify future changes, this commit makes all objects from lib-y be linked regardless of the CONFIG_MODULES setting. Most use cases (CONFIG_MODULES=y) are not affected by this change. The vmlinux size with ARCH=arm allnoconfig, where CONFIG_MODULES=n, increases as follows: text data bss dec hex filename 1368644 835104 206288 2410036 24c634 vmlinux.before 1379440 837064 206288 2422792 24f808 vmlinux.after We no longer benefit from using static libraries, but the impact is mitigated by supporting CONFIG_LD_DEAD_CODE_DATA_ELIMINATION. For example, the size of vmlinux remains almost the same with ARCH=arm tinyconfig, where CONFIG_MODULES=n and CONFIG_LD_DEAD_CODE_DATA_ELIMINATION=y. text data bss dec hex filename 455316 93404 15472 564192 89be0 vmlinux.before 455312 93404 15472 564188 89bdc vmlinux.after Signed-off-by: Masahiro Yamada <[email protected]>
1 parent 81a93bf commit 41a77d4

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

Makefile

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,13 +1184,8 @@ export ARCH_LIB := $(filter %/, $(libs-y))
11841184
export ARCH_DRIVERS := $(drivers-y) $(drivers-m)
11851185
# Externally visible symbols (used by link-vmlinux.sh)
11861186

1187-
KBUILD_VMLINUX_OBJS := ./built-in.a
1188-
ifdef CONFIG_MODULES
1189-
KBUILD_VMLINUX_OBJS += $(patsubst %/, %/lib.a, $(filter %/, $(libs-y)))
1187+
KBUILD_VMLINUX_OBJS := built-in.a $(patsubst %/, %/lib.a, $(filter %/, $(libs-y)))
11901188
KBUILD_VMLINUX_LIBS := $(filter-out %/, $(libs-y))
1191-
else
1192-
KBUILD_VMLINUX_LIBS := $(patsubst %/,%/lib.a, $(libs-y))
1193-
endif
11941189

11951190
export KBUILD_VMLINUX_LIBS
11961191
export KBUILD_LDS := arch/$(SRCARCH)/kernel/vmlinux.lds

0 commit comments

Comments
 (0)