aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2019-01-16 19:10:03 -0500
committerMasahiro Yamada <yamada.masahiro@socionext.com>2019-01-27 19:11:17 -0500
commitdee9495303f2c6d63a20c43a26420765909898eb (patch)
tree743ef93dc34e18f12cd67d7379979ee4651e6c96 /scripts
parent58156ba4468f1d0de166a4330374bc9df9b74efc (diff)
kbuild: remove top-level built-in.a
The symbol table in the final archive is unneeded; the linker does not require the symbol table after the --whole-archive option. Every object file in the archive is included in the link anyway. Pass thin archives from subdirectories directly to the linker, and remove the final archiving step. Fix up the document and comments as well. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Acked-by: Nicholas Piggin <npiggin@gmail.com>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.build8
-rwxr-xr-xscripts/link-vmlinux.sh30
2 files changed, 8 insertions, 30 deletions
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index fd03d60f6c5a..681ab58a1548 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -394,14 +394,10 @@ $(obj)/%.asn1.c $(obj)/%.asn1.h: $(src)/%.asn1 $(objtree)/scripts/asn1_compiler
394$(sort $(subdir-obj-y)): $(subdir-ym) ; 394$(sort $(subdir-obj-y)): $(subdir-ym) ;
395 395
396# 396#
397# Rule to compile a set of .o files into one .o file 397# Rule to compile a set of .o files into one .a file (without symbol table)
398# 398#
399ifdef builtin-target 399ifdef builtin-target
400 400
401# built-in.a archives are made with no symbol table or index which
402# makes them small and fast, but unable to be used by the linker.
403# scripts/link-vmlinux.sh builds an aggregate built-in.a with a symbol
404# table and index.
405quiet_cmd_ar_builtin = AR $@ 401quiet_cmd_ar_builtin = AR $@
406 cmd_ar_builtin = rm -f $@; \ 402 cmd_ar_builtin = rm -f $@; \
407 $(AR) rcSTP$(KBUILD_ARFLAGS) $@ $(filter $(real-obj-y), $^) 403 $(AR) rcSTP$(KBUILD_ARFLAGS) $@ $(filter $(real-obj-y), $^)
@@ -426,7 +422,7 @@ $(modorder-target): $(subdir-ym) FORCE
426 $(Q)(cat /dev/null; $(modorder-cmds)) > $@ 422 $(Q)(cat /dev/null; $(modorder-cmds)) > $@
427 423
428# 424#
429# Rule to compile a set of .o files into one .a file 425# Rule to compile a set of .o files into one .a file (with symbol table)
430# 426#
431ifdef lib-target 427ifdef lib-target
432quiet_cmd_link_l_target = AR $@ 428quiet_cmd_link_l_target = AR $@
diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
index c8cf45362bd6..4788def71358 100755
--- a/scripts/link-vmlinux.sh
+++ b/scripts/link-vmlinux.sh
@@ -44,24 +44,6 @@ info()
44 fi 44 fi
45} 45}
46 46
47# Thin archive build here makes a final archive with symbol table and indexes
48# from vmlinux objects INIT and MAIN, which can be used as input to linker.
49# KBUILD_VMLINUX_LIBS archives should already have symbol table and indexes
50# added.
51#
52# Traditional incremental style of link does not require this step
53#
54# built-in.a output file
55#
56archive_builtin()
57{
58 info AR built-in.a
59 rm -f built-in.a;
60 ${AR} rcsTP${KBUILD_ARFLAGS} built-in.a \
61 ${KBUILD_VMLINUX_INIT} \
62 ${KBUILD_VMLINUX_MAIN}
63}
64
65# Link of vmlinux.o used for section mismatch analysis 47# Link of vmlinux.o used for section mismatch analysis
66# ${1} output file 48# ${1} output file
67modpost_link() 49modpost_link()
@@ -69,7 +51,8 @@ modpost_link()
69 local objects 51 local objects
70 52
71 objects="--whole-archive \ 53 objects="--whole-archive \
72 built-in.a \ 54 ${KBUILD_VMLINUX_INIT} \
55 ${KBUILD_VMLINUX_MAIN} \
73 --no-whole-archive \ 56 --no-whole-archive \
74 --start-group \ 57 --start-group \
75 ${KBUILD_VMLINUX_LIBS} \ 58 ${KBUILD_VMLINUX_LIBS} \
@@ -88,7 +71,8 @@ vmlinux_link()
88 71
89 if [ "${SRCARCH}" != "um" ]; then 72 if [ "${SRCARCH}" != "um" ]; then
90 objects="--whole-archive \ 73 objects="--whole-archive \
91 built-in.a \ 74 ${KBUILD_VMLINUX_INIT} \
75 ${KBUILD_VMLINUX_MAIN} \
92 --no-whole-archive \ 76 --no-whole-archive \
93 --start-group \ 77 --start-group \
94 ${KBUILD_VMLINUX_LIBS} \ 78 ${KBUILD_VMLINUX_LIBS} \
@@ -99,7 +83,8 @@ vmlinux_link()
99 -T ${lds} ${objects} 83 -T ${lds} ${objects}
100 else 84 else
101 objects="-Wl,--whole-archive \ 85 objects="-Wl,--whole-archive \
102 built-in.a \ 86 ${KBUILD_VMLINUX_INIT} \
87 ${KBUILD_VMLINUX_MAIN} \
103 -Wl,--no-whole-archive \ 88 -Wl,--no-whole-archive \
104 -Wl,--start-group \ 89 -Wl,--start-group \
105 ${KBUILD_VMLINUX_LIBS} \ 90 ${KBUILD_VMLINUX_LIBS} \
@@ -160,7 +145,6 @@ cleanup()
160 rm -f .tmp_System.map 145 rm -f .tmp_System.map
161 rm -f .tmp_kallsyms* 146 rm -f .tmp_kallsyms*
162 rm -f .tmp_vmlinux* 147 rm -f .tmp_vmlinux*
163 rm -f built-in.a
164 rm -f System.map 148 rm -f System.map
165 rm -f vmlinux 149 rm -f vmlinux
166 rm -f vmlinux.o 150 rm -f vmlinux.o
@@ -217,8 +201,6 @@ fi;
217# final build of init/ 201# final build of init/
218${MAKE} -f "${srctree}/scripts/Makefile.build" obj=init 202${MAKE} -f "${srctree}/scripts/Makefile.build" obj=init
219 203
220archive_builtin
221
222#link vmlinux.o 204#link vmlinux.o
223info LD vmlinux.o 205info LD vmlinux.o
224modpost_link vmlinux.o 206modpost_link vmlinux.o