aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/link-vmlinux.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/link-vmlinux.sh')
-rwxr-xr-xscripts/link-vmlinux.sh37
1 files changed, 22 insertions, 15 deletions
diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
index f742c65108b9..c80291319cb2 100755
--- a/scripts/link-vmlinux.sh
+++ b/scripts/link-vmlinux.sh
@@ -209,15 +209,6 @@ case "${KCONFIG_CONFIG}" in
209 . "./${KCONFIG_CONFIG}" 209 . "./${KCONFIG_CONFIG}"
210esac 210esac
211 211
212archive_builtin
213
214#link vmlinux.o
215info LD vmlinux.o
216modpost_link vmlinux.o
217
218# modpost vmlinux.o to check for section mismatches
219${MAKE} -f "${srctree}/scripts/Makefile.modpost" vmlinux.o
220
221# Update version 212# Update version
222info GEN .version 213info GEN .version
223if [ ! -r .version ]; then 214if [ ! -r .version ]; then
@@ -231,6 +222,15 @@ fi;
231# final build of init/ 222# final build of init/
232${MAKE} -f "${srctree}/scripts/Makefile.build" obj=init GCC_PLUGINS_CFLAGS="${GCC_PLUGINS_CFLAGS}" 223${MAKE} -f "${srctree}/scripts/Makefile.build" obj=init GCC_PLUGINS_CFLAGS="${GCC_PLUGINS_CFLAGS}"
233 224
225archive_builtin
226
227#link vmlinux.o
228info LD vmlinux.o
229modpost_link vmlinux.o
230
231# modpost vmlinux.o to check for section mismatches
232${MAKE} -f "${srctree}/scripts/Makefile.modpost" vmlinux.o
233
234kallsymso="" 234kallsymso=""
235kallsyms_vmlinux="" 235kallsyms_vmlinux=""
236if [ -n "${CONFIG_KALLSYMS}" ]; then 236if [ -n "${CONFIG_KALLSYMS}" ]; then
@@ -246,10 +246,14 @@ if [ -n "${CONFIG_KALLSYMS}" ]; then
246 # the right size, but due to the added section, some 246 # the right size, but due to the added section, some
247 # addresses have shifted. 247 # addresses have shifted.
248 # From here, we generate a correct .tmp_kallsyms2.o 248 # From here, we generate a correct .tmp_kallsyms2.o
249 # 2a) We may use an extra pass as this has been necessary to 249 # 3) That link may have expanded the kernel image enough that
250 # woraround some alignment related bugs. 250 # more linker branch stubs / trampolines had to be added, which
251 # KALLSYMS_EXTRA_PASS=1 is used to trigger this. 251 # introduces new names, which further expands kallsyms. Do another
252 # 3) The correct ${kallsymso} is linked into the final vmlinux. 252 # pass if that is the case. In theory it's possible this results
253 # in even more stubs, but unlikely.
254 # KALLSYMS_EXTRA_PASS=1 may also used to debug or work around
255 # other bugs.
256 # 4) The correct ${kallsymso} is linked into the final vmlinux.
253 # 257 #
254 # a) Verify that the System.map from vmlinux matches the map from 258 # a) Verify that the System.map from vmlinux matches the map from
255 # ${kallsymso}. 259 # ${kallsymso}.
@@ -265,8 +269,11 @@ if [ -n "${CONFIG_KALLSYMS}" ]; then
265 vmlinux_link .tmp_kallsyms1.o .tmp_vmlinux2 269 vmlinux_link .tmp_kallsyms1.o .tmp_vmlinux2
266 kallsyms .tmp_vmlinux2 .tmp_kallsyms2.o 270 kallsyms .tmp_vmlinux2 .tmp_kallsyms2.o
267 271
268 # step 2a 272 # step 3
269 if [ -n "${KALLSYMS_EXTRA_PASS}" ]; then 273 size1=$(stat -c "%s" .tmp_kallsyms1.o)
274 size2=$(stat -c "%s" .tmp_kallsyms2.o)
275
276 if [ $size1 -ne $size2 ] || [ -n "${KALLSYMS_EXTRA_PASS}" ]; then
270 kallsymso=.tmp_kallsyms3.o 277 kallsymso=.tmp_kallsyms3.o
271 kallsyms_vmlinux=.tmp_vmlinux3 278 kallsyms_vmlinux=.tmp_vmlinux3
272 279